Wordpress 2.5.1
[autoinstalls/wordpress.git] / wp-admin / edit-link-form.php
1 <?php
2 if ( ! empty($link_id) ) {
3         $heading = __('Edit Link');
4         $submit_text = __('Save Changes');
5         $form = '<form name="editlink" id="editlink" method="post" action="link.php">';
6         $nonce_action = 'update-bookmark_' . $link_id;
7 } else {
8         $heading = __('Add Link');
9         $submit_text = __('Add Link');
10         $form = '<form name="addlink" id="addlink" method="post" action="link.php">';
11         $nonce_action = 'add-bookmark';
12 }
13
14 function xfn_check($class, $value = '', $deprecated = '') {
15         global $link;
16
17         $link_rel = $link->link_rel;
18         $rels = preg_split('/\s+/', $link_rel);
19
20         if ('' != $value && in_array($value, $rels) ) {
21                 echo ' checked="checked"';
22         }
23
24         if ('' == $value) {
25                 if ('family' == $class && strpos($link_rel, 'child') === false && strpos($link_rel, 'parent') === false && strpos($link_rel, 'sibling') === false && strpos($link_rel, 'spouse') === false && strpos($link_rel, 'kin') === false) echo ' checked="checked"';
26                 if ('friendship' == $class && strpos($link_rel, 'friend') === false && strpos($link_rel, 'acquaintance') === false && strpos($link_rel, 'contact') === false) echo ' checked="checked"';
27                 if ('geographical' == $class && strpos($link_rel, 'co-resident') === false && strpos($link_rel, 'neighbor') === false) echo ' checked="checked"';
28                 if ('identity' == $class && in_array('me', $rels) ) echo ' checked="checked"';
29         }
30 }
31 ?>
32
33 <?php echo $form ?>
34 <?php wp_nonce_field($nonce_action); ?>
35 <?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
36
37 <div class="wrap">
38 <h2><?php echo $heading; ?></h2>
39
40 <div id="poststuff">
41
42 <div class="submitbox" id="submitlink">
43
44 <div id="previewview">
45 <?php if ( !empty($link_id) ) { ?>
46 <a href="<?php echo $link->link_url; ?>" target="_blank"><?php _e('Visit Link'); ?></a>
47 <?php } ?>
48 </div>
49
50 <div class="inside">
51 <p><label for="link_private" class="selectit"><input id="link_private" name="link_visible" type="checkbox" value="N" <?php checked($link->link_visible, 'N'); ?> /> <?php _e('Keep this link private') ?></label></p>
52 </div>
53
54 <p class="submit">
55 <input type="submit" class="button button-highlighted" name="save" value="<?php _e('Save'); ?>" tabindex="4" />
56 <?php
57 if ( ( 'edit' == $action) && current_user_can('manage_links') )
58         echo "<a class='submitdelete' href='" . wp_nonce_url("link.php?action=delete&amp;link_id=$link_id", 'delete-bookmark_' . $link_id) . "' onclick=\"if ( confirm('" . 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;\">" . __('Delete&nbsp;link') . "</a>";
59 ?>
60 </p>
61
62 <div class="side-info">
63 <h5><?php _e('Related') ?></h5>
64
65 <ul>
66 <li><a href="link-manager.php"><?php _e('Manage All Links') ?></a></li>
67 <li><a href="edit-link-categories.php"><?php _e('Manage All Link Categories') ?></a></li>
68 <li><a href="link-import.php"><?php _e('Import Links') ?></a></li>
69 <?php do_action('link_relatedlinks_list'); ?>
70 </ul>
71 </div>
72 <?php do_action('submitlink_box'); ?>
73 </div>
74
75 <div id="post-body">
76 <div id="namediv" class="stuffbox">
77 <h3><?php _e('Name') ?></h3>
78 <div class="inside">
79         <input type="text" name="link_name" size="30" tabindex="1" value="<?php echo $link->link_name; ?>" id="link_name" /><br />
80     <?php _e('Example: Nifty blogging software'); ?>
81 </div>
82 </div>
83
84 <div id="addressdiv" class="stuffbox">
85 <h3><?php _e('Web Address') ?></h3>
86 <div class="inside">
87         <input type="text" name="link_url" size="30" tabindex="1" value="<?php echo $link->link_url; ?>" id="link_url" /><br />
88     <?php _e('Example: <code>http://wordpress.org/</code> &#8212; don&#8217;t forget the <code>http://</code>'); ?>
89 </div>
90 </div>
91
92 <div id="descriptiondiv" class="stuffbox">
93 <h3><?php _e('Description') ?></h3>
94 <div class="inside">
95         <input type="text" name="link_description" size="30" tabindex="1" value="<?php echo $link->link_description; ?>" id="link_description" /><br />
96     <?php _e('This will be shown when someone hovers over the link in the blogroll, or optionally below the link.'); ?>
97 </div>
98 </div>
99
100 <div id="linkcategorydiv" class="postbox <?php echo postbox_classes('linkcategorydiv', 'link'); ?>">
101 <h3><?php _e('Categories') ?></h3>
102 <div class="inside">
103
104 <div id="category-adder" class="wp-hidden-children">
105         <h4><a id="category-add-toggle" href="#category-add"><?php _e( '+ Add New Category' ); ?></a></h4>
106         <p id="link-category-add" class="wp-hidden-child">
107                 <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" />
108                 <input type="button" id="category-add-sumbit" class="add:categorychecklist:linkcategorydiv button" value="<?php _e( 'Add' ); ?>" />
109                 <?php wp_nonce_field( 'add-link-category', '_ajax_nonce', false ); ?>
110                 <span id="category-ajax-response"></span>
111         </p>
112 </div>
113
114 <ul id="category-tabs">
115         <li class="ui-tabs-selected"><a href="#categories-all"><?php _e( 'All Categories' ); ?></a></li>
116         <li class="wp-no-js-hidden"><a href="#categories-pop"><?php _e( 'Most Used' ); ?></a></li>
117 </ul>
118
119 <div id="categories-all" class="ui-tabs-panel">
120         <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
121                 <?php wp_link_category_checklist($link_id); ?>
122         </ul>
123 </div>
124
125 <div id="categories-pop" class="ui-tabs-panel" style="display: none;">
126         <ul id="categorychecklist-pop" class="categorychecklist form-no-clear">
127                 <?php wp_popular_terms_checklist('link_category'); ?>
128         </ul>
129 </div>
130
131 </div>
132 </div>
133
134 <?php do_meta_boxes('link', 'normal', $link); ?>
135
136 <h2><?php _e('Advanced Options'); ?></h2>
137
138 <div id="linktargetdiv" class="postbox <?php echo postbox_classes('linktargetdiv', 'link'); ?>">
139 <h3><?php _e('Target') ?></h3>
140 <div class="inside">
141 <label for="link_target_blank" class="selectit">
142 <input id="link_target_blank" type="radio" name="link_target" value="_blank" <?php echo(($link->link_target == '_blank') ? 'checked="checked"' : ''); ?> />
143 <code>_blank</code></label><br />
144 <label for="link_target_top" class="selectit">
145 <input id="link_target_top" type="radio" name="link_target" value="_top" <?php echo(($link->link_target == '_top') ? 'checked="checked"' : ''); ?> />
146 <code>_top</code></label><br />
147 <label for="link_target_none" class="selectit">
148 <input id="link_target_none" type="radio" name="link_target" value="" <?php echo(($link->link_target == '') ? 'checked="checked"' : ''); ?> />
149 <?php _e('none') ?></label>
150 <p><?php _e('Choose the frame your link targets. Essentially this means if you choose <code>_blank</code> your link will open in a new window.'); ?></p>
151 </div>
152 </div>
153
154 <div id="linkxfndiv" class="postbox <?php echo postbox_classes('linkxfndiv', 'link'); ?>">
155 <h3><?php _e('Link Relationship (XFN)') ?></h3>
156 <div class="inside">
157 <table class="editform" style="width: 100%;" cellspacing="2" cellpadding="5">
158         <tr>
159                 <th style="width: 20%;" scope="row"><?php _e('rel:') ?></th>
160                 <td style="width: 80%;"><input type="text" name="link_rel" id="link_rel" size="50" value="<?php echo $link->link_rel; ?>" /></td>
161         </tr>
162         <tr>
163                 <td colspan="2">
164                         <table cellpadding="3" cellspacing="5" class="form-table">
165                                 <tr>
166                                         <th scope="row"> <?php _e('identity') ?> </th>
167                                         <td>
168                                                 <label for="me">
169                                                 <input type="checkbox" name="identity" value="me" id="me" <?php xfn_check('identity', 'me'); ?> />
170                                                 <?php _e('another web address of mine') ?></label>
171                                         </td>
172                                 </tr>
173                                 <tr>
174                                         <th scope="row"> <?php _e('friendship') ?> </th>
175                                         <td>
176                                                 <label for="contact">
177                                                 <input class="valinp" type="radio" name="friendship" value="contact" id="contact" <?php xfn_check('friendship', 'contact', 'radio'); ?> /> <?php _e('contact') ?></label>
178                                                 <label for="acquaintance">
179                                                 <input class="valinp" type="radio" name="friendship" value="acquaintance" id="acquaintance" <?php xfn_check('friendship', 'acquaintance', 'radio'); ?> />  <?php _e('acquaintance') ?></label>
180                                                 <label for="friend">
181                                                 <input class="valinp" type="radio" name="friendship" value="friend" id="friend" <?php xfn_check('friendship', 'friend', 'radio'); ?> /> <?php _e('friend') ?></label>
182                                                 <label for="friendship">
183                                                 <input name="friendship" type="radio" class="valinp" value="" id="friendship" <?php xfn_check('friendship', '', 'radio'); ?> /> <?php _e('none') ?></label>
184                                         </td>
185                                 </tr>
186                                 <tr>
187                                         <th scope="row"> <?php _e('physical') ?> </th>
188                                         <td>
189                                                 <label for="met">
190                                                 <input class="valinp" type="checkbox" name="physical" value="met" id="met" <?php xfn_check('physical', 'met'); ?> />
191                                                 <?php _e('met') ?></label>
192                                         </td>
193                                 </tr>
194                                 <tr>
195                                         <th scope="row"> <?php _e('professional') ?> </th>
196                                         <td>
197                                                 <label for="co-worker">
198                                                 <input class="valinp" type="checkbox" name="professional" value="co-worker" id="co-worker" <?php xfn_check('professional', 'co-worker'); ?> />
199                                                 <?php _e('co-worker') ?></label>
200                                                 <label for="colleague">
201                                                 <input class="valinp" type="checkbox" name="professional" value="colleague" id="colleague" <?php xfn_check('professional', 'colleague'); ?> />
202                                                 <?php _e('colleague') ?></label>
203                                         </td>
204                                 </tr>
205                                 <tr>
206                                         <th scope="row"> <?php _e('geographical') ?> </th>
207                                         <td>
208                                                 <label for="co-resident">
209                                                 <input class="valinp" type="radio" name="geographical" value="co-resident" id="co-resident" <?php xfn_check('geographical', 'co-resident', 'radio'); ?> />
210                                                 <?php _e('co-resident') ?></label>
211                                                 <label for="neighbor">
212                                                 <input class="valinp" type="radio" name="geographical" value="neighbor" id="neighbor" <?php xfn_check('geographical', 'neighbor', 'radio'); ?> />
213                                                 <?php _e('neighbor') ?></label>
214                                                 <label for="geographical">
215                                                 <input class="valinp" type="radio" name="geographical" value="" id="geographical" <?php xfn_check('geographical', '', 'radio'); ?> />
216                                                 <?php _e('none') ?></label>
217                                         </td>
218                                 </tr>
219                                 <tr>
220                                         <th scope="row"> <?php _e('family') ?> </th>
221                                         <td>
222                                                 <label for="child">
223                                                 <input class="valinp" type="radio" name="family" value="child" id="child" <?php xfn_check('family', 'child', 'radio'); ?>  />
224                                                 <?php _e('child') ?></label>
225                                                 <label for="kin">
226                                                 <input class="valinp" type="radio" name="family" value="kin" id="kin" <?php xfn_check('family', 'kin', 'radio'); ?>  />
227                                                 <?php _e('kin') ?></label>
228                                                 <label for="parent">
229                                                 <input class="valinp" type="radio" name="family" value="parent" id="parent" <?php xfn_check('family', 'parent', 'radio'); ?> />
230                                                 <?php _e('parent') ?></label>
231                                                 <label for="sibling">
232                                                 <input class="valinp" type="radio" name="family" value="sibling" id="sibling" <?php xfn_check('family', 'sibling', 'radio'); ?> />
233                                                 <?php _e('sibling') ?></label>
234                                                 <label for="spouse">
235                                                 <input class="valinp" type="radio" name="family" value="spouse" id="spouse" <?php xfn_check('family', 'spouse', 'radio'); ?> />
236                                                 <?php _e('spouse') ?></label>
237                                                 <label for="family">
238                                                 <input class="valinp" type="radio" name="family" value="" id="family" <?php xfn_check('family', '', 'radio'); ?> />
239                                                 <?php _e('none') ?></label>
240                                         </td>
241                                 </tr>
242                                 <tr>
243                                         <th scope="row"> <?php _e('romantic') ?> </th>
244                                         <td>
245                                                 <label for="muse">
246                                                 <input class="valinp" type="checkbox" name="romantic" value="muse" id="muse" <?php xfn_check('romantic', 'muse'); ?> />
247                                                 <?php _e('muse') ?></label>
248                                                 <label for="crush">
249                                                 <input class="valinp" type="checkbox" name="romantic" value="crush" id="crush" <?php xfn_check('romantic', 'crush'); ?> />
250                                                 <?php _e('crush') ?></label>
251                                                 <label for="date">
252                                                 <input class="valinp" type="checkbox" name="romantic" value="date" id="date" <?php xfn_check('romantic', 'date'); ?> />
253                                                 <?php _e('date') ?></label>
254                                                 <label for="romantic">
255                                                 <input class="valinp" type="checkbox" name="romantic" value="sweetheart" id="romantic" <?php xfn_check('romantic', 'sweetheart'); ?> />
256                                                 <?php _e('sweetheart') ?></label>
257                                         </td>
258                                 </tr>
259                         </table>
260                 </td>
261         </tr>
262 </table>
263 <p><?php _e('If the link is to a person, you can specify your relationship with them using the above form. If you would like to learn more about the idea check out <a href="http://gmpg.org/xfn/">XFN</a>.'); ?></p>
264 </div>
265 </div>
266
267 <div id="linkadvanceddiv" class="postbox <?php echo postbox_classes('linkadvanceddiv', 'link'); ?>">
268 <h3><?php _e('Advanced') ?></h3>
269 <div class="inside">
270 <table class="form-table" style="width: 100%;" cellspacing="2" cellpadding="5">
271         <tr class="form-field">
272                 <th valign="top"  scope="row"><label for="link_image"><?php _e('Image Address') ?></label></th>
273                 <td><input type="text" name="link_image" id="link_image" size="50" value="<?php echo $link->link_image; ?>" style="width: 95%" /></td>
274         </tr>
275         <tr class="form-field">
276                 <th valign="top"  scope="row"><label for="rss_uri"><?php _e('RSS Address') ?></label></th>
277                 <td><input name="link_rss" type="text" id="rss_uri" value="<?php echo $link->link_rss; ?>" size="50" style="width: 95%" /></td>
278         </tr>
279         <tr class="form-field">
280                 <th valign="top"  scope="row"><label for="link_notes"><?php _e('Notes') ?></label></th>
281                 <td><textarea name="link_notes" id="link_notes" cols="50" rows="10" style="width: 95%"><?php echo $link->link_notes; ?></textarea></td>
282         </tr>
283         <tr class="form-field">
284                 <th valign="top"  scope="row"><label for="link_rating"><?php _e('Rating') ?></label></th>
285                 <td><select name="link_rating" id="link_rating" size="1">
286                 <?php
287                         for ($r = 0; $r < 10; $r++) {
288                                 echo('            <option value="'.$r.'" ');
289                                 if ($link->link_rating == $r)
290                                         echo 'selected="selected"';
291                                 echo('>'.$r.'</option>');
292                         }
293                 ?></select>&nbsp;<?php _e('(Leave at 0 for no rating.)') ?>
294                 </td>
295         </tr>
296 </table>
297 </div>
298 </div>
299
300 <?php do_meta_boxes('link', 'advanced', $link); ?>
301
302 <?php if ( $link_id ) : ?>
303 <input type="hidden" name="action" value="save" />
304 <input type="hidden" name="link_id" value="<?php echo (int) $link_id; ?>" />
305 <input type="hidden" name="order_by" value="<?php echo attribute_escape($order_by); ?>" />
306 <input type="hidden" name="cat_id" value="<?php echo (int) $cat_id ?>" />
307 <?php else: ?>
308 <input type="hidden" name="action" value="add" />
309 <?php endif; ?>
310
311 </div>
312 </div>
313
314 </div>
315
316 </form>