Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tags/2.3.3/wp-admin/edit-page-form.php

    r7641 r7641  
    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) {
     1
     2<div class="wrap">
     3<h2 id="write-post"><?php _e('Write Page'); ?></h2>
     4<?php
     5
     6if (0 == $post_ID) {
    147    $form_action = 'post';
    158    $nonce_action = 'add-page';
     
    3326
    3427<form name="post" action="page.php" method="post" id="post">
    35 <div class="wrap">
    36 <h2><?php _e('Write Page') ?></h2>
    3728
    3829<?php
    3930wp_nonce_field($nonce_action);
    4031
    41 if (isset($mode) && 'bookmarklet' == $mode)
     32if (isset($mode) && 'bookmarklet' == $mode) {
    4233    echo '<input type="hidden" name="mode" value="bookmarklet" />';
    43 ?>
    44 <input type="hidden" id="user-id" name="user_ID" value="<?php echo $user_ID ?>" />
     34}
     35?>
     36<input type="hidden" name="user_ID" value="<?php echo $user_ID ?>" />
    4537<input type="hidden" id="hiddenaction" name="action" value='<?php echo $form_action ?>' />
    4638<input type="hidden" id="originalaction" name="originalaction" value="<?php echo $form_action ?>" />
    4739<?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 ( url_to_postid(wp_get_referer()) == $post_ID && strpos( wp_get_referer(), '/wp-admin/' ) === false )
    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 
     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>
    5850<div id="poststuff">
    5951
    60 <div class="submitbox" id="submitpage">
    61 
    62 <div id="previewview">
     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
    63143<?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>
     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>
    65145<?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>
     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>
    67147<?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_posts') ) : ?>
    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>
     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; ?>" />
    86163</p>
    87164
    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 
    187165<?php do_action('edit_page_form'); ?>
    188166
    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">
     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<fieldset id="postcustom" class="dbx-box">
     180<h3 class="dbx-handle"><?php _e('Custom Fields') ?></h3>
     181<div id="postcustomstuff" class="dbx-content">
    195182<table cellpadding="3">
    196183<?php
     
    203190    meta_form();
    204191?>
     192</div>
    205193<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>
     194</fieldset>
     195
     196<?php do_action('dbx_page_advanced'); ?>
     197
     198</div>
     199
     200<?php if ('edit' == $action) :
     201    $delete_nonce = wp_create_nonce( 'delete-page_' . $post_ID );
     202    if ( current_user_can('delete_page', $post->ID) ) ?>
     203        <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;\""; ?> />
    282204<?php endif; ?>
    283 
    284 <?php do_meta_boxes('page', 'advanced', $post); ?>
    285 
    286 </div>
    287 </div>
    288 
    289205</div>
    290206
    291207</form>
    292208
    293 <script type="text/javascript">
    294 try{document.post.title.focus();}catch(e){}
    295 </script>
     209</div>
Note: See TracChangeset for help on using the changeset viewer.