WordPress.org

Make WordPress Core

Changeset 8889


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

Publish postbox and post status select updates.

Location:
trunk/wp-admin
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/css/colors-classic.css

    r8884 r8889  
    781781}
    782782
    783 .submitbox .submitdelete {
    784     color: #fff;
    785 }
    786 
    787783#edit-settings-wrap,
    788784#show-settings {
  • trunk/wp-admin/css/colors-fresh.css

    r8884 r8889  
    770770}
    771771
    772 .submitbox .submitdelete {
    773     color: #fff;
    774 }
    775 
    776772#edit-settings-wrap,
    777773#show-settings {
  • trunk/wp-admin/edit-form-advanced.php

    r8883 r8889  
    6464function post_submit_meta_box($post) {
    6565    global $action;
     66
     67    $can_publish = current_user_can('publish_posts');
    6668?>
    6769<div class="submitbox" id="submitpost">
     
    6971<div class="inside-submitbox">
    7072
    71 <p><label for='post_status'><?php _e('This post is') ?></label>
     73<div class="insidebox"><label for="post_status"><?php _e('This post is') ?></label>
    7274<strong><span id="post-status-display">
    7375<?php
     
    8991?>
    9092</span></strong>
    91 <a href="#edit_post_status" class="edit-post-status hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a>
    92 </p>
    93 
    94 <p id='post-status-select' class="hide-if-js">
     93<?php if ( 'publish' == $post->post_status || 'private' == $post->post_status ) { ?>
     94<a href="#post_status" class="edit-post-status hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a>
     95
     96<div id="post-status-select" class="hide-if-js">
     97<input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo $post->post_status; ?>" />
     98<?php _e('Change post status'); ?><br />
    9599<select name='post_status' id='post_status' tabindex='4'>
    96100<?php
    97101// 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)
    98 if ( current_user_can('publish_posts') OR ( $post->post_status == 'publish' AND current_user_can('edit_post', $post->ID) ) ) : ?>
    99 <?php if ( 'publish' == $post->post_status || 'private' == $post->post_status ) { ?>
     102if ( $can_publish OR ( $post->post_status == 'publish' AND current_user_can('edit_post', $post->ID) ) ) : ?>
    100103<option<?php selected( $post->post_status, 'publish' ); selected( $post->post_status, 'private' );?> value='publish'><?php _e('Published') ?></option>
    101 <?php } ?>
    102104<?php if ( 'future' == $post->post_status ) : ?>
    103105<option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Scheduled') ?></option>
     
    107109<option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Unpublished') ?></option>
    108110</select>
    109 </p>
    110 
    111 <?php if ( current_user_can( 'publish_posts' ) ) : ?>
    112     <?php if ( current_user_can( 'edit_others_posts' ) ) : ?>
    113         <p id="sticky-checkbox"><label for="sticky" class="selectit"><input id="sticky" name="sticky" type="checkbox" value="sticky" <?php checked(is_sticky($post->ID), true); ?> tabindex="4" /> <?php _e('Stick this post to the front page') ?></label></p>
    114     <?php endif; ?>
    115 <?php endif; ?>
     111
     112<a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e('OK'); ?></a>
     113<a href="#post_status" class="cancel-post-status hide-if-no-js"><?php _e('Cancel'); ?></a>
     114</div>
     115</div>
     116
     117<?php } else { ?>
     118</div>
     119
     120<?php if ( $can_publish && 'pending' != $post->post_status ) { ?>
     121<div  class="insidebox"><input name="pending" type="submit" class="button" id="pending" tabindex="6" accesskey="r" value="<?php _e('Submit for Review') ?>" /></div>
     122<?php } ?>
     123
     124<?php } ?>
     125
     126<?php if ( $can_publish && current_user_can( 'edit_others_posts' ) ) { ?>
     127    <div class="insidebox" id="sticky-checkbox"><input id="sticky" name="sticky" type="checkbox" value="sticky" <?php checked(is_sticky($post->ID), true); ?> tabindex="4" /> <label for="sticky" class="selectit"><?php _e('Stick this post to the front page') ?></label></div>
     128<?php } ?>
     129
     130<?php
     131if ( ( 'edit' == $action ) && current_user_can('delete_post', $post->ID) ) { ?>
     132    <div class="insidebox" id="deletebutton"><a class="submitdelete" href="<?php echo wp_nonce_url("post.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 post '%s'\n  'Cancel' to stop, 'OK' to delete."), $post->post_title )); ?>') ) {return true;}return false;"><?php _e('Delete&nbsp;post'); ?></a></div>
     133<?php } ?>
     134
    116135<?php
    117136if ( 0 != $post->ID ) {
    118137    if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date
    119         $stamp = __('Scheduled for:<br />%1$s at %2$s');
     138        $stamp = __('Scheduled for: %1$s at %2$s');
    120139    } else if ( 'publish' == $post->post_status ) { // already published
    121         $stamp = __('Published on:<br />%1$s at %2$s');
     140        $stamp = __('Published on: %1$s at %2$s');
    122141    } else if ( '0000-00-00 00:00:00' == $post->post_date ) { // draft, 1 or more saves, no date specified
    123142        $stamp = __('Publish immediately');
    124143    } else { // draft, 1 or more saves, date specified
    125         $stamp = __('Publish on:<br />%1$s at %2$s');
     144        $stamp = __('Publish on: %1$s at %2$s');
    126145    }
    127146    $date = mysql2date(get_option('date_format'), $post->post_date);
     
    133152}
    134153?>
    135 <?php if ( current_user_can( 'publish_posts' ) ) : // Contributors don't get to choose the date of publish ?>
    136 <p class="curtime"><?php printf($stamp, $date, $time); ?>
    137 &nbsp;<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a></p>
    138 
    139 <div id='timestampdiv' class='hide-if-js'><?php touch_time(($action == 'edit'),1,4); ?></div>
     154<?php if ( $can_publish ) : // Contributors don't get to choose the date of publish ?>
     155<div class="insidebox curtime"><span id="timestamp"><?php printf($stamp, $date, $time); ?></span>
     156&nbsp;<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a>
     157
     158<div id="timestampdiv" class="hide-if-js"><?php touch_time(($action == 'edit'),1,4); ?></div></div>
    140159<?php endif; ?>
    141160
     
    144163<p class="submit">
    145164<?php do_action('post_submitbox_start'); ?>
    146 <input type="submit" name="save" id="save-post" value="<?php _e('Save Draft'); ?>" tabindex="4" class="button button-highlighted" />
     165<?php if ( 'publish' == $post->post_status || 'private' == $post->post_status )
     166    $savebtn = attribute_escape( __('Save') );
     167else
     168    $savebtn = attribute_escape( __('Save Draft') );
     169?>
     170<input type="submit" name="save" id="save-post" value="<?php echo $savebtn; ?>" tabindex="4" class="button button-highlighted" />
    147171
    148172<?php if ( 'publish' == $post->post_status ) { ?>
    149173<a class="preview button" href="<?php echo clean_url(get_permalink($post->ID)); ?>" target="_blank" tabindex="4"><?php _e('View this Post'); ?></a>
    150174<?php } else { ?>
    151 <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>
     175<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>
    152176<?php } ?>
    153177
    154178<?php
    155 if ( ( 'edit' == $action) && current_user_can('delete_post', $post->ID) )
    156     echo "<a class='submitdelete' href='" . wp_nonce_url("post.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 post '%s'\n  'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete&nbsp;post') . "</a>";
    157 ?>
    158 <br class="clear" />
    159 <?php
    160 if ( !in_array( $post->post_status, array('publish', 'future') ) || 0 == $post->ID ) {
    161 ?>
     179if ( !in_array( $post->post_status, array('publish', 'future') ) || 0 == $post->ID ) { ?>
    162180<?php if ( current_user_can('publish_posts') ) : ?>
    163181    <input name="publish" type="submit" class="button" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" />
     
    167185<?php } ?>
    168186
    169 <!-- moved under the editor
    170 <?php if ( 0 != $post->ID ): ?>
    171 <?php if ( $last_id = get_post_meta($post->ID, '_edit_last', true) ) {
    172     $last_user = get_userdata($last_id);
    173     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));
    174 } else {
    175     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));
    176 }
    177 ?>
    178 <br class="clear" />
    179 <?php endif; ?>
    180 -->
    181 
    182187</p>
    183 </div>
     188<div class="clear"></div>
     189</div>
     190
    184191<?php
    185192}
     
    274281
    275282function post_trackback_meta_box($post) {
    276     $form_trackback = '<input type="text" name="trackback_url" style="width: 415px" id="trackback" tabindex="7" value="'. attribute_escape( str_replace("\n", ' ', $post->to_ping) ) .'" />';
     283    $form_trackback = '<input type="text" name="trackback_url" id="trackback_url" tabindex="7" value="'. attribute_escape( str_replace("\n", ' ', $post->to_ping) ) .'" />';
    277284    if ('' != $post->pinged) {
    278285        $pings = '<p>'. __('Already pinged:') . '</p><ul>';
     
    288295    <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 <a href="http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments" target="_blank">trackbacks and pingbacks</a> on this post') ?></label>
    289296</p>
    290 <p><label for="trackback"><?php _e('Send trackbacks to:'); ?></label> <?php echo $form_trackback; ?><br /> (<?php _e('Separate multiple URLs with spaces'); ?>)</p>
     297<p><label for="trackback_url"><?php _e('Send trackbacks to:'); ?></label> <?php echo $form_trackback; ?><br /> (<?php _e('Separate multiple URLs with spaces'); ?>)</p>
    291298<p><?php _e('Trackbacks are a way to notify legacy blog systems that you&#8217;ve linked to them. If you link other WordPress blogs they&#8217;ll be notified automatically using <a href="http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments" target="_blank">pingbacks</a>, no other action necessary.'); ?></p>
    292299<?php
     
    439446else
    440447    wp_nonce_field('update-post_' .  $post_ID);
    441 
    442 $form_pingback = '<input type="hidden" name="post_pingback" value="' . (int) get_option('default_pingback_flag') . '" id="post_pingback" />';
    443 
    444 $form_prevstatus = '<input type="hidden" name="prev_status" value="' . attribute_escape( $post->post_status ) . '" />';
    445 
    446 $saveasdraft = '<input name="save" type="submit" id="save" class="button" tabindex="3" value="' . attribute_escape( __('Save and Continue Editing') ) . '" />';
    447448
    448449?>
     
    542543<?php
    543544
    544 echo $form_pingback;
    545 echo $form_prevstatus;
    546 
    547545do_meta_boxes('post', 'normal', $post);
    548546
  • trunk/wp-admin/edit-link-form.php

    r8883 r8889  
    4242
    4343<div class="inside-submitbox">
    44 <p><label for="link_private" class="selectit"><input id="link_private" name="link_visible" type="checkbox" value="N" <?php checked($link->link_visible, 'N'); ?> /> <?php _e('Keep this link private') ?></label></p>
     44<div  class="insidebox"><label for="link_private" class="selectit"><input id="link_private" name="link_visible" type="checkbox" value="N" <?php checked($link->link_visible, 'N'); ?> /> <?php _e('Keep this link private') ?></label></div>
    4545</div>
    4646
     
    5353
    5454<?php
    55 if ( ( 'edit' == $action) && current_user_can('manage_links') )
     55if ( 'edit' == $_GET['action'] && current_user_can('manage_links') )
    5656    echo "<a class='submitdelete' href='" . wp_nonce_url("link.php?action=delete&amp;link_id=$link->link_id", 'delete-bookmark_' . $link->link_id) . "' onclick=\"if ( confirm('" . js_escape( sprintf( __("You are about to delete this link '%s'\n'Cancel' to stop, 'OK' to delete."), $link->link_name )) . "') ) { return true;}return false;\">" . __('Delete&nbsp;link') . "</a>";
    5757?>
    5858</p>
    5959<?php do_action('submitlink_box'); ?>
     60<div class="clear"></div>
    6061</div>
    6162<?php
  • 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}
  • trunk/wp-admin/includes/post.php

    r8861 r8889  
    6363    if ( isset($post_data['advanced']) && '' != $post_data['advanced'] )
    6464        $post_data['post_status'] = 'draft';
     65    if ( isset($post_data['pending']) && '' != $post_data['pending'] )
     66        $post_data['post_status'] = 'pending';
    6567
    6668    $previous_status = get_post_field('post_status',  $post_data['ID']);
     
    6870    // Posts 'submitted for approval' present are submitted to $_POST the same as if they were being published.
    6971    // Change status from 'publish' to 'pending' if user lacks permissions to publish or to resave published posts.
    70     if ( 'page' == $post_data['post_type'] ) {
    71         if ( 'publish' == $post_data['post_status'] && !current_user_can( 'publish_pages' ) )
    72             if ( $previous_status != 'publish' OR !current_user_can( 'edit_published_pages') )
    73                 $post_data['post_status'] = 'pending';
    74     } else {
    75         if ( isset($post_data['post_status']) && ('publish' == $post_data['post_status'] && !current_user_can( 'publish_posts' )) ) :
    76             // Stop attempts to publish new posts, but allow already published posts to be saved if appropriate.
    77             if ( $previous_status != 'publish' OR !current_user_can( 'edit_published_posts') )
    78                 $post_data['post_status'] = 'pending';
    79         endif;
    80     }
    81 
     72    if ( isset($post_data['post_status']) && ('publish' == $post_data['post_status'] && !current_user_can( 'publish_posts' )) )
     73        if ( $previous_status != 'publish' OR !current_user_can( 'edit_published_pages') )
     74            $post_data['post_status'] = 'pending';
     75
     76    if ( ! isset($post_data['post_status']) )
     77        $post_data['post_status'] = $previous_status;
     78   
    8279    if (!isset( $post_data['comment_status'] ))
    8380        $post_data['comment_status'] = 'closed';
  • trunk/wp-admin/includes/template.php

    r8888 r8889  
    15721572
    15731573<a href="#edit_timestamp" class="save-timestamp hide-if-no-js button"><?php _e('OK'); ?></a>
    1574 <a href="#edit_timestamp" class="edit-timestamp hide-if-no-js"><?php _e('Cancel'); ?></a>
     1574<a href="#edit_timestamp" class="cancel-timestamp hide-if-no-js"><?php _e('Cancel'); ?></a>
    15751575<?php
    15761576}
  • trunk/wp-admin/js/page.js

    r8883 r8889  
    1111    jQuery('#pageslugdiv').hide();
    1212
    13     jQuery('.edit-timestamp').click(function () {
    14         if (jQuery('#timestampdiv').is(":hidden")) {
    15             jQuery('#curtime').slideUp("normal");
    16             jQuery('#timestampdiv').slideDown("normal");
    17         } else {
    18             jQuery('#timestampdiv').slideUp("normal");
    19             jQuery('#mm').val(jQuery('#hidden_mm').val());
    20             jQuery('#jj').val(jQuery('#hidden_jj').val());
    21             jQuery('#aa').val(jQuery('#hidden_aa').val());
    22             jQuery('#hh').val(jQuery('#hidden_hh').val());
    23             jQuery('#mn').val(jQuery('#hidden_mn').val());
    24             jQuery('#curtime').slideDown("normal");
     13    var stamp = $('#timestamp').html();
     14
     15    $('.edit-timestamp').click(function () {
     16        if ($('#timestampdiv').is(":hidden")) {
     17            $('#timestampdiv').slideDown("normal");
     18            $('.edit-timestamp').hide();
    2519        }
     20
    2621        return false;
    2722    });
    2823
    29     jQuery('.save-timestamp').click(function () { // crazyhorse - multiple ok cancels
    30         jQuery('#timestampdiv').hide();
    31         var link = jQuery('.timestamp a').clone( true );
    32         jQuery('.timestamp').show().html(
    33             jQuery( '#mm option[value=' + jQuery('#mm').val() + ']' ).text() + ' ' +
    34             jQuery('#jj').val() + ',' +
    35             jQuery('#aa').val() + '@' +
    36             jQuery('#hh').val() + ':' +
    37             jQuery('#mn').val() + ' '
    38         ).append( link );
    39         jQuery('#curtime').slideDown("normal");
     24    $('.cancel-timestamp').click(function() {
     25        $('#timestampdiv').slideUp("normal");
     26        $('#mm').val($('#hidden_mm').val());
     27        $('#jj').val($('#hidden_jj').val());
     28        $('#aa').val($('#hidden_aa').val());
     29        $('#hh').val($('#hidden_hh').val());
     30        $('#mn').val($('#hidden_mn').val());
     31        $('#timestamp').html(stamp);
     32        $('.edit-timestamp').show();
     33
     34        return false;
     35    });
     36
     37    $('.save-timestamp').click(function () { // crazyhorse - multiple ok cancels
     38        $('#timestampdiv').slideUp("normal");
     39        $('.edit-timestamp').show();
     40        $('#timestamp').html(
     41            $( '#mm option[value=' + $('#mm').val() + ']' ).text() + ' ' +
     42            $('#jj').val() + ', ' +
     43            $('#aa').val() + ' @ ' +
     44            $('#hh').val() + ':' +
     45            $('#mn').val() + ' '
     46        );
     47
    4048        return false;
    4149    });
     
    6270    });
    6371
    64     jQuery('.edit-post-status').click(function () {
    65         if (jQuery('#post-status-select').is(":hidden")) {
    66             jQuery('#post-status-select').slideDown("normal");
    67         } else {
    68             jQuery('#post-status-select').slideUp("normal");
    69             jQuery('#post-status-display').html(jQuery('#post_status :selected').text());
     72    $('.edit-post-status').click(function() {
     73        if ($('#post-status-select').is(":hidden")) {
     74            $('#post-status-select').slideDown("normal");
     75            $(this).hide();
    7076        }
     77
     78        return false;
     79    });
     80
     81    $('.save-post-status').click(function() {
     82        $('#post-status-select').slideUp("normal");
     83        $('#post-status-display').html($('#post_status :selected').text());
     84        $('.edit-post-status').show();
     85       
     86        return false;
     87    });
     88   
     89    $('.cancel-post-status').click(function() {
     90        $('#post-status-select').slideUp("normal");
     91        $('#post_status').val($('#hidden_post_status').val());
     92        $('#post-status-display').html($('#post_status :selected').text());
     93        $('.edit-post-status').show();
     94       
    7195        return false;
    7296    });
  • trunk/wp-admin/js/post.js

    r8875 r8889  
    155155    } );
    156156    jQuery('.categorychecklist .popular-category :checkbox').change( syncChecks ).filter( ':checked' ).change();
    157 
    158     jQuery('.edit-timestamp').click(function () {
    159         if (jQuery('#timestampdiv').is(":hidden")) {
    160             jQuery('#curtime').slideUp("normal");
    161             jQuery('#timestampdiv').slideDown("normal");
    162         } else {
    163             jQuery('#timestampdiv').slideUp("normal");
    164             jQuery('#mm').val(jQuery('#hidden_mm').val());
    165             jQuery('#jj').val(jQuery('#hidden_jj').val());
    166             jQuery('#aa').val(jQuery('#hidden_aa').val());
    167             jQuery('#hh').val(jQuery('#hidden_hh').val());
    168             jQuery('#mn').val(jQuery('#hidden_mn').val());
    169             jQuery('#curtime').slideDown("normal");
    170         }
    171         return false;
    172     });
    173 
    174     jQuery('.save-timestamp').click(function () { // crazyhorse - multiple ok cancels
    175         jQuery('#timestampdiv').hide();
    176         var link = jQuery('.timestamp a').clone( true );
    177         jQuery('.timestamp').show().html(
    178             jQuery( '#mm option[value=' + jQuery('#mm').val() + ']' ).text() + ' ' +
    179             jQuery('#jj').val() + ',' +
    180             jQuery('#aa').val() + '@' +
    181             jQuery('#hh').val() + ':' +
    182             jQuery('#mn').val() + ' '
    183         ).append( link );
    184         jQuery('#curtime').slideDown("normal");
     157    var stamp = $('#timestamp').html();
     158
     159    $('.edit-timestamp').click(function () {
     160        if ($('#timestampdiv').is(":hidden")) {
     161            $('#timestampdiv').slideDown("normal");
     162            $('.edit-timestamp').hide();
     163        }
     164
     165        return false;
     166    });
     167
     168    $('.cancel-timestamp').click(function() {
     169        $('#timestampdiv').slideUp("normal");
     170        $('#mm').val($('#hidden_mm').val());
     171        $('#jj').val($('#hidden_jj').val());
     172        $('#aa').val($('#hidden_aa').val());
     173        $('#hh').val($('#hidden_hh').val());
     174        $('#mn').val($('#hidden_mn').val());
     175        $('#timestamp').html(stamp);
     176        $('.edit-timestamp').show();
     177
     178        return false;
     179    });
     180
     181    $('.save-timestamp').click(function () { // crazyhorse - multiple ok cancels
     182        $('#timestampdiv').slideUp("normal");
     183        $('.edit-timestamp').show();
     184        $('#timestamp').html(
     185            $( '#mm option[value=' + $('#mm').val() + ']' ).text() + ' ' +
     186            $('#jj').val() + ', ' +
     187            $('#aa').val() + ' @ ' +
     188            $('#hh').val() + ':' +
     189            $('#mn').val() + ' '
     190        );
     191
    185192        return false;
    186193    });
     
    218225    });
    219226   
    220     jQuery('.edit-post-status').click(function () {
    221         if (jQuery('#post-status-select').is(":hidden")) {
    222             jQuery('#post-status-select').slideDown("normal");
    223         } else {
    224             jQuery('#post-status-select').slideUp("normal");
    225             jQuery('#post-status-display').html(jQuery('#post_status :selected').text());
    226         }
     227    $('.edit-post-status').click(function() {
     228        if ($('#post-status-select').is(":hidden")) {
     229            $('#post-status-select').slideDown("normal");
     230            $(this).hide();
     231        }
     232
     233        return false;
     234    });
     235
     236    $('.save-post-status').click(function() {
     237        $('#post-status-select').slideUp("normal");
     238        $('#post-status-display').html($('#post_status :selected').text());
     239        $('.edit-post-status').show();
     240       
    227241        return false;
    228242    });
    229243   
     244    $('.cancel-post-status').click(function() {
     245        $('#post-status-select').slideUp("normal");
     246        $('#post_status').val($('#hidden_post_status').val());
     247        $('#post-status-display').html($('#post_status :selected').text());
     248        $('.edit-post-status').show();
     249       
     250        return false;
     251    });
    230252});
  • trunk/wp-admin/js/postbox.js

    r8871 r8889  
    44        add_postbox_toggles : function(page) {
    55            $('.postbox h3').before('<a class="togbox">+</a> ');
    6             $('.postbox h3, .postbox a.togbox').click( function() { $($(this).parent().get(0)).toggleClass('closed'); save_postboxes_state(page); } );
     6            $('.postbox h3, .postbox a.togbox').click( function() {
     7                $($(this).parent().get(0)).toggleClass('closed');
     8                postboxes.save_state(page);
     9            });
    710
    811            $('.hide-postbox-tog').click( function() {
     
    1417                    jQuery('#' + box).hide();
    1518                }
    16                 save_postboxes_state(page);
     19                postboxes.save_state(page);
    1720            } );
    1821
     
    2629            this.init(page);
    2730        },
    28    
     31
    2932        expandSidebar : function( doIt ) {
    3033            if ( doIt || $.trim( $( '#side-info-column' ).text() ) ) {
     
    4346                handle: '.hndle',
    4447                distance: 2,
    45                 containment: '#wpbody-content',
    4648                stop: function() {
    4749                    if ( 'side-sortables' == this.id ) { // doing this with jQuery doesn't work for some reason: make-it-tall gets duplicated
     
    7072                }
    7173            } );
     74        },
     75
     76        save_state : function(page) {
     77            var closed = $('.postbox').filter('.closed').map(function() { return this.id; }).get().join(',');
     78            var hidden = $('.postbox').filter(':hidden').map(function() { return this.id; }).get().join(',');
     79            $.post(postboxL10n.requestFile, {
     80                action: 'closed-postboxes',
     81                closed: closed,
     82                hidden: hidden,
     83                closedpostboxesnonce: jQuery('#closedpostboxesnonce').val(),
     84                page: page
     85            });
    7286        }
    73     }
     87    };
     88
     89    $(document).ready(function(){postboxes.expandSidebar();});
     90
    7491}(jQuery));
    75 
    76 jQuery(document).ready(function(){postboxes.expandSidebar();});
    77 
    78 function save_postboxes_state(page) {
    79     var closed = jQuery('.postbox').filter('.closed').map(function() { return this.id; }).get().join(',');
    80     var hidden = jQuery('.postbox').filter(':hidden').map(function() { return this.id; }).get().join(',');
    81     jQuery.post(postboxL10n.requestFile, {
    82         action: 'closed-postboxes',
    83         closed: closed,
    84         hidden: hidden,
    85         closedpostboxesnonce: jQuery('#closedpostboxesnonce').val(),
    86         page: page
    87     });
    88 }
  • trunk/wp-admin/wp-admin.css

    r8875 r8889  
    238238
    239239.preview {
    240     border: 0 none;
    241240    padding: 7px;
    242241}
    243242
    244 .submitbox .submit a.preview:hover {
    245     border: 0 none;
    246 }
    247 
    248243#publish {
    249     display: block;
    250244    margin: 8px auto auto;
    251245    min-width: 150px;
     
    10711065    min-width: 195px;
    10721066}
    1073 #normal-sortables .postbox .submitbox {
    1074     clear: both;
    1075     position: relative;
    1076 }
    1077 #normal-sortables .postbox p {
    1078     display: inline;
    1079 }
    1080 #normal-sortables .postbox .curtime {
    1081     display: block;
    1082 }
    1083 #normal-sortables .postbox p strong {
    1084     display: inline;
    1085 }
    1086 #normal-sortables .postbox #private-checkbox, #normal-sortables .postbox #sticky-checkbox {
    1087     padding-left: 30px;
    1088 }
     1067
     1068#normal-sortables .inside-submitbox .insidebox {
     1069    float: left;
     1070    margin: 5px 12px 5px 0;
     1071}
     1072
     1073#normal-sortables .submit #publish {
     1074    margin: 8px 0 0 12px;
     1075}
     1076
     1077#normal-sortables .inside-submitbox {
     1078    float: left;
     1079}
     1080
     1081#trackback_url {
     1082    width: 99%;
     1083}
     1084
    10891085#normal-sortables .postbox .submit {
    1090     position: absolute;
    1091     top: -1em;
    1092     right: 0;
    1093     background: none;
    1094     border: 0;
    1095     padding: 0;
     1086    background: transparent none;
     1087    border: 0 none;
     1088    float: right;
     1089    padding: 0 12px;
     1090    margin: 0;
     1091}
     1092
     1093#side-sortables .submitbox .submit input,
     1094#side-sortables .submitbox .submit .preview,
     1095#side-sortables .submitbox .submit a.preview:hover {
     1096    border: 0 none;
     1097}
     1098
     1099#side-sortables .inside-submitbox .insidebox {
     1100    margin: 11px 0;
    10961101}
    10971102
     
    11381143}
    11391144
    1140 .submitbox {
    1141 /*  margin: 1em 0; */
    1142 }
    1143 
    1144 .submitbox p {
    1145 /*  padding: 0;
    1146     margin: 0; */
    1147 }
    1148 
    1149 .submitbox .submit {
    1150     text-align: left;
    1151     padding: 12px 10px 10px;
    1152     font-size: 11px;
    1153 }
    1154 
    1155 .submitbox .submitdelete {
    1156     border-bottom-width: 1px;
    1157     border-bottom-style: solid;
    1158     text-decoration: none;
    1159     margin-left: 8px;
    1160     padding-bottom: 1px;
    1161 }
    1162 
    1163 .submitbox .submit a:hover {
    1164     border-bottom-width: 1px;
    1165     border-bottom-style: solid;
    1166 }
    1167 
    1168 .submitbox .submit input {
    1169     margin-bottom: 8px;
    1170     margin-right: 3px;
    1171     padding: 6px 4px;
    1172     border: none;
    1173 }
    1174 
    1175 
    11761145#tagchecklist {
    11771146    margin-left: 10px;
     
    12951264    margin: 0 12px 12px;
    12961265    font-size: 11px;
     1266}
     1267
     1268#pending {
     1269    background: 0 none;
     1270    border: 0 none;
     1271    padding: 0;
     1272    font-size: 11px;
     1273    margin-top: -1px;
    12971274}
    12981275
     
    14171394#side-info-column #side-sortables {
    14181395    height: 100%;
    1419     padding-top: 39px;
     1396}
     1397
     1398.submitbox .submit {
     1399    text-align: left;
     1400    padding: 12px 10px 10px;
     1401    font-size: 11px;
    14201402}
    14211403
     
    14241406    border-bottom-style: solid;
    14251407    text-decoration: none;
    1426     margin-left: 8px;
    1427     padding-bottom: 1px;
     1408    padding: 1px 2px;
     1409}
     1410
     1411.submitbox .inside-submitbox #deletebutton {
     1412    padding: 0 0 2px 20px;
     1413    background-image: url(images/no.png);
     1414    background-position: left center;
     1415    background-repeat: no-repeat;
    14281416}
    14291417
     
    14351423.submitbox .submit input {
    14361424    margin-bottom: 8px;
    1437     margin-right: 3px;
     1425    margin-right: 4px;
    14381426    padding: 6px;
     1427}
     1428
     1429#post-status-select {
     1430    line-height: 2.5em;
    14391431}
    14401432
     
    18431835#jj, #hh, #mn {
    18441836    width: 1.5em;
     1837    padding: 1px;
    18451838}
    18461839
    18471840#aa {
    18481841    width: 2.7em;
     1842    padding: 1px;
     1843}
     1844
     1845#timestampdiv {
     1846    padding-top: 3px;
    18491847}
    18501848
Note: See TracChangeset for help on using the changeset viewer.