]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-admin/edit-page-form.php
Wordpress 2.5.1
[autoinstalls/wordpress.git] / wp-admin / edit-page-form.php
1 <?php
2 if ( isset($_GET['message']) )
3         $_GET['message'] = absint( $_GET['message'] );
4 $messages[1] = sprintf( __( 'Page updated. Continue editing below or <a href="%s">go back</a>.' ), attribute_escape( stripslashes( $_GET['_wp_original_http_referer'] ) ) );
5 $messages[2] = __('Custom field updated.');
6 $messages[3] = __('Custom field deleted.');
7 $messages[4] = __('Page updated.');
8 ?>
9 <?php if (isset($_GET['message'])) : ?>
10 <div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div>
11 <?php endif;
12
13 if (!isset($post_ID) || 0 == $post_ID) {
14         $form_action = 'post';
15         $nonce_action = 'add-page';
16         $temp_ID = -1 * time(); // don't change this formula without looking at wp_write_post()
17         $form_extra = "<input type='hidden' id='post_ID' name='temp_ID' value='$temp_ID' />";
18 } else {
19         $post_ID = (int) $post_ID;
20         $form_action = 'editpost';
21         $nonce_action = 'update-page_' . $post_ID;
22         $form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='$post_ID' />";
23 }
24
25 $temp_ID = (int) $temp_ID;
26 $user_ID = (int) $user_ID;
27
28 $sendto = clean_url(stripslashes(wp_get_referer()));
29
30 if ( 0 != $post_ID && $sendto == get_permalink($post_ID) )
31         $sendto = 'redo';
32 ?>
33
34 <form name="post" action="page.php" method="post" id="post">
35 <div class="wrap">
36 <h2><?php _e('Write Page') ?></h2>
37
38 <?php
39 wp_nonce_field($nonce_action);
40
41 if (isset($mode) && 'bookmarklet' == $mode)
42         echo '<input type="hidden" name="mode" value="bookmarklet" />';
43 ?>
44 <input type="hidden" id="user-id" name="user_ID" value="<?php echo $user_ID ?>" />
45 <input type="hidden" id="hiddenaction" name="action" value='<?php echo $form_action ?>' />
46 <input type="hidden" id="originalaction" name="originalaction" value="<?php echo $form_action ?>" />
47 <?php echo $form_extra ?>
48 <input type="hidden" id="post_type" name="post_type" value="<?php echo $post->post_type ?>" />
49 <input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo $post->post_status ?>" />
50 <input name="referredby" type="hidden" id="referredby" value="<?php
51 if ( strpos( wp_get_referer(), '/wp-admin/' ) === false && $post_ID && url_to_postid(wp_get_referer()) === $post_ID )
52         echo 'redo';
53 else
54         echo clean_url(stripslashes(wp_get_referer()));
55 ?>" />
56 <?php if ( 'draft' != $post->post_status ) wp_original_referer_field(true, 'previous'); ?>
57
58 <div id="poststuff">
59
60 <div class="submitbox" id="submitpage">
61
62 <div id="previewview">
63 <?php if ( 'publish' == $post->post_status ) { ?>
64 <a href="<?php echo clean_url(get_permalink($post->ID)); ?>" target="_blank"  tabindex="4"><?php _e('View this Page'); ?></a>
65 <?php } elseif ( 'edit' == $action ) { ?>
66 <a href="<?php echo clean_url(apply_filters('preview_post_link', add_query_arg('preview', 'true', get_permalink($post->ID)))); ?>" target="_blank" tabindex="4"><?php _e('Preview this Page'); ?></a>
67 <?php } ?>
68 </div>
69
70 <div class="inside">
71
72 <p><strong><?php _e('Publish Status') ?></strong></p>
73 <p>
74 <select name='post_status' tabindex='4'>
75 <?php if ( current_user_can('publish_pages') ) : ?>
76 <option<?php selected( $post->post_status, 'publish' ); selected( $post->post_status, 'private' );?> value='publish'><?php _e('Published') ?></option>
77 <?php else: ?>
78 <option<?php selected( $post->post_status, 'private' ); ?> value='private'><?php _e('Published') ?></option>
79 <?php endif; ?>
80 <?php if ( 'future' == $post->post_status ) : ?>
81 <option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Pending') ?></option>
82 <?php endif; ?>
83 <option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e('Pending Review') ?></option>
84 <option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Unpublished') ?></option>
85 </select>
86 </p>
87
88 <p><label for="post_status_private" class="selectit"><input id="post_status_private" name="post_status" type="checkbox" value="private" <?php checked($post->post_status, 'private'); ?> tabindex='4' /> <?php _e('Keep this page private') ?></label></p>
89 <?php
90 if ($post_ID) {
91         if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date
92                 $stamp = __('Scheduled for:<br />%1$s at %2$s');
93         } else if ( 'publish' == $post->post_status ) { // already published
94                 $stamp = __('Published on:<br />%1$s at %2$s');
95         } else if ( '0000-00-00 00:00:00' == $post->post_date ) { // draft, 1 or more saves, no date specified
96                 $stamp = __('Publish immediately');
97         } else { // draft, 1 or more saves, date specified
98                 $stamp = __('Publish on:<br />%1$s at %2$s');
99         }
100         $date = mysql2date(get_option('date_format'), $post->post_date);
101         $time = mysql2date(get_option('time_format'), $post->post_date);
102 } else { // draft (no saves, and thus no date specified)
103         $stamp = __('Publish immediately');
104         $date = mysql2date(get_option('date_format'), current_time('mysql'));
105         $time = mysql2date(get_option('time_format'), current_time('mysql'));
106 }
107 ?>
108 <p class="curtime"><?php printf($stamp, $date, $time); ?>
109 &nbsp;<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a></p>
110
111 <div id='timestampdiv' class='hide-if-js'><?php touch_time(($action == 'edit'),1,4); ?></div>
112
113 </div>
114
115 <p class="submit">
116 <input type="submit" name="save" class="button button-highlighted" value="<?php _e('Save'); ?>" tabindex="4" />
117 <?php
118 if ( !in_array( $post->post_status, array('publish', 'future') ) || 0 == $post_ID ) {
119 ?>
120 <?php if ( current_user_can('publish_pages') ) : ?>
121         <input name="publish" type="submit" class="button" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" />
122 <?php else : ?>
123         <input name="publish" type="submit" class="button" id="publish" tabindex="5" accesskey="p" value="<?php _e('Submit for Review') ?>" />
124 <?php endif; ?>
125 <?php
126 }
127
128 if ( ('edit' == $action) && current_user_can('delete_page', $post_ID) )
129         echo "<a class='submitdelete' href='" . wp_nonce_url("page.php?action=delete&amp;post=$post_ID", 'delete-page_' . $post_ID) . "' onclick=\"if ( confirm('" . js_escape(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n  'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this page '%s'\n  'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete&nbsp;page') . "</a>";
130 ?>
131 <br class="clear" />
132 <?php if ($post_ID): ?>
133 <?php if ( $last_id = get_post_meta($post_ID, '_edit_last', true) ) {
134         $last_user = get_userdata($last_id);
135         printf(__('Last edited by %1$s on %2$s at %3$s'), wp_specialchars( $last_user->display_name ), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified));
136 } else {
137         printf(__('Last edited on %1$s at %2$s'), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified));
138 }
139 ?>
140 <br class="clear" />
141 <?php endif; ?>
142 <span id="autosave"></span>
143 </p>
144
145 <div class="side-info">
146 <h5><?php _e('Related') ?></h5>
147
148 <ul>
149 <?php if ($post_ID): ?>
150 <li><a href="edit-pages.php?page_id=<?php echo $post_ID ?>"><?php _e('See Comments on this Page') ?></a></li>
151 <?php endif; ?>
152 <li><a href="edit-comments.php"><?php _e('Manage All Comments') ?></a></li>
153 <li><a href="edit-pages.php"><?php _e('Manage All Pages') ?></a></li>
154 <?php do_action('page_relatedlinks_list'); ?>
155 </ul>
156 </div>
157 <?php do_action('submitpage_box'); ?>
158 </div>
159
160 <div id="post-body">
161 <div id="titlediv">
162 <h3><?php _e('Title') ?></h3>
163 <div id="titlewrap">
164   <input type="text" name="post_title" size="30" tabindex="1" value="<?php echo attribute_escape( $post->post_title ); ?>" id="title" autocomplete="off" />
165 </div>
166 <div class="inside">
167 <?php $sample_permalink_html = get_sample_permalink_html($post->ID); ?>
168         <div id="edit-slug-box">
169 <?php if ( ! empty($post->ID) && ! empty($sample_permalink_html) ) :
170         echo $sample_permalink_html;
171 endif; ?>
172         </div>
173 </div>
174 </div>
175
176 <div id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>" class="postarea">
177 <h3><?php _e('Page') ?></h3>
178 <?php the_editor($post->post_content); ?>
179 <?php wp_nonce_field( 'autosave', 'autosavenonce', false ); ?>
180 <?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
181 <?php wp_nonce_field( 'getpermalink', 'getpermalinknonce', false ); ?>
182 <?php wp_nonce_field( 'samplepermalink', 'samplepermalinknonce', false ); ?>
183 </div>
184
185 <?php do_meta_boxes('page', 'normal', $post); ?>
186
187 <?php do_action('edit_page_form'); ?>
188
189 <h2><?php _e('Advanced Options'); ?></h2>
190
191 <div id="pagepostcustom" class="postbox <?php echo postbox_classes('pagepostcustom', 'page'); ?>">
192 <h3><?php _e('Custom Fields') ?></h3>
193 <div class="inside">
194 <div id="postcustomstuff">
195 <table cellpadding="3">
196 <?php
197 $metadata = has_meta($post_ID);
198 list_meta($metadata);
199 ?>
200
201 </table>
202 <?php
203         meta_form();
204 ?>
205 <div id="ajax-response"></div>
206 </div>
207 <p><?php _e('Custom fields can be used to add extra metadata to a post that you can <a href="http://codex.wordpress.org/Using_Custom_Fields" target="_blank">use in your theme</a>.'); ?></p>
208 </div>
209 </div>
210
211 <div id="pagecommentstatusdiv" class="postbox <?php echo postbox_classes('pagecommentstatusdiv', 'page'); ?>">
212 <h3><?php _e('Comments &amp; Pings') ?></h3>
213 <div class="inside">
214 <input name="advanced_view" type="hidden" value="1" />
215 <p><label for="comment_status" class="selectit">
216 <input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($post->comment_status, 'open'); ?> />
217 <?php _e('Allow Comments') ?></label></p>
218 <p><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></p>
219 <p><?php _e('These settings apply to this page only. &#8220;Pings&#8221; are <a href="http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments" target="_blank">trackbacks and pingbacks</a>.'); ?></p>
220 </div>
221 </div>
222
223 <div id="pagepassworddiv" class="postbox <?php echo postbox_classes('pagepassworddiv', 'page'); ?>">
224 <h3><?php _e('Password Protect This Page') ?></h3>
225 <div class="inside">
226 <p><input name="post_password" type="text" size="25" id="post_password" value="<?php echo attribute_escape( $post->post_password ); ?>" /></p>
227 <p><?php _e('Setting a password will require people who visit your blog to enter the above password to view this page and its comments.'); ?></p>
228 </div>
229 </div>
230
231 <div id="pageslugdiv" class="postbox <?php echo postbox_classes('pageslugdiv', 'page'); ?>">
232 <h3><?php _e('Page Slug') ?></h3>
233 <div class="inside">
234 <input name="post_name" type="text" size="13" id="post_name" value="<?php echo attribute_escape( $post->post_name ); ?>" />
235 </div>
236 </div>
237
238 <div id="pageparentdiv" class="postbox <?php echo postbox_classes('pageparentdiv', 'page'); ?>">
239 <h3><?php _e('Page Parent') ?></h3>
240 <div class="inside">
241 <select name="parent_id">
242 <option value='0'><?php _e('Main Page (no parent)'); ?></option>
243 <?php parent_dropdown($post->post_parent); ?>
244 </select>
245 <p><?php _e('You can arrange your pages in hierarchies, for example you could have an &#8220;About&#8221; page that has &#8220;Life Story&#8221; and &#8220;My Dog&#8221; pages under it. There are no limits to how deeply nested you can make pages.'); ?></p>
246 </div>
247 </div>
248
249 <?php if ( 0 != count( get_page_templates() ) ) { ?>
250 <div id="pagetemplatediv" class="postbox <?php echo postbox_classes('pagetemplatediv', 'page'); ?>">
251 <h3><?php _e('Page Template') ?></h3>
252 <div class="inside">
253 <select name="page_template">
254 <option value='default'><?php _e('Default Template'); ?></option>
255 <?php page_template_dropdown($post->page_template); ?>
256 </select>
257 <p><?php _e('Some themes have custom templates you can use for certain pages that might have additional features or custom layouts. If so, you&#8217;ll see them above.'); ?></p>
258 </div>
259 </div>
260 <?php } ?>
261
262 <div id="pageorderdiv" class="postbox <?php echo postbox_classes('pageorderdiv', 'page'); ?>">
263 <h3><?php _e('Page Order') ?></h3>
264 <div class="inside">
265 <p><input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo $post->menu_order ?>" /></p>
266 <p><?php _e('Pages are usually ordered alphabetically, but you can put a number above to change the order pages appear in. (We know this is a little janky, it&#8217;ll be better in future releases.)'); ?></p>
267 </div>
268 </div>
269
270 <?php
271 $authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM
272 if ( $post->post_author && !in_array($post->post_author, $authors) )
273         $authors[] = $post->post_author;
274 if ( $authors && count( $authors ) > 1 ) :
275 ?>
276 <div id="pageauthordiv" class="postbox <?php echo postbox_classes('pageauthordiv', 'page'); ?>">
277 <h3><?php _e('Page Author'); ?></h3>
278 <div class="inside">
279 <?php wp_dropdown_users( array('include' => $authors, 'name' => 'post_author_override', 'selected' => empty($post_ID) ? $user_ID : $post->post_author) ); ?>
280 </div>
281 </div>
282 <?php endif; ?>
283
284 <?php do_meta_boxes('page', 'advanced', $post); ?>
285
286 </div>
287 </div>
288
289 </div>
290
291 </form>
292
293 <script type="text/javascript">
294 try{document.post.title.focus();}catch(e){}
295 </script>