From 3a0dc54a268cecf38c04b1b2feecff805e94d5d1 Mon Sep 17 00:00:00 2001 From: markjaquith Date: Wed, 29 Oct 2008 19:22:56 +0000 Subject: [PATCH] More work on Publish postbox. Post status tweaks, post date tweaks. git-svn-id: http://svn.automattic.com/wordpress/trunk@9402 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/edit-form-advanced.php | 23 ++++++++++++++-------- wp-admin/includes/template.php | 11 ++++++++++- wp-admin/js/post.js | 34 ++++++++++++++++++++++++++++++++- wp-admin/wp-admin.css | 7 ++++++- wp-includes/script-loader.php | 12 ++++++++++-- 5 files changed, 74 insertions(+), 13 deletions(-) diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php index 2fa888c9bc..c784ad9cdd 100644 --- a/wp-admin/edit-form-advanced.php +++ b/wp-admin/edit-form-advanced.php @@ -95,6 +95,8 @@ if ( 0 != $post->ID ) { $stamp = __('Published on:
%1$s'); } else if ( '0000-00-00 00:00:00' == $post->post_date_gmt ) { // draft, 1 or more saves, no date specified $stamp = __('Publish immediately'); + } else if ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // draft, 1 or more saves, future date specified + $stamp = __('Schedule for:
%1$s'); } else { // draft, 1 or more saves, date specified $stamp = __('Publish on:
%1$s'); } @@ -106,7 +108,8 @@ if ( 0 != $post->ID ) { ?>
- + +  
@@ -132,16 +135,14 @@ switch ( $post->post_status ) { } ?> -post_status || 'private' == $post->post_status ) { ?> +post_status || 'private' == $post->post_status || $can_publish ) { ?>
-
- +
@@ -171,8 +172,10 @@ if ( $can_publish OR ( $post->post_status == 'publish' AND current_user_can('edi
-post_status && 'private' != $post->post_status ) { ?> +post_status && 'private' != $post->post_status && 'future' != $post->post_status && 'pending' != $post->post_status ) { ?> +post_status && $can_publish ) { ?> + post_status ) { ?> @@ -197,7 +200,11 @@ if ( ( 'edit' == $action ) && current_user_can('delete_post', $post->ID) ) { ?> post_status, array('publish', 'future') ) || 0 == $post->ID ) { ?> - + post_date_gmt . ' +0000' ) ) : ?> + + + + diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index ec35a7341d..2642c0dc8b 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -2236,6 +2236,12 @@ function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) { $mn = ($edit) ? mysql2date( 'i', $post_date ) : gmdate( 'i', $time_adj ); $ss = ($edit) ? mysql2date( 's', $post_date ) : gmdate( 's', $time_adj ); + $cur_jj = gmdate( 'd', $time_adj ); + $cur_mm = gmdate( 'm', $time_adj ); + $cur_aa = gmdate( 'Y', $time_adj ); + $cur_hh = gmdate( 'H', $time_adj ); + $cur_mn = gmdate( 'i', $time_adj ); + $month = "' . "\n"; + } ?> diff --git a/wp-admin/js/post.js b/wp-admin/js/post.js index 212448330c..e3e6d354cf 100644 --- a/wp-admin/js/post.js +++ b/wp-admin/js/post.js @@ -175,13 +175,36 @@ jQuery(document).ready( function($) { $('#timestamp').html(stamp); $('.edit-timestamp').show(); + var attemptedDate = new Date( $('#aa').val(), $('#mm').val() -1, $('#jj').val(), $('#hh').val(), $('#mn').val() ); + var currentDate = new Date( $('#cur_aa').val(), $('#cur_mm').val() -1, $('#cur_jj').val(), $('#cur_hh').val(), $('#cur_mn').val() ); + if ( attemptedDate > currentDate ) { + $('#publish').val( postL10n.schedule ); + } else if ( $('#original_post_status').val() != 'publish' ) { + $('#publish').val( postL10n.publish ); + } else { + $('#publish').val( postL10n.update ); + } + return false; }); $('.save-timestamp').click(function () { // crazyhorse - multiple ok cancels $('#timestampdiv').slideUp("normal"); $('.edit-timestamp').show(); + var attemptedDate = new Date( $('#aa').val(), $('#mm').val() -1, $('#jj').val(), $('#hh').val(), $('#mn').val() ); + var currentDate = new Date( $('#cur_aa').val(), $('#cur_mm').val() -1, $('#cur_jj').val(), $('#cur_hh').val(), $('#cur_mn').val() ); + if ( attemptedDate > currentDate ) { + var publishOn = postL10n.publishOnFuture; + $('#publish').val( postL10n.schedule ); + } else if ( $('#original_post_status').val() != 'publish' ) { + var publishOn = postL10n.publishOn; + $('#publish').val( postL10n.publish ); + } else { + var publishOn = postL10n.publishOnPast; + $('#publish').val( postL10n.update ); + } $('#timestamp').html( + publishOn + '
' + $( '#mm option[value=' + $('#mm').val() + ']' ).text() + ' ' + $('#jj').val() + ', ' + $('#aa').val() + ' @ ' + @@ -216,7 +239,11 @@ jQuery(document).ready( function($) { $('#post-status-select').slideUp("normal"); $('#post-status-display').html($('#post_status :selected').text()); $('.edit-post-status').show(); - + if ( $('#post_status :selected').val() == 'pending' ) { + $('#save-post').val( postL10n.savePending ); + } else { + $('#save-post').val( postL10n.saveDraft ); + } return false; }); @@ -225,6 +252,11 @@ jQuery(document).ready( function($) { $('#post_status').val($('#hidden_post_status').val()); $('#post-status-display').html($('#post_status :selected').text()); $('.edit-post-status').show(); + if ( $('#post_status :selected').val() == 'pending' ) { + $('#save-post').val( postL10n.savePending ); + } else { + $('#save-post').val( postL10n.saveDraft ); + } return false; }); diff --git a/wp-admin/wp-admin.css b/wp-admin/wp-admin.css index 56820c0c4b..03fd80d337 100644 --- a/wp-admin/wp-admin.css +++ b/wp-admin/wp-admin.css @@ -210,12 +210,17 @@ table#availablethemes td.bottom { #misc-publishing-actions { float: left; border-right: 1px solid #ddd; + min-height: 70px; } #side-sortables #misc-publishing-actions { max-width: 170px; } +#side-sortable #minor-publishing-actions { + max-width: 108px; +} + .misc-pub-section { padding: 6px; border-bottom: 1px solid #ddd; @@ -226,7 +231,7 @@ table#availablethemes td.bottom { } #minor-publishing-actions { - padding: 6px 6px 0 0; + padding: 4px 4px 4px 0; float: right; text-align: right; } diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index 4c22708301..c66cc043c8 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -183,8 +183,16 @@ function wp_default_scripts( &$scripts ) { 'separate' => __('Separate tags with commas'), 'cancel' => __('Cancel'), 'edit' => __('Edit'), + 'publishOn' => __('Publish on:'), + 'publishOnFuture' => __('Schedule for:'), + 'publishOnPast' => __('Published on:'), 'showcomm' => __('Show more comments'), - 'endcomm' => __('No more comments found.') + 'endcomm' => __('No more comments found.'), + 'publish' => __('Publish'), + 'schedule' => __('Schedule'), + 'update' => __('Update Post'), + 'savePending' => __('Save Pending'), + 'saveDraft' => __('Save Draft') ) ); $scripts->add( 'page', '/wp-admin/js/page.js', array('jquery', 'slug', 'postbox', 'settings-box'), '20080925' ); $scripts->localize( 'page', 'postL10n', array( @@ -308,7 +316,7 @@ function wp_default_styles( &$styles ) { $rtl_styles = array( 'global', 'colors', 'dashboard', 'ie', 'install', 'login', 'media', 'theme-editor', 'upload', 'widgets', 'press-this', 'press-this-ie' ); - $styles->add( 'wp-admin', '/wp-admin/wp-admin.css', array(), '20081029' ); + $styles->add( 'wp-admin', '/wp-admin/wp-admin.css', array(), '20081029b' ); $styles->add_data( 'wp-admin', 'rtl', '/wp-admin/rtl.css' ); $styles->add( 'ie', '/wp-admin/css/ie.css' );