WordPress.org

Make WordPress Core

Ticket #5068: edit-page-form.php

File edit-page-form.php, 8.5 KB (added by minusfive, 7 years ago)

Corrected XHTML of Custom Fields box.

Line 
1
2<div class="wrap">
3<h2 id="write-post"><?php _e('Write Page'); ?></h2>
4<?php
5
6if (0 == $post_ID) {
7        $form_action = 'post';
8        $nonce_action = 'add-page';
9        $temp_ID = -1 * time(); // don't change this formula without looking at wp_write_post()
10        $form_extra = "<input type='hidden' id='post_ID' name='temp_ID' value='$temp_ID' />";
11} else {
12        $post_ID = (int) $post_ID;
13        $form_action = 'editpost';
14        $nonce_action = 'update-page_' . $post_ID;
15        $form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='$post_ID' />";
16}
17
18$temp_ID = (int) $temp_ID;
19$user_ID = (int) $user_ID;
20
21$sendto = clean_url(stripslashes(wp_get_referer()));
22
23if ( 0 != $post_ID && $sendto == get_permalink($post_ID) )
24        $sendto = 'redo';
25?>
26
27<form name="post" action="page.php" method="post" id="post">
28
29<?php
30wp_nonce_field($nonce_action);
31
32if (isset($mode) && 'bookmarklet' == $mode) {
33        echo '<input type="hidden" name="mode" value="bookmarklet" />';
34}
35?>
36<input type="hidden" name="user_ID" value="<?php echo $user_ID ?>" />
37<input type="hidden" id="hiddenaction" name="action" value='<?php echo $form_action ?>' />
38<input type="hidden" id="originalaction" name="originalaction" value="<?php echo $form_action ?>" />
39<?php echo $form_extra ?>
40<input type="hidden" id="post_type" name="post_type" value="page" />
41
42<script type="text/javascript">
43// <![CDATA[
44function focusit() { // focus on first input field
45        document.post.title.focus();
46}
47addLoadEvent(focusit);
48// ]]>
49</script>
50<div id="poststuff">
51
52<div id="moremeta">
53<div id="grabit" class="dbx-group">
54<fieldset id="commentstatusdiv" class="dbx-box">
55<h3 class="dbx-handle"><?php _e('Discussion') ?></h3>
56<div class="dbx-content">
57<input name="advanced_view" type="hidden" value="1" />
58<label for="comment_status" class="selectit">
59<input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($post->comment_status, 'open'); ?> />
60<?php _e('Allow Comments') ?></label>
61<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>
62</div>
63</fieldset>
64
65<fieldset class="dbx-box">
66<h3 class="dbx-handle"><?php _e('Page Status') ?></h3>
67<div class="dbx-content"><?php if ( current_user_can('publish_pages') ) : ?>
68<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'); checked($post->post_status, 'future'); ?> /> <?php _e('Published') ?></label>
69<?php endif; ?>
70          <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>
71          <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>
72</fieldset>
73
74<fieldset id="passworddiv" class="dbx-box">
75<h3 class="dbx-handle"><?php _e('Page Password') ?></h3>
76<div class="dbx-content"><input name="post_password" type="text" size="13" id="post_password" value="<?php echo attribute_escape( $post->post_password ); ?>" /></div>
77</fieldset>
78
79<fieldset id="pageparent" class="dbx-box">
80<h3 class="dbx-handle"><?php _e('Page Parent') ?></h3>
81<div class="dbx-content"><p><select name="parent_id">
82<option value='0'><?php _e('Main Page (no parent)'); ?></option>
83<?php parent_dropdown($post->post_parent); ?>
84</select></p>
85</div>
86</fieldset>
87
88<?php if ( 0 != count( get_page_templates() ) ) { ?>
89<fieldset id="pagetemplate" class="dbx-box">
90<h3 class="dbx-handle"><?php _e('Page Template') ?></h3>
91<div class="dbx-content"><p><select name="page_template">
92                <option value='default'><?php _e('Default Template'); ?></option>
93                <?php page_template_dropdown($post->page_template); ?>
94                </select></p>
95</div>
96</fieldset>
97<?php } ?>
98
99<fieldset id="slugdiv" class="dbx-box">
100<h3 class="dbx-handle"><?php _e('Page Slug') ?></h3>
101<div class="dbx-content"><input name="post_name" type="text" size="13" id="post_name" value="<?php echo attribute_escape( $post->post_name ); ?>" /></div>
102</fieldset>
103
104<?php if ( $authors = get_editable_authors( $current_user->id ) ) : // TODO: ROLE SYSTEM ?>
105<fieldset id="authordiv" class="dbx-box">
106<h3 class="dbx-handle"><?php _e('Page Author'); ?></h3>
107<div class="dbx-content">
108<select name="post_author_override" id="post_author_override">
109<?php
110foreach ($authors as $o) :
111$o = get_userdata( $o->ID );
112if ( $post->post_author == $o->ID || ( empty($post_ID) && $user_ID == $o->ID ) ) $selected = 'selected="selected"';
113else $selected = '';
114$o->ID = (int) $o->ID;
115$o->display_name = wp_specialchars( $o->display_name );
116echo "<option value='$o->ID' $selected>$o->display_name</option>";
117endforeach;
118?>
119</select>
120</div>
121</fieldset>
122<?php endif; ?>
123
124<fieldset id="pageorder" class="dbx-box">
125<h3 class="dbx-handle"><?php _e('Page Order') ?></h3>
126<div class="dbx-content"><p><input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo $post->menu_order ?>" /></p></div>
127</fieldset>
128
129<?php do_action('dbx_page_sidebar'); ?>
130
131</div>
132</div>
133
134<fieldset id="titlediv">
135  <legend><?php _e('Page Title') ?></legend>
136  <div><input type="text" name="post_title" size="30" tabindex="1" value="<?php echo attribute_escape( $post->post_title ); ?>" id="title" /></div>
137</fieldset>
138
139
140<fieldset id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>">
141<legend><?php _e('Page Content') ?>
142
143<?php if ( 'publish' == $post->post_status ) { ?>
144<a href="<?php echo clean_url(get_permalink($post->ID)); ?>" style="position: absolute; right: 2em; margin-right: 19em; text-decoration: underline;" target="_blank"><?php _e('View &raquo;'); ?></a>
145<?php } elseif ( 'edit' == $action ) { ?>
146<a href="<?php echo clean_url(apply_filters('preview_post_link', add_query_arg('preview', 'true', get_permalink($post->ID)))); ?>" style="position: absolute; right: 2em; margin-right: 19em; text-decoration: underline;" target="_blank"><?php _e('Preview &raquo;'); ?></a>
147<?php } ?>
148</legend>
149        <?php the_editor($post->post_content); ?>
150</fieldset>
151
152<p class="submit">
153<span id="autosave"></span>
154<input name="save" type="submit" id="save" tabindex="3" value="<?php _e('Save and Continue Editing'); ?>" />
155<input type="submit" name="submit" value="<?php _e('Save') ?>" style="font-weight: bold;" tabindex="4" />
156<?php
157if ('publish' != $post->post_status || 0 == $post_ID):
158?>
159<?php if ( current_user_can('publish_pages') ) : ?>
160        <input name="publish" type="submit" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" />
161<?php endif; endif;?>
162<input name="referredby" type="hidden" id="referredby" value="<?php echo $sendto; ?>" />
163</p>
164
165<?php do_action('edit_page_form'); ?>
166
167<?php
168if (current_user_can('upload_files')) {
169        $uploading_iframe_ID = (0 == $post_ID ? $temp_ID : $post_ID);
170        $uploading_iframe_src = wp_nonce_url("upload.php?style=inline&amp;tab=upload&amp;post_id=$uploading_iframe_ID", 'inlineuploading');
171        $uploading_iframe_src = apply_filters('uploading_iframe_src', $uploading_iframe_src);
172        if ( false != $uploading_iframe_src )
173                echo '<iframe id="uploading" name="uploading" frameborder="0" src="' . $uploading_iframe_src . '">' . __('This feature requires iframe support.') . '</iframe>';
174}
175?>
176
177<div id="advancedstuff" class="dbx-group">
178
179<div class="dbx-b-ox-wrapper">
180<fieldset id="postcustom" class="dbx-box">
181<div class="dbx-h-andle-wrapper">
182<h3 class="dbx-handle"><?php _e('Custom Fields') ?></h3>
183</div>
184<div class="dbx-c-ontent-wrapper">
185<div id="postcustomstuff" class="dbx-content">
186<table cellpadding="3">
187<?php
188$metadata = has_meta($post_ID);
189list_meta($metadata);
190?>
191
192</table>
193<?php
194        meta_form();
195?>
196<div id="ajax-response"></div>
197</div>
198</div>
199</fieldset>
200</div>
201
202<?php do_action('dbx_page_advanced'); ?>
203
204</div>
205
206<?php if ('edit' == $action) :
207        $delete_nonce = wp_create_nonce( 'delete-page_' . $post_ID );
208        if ( current_user_can('delete_page', $post->ID) ) ?>
209                <input name="deletepost" class="button delete" type="submit" id="deletepost" tabindex="10" value="<?php _e('Delete this page') ?>" <?php echo "onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this page '%s'\n  'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { document.forms.post._wpnonce.value = '$delete_nonce'; return true;}return false;\""; ?> />
210<?php endif; ?>
211</div>
212
213</form>
214
215</div>