Make WordPress Core


Ignore:
Timestamp:
09/14/2008 12:58:00 PM (17 years ago)
Author:
azaozz
Message:

Publish postbox and post status select updates.

File:
1 edited

Legend:

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

    r8883 r8889  
    5858function page_submit_meta_box($post) {
    5959    global $action;
     60
     61    $can_publish = current_user_can('publish_pages');
    6062?>
    6163<div class="submitbox" id="submitpage">
     
    6365<div class="inside-submitbox">
    6466
    65 <p><label for='post_status'><?php _e('This post is') ?></label>
     67<div class="insidebox"><label for='post_status'><?php _e('This page is') ?></label>
    6668<strong><span id="post-status-display">
    6769<?php
     
    8385?>
    8486</span></strong>
     87<?php if ( 'publish' == $post->post_status || 'private' == $post->post_status ) { ?>
    8588<a href="#edit_post_status" class="edit-post-status hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a>
    86 </p>
    87 
    88 <p id='post-status-select' class="hide-if-js">
     89
     90<div id="post-status-select" class="hide-if-js">
     91<input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo $post->post_status; ?>" />
     92<?php _e('Change page status'); ?><br />
    8993<select name='post_status' id='post_status' tabindex='4'>
    9094<?php
    9195// only show the publish menu item if they are allowed to publish posts or they are allowed to edit this post (accounts for 'edit_published_posts' capability)
    92 if ( current_user_can('publish_pages') OR ( $post->post_status == 'publish' AND current_user_can('edit_page', $post->ID) ) ) : ?>
    93 <?php if ( 'publish' == $post->post_status || 'private' == $post->post_status ) { ?>
     96if ( $can_publish OR ( $post->post_status == 'publish' AND current_user_can('edit_page', $post->ID) ) ) : ?>
    9497<option<?php selected( $post->post_status, 'publish' ); selected( $post->post_status, 'private' );?> value='publish'><?php _e('Published') ?></option>
    95 <?php } ?>
    9698<?php if ( 'future' == $post->post_status ) : ?>
    9799<option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Scheduled') ?></option>
     
    101103<option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Unpublished') ?></option>
    102104</select>
    103 </p>
     105<a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e('OK'); ?></a>
     106<a href="#post_status" class="cancel-post-status hide-if-no-js"><?php _e('Cancel'); ?></a>
     107</div>
     108</div>
     109
     110<?php } else { ?>
     111</div>
     112
     113<?php if ( $can_publish && 'pending' != $post->post_status ) { ?>
     114<div  class="insidebox"><input name="pending" type="submit" class="button" id="pending" tabindex="6" accesskey="r" value="<?php _e('Submit for Review') ?>" /></div>
     115<?php } ?>
     116
     117<?php } ?>
     118
     119<?php if ( ('edit' == $action) && current_user_can('delete_page', $post->ID) ) { ?>
     120    <div class="insidebox" id="deletebutton"><a class="submitdelete" href="<?php echo wp_nonce_url("page.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID); ?>" onclick="if ( confirm('<?php echo 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;"><?php _e('Delete&nbsp;page'); ?></a></div>
     121<?php } ?>
    104122
    105123<?php
    106124if ( 0 != $post->ID ) {
    107125    if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date
    108         $stamp = __('Scheduled for:<br />%1$s at %2$s');
     126        $stamp = __('Scheduled for: %1$s at %2$s');
    109127    } else if ( 'publish' == $post->post_status ) { // already published
    110         $stamp = __('Published on:<br />%1$s at %2$s');
     128        $stamp = __('Published on: %1$s at %2$s');
    111129    } else if ( '0000-00-00 00:00:00' == $post->post_date ) { // draft, 1 or more saves, no date specified
    112130        $stamp = __('Publish immediately');
    113131    } else { // draft, 1 or more saves, date specified
    114         $stamp = __('Publish on:<br />%1$s at %2$s');
     132        $stamp = __('Publish on: %1$s at %2$s');
    115133    }
    116134    $date = mysql2date(get_option('date_format'), $post->post_date);
     
    122140}
    123141?>
    124 <?php if ( current_user_can( 'publish_pages' ) ) : // Contributors don't get to choose the date of publish ?>
    125 <p class="curtime"><?php printf($stamp, $date, $time); ?>
     142<?php if ( $can_publish ) : // Contributors don't get to choose the date of publish ?>
     143<div class="insidebox curtime"><span id="timestamp"><?php printf($stamp, $date, $time); ?></span>
    126144&nbsp;<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a></p>
    127145
    128 <div id='timestampdiv' class='hide-if-js'><?php touch_time(($action == 'edit'),1,4); ?></div>
     146<div id="timestampdiv" class="hide-if-js"><?php touch_time(($action == 'edit'),1,4); ?></div></div>
    129147<?php endif; ?>
    130148
     
    133151<p class="submit">
    134152<?php do_action('page_submitbox_start'); ?>
    135 <input type="submit" name="save" class="button button-highlighted" value="<?php _e('Save'); ?>" tabindex="4" />
     153<?php if ( 'publish' == $post->post_status || 'private' == $post->post_status )
     154    $savebtn = attribute_escape( __('Save') );
     155else
     156    $savebtn = attribute_escape( __('Save Draft') );
     157?>
     158<input type="submit" name="save" id="save-post" value="<?php echo $savebtn; ?>" tabindex="4" class="button button-highlighted" />
    136159
    137160<?php if ( 'publish' == $post->post_status ) { ?>
    138161<a class="preview button" href="<?php echo clean_url(get_permalink($post->ID)); ?>" target="_blank" tabindex="4"><?php _e('View this Page'); ?></a>
    139162<?php } else { ?>
    140 <a class="preview button" 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'); ?></a>
     163<a class="preview button" 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'); ?></a>
    141164<?php } ?>
    142165
    143 <?php if ( ('edit' == $action) && current_user_can('delete_page', $post->ID) )
    144     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>";
    145 ?>
    146 <br class="clear" />
    147 <?php
    148 if ( !in_array( $post->post_status, array('publish', 'future') ) || 0 == $post->ID ) {
    149 ?>
     166<?php
     167if ( !in_array( $post->post_status, array('publish', 'future') ) || 0 == $post->ID ) { ?>
    150168<?php if ( current_user_can('publish_pages') ) : ?>
    151169    <input name="publish" type="submit" class="button" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" />
     
    153171    <input name="publish" type="submit" class="button" id="publish" tabindex="5" accesskey="p" value="<?php _e('Submit for Review') ?>" />
    154172<?php endif; ?>
    155 <?php
    156 }
    157 ?>
    158 
    159 <!-- moved under the editor
    160 <?php if ( 0 != $post->ID ) : ?>
    161 <?php if ( $last_id = get_post_meta($post->ID, '_edit_last', true) ) {
    162     $last_user = get_userdata($last_id);
    163     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));
    164 } else {
    165     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));
    166 }
    167 ?>
    168 <br class="clear" />
    169 <?php endif; ?>
    170 -->
     173<?php } ?>
    171174
    172175</p>
    173 </div>
     176<div class="clear"></div>
     177</div>
     178
    174179<?php
    175180}
Note: See TracChangeset for help on using the changeset viewer.