]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-admin/edit-form-advanced.php
Wordpress 2.0.4-scripts
[autoinstalls/wordpress.git] / wp-admin / edit-form-advanced.php
1 <?php
2 $messages[1] = __('Post updated');
3 $messages[2] = __('Custom field updated');
4 $messages[3] = __('Custom field deleted.');
5 ?>
6 <?php if (isset($_GET['message'])) : ?>
7 <div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div>
8 <?php endif; ?>
9
10 <form name="post" action="post.php" method="post" id="post">
11 <?php if ( (isset($mode) && 'bookmarklet' == $mode) || 
12             isset($_GET['popupurl']) ): ?>
13 <input type="hidden" name="mode" value="bookmarklet" />
14 <?php endif; ?>
15
16 <div class="wrap">
17 <h2 id="write-post"><?php _e('Write Post'); ?><?php if ( 0 != $post_ID ) : ?>
18  <small class="quickjump"><a href="#preview-post"><?php _e('preview &darr;'); ?></a></small><?php endif; ?></h2>
19 <?php
20
21 if (0 == $post_ID) {
22         $form_action = 'post';
23         $temp_ID = -1 * time();
24         $form_extra = "<input type='hidden' name='temp_ID' value='$temp_ID' />";
25         wp_nonce_field('add-post');
26 } else {
27         $form_action = 'editpost';
28         $form_extra = "<input type='hidden' name='post_ID' value='$post_ID' />";
29         wp_nonce_field('update-post_' .  $post_ID);
30 }
31
32 $form_pingback = '<input type="hidden" name="post_pingback" value="' . get_option('default_pingback_flag') . '" id="post_pingback" />';
33
34 $form_prevstatus = '<input type="hidden" name="prev_status" value="' . $post->post_status . '" />';
35
36 $form_trackback = '<input type="text" name="trackback_url" style="width: 415px" id="trackback" tabindex="7" value="'. str_replace("\n", ' ', $post->to_ping) .'" />';
37
38 if ('' != $post->pinged) {
39         $pings = '<p>'. __('Already pinged:') . '</p><ul>';
40         $already_pinged = explode("\n", trim($post->pinged));
41         foreach ($already_pinged as $pinged_url) {
42                 $pings .= "\n\t<li>$pinged_url</li>";
43         }
44         $pings .= '</ul>';
45 }
46
47 $saveasdraft = '<input name="save" type="submit" id="save" tabindex="3" value="' . __('Save and Continue Editing') . '" />';
48
49 if (empty($post->post_status)) $post->post_status = 'draft';
50
51 ?>
52
53 <input type="hidden" name="user_ID" value="<?php echo $user_ID ?>" />
54 <input type="hidden" name="action" value="<?php echo $form_action ?>" />
55 <input type="hidden" name="post_author" value="<?php echo $post->post_author ?>" />
56
57 <?php echo $form_extra ?>
58 <?php if (isset($_GET['message']) && 2 > $_GET['message']) : ?>
59 <script type="text/javascript">
60 function focusit() {
61         // focus on first input field
62         document.post.title.focus();
63 }
64 addLoadEvent(focusit);
65 </script>
66 <?php endif; ?>
67 <div id="poststuff">
68
69 <div id="moremeta">
70 <div id="grabit" class="dbx-group">
71
72 <fieldset id="commentstatusdiv" class="dbx-box">
73 <h3 class="dbx-handle"><?php _e('Discussion') ?></h3>
74 <div class="dbx-content">
75 <input name="advanced_view" type="hidden" value="1" />
76 <label for="comment_status" class="selectit">
77 <input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($post->comment_status, 'open'); ?> />
78 <?php _e('Allow Comments') ?></label> 
79 <label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked($post->ping_status, 'open'); ?> /> <?php _e('Allow Pings') ?></label>
80 </div>
81 </fieldset>
82
83 <fieldset id="passworddiv" class="dbx-box">
84 <h3 class="dbx-handle"><?php _e('Password-Protect Post') ?></h3> 
85 <div class="dbx-content"><input name="post_password" type="text" size="13" id="post_password" value="<?php echo $post->post_password ?>" /></div>
86 </fieldset>
87
88 <fieldset id="slugdiv" class="dbx-box">
89 <h3 class="dbx-handle"><?php _e('Post slug') ?></h3> 
90 <div class="dbx-content"><input name="post_name" type="text" size="13" id="post_name" value="<?php echo $post->post_name ?>" /></div>
91 </fieldset>
92
93 <fieldset id="categorydiv" class="dbx-box">
94 <h3 class="dbx-handle"><?php _e('Categories') ?></h3>
95 <div class="dbx-content">
96 <p id="jaxcat"></p>
97 <div id="categorychecklist"><?php dropdown_categories(get_settings('default_category')); ?></div></div>
98 </fieldset>
99
100 <fieldset class="dbx-box">
101 <h3 class="dbx-handle"><?php _e('Post Status') ?></h3> 
102 <div class="dbx-content"><?php if ( current_user_can('publish_posts') ) : ?>
103 <label for="post_status_publish" class="selectit"><input id="post_status_publish" name="post_status" type="radio" value="publish" <?php checked($post->post_status, 'publish'); ?> /> <?php _e('Published') ?></label>
104 <?php endif; ?>
105           <label for="post_status_draft" class="selectit"><input id="post_status_draft" name="post_status" type="radio" value="draft" <?php checked($post->post_status, 'draft'); ?> /> <?php _e('Draft') ?></label>
106           <label for="post_status_private" class="selectit"><input id="post_status_private" name="post_status" type="radio" value="private" <?php checked($post->post_status, 'private'); ?> /> <?php _e('Private') ?></label></div>
107 </fieldset>
108
109 <?php if ( current_user_can('edit_posts') ) : ?>
110 <fieldset class="dbx-box">
111 <h3 class="dbx-handle"><?php _e('Post Timestamp'); ?>:</h3>
112 <div class="dbx-content"><?php touch_time(($action == 'edit')); ?></div>
113 </fieldset>
114 <?php endif; ?>
115
116 <?php if ( $authors = get_editable_authors( $current_user->id ) ) : // TODO: ROLE SYSTEM ?>
117 <fieldset id="authordiv" class="dbx-box">
118 <h3 class="dbx-handle"><?php _e('Post author'); ?>:</h3>
119 <div class="dbx-content">
120 <select name="post_author_override" id="post_author_override">
121 <?php 
122 foreach ($authors as $o) :
123 $o = get_userdata( $o->ID );
124 if ( $post->post_author == $o->ID || ( empty($post_ID) && $user_ID == $o->ID ) ) $selected = 'selected="selected"';
125 else $selected = '';
126 echo "<option value='$o->ID' $selected>$o->display_name</option>";
127 endforeach;
128 ?>
129 </select>
130 </div>
131 </fieldset>
132 <?php endif; ?>
133
134 <?php do_action('dbx_post_sidebar'); ?>
135
136 </div>
137 </div>
138
139 <fieldset id="titlediv">
140   <legend><?php _e('Title') ?></legend> 
141   <div><input type="text" name="post_title" size="30" tabindex="1" value="<?php echo $post->post_title; ?>" id="title" /></div>
142 </fieldset>
143
144 <fieldset id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>">
145 <legend><?php _e('Post') ?></legend>
146
147 <?php
148  $rows = get_settings('default_post_edit_rows');
149  if (($rows < 3) || ($rows > 100)) {
150      $rows = 12;
151  }
152 ?>
153 <?php the_quicktags(); ?>
154
155 <div><textarea <?php if ( user_can_richedit() ) echo 'title="true" '; ?>rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="2" id="content"><?php echo user_can_richedit() ? wp_richedit_pre($post->post_content) : $post->post_content; ?></textarea></div>
156 </fieldset>
157
158 <script type="text/javascript">
159 // <![CDATA[
160 edCanvas = document.getElementById('content');
161 <?php if ( user_can_richedit() ) : ?>
162 // This code is meant to allow tabbing from Title to Post (TinyMCE).
163 if ( tinyMCE.isMSIE )
164         document.getElementById('title').onkeydown = function (e)
165                 {
166                         e = e ? e : window.event;
167                         if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
168                                 var i = tinyMCE.selectedInstance;
169                                 if(typeof i ==  'undefined')
170                                         return true;
171                                 tinyMCE.execCommand("mceStartTyping");
172                                 this.blur();
173                                 i.contentWindow.focus();
174                                 e.returnValue = false;
175                                 return false;
176                         }
177                 }
178 else
179         document.getElementById('title').onkeypress = function (e)
180                 {
181                         e = e ? e : window.event;
182                         if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
183                                 var i = tinyMCE.selectedInstance;
184                                 if(typeof i ==  'undefined')
185                                         return true;
186                                 tinyMCE.execCommand("mceStartTyping");
187                                 this.blur();
188                                 i.contentWindow.focus();
189                                 e.returnValue = false;
190                                 return false;
191                         }
192                 }
193 <?php endif; ?>
194 // ]]>
195 </script>
196
197 <?php echo $form_pingback ?>
198 <?php echo $form_prevstatus ?>
199
200
201 <p class="submit"><?php echo $saveasdraft; ?> <input type="submit" name="submit" value="<?php _e('Save') ?>" style="font-weight: bold;" tabindex="4" /> 
202 <?php 
203 if ('publish' != $post->post_status || 0 == $post_ID) {
204 ?>
205 <?php if ( current_user_can('publish_posts') ) : ?>
206         <input name="publish" type="submit" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" /> 
207 <?php endif; ?>
208 <?php
209 }
210 ?>
211 <input name="referredby" type="hidden" id="referredby" value="<?php 
212 if ( !empty($_REQUEST['popupurl']) )
213         echo wp_specialchars($_REQUEST['popupurl']);
214 else if ( url_to_postid(wp_get_referer()) == $post_ID )
215         echo 'redo';
216 else
217         echo wp_specialchars(wp_get_referer());
218 ?>" /></p>
219
220 <?php do_action('edit_form_advanced'); ?>
221
222 <?php
223 if (current_user_can('upload_files')) {
224         $uploading_iframe_ID = (0 == $post_ID ? $temp_ID : $post_ID);
225         $uploading_iframe_src = wp_nonce_url("inline-uploading.php?action=view&amp;post=$uploading_iframe_ID", 'inlineuploading');
226         $uploading_iframe_src = apply_filters('uploading_iframe_src', $uploading_iframe_src);
227         if ( false != $uploading_iframe_src )
228                 echo '<iframe id="uploading" border="0" src="' . $uploading_iframe_src . '">' . __('This feature requires iframe support.') . '</iframe>';
229 }
230 ?>
231
232 <div id="advancedstuff" class="dbx-group" >
233
234 <div class="dbx-box-wrapper">
235 <fieldset id="postexcerpt" class="dbx-box">
236 <div class="dbx-handle-wrapper">
237 <h3 class="dbx-handle"><?php _e('Optional Excerpt') ?></h3>
238 </div>
239 <div class="dbx-content-wrapper">
240 <div class="dbx-content"><textarea rows="1" cols="40" name="excerpt" tabindex="6" id="excerpt"><?php echo $post->post_excerpt ?></textarea></div>
241 </div>
242 </fieldset>
243 </div>
244
245 <div class="dbx-box-wrapper">
246 <fieldset class="dbx-box">
247 <div class="dbx-handle-wrapper">
248 <h3 class="dbx-handle"><?php _e('Trackbacks') ?></h3>
249 </div>
250 <div class="dbx-content-wrapper">
251 <div class="dbx-content"><?php _e('Send trackbacks to'); ?>: <?php echo $form_trackback; ?> (<?php _e('Separate multiple URIs with spaces'); ?>)
252 <?php 
253 if ( ! empty($pings) )
254         echo $pings;
255 ?>
256 </div>
257 </div>
258 </fieldset>
259 </div>
260
261 <div class="dbx-box-wrapper">
262 <fieldset id="postcustom" class="dbx-box">
263 <div class="dbx-handle-wrapper">
264 <h3 class="dbx-handle"><?php _e('Custom Fields') ?></h3>
265 </div>
266 <div class="dbx-content-wrapper">
267 <div id="postcustomstuff" class="dbx-content">
268 <?php 
269 if($metadata = has_meta($post_ID)) {
270 ?>
271 <?php
272         list_meta($metadata); 
273 ?>
274 <?php
275 }
276         meta_form();
277 ?>
278 </div>
279 </fieldset>
280 </div>
281
282 <?php do_action('dbx_post_advanced'); ?>
283
284 </div>
285
286 <?php if ('edit' == $action) : $delete_nonce = wp_create_nonce( 'delete-post_' . $post_ID ); ?>
287 <input name="deletepost" class="button" type="submit" id="deletepost" tabindex="10" value="<?php _e('Delete this post') ?>" <?php echo "onclick=\"if ( confirm('" . sprintf(__("You are about to delete this post \'%s\'\\n  \'Cancel\' to stop, \'OK\' to delete."), js_escape($post->post_title) ) . "') ) { document.forms.post._wpnonce.value = '$delete_nonce'; return true;}return false;\""; ?> />
288 <?php endif; ?>
289
290 </div>
291
292 </div>
293
294 </form>