Make WordPress Core


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

Consolidate link forms into edit-link-form

File:
1 edited

Legend:

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

    r2889 r2890  
    66$parent_file = 'link-manager.php';
    77
    8 function category_dropdown($fieldname, $selected = 0) {
    9     global $wpdb;
    10    
    11     $results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $wpdb->linkcategories ORDER BY cat_id");
    12     echo "\n<select name='$fieldname' size='1'>\n";
    13     foreach ($results as $row) {
    14         echo "\n\t<option value='$row->cat_id'";
    15         if ($row->cat_id == $selected)
    16             echo " selected='selected'";
    17         echo ">$row->cat_id : " . wp_specialchars($row->cat_name);
    18         if ($row->auto_toggle == 'Y')
    19             echo ' (auto toggle)';
    20         echo "</option>";
    21     }
    22     echo "\n</select>\n";
    23 }
    24 
    25 function xfn_check($class, $value = '', $type = 'check') {
    26     global $link_rel;
    27     $rels = preg_split('/\s+/', $link_rel);
    28 
    29     if ('' != $value && in_array($value, $rels) ) {
    30         echo ' checked="checked"';
    31     }
    32 
    33     if ('' == $value) {
    34         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"';
    35         if ('friendship' == $class && !strstr($link_rel, 'friend') && !strstr($link_rel, 'acquaintance') && !strstr($link_rel, 'contact') ) echo ' checked="checked"';
    36         if ('geographical' == $class && !strstr($link_rel, 'co-resident') && !strstr($link_rel, 'neighbor') ) echo ' checked="checked"';
    37         if ('identity' == $class && in_array('me', $rels) ) echo ' checked="checked"';
    38     }
    39 }
    408
    419$wpvarstoreset = array('action', 'cat_id', 'linkurl', 'name', 'image',
     
    5725    }
    5826}
    59 $link_url = stripslashes($_GET['linkurl']);
    60 $link_name = htmlentities(stripslashes(urldecode($_GET['name'])));
    6127
    62 
    63 $xfn = true;
    6428require('admin-header.php');
    6529?>
     
    6832<div id="message" class="updated fade"><p><?php _e('Link added.'); ?></p></div>
    6933<?php endif; ?>
    70 <div class="wrap">
    71 <h2><?php _e('<strong>Add</strong> a link:') ?></h2>
    72      <form name="addlink" method="post" action="link-manager.php">
    73 <fieldset class="options">
    74     <legend><?php _e('Basics') ?></legend>
    75         <table class="editform" width="100%" cellspacing="2" cellpadding="5">
    76          <tr>
    77            <th width="33%" scope="row"><?php _e('URI:') ?></th>
    78            <td width="67%"><input type="text" name="link_url" value="<?php echo wp_specialchars($_GET['linkurl'], 1); ?>" style="width: 95%;" /></td>
    79          </tr>
    80          <tr>
    81            <th scope="row"><?php _e('Link Name:') ?></th>
    82            <td><input type="text" name="link_name" value="<?php echo wp_specialchars( urldecode($_GET['name']), 1 ); ?>" style="width: 95%" /></td>
    83          </tr>
    84          <tr>
    85             <th scope="row"><?php _e('Short description:') ?></th>
    86             <td><input type="text" name="link_description" value="" style="width: 95%" /></td>
    87             </tr>
    88         <tr>
    89            <th scope="row"><?php _e('Category:') ?></th>
    90            <td><?php category_dropdown('link_category'); ?></td>
    91          </tr>
    92 </table>
    93 </fieldset>
    94        <p class="submit">
    95          <input type="submit" name="submit" value="<?php _e('Add Link &raquo;') ?>" />
    96        </p>
    97     <fieldset class="options">
    98     <legend><?php _e('Link Relationship (XFN)') ?></legend>
    99         <table class="editform" width="100%" cellspacing="2" cellpadding="5">
    100             <tr>
    101                 <th width="33%" scope="row"><?php _e('rel:') ?></th>
    102                 <td width="67%"><input type="text" name="link_rel" id="rel" size="50" value="<?php echo $link_rel; ?>" /></td>
    103             </tr>
    104             <tr>
    105                 <th scope="row"><?php _e('<a href="http://gmpg.org/xfn/">XFN</a> Creator:') ?></th>
    106                 <td>
    107                     <table cellpadding="3" cellspacing="5">
    108               <tr>
    109               <th scope="row"> <?php _e('identity') ?> </th>
    110               <td>
    111                 <label for="me">
    112                 <input type="checkbox" name="identity" value="me" id="me" <?php xfn_check('identity', 'me'); ?> />
    113           <?php _e('another web address of mine') ?></label>
    114               </td>
    115             </tr>
    116             <tr>
    117               <th scope="row"> <?php _e('friendship') ?> </th>
    118               <td>
    119                 <label for="contact">
    120                 <input class="valinp" type="radio" name="friendship" value="contact" id="contact" <?php xfn_check('friendship', 'contact', 'radio'); ?> /> <?php _e('contact') ?></label>
    121                 <label for="acquaintance">
    122                 <input class="valinp" type="radio" name="friendship" value="acquaintance" id="acquaintance" <?php xfn_check('friendship', 'acquaintance', 'radio'); ?> />  <?php _e('acquaintance') ?></label>
    123                 <label id="friend">
    124                 <input class="valinp" type="radio" name="friendship" value="friend" id="friend" <?php xfn_check('friendship', 'friend', 'radio'); ?> /> <?php _e('friend') ?></label>
    125                 <label for="friendship">
    126                 <input name="friendship" type="radio" class="valinp" value="" id="friendship" <?php xfn_check('friendship', '', 'radio'); ?> /> <?php _e('none') ?></label>
    127               </td>
    128             </tr>
    129             <tr>
    130               <th scope="row"> <?php _e('physical') ?> </th>
    131               <td>
    132                 <label for="met">
    133                 <input class="valinp" type="checkbox" name="physical" value="met" id="met" <?php xfn_check('physical', 'met'); ?> />
    134           <?php _e('met') ?></label>
    135               </td>
    136             </tr>
    137             <tr>
    138               <th scope="row"> <?php _e('professional') ?> </th>
    139               <td>
    140                 <label for="co-worker">
    141                 <input class="valinp" type="checkbox" name="professional" value="co-worker" id="co-worker" <?php xfn_check('professional', 'co-worker'); ?> />
    142           <?php _e('co-worker') ?></label>
    143                 <label for="colleague">
    144                 <input class="valinp" type="checkbox" name="professional" value="colleague" id="colleague" <?php xfn_check('professional', 'colleague'); ?> />
    145           <?php _e('colleague') ?></label>
    146               </td>
    147             </tr>
    148             <tr>
    149               <th scope="row"> <?php _e('geographical') ?> </th>
    150               <td>
    151                 <label for="co-resident">
    152                 <input class="valinp" type="radio" name="geographical" value="co-resident" id="co-resident" <?php xfn_check('geographical', 'co-resident', 'radio'); ?> />
    153           <?php _e('co-resident') ?></label>
    154                 <label for="neighbor">
    155                 <input class="valinp" type="radio" name="geographical" value="neighbor" id="neighbor" <?php xfn_check('geographical', 'neighbor', 'radio'); ?> />
    156           <?php _e('neighbor') ?></label>
    157                 <label for="geographical">
    158                 <input class="valinp" type="radio" name="geographical" value="" id="geographical" <?php xfn_check('geographical', '', 'radio'); ?> />
    159           <?php _e('none') ?></label>
    160               </td>
    161             </tr>
    162             <tr>
    163               <th scope="row"> <?php _e('family'); ?> </th>
    164               <td>
    165                 <label for="child">
    166                 <input class="valinp" type="radio" name="family" value="child" id="child" <?php xfn_check('family', 'child', 'radio'); ?>  />
    167           <?php _e('child') ?></label>
    168                 <label for="kin">
    169                 <input class="valinp" type="radio" name="family" value="kin" id="kin" <?php xfn_check('family', 'kin', 'radio'); ?>  />
    170           <?php _e('kin') ?></label>
    171                 <label for="parent">
    172                 <input class="valinp" type="radio" name="family" value="parent" id="parent" <?php xfn_check('family', 'parent', 'radio'); ?> />
    173           <?php _e('parent') ?></label>
    174                 <label for="sibling">
    175                 <input class="valinp" type="radio" name="family" value="sibling" id="sibling" <?php xfn_check('family', 'sibling', 'radio'); ?> />
    176           <?php _e('sibling') ?></label>
    177                 <label for="spouse">
    178                 <input class="valinp" type="radio" name="family" value="spouse" id="spouse" <?php xfn_check('family', 'spouse', 'radio'); ?> />
    179           <?php _e('spouse') ?></label>
    180                 <label for="family">
    181                 <input class="valinp" type="radio" name="family" value="" id="family" <?php xfn_check('family', '', 'radio'); ?> />
    182           <?php _e('none') ?></label>
    183               </td>
    184             </tr>
    185             <tr>
    186               <th scope="row"> <?php _e('romantic') ?> </th>
    187               <td>
    188                 <label for="muse">
    189                 <input class="valinp" type="checkbox" name="romantic" value="muse" id="muse" <?php xfn_check('romantic', 'muse'); ?> />
    190          <?php _e('muse') ?></label>
    191                 <label for="crush">
    192                 <input class="valinp" type="checkbox" name="romantic" value="crush" id="crush" <?php xfn_check('romantic', 'crush'); ?> />
    193          <?php _e('crush') ?></label>
    194                 <label for="date">
    195                 <input class="valinp" type="checkbox" name="romantic" value="date" id="date" <?php xfn_check('romantic', 'date'); ?> />
    196          <?php _e('date') ?></label>
    197                 <label for="romantic">
    198                 <input class="valinp" type="checkbox" name="romantic" value="sweetheart" id="romantic" <?php xfn_check('romantic', 'sweetheart'); ?> />
    199          <?php _e('sweetheart') ?></label>
    200               </td>
    201             </tr>
    202         </table>
    203           </td>
    204             </tr>
    205 </table>
    206 </fieldset>
    207        <p class="submit">
    208          <input type="submit" name="submit" value="<?php _e('Add Link &raquo;') ?>" />
    209        </p>
    210 <fieldset class="options">
    211     <legend><?php _e('Advanced') ?></legend>
    212         <table class="editform" width="100%" cellspacing="2" cellpadding="5">
    213          <tr>
    214            <th width="33%" scope="row"><?php _e('Image URI:') ?></th>
    215            <td width="67%"><input type="text" name="link_image" size="50" value="" style="width: 95%" /></td>
    216          </tr>
    217 <tr>
    218            <th scope="row"><?php _e('RSS URI:') ?> </th>
    219            <td><input name="link_rss" type="text" id="rss_uri" value="" size="50" style="width: 95%" /></td>
    220          </tr>
    221          <tr>
    222            <th scope="row"><?php _e('Notes:') ?></th>
    223            <td><textarea name="link_notes" cols="50" rows="10" style="width: 95%"></textarea></td>
    224          </tr>
    225          <tr>
    226            <th scope="row"><?php _e('Rating:') ?></th>
    227            <td><select name="link_rating" size="1">
    228              <?php
    229     for ($r = 0; $r < 10; $r++) {
    230       echo('            <option value="'.$r.'">'.$r.'</option>');
    231     }
     34
     35<?php
     36    $link = get_default_link_to_edit();
     37    include('edit-link-form.php');
    23238?>
    233            </select>
    234            &nbsp;<?php _e('(Leave at 0 for no rating.)') ?> </td>
    235          </tr>
    236          <tr>
    237            <th scope="row"><?php _e('Target') ?></th>
    238            <td><label>
    239              <input type="radio" name="link_target" value="_blank" />
    240              <code>_blank</code></label>
    241 <br />
    242 <label><input type="radio" name="link_target" value="_top" />
    243 <code>_top</code></label>
    244 <br />
    245 <label><input type="radio" name="link_target" value="" checked="checked" />
    246 <?php _e('none') ?></label>
    247 <?php _e('(Note that the <code>target</code> attribute is illegal in XHTML 1.1 and 1.0 Strict.)') ?></td>
    248          </tr>
    249          <tr>
    250            <th scope="row"><?php _e('Visible:') ?></th>
    251            <td><label>
    252              <input type="radio" name="link_visible" checked="checked" value="Y" />
    253 <?php _e('Yes') ?></label><br />
    254 <label><input type="radio" name="link_visible" value="N" /> <input type="hidden" name="action" value="Add" />
    255 <?php _e('No') ?></label></td>
    256          </tr>
    257 </table>
    258 </fieldset>
    259 
    260        <p class="submit">
    261          <input type="submit" name="submit" value="<?php _e('Add Link &raquo;') ?>" />
    262        </p>
    263   </form>
    264 </div>
    26539
    26640<div class="wrap">
Note: See TracChangeset for help on using the changeset viewer.