diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php
index b2bd6fc85c..bc902c5c95 100644
--- a/wp-admin/edit-form-advanced.php
+++ b/wp-admin/edit-form-advanced.php
@@ -92,8 +92,8 @@ function post_submit_meta_box($post) {
-post_status && 'private' != $post->post_status && 'future' != $post->post_status && 'pending' != $post->post_status ) { ?>
-
+post_status && 'future' != $post->post_status && 'pending' != $post->post_status ) { ?>
+
post_status ) { ?>style="display:none" type="submit" name="save" id="save-post" value="" tabindex="4" class="button button-highlighted" />
post_status && $can_publish ) { ?>
@@ -113,8 +113,10 @@ function post_submit_meta_box($post) {
post_status ) {
- case 'publish':
case 'private':
+ _e('Privately Published');
+ break;
+ case 'publish':
_e('Published');
break;
case 'future':
@@ -130,13 +132,15 @@ switch ( $post->post_status ) {
?>
post_status || 'private' == $post->post_status || $can_publish ) { ?>
-
+
post_status ) { ?>style="display:none;" class="edit-post-status hide-if-no-js" tabindex='4'>
+
+
-
-ID), true); ?> tabindex="4" />
-
+if ( !empty( $post->post_password ) ) {
+ $visibility = 'password';
+ $visibility_trans = __('Password protected');
+} elseif ( 'private' == $post->post_status ) {
+ $visibility = 'private';
+ $visibility_trans = __('Private');
+} elseif ( is_sticky( $post->ID ) ) {
+ $visibility = 'public';
+ $visibility_trans = __('Public, sticky');
+ $sticky = 'sticky';
+} else {
+ $visibility = 'public';
+ $visibility_trans = __('Public');
+}
+
+?>
+
+
+
+
ID ) {
if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date
$stamp = __('Scheduled for:
%1$s');
- } else if ( 'publish' == $post->post_status ) { // already published
+ } else if ( 'publish' == $post->post_status || 'private' == $post->post_status ) { // already published
$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');
@@ -202,17 +240,21 @@ if ( ( 'edit' == $action ) && current_user_can('delete_post', $post->ID) ) { ?>
post_status, array('publish', 'future') ) || 0 == $post->ID ) { ?>
+if ( !in_array( $post->post_status, array('publish', 'future', 'private') ) || 0 == $post->ID ) { ?>
post_date_gmt) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : ?>
+
+
+
+
@@ -300,7 +342,7 @@ function post_password_meta_box($post) {
get_error_message() );
+ switch ( $post_data['visibility'] ) {
+ case 'public' :
+ unset( $post_data['post_password'] );
+ break;
+ case 'password' :
+ unset( $post_data['sticky'] );
+ break;
+ case 'private' :
+ $post_data['post_status'] = 'private';
+ $post_data['post_password'] = '';
+ unset( $post_data['sticky'] );
+ break;
+ }
+
// Meta Stuff
if ( isset($post_data['meta']) && $post_data['meta'] ) {
foreach ( $post_data['meta'] as $key => $value )
@@ -442,6 +456,20 @@ function wp_write_post() {
if ( is_wp_error($translated) )
return $translated;
+ switch ( $_POST['visibility'] ) {
+ case 'public' :
+ $_POST['post_password'] = '';
+ break;
+ case 'password' :
+ unset( $_POST['sticky'] );
+ break;
+ case 'private' :
+ $_POST['post_status'] = 'private';
+ $_POST['post_password'] = '';
+ unset( $_POST['sticky'] );
+ break;
+ }
+
// Create the post.
$post_ID = wp_insert_post( $_POST );
if ( is_wp_error( $post_ID ) )
diff --git a/wp-admin/js/post.js b/wp-admin/js/post.js
index 7749054664..cbd97b215d 100644
--- a/wp-admin/js/post.js
+++ b/wp-admin/js/post.js
@@ -192,6 +192,126 @@ jQuery(document).ready( function($) {
} );
jQuery('.categorychecklist .popular-category :checkbox').change( syncChecks ).filter( ':checked' ).change();
var stamp = $('#timestamp').html();
+ var visibility = $('#post-visibility-display').html();
+ var sticky = '';
+
+ function updateVisibility() {
+ if ( $('#post-visibility-select input:radio:checked').val() != 'public' ) {
+ $('#sticky').attr('checked', false);
+ $('#sticky-span').hide();
+ } else {
+ $('#sticky-span').show();
+ }
+ if ( $('#post-visibility-select input:radio:checked').val() != 'password' ) {
+ $('#password-span').hide();
+ } else {
+ $('#password-span').show();
+ }
+ }
+
+ function updateText() {
+ var attemptedDate = new Date( $('#aa').val(), $('#mm').val() -1, $('#jj').val(), $('#hh').val(), $('#mn').val());
+ var originalDate = new Date( $('#hidden_aa').val(), $('#hidden_mm').val() -1, $('#hidden_jj').val(), $('#hidden_hh').val(), $('#hidden_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 );
+ }
+ if ( originalDate.toUTCString() == attemptedDate.toUTCString() ) { //hack
+ $('#timestamp').html(stamp);
+ } else {
+ $('#timestamp').html(
+ publishOn + '
' +
+ $( '#mm option[value=' + $('#mm').val() + ']' ).text() + ' ' +
+ $('#jj').val() + ', ' +
+ $('#aa').val() + ' @ ' +
+ $('#hh').val() + ':' +
+ $('#mn').val() + ' '
+ );
+ }
+
+ if ( $('#post-visibility-select input:radio:checked').val() == 'private' ) {
+ $('#publish').val( postL10n.update );
+ if ( $('#post_status option[value=publish]').length == 0 ) {
+ $('#post_status').append('
');
+ }
+ $('#post_status option[value=publish]').html( postL10n.privatelyPublished );
+ $('#post_status option[value=publish]').attr('selected', true);
+ $('.edit-post-status').hide();
+ } else {
+ if ( $('#original_post_status').val() == 'future' || $('#original_post_status').val() == 'draft' ) {
+ if ( $('#post_status option[value=publish]').length != 0 ) {
+ $('#post_status option[value=publish]').remove();
+ $('#post_status').val($('#hidden_post_status').val());
+ }
+ } else {
+ $('#post_status option[value=publish]').html( postL10n.published );
+ }
+ $('.edit-post-status').show();
+ }
+ $('#post-status-display').html($('#post_status :selected').text());
+ if ( $('#post_status :selected').val() == 'private' || $('#post_status :selected').val() == 'publish' ) {
+ $('#save-post').hide();
+ } else {
+ $('#save-post').show();
+ if ( $('#post_status :selected').val() == 'pending' ) {
+ $('#save-post').show().val( postL10n.savePending );
+ } else {
+ $('#save-post').show().val( postL10n.saveDraft );
+ }
+ }
+ }
+
+ $('.edit-visibility').click(function () {
+ if ($('#post-visibility-select').is(":hidden")) {
+ updateVisibility();
+ $('#post-visibility-select').slideDown("normal");
+ $('.edit-visibility').hide();
+ }
+ return false;
+ });
+
+ $('.cancel-post-visibility').click(function () {
+ $('#post-visibility-select').slideUp("normal");
+ $('#visibility-radio-' + $('#hidden-post-visibility').val()).attr('checked', true);
+ $('#post_password').val($('#hidden_post_password').val());
+ $('#sticky').attr('checked', $('#hidden-post-sticky').attr('checked'));
+ $('#post-visibility-display').html(visibility);
+ $('.edit-visibility').show();
+ updateText();
+ return false;
+ });
+
+ $('.save-post-visibility').click(function () { // crazyhorse - multiple ok cancels
+ $('#post-visibility-select').slideUp("normal");
+ $('.edit-visibility').show();
+ updateText();
+ if ( $('#post-visibility-select input:radio:checked').val() != 'public' ) {
+ $('#sticky').attr('checked', false);
+ }
+
+ if ( true == $('#sticky').attr('checked') ) {
+ sticky = 'Sticky';
+ } else {
+ sticky = '';
+ }
+
+ $('#post-visibility-display').html(
+ postL10n[$('#post-visibility-select input:radio:checked').val() + sticky]
+ );
+
+ return false;
+ });
+
+ $('#post-visibility-select input:radio').change(function() {
+ updateVisibility();
+ });
$('.edit-timestamp').click(function () {
if ($('#timestampdiv').is(":hidden")) {
@@ -209,45 +329,15 @@ jQuery(document).ready( function($) {
$('#aa').val($('#hidden_aa').val());
$('#hh').val($('#hidden_hh').val());
$('#mn').val($('#hidden_mn').val());
- $('#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 );
- }
-
+ updateText();
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() + ' @ ' +
- $('#hh').val() + ':' +
- $('#mn').val() + ' '
- );
+ updateText();
return false;
});
@@ -263,27 +353,16 @@ jQuery(document).ready( function($) {
$('.save-post-status').click(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 );
- }
+ updateText();
return false;
});
$('.cancel-post-status').click(function() {
$('#post-status-select').slideUp("normal");
$('#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 );
- }
-
+ updateText();
return false;
});
diff --git a/wp-admin/wp-admin.css b/wp-admin/wp-admin.css
index 224bbae3d0..2502effbef 100644
--- a/wp-admin/wp-admin.css
+++ b/wp-admin/wp-admin.css
@@ -303,6 +303,10 @@ form p.submit .cancel:hover {
border-right: 0;
}
+#sticky-span {
+ margin-left: 18px;
+}
+
.side-info {
margin: 0;
padding: 4px;
diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php
index ce85bd1eea..15d141ad61 100644
--- a/wp-includes/script-loader.php
+++ b/wp-includes/script-loader.php
@@ -191,7 +191,14 @@ function wp_default_scripts( &$scripts ) {
'schedule' => __('Schedule'),
'update' => __('Update Post'),
'savePending' => __('Save as Pending'),
- 'saveDraft' => __('Save Draft')
+ 'saveDraft' => __('Save Draft'),
+ 'private' => __('Private'),
+ 'public' => __('Public'),
+ 'publicSticky' => __('Public, sticky'),
+ 'password' => __('Password protected'),
+ 'privatelyPublished' => __('Privately Published'),
+ 'published' => __('Published')
+
) );
$scripts->add( 'page', '/wp-admin/js/page.js', array('jquery', 'slug', 'wp-lists', 'postbox'), '20081107' );
$scripts->localize( 'page', 'postL10n', array(
@@ -290,7 +297,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', 'plugin-install', 'farbtastic' );
- $styles->add( 'wp-admin', '/wp-admin/wp-admin.css', array(), '20081110' );
+ $styles->add( 'wp-admin', '/wp-admin/wp-admin.css', array(), '20081112' );
$styles->add_data( 'wp-admin', 'rtl', '/wp-admin/rtl.css' );
$styles->add( 'ie', '/wp-admin/css/ie.css' );