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