Publish postbox and post status select updates.

git-svn-id: http://svn.automattic.com/wordpress/trunk@8889 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2008-09-14 12:58:00 +00:00
parent 059492b3be
commit 203530fe88
11 changed files with 294 additions and 254 deletions

View File

@ -780,10 +780,6 @@ table.diff .diff-addedline ins {
color: #CFEBF6;
}
.submitbox .submitdelete {
color: #fff;
}
#edit-settings-wrap,
#show-settings {
background-color: #14568A;

View File

@ -769,10 +769,6 @@ table.diff .diff-addedline ins {
border-top-color: #e4f2fd;
}
.submitbox .submitdelete {
color: #fff;
}
#edit-settings-wrap,
#show-settings {
background-color: #E4F2FD;

View File

@ -63,12 +63,14 @@ if ( 0 == $post_ID ) {
function post_submit_meta_box($post) {
global $action;
$can_publish = current_user_can('publish_posts');
?>
<div class="submitbox" id="submitpost">
<div class="inside-submitbox">
<p><label for='post_status'><?php _e('This post is') ?></label>
<div class="insidebox"><label for="post_status"><?php _e('This post is') ?></label>
<strong><span id="post-status-display">
<?php
switch ( $post->post_status ) {
@ -88,17 +90,17 @@ switch ( $post->post_status ) {
}
?>
</span></strong>
<a href="#edit_post_status" class="edit-post-status hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a>
</p>
<?php if ( 'publish' == $post->post_status || 'private' == $post->post_status ) { ?>
<a href="#post_status" class="edit-post-status hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a>
<p id='post-status-select' class="hide-if-js">
<div id="post-status-select" class="hide-if-js">
<input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo $post->post_status; ?>" />
<?php _e('Change post status'); ?><br />
<select name='post_status' id='post_status' tabindex='4'>
<?php
// 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)
if ( current_user_can('publish_posts') OR ( $post->post_status == 'publish' AND current_user_can('edit_post', $post->ID) ) ) : ?>
<?php if ( 'publish' == $post->post_status || 'private' == $post->post_status ) { ?>
if ( $can_publish OR ( $post->post_status == 'publish' AND current_user_can('edit_post', $post->ID) ) ) : ?>
<option<?php selected( $post->post_status, 'publish' ); selected( $post->post_status, 'private' );?> value='publish'><?php _e('Published') ?></option>
<?php } ?>
<?php if ( 'future' == $post->post_status ) : ?>
<option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Scheduled') ?></option>
<?php endif; ?>
@ -106,23 +108,40 @@ if ( current_user_can('publish_posts') OR ( $post->post_status == 'publish' AND
<option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e('Pending Review') ?></option>
<option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Unpublished') ?></option>
</select>
</p>
<?php if ( current_user_can( 'publish_posts' ) ) : ?>
<?php if ( current_user_can( 'edit_others_posts' ) ) : ?>
<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>
<?php endif; ?>
<?php endif; ?>
<a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e('OK'); ?></a>
<a href="#post_status" class="cancel-post-status hide-if-no-js"><?php _e('Cancel'); ?></a>
</div>
</div>
<?php } else { ?>
</div>
<?php if ( $can_publish && 'pending' != $post->post_status ) { ?>
<div class="insidebox"><input name="pending" type="submit" class="button" id="pending" tabindex="6" accesskey="r" value="<?php _e('Submit for Review') ?>" /></div>
<?php } ?>
<?php } ?>
<?php if ( $can_publish && current_user_can( 'edit_others_posts' ) ) { ?>
<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>
<?php } ?>
<?php
if ( ( 'edit' == $action ) && current_user_can('delete_post', $post->ID) ) { ?>
<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>
<?php } ?>
<?php
if ( 0 != $post->ID ) {
if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date
$stamp = __('Scheduled for:<br />%1$s at %2$s');
$stamp = __('Scheduled for: %1$s at %2$s');
} else if ( 'publish' == $post->post_status ) { // already published
$stamp = __('Published on:<br />%1$s at %2$s');
$stamp = __('Published on: %1$s at %2$s');
} else if ( '0000-00-00 00:00:00' == $post->post_date ) { // draft, 1 or more saves, no date specified
$stamp = __('Publish immediately');
} else { // draft, 1 or more saves, date specified
$stamp = __('Publish on:<br />%1$s at %2$s');
$stamp = __('Publish on: %1$s at %2$s');
}
$date = mysql2date(get_option('date_format'), $post->post_date);
$time = mysql2date(get_option('time_format'), $post->post_date);
@ -132,33 +151,32 @@ if ( 0 != $post->ID ) {
$time = mysql2date(get_option('time_format'), current_time('mysql'));
}
?>
<?php if ( current_user_can( 'publish_posts' ) ) : // Contributors don't get to choose the date of publish ?>
<p class="curtime"><?php printf($stamp, $date, $time); ?>
&nbsp;<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a></p>
<?php if ( $can_publish ) : // Contributors don't get to choose the date of publish ?>
<div class="insidebox curtime"><span id="timestamp"><?php printf($stamp, $date, $time); ?></span>
&nbsp;<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a>
<div id='timestampdiv' class='hide-if-js'><?php touch_time(($action == 'edit'),1,4); ?></div>
<div id="timestampdiv" class="hide-if-js"><?php touch_time(($action == 'edit'),1,4); ?></div></div>
<?php endif; ?>
</div>
<p class="submit">
<?php do_action('post_submitbox_start'); ?>
<input type="submit" name="save" id="save-post" value="<?php _e('Save Draft'); ?>" tabindex="4" class="button button-highlighted" />
<?php if ( 'publish' == $post->post_status || 'private' == $post->post_status )
$savebtn = attribute_escape( __('Save') );
else
$savebtn = attribute_escape( __('Save Draft') );
?>
<input type="submit" name="save" id="save-post" value="<?php echo $savebtn; ?>" tabindex="4" class="button button-highlighted" />
<?php if ( 'publish' == $post->post_status ) { ?>
<a class="preview button" href="<?php echo clean_url(get_permalink($post->ID)); ?>" target="_blank" tabindex="4"><?php _e('View this Post'); ?></a>
<?php } else { ?>
<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>
<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>
<?php } ?>
<?php
if ( ( 'edit' == $action) && current_user_can('delete_post', $post->ID) )
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>";
?>
<br class="clear" />
<?php
if ( !in_array( $post->post_status, array('publish', 'future') ) || 0 == $post->ID ) {
?>
if ( !in_array( $post->post_status, array('publish', 'future') ) || 0 == $post->ID ) { ?>
<?php if ( current_user_can('publish_posts') ) : ?>
<input name="publish" type="submit" class="button" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" />
<?php else : ?>
@ -166,21 +184,10 @@ if ( !in_array( $post->post_status, array('publish', 'future') ) || 0 == $post->
<?php endif; ?>
<?php } ?>
<!-- moved under the editor
<?php if ( 0 != $post->ID ): ?>
<?php if ( $last_id = get_post_meta($post->ID, '_edit_last', true) ) {
$last_user = get_userdata($last_id);
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));
} else {
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));
}
?>
<br class="clear" />
<?php endif; ?>
-->
</p>
<div class="clear"></div>
</div>
<?php
}
add_meta_box('submitdiv', __('Publish'), 'post_submit_meta_box', 'post', 'side', 'core');
@ -273,7 +280,7 @@ function post_excerpt_meta_box($post) {
add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', 'post', 'normal', 'core');
function post_trackback_meta_box($post) {
$form_trackback = '<input type="text" name="trackback_url" style="width: 415px" id="trackback" tabindex="7" value="'. attribute_escape( str_replace("\n", ' ', $post->to_ping) ) .'" />';
$form_trackback = '<input type="text" name="trackback_url" id="trackback_url" tabindex="7" value="'. attribute_escape( str_replace("\n", ' ', $post->to_ping) ) .'" />';
if ('' != $post->pinged) {
$pings = '<p>'. __('Already pinged:') . '</p><ul>';
$already_pinged = explode("\n", trim($post->pinged));
@ -287,7 +294,7 @@ function post_trackback_meta_box($post) {
<p class="meta-options">
<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>
</p>
<p><label for="trackback"><?php _e('Send trackbacks to:'); ?></label> <?php echo $form_trackback; ?><br /> (<?php _e('Separate multiple URLs with spaces'); ?>)</p>
<p><label for="trackback_url"><?php _e('Send trackbacks to:'); ?></label> <?php echo $form_trackback; ?><br /> (<?php _e('Separate multiple URLs with spaces'); ?>)</p>
<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>
<?php
if ( ! empty($pings) )
@ -439,12 +446,6 @@ if ( 0 == $post_ID)
else
wp_nonce_field('update-post_' . $post_ID);
$form_pingback = '<input type="hidden" name="post_pingback" value="' . (int) get_option('default_pingback_flag') . '" id="post_pingback" />';
$form_prevstatus = '<input type="hidden" name="prev_status" value="' . attribute_escape( $post->post_status ) . '" />';
$saveasdraft = '<input name="save" type="submit" id="save" class="button" tabindex="3" value="' . attribute_escape( __('Save and Continue Editing') ) . '" />';
?>
<input type="hidden" id="user-id" name="user_ID" value="<?php echo (int) $user_ID ?>" />
@ -541,9 +542,6 @@ endif; ?>
<?php
echo $form_pingback;
echo $form_prevstatus;
do_meta_boxes('post', 'normal', $post);
do_action('edit_form_advanced');

View File

@ -41,7 +41,7 @@ function xfn_check($class, $value = '', $deprecated = '') {
<div class="submitbox" id="submitlink">
<div class="inside-submitbox">
<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>
<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>
</div>
<p class="submit">
@ -52,11 +52,12 @@ function xfn_check($class, $value = '', $deprecated = '') {
<?php } ?>
<?php
if ( ( 'edit' == $action) && current_user_can('manage_links') )
if ( 'edit' == $_GET['action'] && current_user_can('manage_links') )
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>";
?>
</p>
<?php do_action('submitlink_box'); ?>
<div class="clear"></div>
</div>
<?php
}

View File

@ -57,12 +57,14 @@ $user_ID = (int) $user_ID;
<?php
function page_submit_meta_box($post) {
global $action;
$can_publish = current_user_can('publish_pages');
?>
<div class="submitbox" id="submitpage">
<div class="inside-submitbox">
<p><label for='post_status'><?php _e('This post is') ?></label>
<div class="insidebox"><label for='post_status'><?php _e('This page is') ?></label>
<strong><span id="post-status-display">
<?php
switch ( $post->post_status ) {
@ -82,17 +84,17 @@ switch ( $post->post_status ) {
}
?>
</span></strong>
<?php if ( 'publish' == $post->post_status || 'private' == $post->post_status ) { ?>
<a href="#edit_post_status" class="edit-post-status hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a>
</p>
<p id='post-status-select' class="hide-if-js">
<div id="post-status-select" class="hide-if-js">
<input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo $post->post_status; ?>" />
<?php _e('Change page status'); ?><br />
<select name='post_status' id='post_status' tabindex='4'>
<?php
// 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)
if ( current_user_can('publish_pages') OR ( $post->post_status == 'publish' AND current_user_can('edit_page', $post->ID) ) ) : ?>
<?php if ( 'publish' == $post->post_status || 'private' == $post->post_status ) { ?>
if ( $can_publish OR ( $post->post_status == 'publish' AND current_user_can('edit_page', $post->ID) ) ) : ?>
<option<?php selected( $post->post_status, 'publish' ); selected( $post->post_status, 'private' );?> value='publish'><?php _e('Published') ?></option>
<?php } ?>
<?php if ( 'future' == $post->post_status ) : ?>
<option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Scheduled') ?></option>
<?php endif; ?>
@ -100,18 +102,34 @@ if ( current_user_can('publish_pages') OR ( $post->post_status == 'publish' AND
<option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e('Pending Review') ?></option>
<option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Unpublished') ?></option>
</select>
</p>
<a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e('OK'); ?></a>
<a href="#post_status" class="cancel-post-status hide-if-no-js"><?php _e('Cancel'); ?></a>
</div>
</div>
<?php } else { ?>
</div>
<?php if ( $can_publish && 'pending' != $post->post_status ) { ?>
<div class="insidebox"><input name="pending" type="submit" class="button" id="pending" tabindex="6" accesskey="r" value="<?php _e('Submit for Review') ?>" /></div>
<?php } ?>
<?php } ?>
<?php if ( ('edit' == $action) && current_user_can('delete_page', $post->ID) ) { ?>
<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>
<?php } ?>
<?php
if ( 0 != $post->ID ) {
if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date
$stamp = __('Scheduled for:<br />%1$s at %2$s');
$stamp = __('Scheduled for: %1$s at %2$s');
} else if ( 'publish' == $post->post_status ) { // already published
$stamp = __('Published on:<br />%1$s at %2$s');
$stamp = __('Published on: %1$s at %2$s');
} else if ( '0000-00-00 00:00:00' == $post->post_date ) { // draft, 1 or more saves, no date specified
$stamp = __('Publish immediately');
} else { // draft, 1 or more saves, date specified
$stamp = __('Publish on:<br />%1$s at %2$s');
$stamp = __('Publish on: %1$s at %2$s');
}
$date = mysql2date(get_option('date_format'), $post->post_date);
$time = mysql2date(get_option('time_format'), $post->post_date);
@ -121,56 +139,43 @@ if ( 0 != $post->ID ) {
$time = mysql2date(get_option('time_format'), current_time('mysql'));
}
?>
<?php if ( current_user_can( 'publish_pages' ) ) : // Contributors don't get to choose the date of publish ?>
<p class="curtime"><?php printf($stamp, $date, $time); ?>
<?php if ( $can_publish ) : // Contributors don't get to choose the date of publish ?>
<div class="insidebox curtime"><span id="timestamp"><?php printf($stamp, $date, $time); ?></span>
&nbsp;<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a></p>
<div id='timestampdiv' class='hide-if-js'><?php touch_time(($action == 'edit'),1,4); ?></div>
<div id="timestampdiv" class="hide-if-js"><?php touch_time(($action == 'edit'),1,4); ?></div></div>
<?php endif; ?>
</div>
<p class="submit">
<?php do_action('page_submitbox_start'); ?>
<input type="submit" name="save" class="button button-highlighted" value="<?php _e('Save'); ?>" tabindex="4" />
<?php if ( 'publish' == $post->post_status || 'private' == $post->post_status )
$savebtn = attribute_escape( __('Save') );
else
$savebtn = attribute_escape( __('Save Draft') );
?>
<input type="submit" name="save" id="save-post" value="<?php echo $savebtn; ?>" tabindex="4" class="button button-highlighted" />
<?php if ( 'publish' == $post->post_status ) { ?>
<a class="preview button" href="<?php echo clean_url(get_permalink($post->ID)); ?>" target="_blank" tabindex="4"><?php _e('View this Page'); ?></a>
<?php } else { ?>
<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>
<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>
<?php } ?>
<?php if ( ('edit' == $action) && current_user_can('delete_page', $post->ID) )
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>";
?>
<br class="clear" />
<?php
if ( !in_array( $post->post_status, array('publish', 'future') ) || 0 == $post->ID ) {
?>
if ( !in_array( $post->post_status, array('publish', 'future') ) || 0 == $post->ID ) { ?>
<?php if ( current_user_can('publish_pages') ) : ?>
<input name="publish" type="submit" class="button" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" />
<?php else : ?>
<input name="publish" type="submit" class="button" id="publish" tabindex="5" accesskey="p" value="<?php _e('Submit for Review') ?>" />
<?php endif; ?>
<?php
}
?>
<!-- moved under the editor
<?php if ( 0 != $post->ID ) : ?>
<?php if ( $last_id = get_post_meta($post->ID, '_edit_last', true) ) {
$last_user = get_userdata($last_id);
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));
} else {
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));
}
?>
<br class="clear" />
<?php endif; ?>
-->
<?php } ?>
</p>
<div class="clear"></div>
</div>
<?php
}
add_meta_box('pagesubmitdiv', __('Publish'), 'page_submit_meta_box', 'page', 'side', 'core');

View File

@ -62,23 +62,20 @@ function _wp_translate_postdata( $update = false, $post_data = null ) {
$post_data['post_status'] = 'publish';
if ( isset($post_data['advanced']) && '' != $post_data['advanced'] )
$post_data['post_status'] = 'draft';
if ( isset($post_data['pending']) && '' != $post_data['pending'] )
$post_data['post_status'] = 'pending';
$previous_status = get_post_field('post_status', $post_data['ID']);
// Posts 'submitted for approval' present are submitted to $_POST the same as if they were being published.
// Change status from 'publish' to 'pending' if user lacks permissions to publish or to resave published posts.
if ( 'page' == $post_data['post_type'] ) {
if ( 'publish' == $post_data['post_status'] && !current_user_can( 'publish_pages' ) )
if ( $previous_status != 'publish' OR !current_user_can( 'edit_published_pages') )
$post_data['post_status'] = 'pending';
} else {
if ( isset($post_data['post_status']) && ('publish' == $post_data['post_status'] && !current_user_can( 'publish_posts' )) ) :
// Stop attempts to publish new posts, but allow already published posts to be saved if appropriate.
if ( $previous_status != 'publish' OR !current_user_can( 'edit_published_posts') )
$post_data['post_status'] = 'pending';
endif;
}
if ( isset($post_data['post_status']) && ('publish' == $post_data['post_status'] && !current_user_can( 'publish_posts' )) )
if ( $previous_status != 'publish' OR !current_user_can( 'edit_published_pages') )
$post_data['post_status'] = 'pending';
if ( ! isset($post_data['post_status']) )
$post_data['post_status'] = $previous_status;
if (!isset( $post_data['comment_status'] ))
$post_data['comment_status'] = 'closed';

View File

@ -1571,7 +1571,7 @@ function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) {
<input type="hidden" id="ss" name="ss" value="<?php echo $ss ?>" size="2" maxlength="2" />
<a href="#edit_timestamp" class="save-timestamp hide-if-no-js button"><?php _e('OK'); ?></a>
<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js"><?php _e('Cancel'); ?></a>
<a href="#edit_timestamp" class="cancel-timestamp hide-if-no-js"><?php _e('Cancel'); ?></a>
<?php
}

View File

@ -10,33 +10,41 @@ jQuery(document).ready( function($) {
// hide advanced slug field
jQuery('#pageslugdiv').hide();
jQuery('.edit-timestamp').click(function () {
if (jQuery('#timestampdiv').is(":hidden")) {
jQuery('#curtime').slideUp("normal");
jQuery('#timestampdiv').slideDown("normal");
} else {
jQuery('#timestampdiv').slideUp("normal");
jQuery('#mm').val(jQuery('#hidden_mm').val());
jQuery('#jj').val(jQuery('#hidden_jj').val());
jQuery('#aa').val(jQuery('#hidden_aa').val());
jQuery('#hh').val(jQuery('#hidden_hh').val());
jQuery('#mn').val(jQuery('#hidden_mn').val());
jQuery('#curtime').slideDown("normal");
var stamp = $('#timestamp').html();
$('.edit-timestamp').click(function () {
if ($('#timestampdiv').is(":hidden")) {
$('#timestampdiv').slideDown("normal");
$('.edit-timestamp').hide();
}
return false;
});
jQuery('.save-timestamp').click(function () { // crazyhorse - multiple ok cancels
jQuery('#timestampdiv').hide();
var link = jQuery('.timestamp a').clone( true );
jQuery('.timestamp').show().html(
jQuery( '#mm option[value=' + jQuery('#mm').val() + ']' ).text() + ' ' +
jQuery('#jj').val() + ',' +
jQuery('#aa').val() + '@' +
jQuery('#hh').val() + ':' +
jQuery('#mn').val() + ' '
).append( link );
jQuery('#curtime').slideDown("normal");
$('.cancel-timestamp').click(function() {
$('#timestampdiv').slideUp("normal");
$('#mm').val($('#hidden_mm').val());
$('#jj').val($('#hidden_jj').val());
$('#aa').val($('#hidden_aa').val());
$('#hh').val($('#hidden_hh').val());
$('#mn').val($('#hidden_mn').val());
$('#timestamp').html(stamp);
$('.edit-timestamp').show();
return false;
});
$('.save-timestamp').click(function () { // crazyhorse - multiple ok cancels
$('#timestampdiv').slideUp("normal");
$('.edit-timestamp').show();
$('#timestamp').html(
$( '#mm option[value=' + $('#mm').val() + ']' ).text() + ' ' +
$('#jj').val() + ', ' +
$('#aa').val() + ' @ ' +
$('#hh').val() + ':' +
$('#mn').val() + ' '
);
return false;
});
@ -61,13 +69,29 @@ jQuery(document).ready( function($) {
return false;
});
jQuery('.edit-post-status').click(function () {
if (jQuery('#post-status-select').is(":hidden")) {
jQuery('#post-status-select').slideDown("normal");
} else {
jQuery('#post-status-select').slideUp("normal");
jQuery('#post-status-display').html(jQuery('#post_status :selected').text());
$('.edit-post-status').click(function() {
if ($('#post-status-select').is(":hidden")) {
$('#post-status-select').slideDown("normal");
$(this).hide();
}
return false;
});
});
$('.save-post-status').click(function() {
$('#post-status-select').slideUp("normal");
$('#post-status-display').html($('#post_status :selected').text());
$('.edit-post-status').show();
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();
return false;
});
});

View File

@ -154,34 +154,41 @@ jQuery(document).ready( function($) {
return false;
} );
jQuery('.categorychecklist .popular-category :checkbox').change( syncChecks ).filter( ':checked' ).change();
var stamp = $('#timestamp').html();
jQuery('.edit-timestamp').click(function () {
if (jQuery('#timestampdiv').is(":hidden")) {
jQuery('#curtime').slideUp("normal");
jQuery('#timestampdiv').slideDown("normal");
} else {
jQuery('#timestampdiv').slideUp("normal");
jQuery('#mm').val(jQuery('#hidden_mm').val());
jQuery('#jj').val(jQuery('#hidden_jj').val());
jQuery('#aa').val(jQuery('#hidden_aa').val());
jQuery('#hh').val(jQuery('#hidden_hh').val());
jQuery('#mn').val(jQuery('#hidden_mn').val());
jQuery('#curtime').slideDown("normal");
$('.edit-timestamp').click(function () {
if ($('#timestampdiv').is(":hidden")) {
$('#timestampdiv').slideDown("normal");
$('.edit-timestamp').hide();
}
return false;
});
jQuery('.save-timestamp').click(function () { // crazyhorse - multiple ok cancels
jQuery('#timestampdiv').hide();
var link = jQuery('.timestamp a').clone( true );
jQuery('.timestamp').show().html(
jQuery( '#mm option[value=' + jQuery('#mm').val() + ']' ).text() + ' ' +
jQuery('#jj').val() + ',' +
jQuery('#aa').val() + '@' +
jQuery('#hh').val() + ':' +
jQuery('#mn').val() + ' '
).append( link );
jQuery('#curtime').slideDown("normal");
$('.cancel-timestamp').click(function() {
$('#timestampdiv').slideUp("normal");
$('#mm').val($('#hidden_mm').val());
$('#jj').val($('#hidden_jj').val());
$('#aa').val($('#hidden_aa').val());
$('#hh').val($('#hidden_hh').val());
$('#mn').val($('#hidden_mn').val());
$('#timestamp').html(stamp);
$('.edit-timestamp').show();
return false;
});
$('.save-timestamp').click(function () { // crazyhorse - multiple ok cancels
$('#timestampdiv').slideUp("normal");
$('.edit-timestamp').show();
$('#timestamp').html(
$( '#mm option[value=' + $('#mm').val() + ']' ).text() + ' ' +
$('#jj').val() + ', ' +
$('#aa').val() + ' @ ' +
$('#hh').val() + ':' +
$('#mn').val() + ' '
);
return false;
});
@ -217,14 +224,29 @@ jQuery(document).ready( function($) {
}
});
jQuery('.edit-post-status').click(function () {
if (jQuery('#post-status-select').is(":hidden")) {
jQuery('#post-status-select').slideDown("normal");
} else {
jQuery('#post-status-select').slideUp("normal");
jQuery('#post-status-display').html(jQuery('#post_status :selected').text());
$('.edit-post-status').click(function() {
if ($('#post-status-select').is(":hidden")) {
$('#post-status-select').slideDown("normal");
$(this).hide();
}
return false;
});
$('.save-post-status').click(function() {
$('#post-status-select').slideUp("normal");
$('#post-status-display').html($('#post_status :selected').text());
$('.edit-post-status').show();
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();
return false;
});
});

View File

@ -3,7 +3,10 @@
postboxes = {
add_postbox_toggles : function(page) {
$('.postbox h3').before('<a class="togbox">+</a> ');
$('.postbox h3, .postbox a.togbox').click( function() { $($(this).parent().get(0)).toggleClass('closed'); save_postboxes_state(page); } );
$('.postbox h3, .postbox a.togbox').click( function() {
$($(this).parent().get(0)).toggleClass('closed');
postboxes.save_state(page);
});
$('.hide-postbox-tog').click( function() {
var box = jQuery(this).val();
@ -13,7 +16,7 @@
} else {
jQuery('#' + box).hide();
}
save_postboxes_state(page);
postboxes.save_state(page);
} );
if ( $.browser.msie ) {
@ -25,7 +28,7 @@
this.init(page);
},
expandSidebar : function( doIt ) {
if ( doIt || $.trim( $( '#side-info-column' ).text() ) ) {
$( '#post-body' ).addClass( 'has-sidebar' );
@ -42,7 +45,6 @@
items: '> .postbox',
handle: '.hndle',
distance: 2,
containment: '#wpbody-content',
stop: function() {
if ( 'side-sortables' == this.id ) { // doing this with jQuery doesn't work for some reason: make-it-tall gets duplicated
var makeItTall = document.getElementById( 'make-it-tall' );
@ -69,20 +71,21 @@
postboxes.expandSidebar( true );
}
} );
},
save_state : function(page) {
var closed = $('.postbox').filter('.closed').map(function() { return this.id; }).get().join(',');
var hidden = $('.postbox').filter(':hidden').map(function() { return this.id; }).get().join(',');
$.post(postboxL10n.requestFile, {
action: 'closed-postboxes',
closed: closed,
hidden: hidden,
closedpostboxesnonce: jQuery('#closedpostboxesnonce').val(),
page: page
});
}
}
};
$(document).ready(function(){postboxes.expandSidebar();});
}(jQuery));
jQuery(document).ready(function(){postboxes.expandSidebar();});
function save_postboxes_state(page) {
var closed = jQuery('.postbox').filter('.closed').map(function() { return this.id; }).get().join(',');
var hidden = jQuery('.postbox').filter(':hidden').map(function() { return this.id; }).get().join(',');
jQuery.post(postboxL10n.requestFile, {
action: 'closed-postboxes',
closed: closed,
hidden: hidden,
closedpostboxesnonce: jQuery('#closedpostboxesnonce').val(),
page: page
});
}

View File

@ -237,16 +237,10 @@ table#availablethemes td.bottom {
}
.preview {
border: 0 none;
padding: 7px;
}
.submitbox .submit a.preview:hover {
border: 0 none;
}
#publish {
display: block;
margin: 8px auto auto;
min-width: 150px;
}
@ -1070,29 +1064,40 @@ table.form-table td .updated {
position: relative;
min-width: 195px;
}
#normal-sortables .postbox .submitbox {
clear: both;
position: relative;
#normal-sortables .inside-submitbox .insidebox {
float: left;
margin: 5px 12px 5px 0;
}
#normal-sortables .postbox p {
display: inline;
#normal-sortables .submit #publish {
margin: 8px 0 0 12px;
}
#normal-sortables .postbox .curtime {
display: block;
#normal-sortables .inside-submitbox {
float: left;
}
#normal-sortables .postbox p strong {
display: inline;
}
#normal-sortables .postbox #private-checkbox, #normal-sortables .postbox #sticky-checkbox {
padding-left: 30px;
#trackback_url {
width: 99%;
}
#normal-sortables .postbox .submit {
position: absolute;
top: -1em;
right: 0;
background: none;
border: 0;
padding: 0;
background: transparent none;
border: 0 none;
float: right;
padding: 0 12px;
margin: 0;
}
#side-sortables .submitbox .submit input,
#side-sortables .submitbox .submit .preview,
#side-sortables .submitbox .submit a.preview:hover {
border: 0 none;
}
#side-sortables .inside-submitbox .insidebox {
margin: 11px 0;
}
#mediadiv img {
@ -1137,42 +1142,6 @@ table.form-table td .updated {
margin: 0;
}
.submitbox {
/* margin: 1em 0; */
}
.submitbox p {
/* padding: 0;
margin: 0; */
}
.submitbox .submit {
text-align: left;
padding: 12px 10px 10px;
font-size: 11px;
}
.submitbox .submitdelete {
border-bottom-width: 1px;
border-bottom-style: solid;
text-decoration: none;
margin-left: 8px;
padding-bottom: 1px;
}
.submitbox .submit a:hover {
border-bottom-width: 1px;
border-bottom-style: solid;
}
.submitbox .submit input {
margin-bottom: 8px;
margin-right: 3px;
padding: 6px 4px;
border: none;
}
#tagchecklist {
margin-left: 10px;
font-size: 12px;
@ -1296,6 +1265,14 @@ table.form-table td .updated {
font-size: 11px;
}
#pending {
background: 0 none;
border: 0 none;
padding: 0;
font-size: 11px;
margin-top: -1px;
}
#link_name, #link_url, #link_description {
font-size: 1.7em;
padding: 4px 3px;
@ -1416,15 +1393,26 @@ table.form-table td .updated {
#side-info-column #side-sortables {
height: 100%;
padding-top: 39px;
}
.submitbox .submit {
text-align: left;
padding: 12px 10px 10px;
font-size: 11px;
}
.submitbox .submitdelete {
border-bottom-width: 1px;
border-bottom-style: solid;
text-decoration: none;
margin-left: 8px;
padding-bottom: 1px;
padding: 1px 2px;
}
.submitbox .inside-submitbox #deletebutton {
padding: 0 0 2px 20px;
background-image: url(images/no.png);
background-position: left center;
background-repeat: no-repeat;
}
.submitbox .submit a:hover {
@ -1434,10 +1422,14 @@ table.form-table td .updated {
.submitbox .submit input {
margin-bottom: 8px;
margin-right: 3px;
margin-right: 4px;
padding: 6px;
}
#post-status-select {
line-height: 2.5em;
}
/* Categories */
#category-adder {
@ -1842,10 +1834,16 @@ a.togbox {
#jj, #hh, #mn {
width: 1.5em;
padding: 1px;
}
#aa {
width: 2.7em;
padding: 1px;
}
#timestampdiv {
padding-top: 3px;
}
#inbox-filter .actions {