Make WordPress Core


Ignore:
Timestamp:
09/19/2005 12:47:58 AM (18 years ago)
Author:
ryan
Message:

Consolidate link forms into edit-link-form

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/link-manager.php

    r2889 r2890  
    77$title = __('Manage Links');
    88$this_file = $parent_file = 'link-manager.php';
    9 
    10 function xfn_check($class, $value = '', $type = 'check') {
    11     global $link_rel;
    12     $rels = preg_split('/\s+/', $link_rel);
    13 
    14     if ('' != $value && in_array($value, $rels) ) {
    15         echo ' checked="checked"';
    16     }
    17 
    18     if ('' == $value) {
    19         if ('family' == $class && !strstr($link_rel, 'child') && !strstr($link_rel, 'parent') && !strstr($link_rel, 'sibling') && !strstr($link_rel, 'spouse') && !strstr($link_rel, 'kin')) echo ' checked="checked"';
    20         if ('friendship' == $class && !strstr($link_rel, 'friend') && !strstr($link_rel, 'acquaintance') && !strstr($link_rel, 'contact') ) echo ' checked="checked"';
    21         if ('geographical' == $class && !strstr($link_rel, 'co-resident') && !strstr($link_rel, 'neighbor') ) echo ' checked="checked"';
    22         if ('identity' == $class && in_array('me', $rels) ) echo ' checked="checked"';
    23     }
    24 }
    25 
    26 function category_dropdown($fieldname, $selected = 0) {
    27     global $wpdb;
    28    
    29     $results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $wpdb->linkcategories ORDER BY cat_id");
    30     echo "\n<select name='$fieldname' size='1'>";
    31     foreach ($results as $row) {
    32         echo "\n\t<option value='$row->cat_id'";
    33         if ($row->cat_id == $selected)
    34             echo " selected='selected'";
    35         echo ">$row->cat_id: ".wp_specialchars($row->cat_name);
    36         if ('Y' == $row->auto_toggle)
    37             echo ' (auto toggle)';
    38         echo "</option>\n";
    39     }
    40     echo "\n</select>\n";
    41 }
    429
    4310$wpvarstoreset = array('action','cat_id', 'linkurl', 'name', 'image',
     
    222189    if ( !$link = get_link_to_edit($link_id) )
    223190        die( __('Link not found.') );
    224 ?>
    225 
    226 <div class="wrap">
    227   <form action="" method="post" name="editlink" id="editlink">
    228   <h2><?php _e('Edit a link:') ?></h2>
    229 <fieldset class="options">
    230     <legend><?php _e('Basics') ?></legend>
    231         <table class="editform" width="100%" cellspacing="2" cellpadding="5">
    232          <tr>
    233            <th width="33%" scope="row"><?php _e('URI:') ?></th>
    234            <td width="67%"><input type="text" name="link_url" value="<?php echo $link->link_url; ?>" style="width: 95%;" /></td>
    235          </tr>
    236          <tr>
    237            <th scope="row"><?php _e('Link Name:') ?></th>
    238            <td><input type="text" name="link_name" value="<?php echo $link->link_name; ?>" style="width: 95%" /></td>
    239          </tr>
    240          <tr>
    241             <th scope="row"><?php _e('Short description:') ?></th>
    242             <td><input type="text" name="link_description" value="<?php echo $link->link_description; ?>" style="width: 95%" /></td>
    243             </tr>
    244         <tr>
    245            <th scope="row"><?php _e('Category:') ?></th>
    246            <td><?php category_dropdown('link_category', $link->link_category); ?></td>
    247          </tr>
    248 </table>
    249 </fieldset>
    250        <p class="submit">
    251        <input type="submit" name="submit" value="<?php _e('Save Changes &raquo;') ?>" />
    252        </p>
    253     <fieldset class="options">
    254         <legend><?php _e('Link Relationship (XFN)') ?></legend>
    255         <table class="editform" width="100%" cellspacing="2" cellpadding="5">
    256             <tr>
    257                 <th width="33%" scope="row"><?php _e('rel:') ?></th>
    258                 <td width="67%"><input type="text" name="link_rel" id="rel" size="50" value="<?php echo $link->link_rel; ?>" /></td>
    259             </tr>
    260             <tr>
    261                 <th scope="row"><?php _e('<a href="http://gmpg.org/xfn/">XFN</a> Creator:') ?></th>
    262                 <td>
    263                     <table cellpadding="3" cellspacing="5">
    264               <tr>
    265               <th scope="row"> <?php _e('identity') ?> </th>
    266               <td>
    267                 <label for="me">
    268                 <input type="checkbox" name="identity" value="me" id="me" <?php xfn_check('identity', 'me'); ?> />
    269           <?php _e('another web address of mine') ?></label>
    270               </td>
    271             </tr>
    272             <tr>
    273               <th scope="row"> <?php _e('friendship') ?> </th>
    274               <td>
    275                 <label for="contact">
    276                 <input class="valinp" type="radio" name="friendship" value="contact" id="contact" <?php xfn_check('friendship', 'contact', 'radio'); ?> /> <?php _e('contact') ?></label>
    277                 <label for="acquaintance">
    278                 <input class="valinp" type="radio" name="friendship" value="acquaintance" id="acquaintance" <?php xfn_check('friendship', 'acquaintance', 'radio'); ?> />  <?php _e('acquaintance') ?></label>
    279                 <label id="friend">
    280                 <input class="valinp" type="radio" name="friendship" value="friend" id="friend" <?php xfn_check('friendship', 'friend', 'radio'); ?> /> <?php _e('friend') ?></label>
    281                 <label for="friendship">
    282                 <input name="friendship" type="radio" class="valinp" value="" id="friendship" <?php xfn_check('friendship', '', 'radio'); ?> /> <?php _e('none') ?></label>
    283               </td>
    284             </tr>
    285             <tr>
    286               <th scope="row"> <?php _e('physical') ?> </th>
    287               <td>
    288                 <label for="met">
    289                 <input class="valinp" type="checkbox" name="physical" value="met" id="met" <?php xfn_check('physical', 'met'); ?> />
    290           <?php _e('met') ?></label>
    291               </td>
    292             </tr>
    293             <tr>
    294               <th scope="row"> <?php _e('professional') ?> </th>
    295               <td>
    296                 <label for="co-worker">
    297                 <input class="valinp" type="checkbox" name="professional" value="co-worker" id="co-worker" <?php xfn_check('professional', 'co-worker'); ?> />
    298           <?php _e('co-worker') ?></label>
    299                 <label for="colleague">
    300                 <input class="valinp" type="checkbox" name="professional" value="colleague" id="colleague" <?php xfn_check('professional', 'colleague'); ?> />
    301           <?php _e('colleague') ?></label>
    302               </td>
    303             </tr>
    304             <tr>
    305               <th scope="row"> <?php _e('geographical') ?> </th>
    306               <td>
    307                 <label for="co-resident">
    308                 <input class="valinp" type="radio" name="geographical" value="co-resident" id="co-resident" <?php xfn_check('geographical', 'co-resident', 'radio'); ?> />
    309           <?php _e('co-resident') ?></label>
    310                 <label for="neighbor">
    311                 <input class="valinp" type="radio" name="geographical" value="neighbor" id="neighbor" <?php xfn_check('geographical', 'neighbor', 'radio'); ?> />
    312           <?php _e('neighbor') ?></label>
    313                 <label for="geographical">
    314                 <input class="valinp" type="radio" name="geographical" value="" id="geographical" <?php xfn_check('geographical', '', 'radio'); ?> />
    315           <?php _e('none') ?></label>
    316               </td>
    317             </tr>
    318             <tr>
    319               <th scope="row"> <?php _e('family') ?> </th>
    320               <td>
    321                 <label for="child">
    322                 <input class="valinp" type="radio" name="family" value="child" id="child" <?php xfn_check('family', 'child', 'radio'); ?>  />
    323           <?php _e('child') ?></label>
    324                 <label for="kin">
    325                 <input class="valinp" type="radio" name="family" value="kin" id="kin" <?php xfn_check('family', 'kin', 'radio'); ?>  />
    326           <?php _e('kin') ?></label>
    327                 <label for="parent">
    328                 <input class="valinp" type="radio" name="family" value="parent" id="parent" <?php xfn_check('family', 'parent', 'radio'); ?> />
    329           <?php _e('parent') ?></label>
    330                 <label for="sibling">
    331                 <input class="valinp" type="radio" name="family" value="sibling" id="sibling" <?php xfn_check('family', 'sibling', 'radio'); ?> />
    332           <?php _e('sibling') ?></label>
    333                 <label for="spouse">
    334                 <input class="valinp" type="radio" name="family" value="spouse" id="spouse" <?php xfn_check('family', 'spouse', 'radio'); ?> />
    335           <?php _e('spouse') ?></label>
    336                 <label for="family">
    337                 <input class="valinp" type="radio" name="family" value="" id="family" <?php xfn_check('family', '', 'radio'); ?> />
    338           <?php _e('none') ?></label>
    339               </td>
    340             </tr>
    341             <tr>
    342               <th scope="row"> <?php _e('romantic') ?> </th>
    343               <td>
    344                 <label for="muse">
    345                 <input class="valinp" type="checkbox" name="romantic" value="muse" id="muse" <?php xfn_check('romantic', 'muse'); ?> />
    346          <?php _e('muse') ?></label>
    347                 <label for="crush">
    348                 <input class="valinp" type="checkbox" name="romantic" value="crush" id="crush" <?php xfn_check('romantic', 'crush'); ?> />
    349          <?php _e('crush') ?></label>
    350                 <label for="date">
    351                 <input class="valinp" type="checkbox" name="romantic" value="date" id="date" <?php xfn_check('romantic', 'date'); ?> />
    352          <?php _e('date') ?></label>
    353                 <label for="romantic">
    354                 <input class="valinp" type="checkbox" name="romantic" value="sweetheart" id="romantic" <?php xfn_check('romantic', 'sweetheart'); ?> />
    355          <?php _e('sweetheart') ?></label>
    356               </td>
    357             </tr>
    358         </table>
    359           </td>
    360             </tr>
    361 </table>
    362 </fieldset>
    363        <p class="submit">
    364        <input type="submit" name="submit" value="<?php _e('Save Changes &raquo;') ?>" />
    365        </p>
    366 <fieldset class="options">
    367         <legend><?php _e('Advanced') ?></legend>
    368         <table class="editform" width="100%" cellspacing="2" cellpadding="5">
    369          <tr>
    370            <th width="33%" scope="row"><?php _e('Image URI:') ?></th>
    371            <td width="67%"><input type="text" name="link_image" size="50" value="<?php echo $link->link_image; ?>" style="width: 95%" /></td>
    372          </tr>
    373 <tr>
    374            <th scope="row"><?php _e('RSS URI:') ?> </th>
    375            <td><input name="link_rss" type="text" id="rss_uri" value="<?php echo $link->link_rss; ?>" size="50" style="width: 95%" /></td>
    376          </tr>
    377          <tr>
    378            <th scope="row"><?php _e('Notes:') ?></th>
    379            <td><textarea name="link_notes" cols="50" rows="10" style="width: 95%"><?php echo $link->link_notes; ?></textarea></td>
    380          </tr>
    381          <tr>
    382            <th scope="row"><?php _e('Rating:') ?></th>
    383            <td><select name="link_rating" size="1">
    384 <?php
    385     for ($r = 0; $r < 10; $r++) {
    386       echo('            <option value="'.$r.'" ');
    387       if ($link->link_rating == $r)
    388         echo 'selected="selected"';
    389       echo('>'.$r.'</option>');
    390     }
    391 ?>
    392            </select>
    393          &nbsp;<?php _e('(Leave at 0 for no rating.)') ?> </td>
    394          </tr>
    395          <tr>
    396            <th scope="row"><?php _e('Target') ?></th>
    397            <td><label>
    398           <input type="radio" name="target" value="_blank"   <?php echo(($link->link_target == '_blank') ? 'checked="checked"' : ''); ?> />
    399           <code>_blank</code></label><br />
    400 <label>
    401 <input type="radio" name="target" value="_top" <?php echo(($link->link_target == '_top') ? 'checked="checked"' : ''); ?> />
    402 <code>_top</code></label><br />
    403 <label>
    404 <input type="radio" name="link_target" value=""     <?php echo(($link->link_target == '') ? 'checked="checked"' : ''); ?> />
    405 <?php _e('none') ?></label><br />
    406 <?php _e('(Note that the <code>target</code> attribute is illegal in XHTML 1.1 and 1.0 Strict.)') ?></td>
    407          </tr>
    408          <tr>
    409            <th scope="row"><?php _e('Visible:') ?></th>
    410            <td><label>
    411              <input type="radio" name="link_visible" <?php if ($link->link_visible == 'Y') echo "checked='checked'"; ?> value="Y" />
    412 <?php _e('Yes') ?></label><br /><label>
    413 <input type="radio" name="visible" <?php if ($link->link_visible == 'N') echo "checked='checked'"; ?> value="N" />
    414 <?php _e('No') ?></label></td>
    415          </tr>
    416 </table>
    417 </fieldset>
    418 <p class="submit"><input type="submit" name="submit" value="<?php _e('Save Changes &raquo;') ?>" />
    419           <input type="hidden" name="action" value="editlink" />
    420           <input type="hidden" name="link_id" value="<?php echo (int) $link_id; ?>" />
    421           <input type="hidden" name="order_by" value="<?php echo wp_specialchars($order_by, 1); ?>" />
    422           <input type="hidden" name="cat_id" value="<?php echo (int) $cat_id ?>" /></p>
    423   </form>
    424 </div>
    425 <?php
     191       
     192    include('edit-link-form.php');
    426193    break;
    427194  } // end linkedit
     
    654421        </td>
    655422        <td>
    656           <?php _e('Move to category:'); category_dropdown('category'); ?> <input name="move" type="submit" id="move" value="<?php _e('Go') ?>" />
     423          <?php _e('Move to category:'); link_category_dropdown('category'); ?> <input name="move" type="submit" id="move" value="<?php _e('Go') ?>" />
    657424        </td>
    658425        <td align="right">
Note: See TracChangeset for help on using the changeset viewer.