[ Index ]

PHP Cross Reference of zeList

title

Body

[close]

/includes/ -> admin-submit.php (source)

   1  <?php
   2  
   3  /**
   4   * Display link create form fields.
   5   *
   6   * @since 2.7.0
   7   *
   8   * @param object $link
   9   */
  10  function zelist_link_submit_meta_box($link) {
  11    ?>
  12  <div class="submitbox" id="submitlink">
  13  
  14  <div id="minor-publishing"><?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?>
  15  <div style="display: none;"><input type="submit" name="save"
  16      value="<?php echo attribute_escape( __('Save') ); ?>" /></div>
  17  
  18    <?php // link status ?>
  19  <div class="misc-pub-section">
  20  <?php if($link->link_status) : ?>
  21      <label for="link_status"><?php _e('Status:') ?></label>
  22      <b><span id="link-status-display">
  23      <?php
  24      switch ( $link->link_status ) {
  25        case 'deny' : _e('Denied','zelist'); break;
  26        case 'publish': _e('Published','zelist'); break;
  27        case 'pending': _e('Pending Review','zelist'); break;
  28        case 'dead' : _e('Dead','zelist'); break;
  29      }
  30      ?>
  31      </span></b>
  32  <?php endif; ?>
  33  
  34    <?php if ( current_user_can('manage_links_advanced') ) { ?>
  35      <a href="#link_status" class="edit-link-status hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a>
  36  
  37  <div id="link-status-select" class="hide-if-js">
  38      <input type="hidden" name="hidden_link_status" id="hidden_link_status" value="<?php echo $link->link_status; ?>" />
  39      <select name='link_status' id='link_status' tabindex='4'>
  40      <?php if(current_user_can('publish_links')) : ?><option <?php selected( $link->link_status, 'publish' ); ?> value='publish'><?php _e('Published','zelist') ?></option><?php endif; ?>
  41      <?php if(current_user_can('deny_links')) : ?><option <?php selected( $link->link_status, 'deny' ); ?> value='deny'><?php _e('Denied','zelist') ?></option><?php endif; ?>
  42      <?php if(current_user_can('pending_links')) : ?><option <?php selected( $link->link_status, 'pending' ); ?> value='pending'><?php _e('Pending Review','zelist') ?></option><?php endif; ?>
  43      <?php if($link->link_status == 'dead') : ?><option <?php selected( $link->link_status, 'dead' ); ?> value='dead'><?php _e('Dead','zelist') ?></option><?php endif; ?>
  44      </select>
  45      <a href="#link_status" class="save-link-status hide-if-no-js button"><?php _e('OK'); ?></a>
  46      <a href="#link_status" class="cancel-link-status hide-if-no-js"><?php _e('Cancel'); ?></a>
  47      <br class="clear" />
  48      <span id="link-banreason" style="display: none;">
  49        <label class="alignleft hidden"><?php _e( 'Ban Reason','zelist' ); ?></label>
  50        <select name="ban_reason">
  51        <?php $ban_reasons = get_option('zelist_banreasons'); if($ban_reasons) foreach($ban_reasons as $reason => $label) :  ?>
  52            <option value="<?php echo $reason; ?>"><?php echo stripslashes($label); ?></option>
  53        <?php endforeach; ?>
  54        </select>
  55      </span>
  56  </div>
  57  
  58  
  59  
  60          <?php } ?></div>
  61          <?php // /misc-pub-section ?> <?php //end link status ?>
  62  
  63  
  64  
  65  
  66  <div id="minor-publishing-actions">
  67  <ul id="history">
  68  <?php $date_format = get_option('date_format');?>
  69  <?php if($link->link_added != '0000-00-00') : ?><li><span><?php _e('Submitted on:','zelist')?></span><?php echo date($date_format,strtotime($link->link_added)); ?></li><?php endif; ?>
  70  <?php if($link->link_status == 'publish') : ?><li><span><?php _e('Published on:','zelist')?></span><?php echo date($date_format,strtotime($link->link_published)); ?></li><?php endif; ?>
  71  <?php if($link->link_updated != '0000-00-00' && $link->link_updated != $link->link_published && $link->link_updated != $link->link_added) : ?><li><span><?php _e('Last updated:','zelist')?></span><?php echo date($date_format,strtotime($link->link_updated)); ?></li><?php endif; ?>
  72  </ul>
  73  <div class="clear"></div>
  74  <div id="preview-action"><?php if ( !empty($link->link_id) ) { ?> <?php if($link->link_visible == 'Y') :
  75  // @TODO : allow preview of pending links
  76  ?>
  77  
  78  <a class="button" href="<?php echo get_link_permalink($link->link_id); ?>" target="_blank" tabindex="5"><?php _e('View Link','zelist'); ?></a>
  79  <?php endif; ?>
  80  <a class="button" href="<?php echo $link->link_url; ?>" target="_blank" tabindex="4"><?php _e('Visit Link'); ?></a>
  81  <?php } ?></div>
  82  <div class="clear"></div>
  83  </div>
  84  
  85  <div id="misc-publishing-actions">
  86  <div class="response" id="publish_response"></div>
  87  </div>
  88  
  89  </div>
  90  
  91  <div id="major-publishing-actions"><?php do_action('post_submitbox_start'); ?>
  92  <div id="delete-action"><?php
  93  if ( !empty($_GET['action']) && 'edit' == $_GET['action'] && current_user_can('manage_links') ) { ?>
  94  <a class="submitdelete deletion"
  95      href="<?php echo wp_nonce_url(ZELIST_ADMIN_URL_LINK."&noheader=1&action=delete&link_id=$link->link_id", 'delete-bookmark_' . $link->link_id); ?>"
  96      onclick="if ( confirm('<?php echo js_escape(sprintf(__("You are about to delete this link '%s'\n  'Cancel' to stop, 'OK' to delete."), $link->link_name )); ?>') ) {return true;}return false;"><?php _e('Delete'); ?></a>
  97  <?php } ?></div>
  98  
  99  <div id="publishing-action"><?php if ( !empty($link->link_id) ) { ?>
 100      <input name="save" type="submit" class="button-primary" id="publish" tabindex="4" accesskey="p" value="<?php _e('Update Link') ?>" /> <?php } else { ?>
 101      <input name="save" type="submit" class="button-primary" id="publish" tabindex="4" accesskey="p" value="<?php _e('Add Link') ?>" /> <?php } ?>
 102  </div>
 103  <div class="clear"></div>
 104  </div>
 105  <?php do_action('submitlink_box'); ?>
 106  <div class="clear"></div>
 107  </div>
 108  <?php
 109  }
 110  
 111  
 112  /**
 113   * Display link tags form fields.
 114   *
 115   * @since 2.6.0
 116   *
 117   * @param object $link
 118   */
 119  function link_tags_meta_box($link) {
 120    ?>
 121  <p id="jaxtag"><label class="hidden" for="newtag"><?php _e('Tags'); ?></label>
 122  <input type="text" name="tags_input" class="tags-input" id="tags-input"
 123      size="20" tabindex="6"
 124      value="<?php echo get_link_tags_to_edit( $link->link_id ); ?>" /></p>
 125  <div id="tagchecklist"></div>
 126  <p id="tagcloud-link" class="hide-if-no-js"><a href='#'><?php _e( 'Choose from the most popular tags' ); ?></a></p>
 127    <?php
 128  }
 129  
 130  
 131  /**
 132   * Display link categories form fields.
 133   *
 134   * @since 2.6.0
 135   *
 136   * @param object $link
 137   */
 138  function link_categories_meta_box($link) {
 139    ?>
 140  <ul id="category-tabs">
 141      <li class="ui-tabs-selected"><a href="#categories-all" tabindex="7"><?php _e( 'All Categories' ); ?></a></li>
 142      <li class="hide-if-no-js"><a href="#categories-pop" tabindex="7"><?php _e( 'Most Used' ); ?></a></li>
 143  </ul>
 144  
 145  <div id="categories-pop" class="ui-tabs-panel" style="display: none;">
 146  <ul id="categorychecklist-pop" class="categorychecklist form-no-clear">
 147  <?php $popular_ids = zelist_popular_terms_checklist('link_category'); ?>
 148  </ul>
 149  </div>
 150  
 151  <div id="categories-all" class="ui-tabs-panel">
 152  <ul id="categorychecklist"
 153      class="list:category categorychecklist form-no-clear">
 154      <?php
 155      if(get_option('zelist_allow_multiple_categories')) zelist_link_category_checklist($link->link_id, false, false, $popular_ids);
 156      else wp_dropdown_categories('type=link&orderby=name&hide_empty=0&hierarchical=1&name=link_category[]&selected='.$link->link_category[0]);
 157      ?>
 158  </ul>
 159  </div>
 160  
 161  <?php if ( current_user_can('manage_categories') ) : ?>
 162  <div id="category-adder" class="wp-hidden-children">
 163  <h4><a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="7"><?php _e( '+ Add New Category' ); ?></a></h4>
 164  <p id="category-add" class="wp-hidden-child">
 165      <label class="hidden" for="newcat"><?php _e( '+ Add New Category' ); ?></label>
 166      <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" aria-required="true" />
 167      <label class="hidden" for="newcat_parent"><?php _e('Parent category'); ?>:</label>
 168      <?php wp_dropdown_categories( array( 'type' => 'link', 'hide_empty' => 0, 'name' => 'parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3 ) ); ?>
 169      <input type="button" id="category-add-submit" class="add:categorychecklist:linkcategorydiv button" value="<?php _e( 'Add' ); ?>" />
 170      <?php wp_nonce_field( 'add-link-category', '_ajax_nonce', false ); ?>
 171      <span id="category-ajax-response"></span>
 172  </p>
 173  </div>
 174  <p class="response"    id="link_category_response"></p>
 175  <?php endif;
 176  }
 177  
 178  
 179  /**
 180   * Add Image box to link form
 181   * @param $link
 182   * @return unknown_type
 183   */
 184  function link_image_meta_box($link) {
 185    ?>
 186    <?php
 187    if (current_user_can('upload_files')) {
 188    $image_title = __('Add an Image');
 189    $link_image_url = apply_filters('zelist_link_image_url','media-upload.php?type=image&amp;tab=type_url');
 190    echo '<a href="#" id="add_link_image" title="'.$image_title.'"><img src="images/media-button-image.gif" alt="'.$image_title.'" /></a>';
 191    ?>
 192  <input type="hidden" name="link_image" id="link_image" value="<?php echo ( isset( $link->link_image ) ? $link->link_image : ''); ?>" />
 193  <div id="link_image_display"><?php if(!empty($link->link_image)) : ?>
 194  <img src="<?php echo $link->link_image; ?>" /><?php endif; ?>
 195  </div>
 196  <iframe name="link_image_iframe" id="link_image_iframe" src="<?php echo $link_image_url; ?>" width="100%" height="600px" frameborder="no"></iframe>
 197    <?php
 198    }
 199  }
 200  
 201  
 202  /**
 203   * Add RSS box to link form
 204   * @param $link
 205   * @return unknown_type
 206   */
 207  function link_rss_meta_box($link) {
 208    ?>
 209  <input
 210      name="link_rss" type="text" id="link_rss" class="rss check_url"
 211      value="<?php echo  ( isset( $link->link_rss ) ? $link->link_rss : ''); ?>"
 212      style="width: 95%" />
 213  <p class="response"    id="link_rss_response"></p>
 214    <?php
 215  }
 216  
 217  /**
 218   * Add owner box to link form
 219   * @param $link
 220   * @return unknown_type
 221   */
 222  function link_owner_meta_box($link) {
 223    global $link,$user_ID,$current_user;
 224    $authors = get_editable_user_ids( $current_user->id );
 225    if(!$authors) $authors = array();
 226    if ( $link->link_owner && !in_array($link->link_owner, $authors) ) $authors[] = $link->link_owner;
 227    if( !in_array($user_ID,$authors)) $authors[] = $user_ID;
 228    if(isset($_POST['link_owner']) && !in_array($_POST['link_owner'],$authors)) $authors[] = $_POST['link_owner'];
 229  
 230    if($_POST['link_owner']) $selected = $_POST['link_owner'];
 231    elseif ($link->link_owner) $selected = $link->link_owner;
 232    else $selected = $user_ID;
 233    ?>
 234      <label class="hidden" for="link_owner" class="owner"><?php _e('Webmaster'); ?></label>
 235      <?php wp_dropdown_users( array('include' => $authors, 'name' => 'link_owner', 'selected' =>  $selected) );
 236  
 237      if(current_user_can('create_users')) : ?>
 238      <div id="owner_adder">
 239      <h4><a id="owner_add_toggle" href="#" class="hide-if-no-js" tabindex="8"><?php _e( '+ Add New Webmaster' , 'zelist'); ?></a></h4>
 240      <p id="owner_add" class="hidden">
 241          <label class="hidden" for="newemail"><?php _e( '+ Add New Webmaster','zelist' ); ?></label>
 242          <input type="text" name="owner_add_email" id="owner_add_email" value="<?php _e( 'New owner email' , 'zelist' ); ?>" aria-required="true" />
 243          <input type="button" id="owner_add_submit" class="button" value="<?php _e( 'Add' ); ?>" />
 244          <?php wp_nonce_field( 'owner_add', 'owner_add_nonce', false ); ?>
 245          <span class="response" id="owner_add_response"></span>
 246      </p>
 247      </div>
 248  <p class="response"    id="link_user_response"></p>
 249  <?php endif;
 250  
 251  }
 252  
 253  
 254  
 255  
 256  


Generated: Sat May 30 23:51:06 2009 Cross-referenced by PHPXref 0.7