Make WordPress Core

Changeset 6665


Ignore:
Timestamp:
01/25/2008 11:11:54 PM (17 years ago)
Author:
ryan
Message:

Update edit page form. Post boxes need fixin'

Location:
trunk/wp-admin
Files:
3 edited

Legend:

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

    r6567 r6665  
    1 
    2 <div class="wrap">
    3 <h2 id="write-post"><?php _e('Write Page'); ?></h2>
    41<?php
    52
     
    2623
    2724<form name="post" action="page.php" method="post" id="post">
     25<div class="wrap">
    2826
    2927<?php
     
    5048<div id="poststuff">
    5149
    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">
     50<div id="titlediv">
     51<h3><?php _e('Title') ?></h3>
     52<div class="inside">
     53  <input type="text" name="post_title" size="30" tabindex="1" value="<?php echo attribute_escape( $post->post_title ); ?>" id="title" />
     54</div>
     55</div>
     56
     57<div id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>" class="postarea">
     58<h3><?php _e('Page') ?></h3>
     59<?php the_editor($post->post_content); ?>
     60</div>
     61
     62<div id="submitpost">
     63
     64<div id="previewview">
     65<?php if ( 'publish' == $post->post_status ) { ?>
     66<a href="<?php echo clean_url(get_permalink($post->ID)); ?>" target="_blank"><?php _e('View this Page'); ?></a>
     67<?php } elseif ( 'edit' == $action ) { ?>
     68<a href="<?php echo clean_url(apply_filters('preview_post_link', add_query_arg('preview', 'true', get_permalink($post->ID)))); ?>" target="_blank"><?php _e('Preview this Page'); ?></a>
     69<?php } ?>
     70</div>
     71
     72<div class="inside">
     73
     74<p><strong><?php _e('Publish Status') ?></strong></p>
     75<p>
     76<select name='post_status'>
     77<?php if ( current_user_can('publish_posts') ) : ?>
     78<?php $pub_value = ( 'private' == $post->post_status ) ? 'private' : 'publish'; ?>
     79<option<?php selected( $post->post_status, 'publish' ); selected( $post->post_status, 'private' );?> value='<?php echo $pub_value ?>'><?php _e('Published') ?></option>
     80<?php else: ?>
     81<option<?php selected( $post->post_status, 'private' ); ?> value='private'><?php _e('Published') ?></option>
     82<?php endif; ?>
     83<?php if ( 'future' == $post->post_status ) : ?>
     84<option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Pending') ?></option>
     85<?php endif; ?>
     86<option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e('Pending Review') ?></option>
     87<option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Unpublished') ?></option>
     88</select>
     89</p>
     90
     91<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'); ?> /> <?php _e('Keep this post private') ?></label></p>
     92<?php
     93if ($post_ID):
     94
     95if ( 'future' == $post->post_status )
     96    $time = __('Scheduled for:<br />%1$s at %2$s');
     97else if ( 'publish' == $post->post_status )
     98    $time = __('Published on:<br />%1$s at %2$s');
     99else
     100    $time = __('Saved on:<br />%1$s at %2$s');
     101?>
     102<p><?php printf($time, mysql2date(get_option('date_format'), $post->post_date), mysql2date(get_option('time_format'), $post->post_date)); ?>
     103<?php endif; ?>
     104</div>
     105
     106<p class="submit">
     107<input type="submit" name="save" value="<?php _e('Save'); ?>" style="font-weight: bold;" tabindex="4" />
     108<?php
     109if ( !in_array( $post->post_status, array('publish', 'future') ) || 0 == $post_ID ) {
     110?>
     111<?php if ( current_user_can('publish_pages') ) : ?>
     112    <input name="publish" type="submit" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" />
     113<?php else : ?>
     114    <input name="publish" type="submit" id="publish" tabindex="5" accesskey="p" value="<?php _e('Submit for Review') ?>" />
     115<?php endif; ?>
     116<?php
     117}
     118
     119if ( ('edit' == $action) && current_user_can('delete_page', $post_ID) )
     120    echo "<a href='" . wp_nonce_url("page.php?action=delete&amp;post=$post_ID", 'delete-post_' . $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 page') . "</a>";
     121?>
     122<?php if ($post_ID): ?>
     123<br />
     124<?php 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)); ?>
     125<?php endif; ?>
     126</p>
     127</div>
     128
     129<p class="submit">
     130
     131<span id="autosave"></span>
     132
     133</p>
     134
     135<?php do_action('edit_page_form'); ?>
     136
     137<h2><?php _e('Advanced Options'); ?></h2>
     138
     139<div id="postcustom" class="postbox <?php echo postbox_classes('postcustom'); ?>">
     140<h3><?php _e('Custom Fields') ?></h3>
     141<div class="inside">
     142<div id="postcustomstuff">
     143<table cellpadding="3">
     144<?php
     145$metadata = has_meta($post_ID);
     146list_meta($metadata);
     147?>
     148
     149</table>
     150<?php
     151    meta_form();
     152?>
     153<div id="ajax-response"></div>
     154</div>
     155</div>
     156</div>
     157
     158<div id="commentstatusdiv" class="postbox <?php echo postbox_classes('commentstatusdiv'); ?>">
     159<h3><?php _e('Discussion') ?></h3>
     160<div class="inside">
    57161<input name="advanced_view" type="hidden" value="1" />
    58162<label for="comment_status" class="selectit">
     
    61165<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>
    62166</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">
     167</div>
     168
     169<div id="passworddiv" class="postbox <?php echo postbox_classes('passworddiv'); ?>">
     170<h3><?php _e('Page Password') ?></h3>
     171<div class="inside">
     172<input name="post_password" type="text" size="13" id="post_password" value="<?php echo attribute_escape( $post->post_password ); ?>" />
     173</div>
     174</div>
     175
     176<div id="slugdiv" class="postbox <?php echo postbox_classes('slugdiv'); ?>">
     177<h3><?php _e('Page Slug') ?></h3>
     178<div class="inside">
     179<input name="post_name" type="text" size="13" id="post_name" value="<?php echo attribute_escape( $post->post_name ); ?>" />
     180</div>
     181</div>
     182
     183<div id="parentdiv" class="postbox <?php echo postbox_classes('parentdiv'); ?>">
     184<h3><?php _e('Page Parent') ?></h3>
     185<div class="inside">
     186<select name="parent_id">
    82187<option value='0'><?php _e('Main Page (no parent)'); ?></option>
    83188<?php parent_dropdown($post->post_parent); ?>
    84 </select></p>
    85 </div>
    86 </fieldset>
     189</select>
     190</div>
     191</div>
    87192
    88193<?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>
     194<div id="templatediv" class="postbox <?php echo postbox_classes('templatediv'); ?>">
     195<h3><?php _e('Page Template') ?></h3>
     196<div class="inside">
     197<select name="page_template">
     198<option value='default'><?php _e('Default Template'); ?></option>
     199<?php page_template_dropdown($post->page_template); ?>
     200</select>
     201</div>
     202</div>
    97203<?php } ?>
    98204
    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
    110 foreach ($authors as $o) :
    111 $o = get_userdata( $o->ID );
    112 if ( $post->post_author == $o->ID || ( empty($post_ID) && $user_ID == $o->ID ) ) $selected = 'selected="selected"';
    113 else $selected = '';
    114 $o->ID = (int) $o->ID;
    115 $o->display_name = wp_specialchars( $o->display_name );
    116 echo "<option value='$o->ID' $selected>$o->display_name</option>";
    117 endforeach;
    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
    157 if ('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
    168 if (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);
    189 list_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; ?>
     205<div id="orderdiv" class="postbox <?php echo postbox_classes('orderdiv'); ?>">
     206<h3><?php _e('Page Order') ?></h3>
     207<div class="inside">
     208<input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo $post->menu_order ?>" />
     209</div>
     210</div>
     211
     212<?php
     213$authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM
     214if ( $post->post_author && !in_array($post->post_author, $authors) )
     215    $authors[] = $post->post_author;
     216if ( $authors && count( $authors ) > 1 ) :
     217?>
     218<div id="authordiv" class="postbox <?php echo postbox_classes('authordiv'); ?>">
     219<h3><?php _e('Post Author'); ?></h3>
     220<div class="inside">
     221<?php wp_dropdown_users( array('include' => $authors, 'name' => 'post_author_override', 'selected' => empty($post_ID) ? $user_ID : $post->post_author) ); ?>
     222</div>
     223</div>
     224<?php endif; ?>
     225
     226</div>
     227
     228</div>
     229
    211230</div>
    212231
    213232</form>
    214 
    215 </div>
  • trunk/wp-admin/page-new.php

    r6546 r6665  
    55$editing = true;
    66wp_enqueue_script('autosave');
     7wp_enqueue_script('post');
     8wp_enqueue_script('thickbox');
     9wp_enqueue_script('media-upload');
     10
    711require_once('admin-header.php');
    812?>
  • trunk/wp-admin/page.php

    r6546 r6665  
    5252        exit();
    5353    }
     54
     55    wp_enqueue_script('post');
     56    wp_enqueue_script('thickbox');
     57    wp_enqueue_script('media-upload');
    5458
    5559    if ( 'draft' == $post->post_status )
Note: See TracChangeset for help on using the changeset viewer.