WordPress.org

Make WordPress Core

Changeset 9402


Ignore:
Timestamp:
10/29/2008 07:22:56 PM (10 years ago)
Author:
markjaquith
Message:

More work on Publish postbox. Post status tweaks, post date tweaks.

Location:
trunk
Files:
5 edited

Legend:

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

    r9398 r9402  
    9696    } else if ( '0000-00-00 00:00:00' == $post->post_date_gmt ) { // draft, 1 or more saves, no date specified
    9797        $stamp = __('Publish immediately');
     98    } else if ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // draft, 1 or more saves, future date specified
     99        $stamp = __('Schedule for:<br />%1$s');
    98100    } else { // draft, 1 or more saves, date specified
    99101        $stamp = __('Publish on:<br />%1$s');
     
    107109<?php if ( $can_publish ) : // Contributors don't get to choose the date of publish ?>
    108110<div class="misc-pub-section curtime">
    109     <span id="timestamp"><?php printf($stamp, $date); ?></span>
     111    <span id="timestamp">
     112    <?php printf($stamp, $date); ?></span>
    110113    &nbsp;<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a>
    111114    <div id="timestampdiv" class="hide-if-js"><?php touch_time(($action == 'edit'),1,4); ?></div>
     
    133136?>
    134137</span></b>
    135 <?php if ( 'publish' == $post->post_status || 'private' == $post->post_status ) { ?>
     138<?php if ( 'publish' == $post->post_status || 'private' == $post->post_status || $can_publish ) { ?>
    136139<a href="#post_status" class="edit-post-status hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a>
    137140
    138141<div id="post-status-select" class="hide-if-js">
    139142<input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo $post->post_status; ?>" />
    140 <br />
    141143<select name='post_status' id='post_status' tabindex='4'>
    142144<?php
    143 // 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)
    144 if ( $can_publish OR ( $post->post_status == 'publish' AND current_user_can('edit_post', $post->ID) ) ) : ?>
     145if ( $post->post_status == 'publish' ) : ?>
    145146<option<?php selected( $post->post_status, 'publish' ); selected( $post->post_status, 'private' );?> value='publish'><?php _e('Published') ?></option>
    146147<?php if ( 'future' == $post->post_status ) : ?>
     
    151152<option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Draft') ?></option>
    152153</select>
    153 
     154<br />
    154155<a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e('OK'); ?></a>
    155156<a href="#post_status" class="cancel-post-status hide-if-no-js"><?php _e('Cancel'); ?></a>
     
    172173<div id="minor-publishing-actions">
    173174
    174 <?php if ( 'publish' != $post->post_status && 'private' != $post->post_status )  { ?>
     175<?php if ( 'publish' != $post->post_status && 'private' != $post->post_status && 'future' != $post->post_status && 'pending' != $post->post_status )  { ?>
    175176<input type="submit" name="save" id="save-post" value="<?php echo attribute_escape( __('Save Draft') ); ?>" tabindex="4" class="button button-highlighted" />
     177<?php } elseif ( 'pending' == $post->post_status && $can_publish ) { ?>
     178<input type="submit" name="save" id="save-post" value="<?php echo attribute_escape( __('Save Pending') ); ?>" tabindex="4" class="button button-highlighted" />
    176179<?php } ?>
    177180
     
    198201if ( !in_array( $post->post_status, array('publish', 'future') ) || 0 == $post->ID ) { ?>
    199202<?php if ( current_user_can('publish_posts') ) : ?>
    200     <input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" />
     203    <?php if ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : ?>
     204        <input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php _e('Schedule') ?>" />
     205    <?php else : ?>
     206        <input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" />
     207    <?php endif; ?>
    201208<?php else : ?>
    202209    <input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php _e('Submit for Review') ?>" />
  • trunk/wp-admin/includes/template.php

    r9399 r9402  
    22372237    $ss = ($edit) ? mysql2date( 's', $post_date ) : gmdate( 's', $time_adj );
    22382238
     2239    $cur_jj = gmdate( 'd', $time_adj );
     2240    $cur_mm = gmdate( 'm', $time_adj );
     2241    $cur_aa = gmdate( 'Y', $time_adj );
     2242    $cur_hh = gmdate( 'H', $time_adj );
     2243    $cur_mn = gmdate( 'i', $time_adj );
     2244
    22392245    $month = "<select " . ( $multi ? '' : 'id="mm" ' ) . "name=\"mm\"$tab_index_attribute>\n";
    22402246    for ( $i = 1; $i < 13; $i = $i +1 ) {
     
    22552261
    22562262    echo "\n\n";
    2257     foreach ( array('mm', 'jj', 'aa', 'hh', 'mn') as $timeunit )
     2263    foreach ( array('mm', 'jj', 'aa', 'hh', 'mn') as $timeunit ) {
    22582264        echo '<input type="hidden" id="hidden_' . $timeunit . '" name="hidden_' . $timeunit . '" value="' . $$timeunit . '" />' . "\n";
     2265        $cur_timeunit = 'cur_' . $timeunit;
     2266        echo '<input type="hidden" id="'. $cur_timeunit . '" name="'. $cur_timeunit . '" value="' . $$cur_timeunit . '" />' . "\n";
     2267    }
    22592268?>
    22602269
  • trunk/wp-admin/js/post.js

    r9241 r9402  
    176176        $('.edit-timestamp').show();
    177177
     178        var attemptedDate = new Date( $('#aa').val(), $('#mm').val() -1, $('#jj').val(), $('#hh').val(), $('#mn').val() );
     179        var currentDate = new Date( $('#cur_aa').val(), $('#cur_mm').val() -1, $('#cur_jj').val(), $('#cur_hh').val(), $('#cur_mn').val() );
     180        if ( attemptedDate > currentDate ) {
     181            $('#publish').val( postL10n.schedule );
     182        } else if ( $('#original_post_status').val() != 'publish' ) {
     183            $('#publish').val( postL10n.publish );
     184        } else {
     185            $('#publish').val( postL10n.update );
     186        }
     187
    178188        return false;
    179189    });
     
    182192        $('#timestampdiv').slideUp("normal");
    183193        $('.edit-timestamp').show();
     194        var attemptedDate = new Date( $('#aa').val(), $('#mm').val() -1, $('#jj').val(), $('#hh').val(), $('#mn').val() );
     195        var currentDate = new Date( $('#cur_aa').val(), $('#cur_mm').val() -1, $('#cur_jj').val(), $('#cur_hh').val(), $('#cur_mn').val() );
     196        if ( attemptedDate > currentDate ) {
     197            var publishOn = postL10n.publishOnFuture;
     198            $('#publish').val( postL10n.schedule );
     199        } else if ( $('#original_post_status').val() != 'publish' ) {
     200            var publishOn = postL10n.publishOn;
     201            $('#publish').val( postL10n.publish );
     202        } else {
     203            var publishOn = postL10n.publishOnPast;
     204            $('#publish').val( postL10n.update );
     205        }
    184206        $('#timestamp').html(
     207            publishOn + '<br />' +
    185208            $( '#mm option[value=' + $('#mm').val() + ']' ).text() + ' ' +
    186209            $('#jj').val() + ', ' +
     
    217240        $('#post-status-display').html($('#post_status :selected').text());
    218241        $('.edit-post-status').show();
    219 
     242        if ( $('#post_status :selected').val() == 'pending' ) {
     243            $('#save-post').val( postL10n.savePending );
     244        } else {
     245            $('#save-post').val( postL10n.saveDraft );
     246        }
    220247        return false;
    221248    });
     
    226253        $('#post-status-display').html($('#post_status :selected').text());
    227254        $('.edit-post-status').show();
     255        if ( $('#post_status :selected').val() == 'pending' ) {
     256            $('#save-post').val( postL10n.savePending );
     257        } else {
     258            $('#save-post').val( postL10n.saveDraft );
     259        }
    228260
    229261        return false;
  • trunk/wp-admin/wp-admin.css

    r9394 r9402  
    211211    float: left;
    212212    border-right: 1px solid #ddd;
     213    min-height: 70px;
    213214}
    214215
    215216#side-sortables #misc-publishing-actions {
    216217    max-width: 170px;
     218}
     219
     220#side-sortable #minor-publishing-actions {
     221    max-width: 108px;
    217222}
    218223
     
    227232
    228233#minor-publishing-actions {
    229     padding: 6px 6px 0 0;
     234    padding: 4px 4px 4px 0;
    230235    float: right;
    231236    text-align: right;
  • trunk/wp-includes/script-loader.php

    r9396 r9402  
    184184            'cancel' => __('Cancel'),
    185185            'edit' => __('Edit'),
     186            'publishOn' => __('Publish on:'),
     187            'publishOnFuture' =>  __('Schedule for:'),
     188            'publishOnPast' => __('Published on:'),
    186189            'showcomm' => __('Show more comments'),
    187             'endcomm' => __('No more comments found.')
     190            'endcomm' => __('No more comments found.'),
     191            'publish' => __('Publish'),
     192            'schedule' => __('Schedule'),
     193            'update' => __('Update Post'),
     194            'savePending' => __('Save Pending'),
     195            'saveDraft' => __('Save Draft')
    188196        ) );
    189197        $scripts->add( 'page', '/wp-admin/js/page.js', array('jquery', 'slug', 'postbox', 'settings-box'), '20080925' );
     
    309317    $rtl_styles = array( 'global', 'colors', 'dashboard', 'ie', 'install', 'login', 'media', 'theme-editor', 'upload', 'widgets', 'press-this', 'press-this-ie' );
    310318
    311     $styles->add( 'wp-admin', '/wp-admin/wp-admin.css', array(), '20081029' );
     319    $styles->add( 'wp-admin', '/wp-admin/wp-admin.css', array(), '20081029b' );
    312320    $styles->add_data( 'wp-admin', 'rtl', '/wp-admin/rtl.css' );
    313321
Note: See TracChangeset for help on using the changeset viewer.