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; color: #CFEBF6;
} }
.submitbox .submitdelete {
color: #fff;
}
#edit-settings-wrap, #edit-settings-wrap,
#show-settings { #show-settings {
background-color: #14568A; background-color: #14568A;

View File

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

View File

@ -63,12 +63,14 @@ if ( 0 == $post_ID ) {
function post_submit_meta_box($post) { function post_submit_meta_box($post) {
global $action; global $action;
$can_publish = current_user_can('publish_posts');
?> ?>
<div class="submitbox" id="submitpost"> <div class="submitbox" id="submitpost">
<div class="inside-submitbox"> <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"> <strong><span id="post-status-display">
<?php <?php
switch ( $post->post_status ) { switch ( $post->post_status ) {
@ -88,17 +90,17 @@ switch ( $post->post_status ) {
} }
?> ?>
</span></strong> </span></strong>
<a href="#edit_post_status" class="edit-post-status hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a> <?php if ( 'publish' == $post->post_status || 'private' == $post->post_status ) { ?>
</p> <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'> <select name='post_status' id='post_status' tabindex='4'>
<?php <?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) // 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) ) ) : ?> if ( $can_publish OR ( $post->post_status == 'publish' AND current_user_can('edit_post', $post->ID) ) ) : ?>
<?php if ( 'publish' == $post->post_status || 'private' == $post->post_status ) { ?>
<option<?php selected( $post->post_status, 'publish' ); selected( $post->post_status, 'private' );?> value='publish'><?php _e('Published') ?></option> <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 ) : ?> <?php if ( 'future' == $post->post_status ) : ?>
<option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Scheduled') ?></option> <option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Scheduled') ?></option>
<?php endif; ?> <?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, 'pending' ); ?> value='pending'><?php _e('Pending Review') ?></option>
<option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Unpublished') ?></option> <option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Unpublished') ?></option>
</select> </select>
</p>
<?php if ( current_user_can( 'publish_posts' ) ) : ?> <a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e('OK'); ?></a>
<?php if ( current_user_can( 'edit_others_posts' ) ) : ?> <a href="#post_status" class="cancel-post-status hide-if-no-js"><?php _e('Cancel'); ?></a>
<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> </div>
<?php endif; ?> </div>
<?php endif; ?>
<?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 <?php
if ( 0 != $post->ID ) { if ( 0 != $post->ID ) {
if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date 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 } 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 } else if ( '0000-00-00 00:00:00' == $post->post_date ) { // draft, 1 or more saves, no date specified
$stamp = __('Publish immediately'); $stamp = __('Publish immediately');
} else { // draft, 1 or more saves, date specified } 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); $date = mysql2date(get_option('date_format'), $post->post_date);
$time = mysql2date(get_option('time_format'), $post->post_date); $time = mysql2date(get_option('time_format'), $post->post_date);
@ -132,18 +151,23 @@ if ( 0 != $post->ID ) {
$time = mysql2date(get_option('time_format'), current_time('mysql')); $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 ?> <?php if ( $can_publish ) : // Contributors don't get to choose the date of publish ?>
<p class="curtime"><?php printf($stamp, $date, $time); ?> <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> &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; ?> <?php endif; ?>
</div> </div>
<p class="submit"> <p class="submit">
<?php do_action('post_submitbox_start'); ?> <?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 ) { ?> <?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> <a class="preview button" href="<?php echo clean_url(get_permalink($post->ID)); ?>" target="_blank" tabindex="4"><?php _e('View this Post'); ?></a>
@ -152,13 +176,7 @@ if ( 0 != $post->ID ) {
<?php } ?> <?php } ?>
<?php <?php
if ( ( 'edit' == $action) && current_user_can('delete_post', $post->ID) ) if ( !in_array( $post->post_status, array('publish', 'future') ) || 0 == $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 ) {
?>
<?php if ( current_user_can('publish_posts') ) : ?> <?php if ( current_user_can('publish_posts') ) : ?>
<input name="publish" type="submit" class="button" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" /> <input name="publish" type="submit" class="button" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" />
<?php else : ?> <?php else : ?>
@ -166,21 +184,10 @@ if ( !in_array( $post->post_status, array('publish', 'future') ) || 0 == $post->
<?php endif; ?> <?php endif; ?>
<?php } ?> <?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> </p>
<div class="clear"></div>
</div> </div>
<?php <?php
} }
add_meta_box('submitdiv', __('Publish'), 'post_submit_meta_box', 'post', 'side', 'core'); 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'); add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', 'post', 'normal', 'core');
function post_trackback_meta_box($post) { 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) { if ('' != $post->pinged) {
$pings = '<p>'. __('Already pinged:') . '</p><ul>'; $pings = '<p>'. __('Already pinged:') . '</p><ul>';
$already_pinged = explode("\n", trim($post->pinged)); $already_pinged = explode("\n", trim($post->pinged));
@ -287,7 +294,7 @@ function post_trackback_meta_box($post) {
<p class="meta-options"> <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> <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>
<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> <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 <?php
if ( ! empty($pings) ) if ( ! empty($pings) )
@ -439,12 +446,6 @@ if ( 0 == $post_ID)
else else
wp_nonce_field('update-post_' . $post_ID); 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 ?>" /> <input type="hidden" id="user-id" name="user_ID" value="<?php echo (int) $user_ID ?>" />
@ -541,9 +542,6 @@ endif; ?>
<?php <?php
echo $form_pingback;
echo $form_prevstatus;
do_meta_boxes('post', 'normal', $post); do_meta_boxes('post', 'normal', $post);
do_action('edit_form_advanced'); do_action('edit_form_advanced');

View File

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

View File

@ -57,12 +57,14 @@ $user_ID = (int) $user_ID;
<?php <?php
function page_submit_meta_box($post) { function page_submit_meta_box($post) {
global $action; global $action;
$can_publish = current_user_can('publish_pages');
?> ?>
<div class="submitbox" id="submitpage"> <div class="submitbox" id="submitpage">
<div class="inside-submitbox"> <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"> <strong><span id="post-status-display">
<?php <?php
switch ( $post->post_status ) { switch ( $post->post_status ) {
@ -82,17 +84,17 @@ switch ( $post->post_status ) {
} }
?> ?>
</span></strong> </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> <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'> <select name='post_status' id='post_status' tabindex='4'>
<?php <?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) // 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) ) ) : ?> if ( $can_publish OR ( $post->post_status == 'publish' AND current_user_can('edit_page', $post->ID) ) ) : ?>
<?php if ( 'publish' == $post->post_status || 'private' == $post->post_status ) { ?>
<option<?php selected( $post->post_status, 'publish' ); selected( $post->post_status, 'private' );?> value='publish'><?php _e('Published') ?></option> <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 ) : ?> <?php if ( 'future' == $post->post_status ) : ?>
<option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Scheduled') ?></option> <option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Scheduled') ?></option>
<?php endif; ?> <?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, 'pending' ); ?> value='pending'><?php _e('Pending Review') ?></option>
<option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Unpublished') ?></option> <option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Unpublished') ?></option>
</select> </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 <?php
if ( 0 != $post->ID ) { if ( 0 != $post->ID ) {
if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date 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 } 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 } else if ( '0000-00-00 00:00:00' == $post->post_date ) { // draft, 1 or more saves, no date specified
$stamp = __('Publish immediately'); $stamp = __('Publish immediately');
} else { // draft, 1 or more saves, date specified } 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); $date = mysql2date(get_option('date_format'), $post->post_date);
$time = mysql2date(get_option('time_format'), $post->post_date); $time = mysql2date(get_option('time_format'), $post->post_date);
@ -121,18 +139,23 @@ if ( 0 != $post->ID ) {
$time = mysql2date(get_option('time_format'), current_time('mysql')); $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 ?> <?php if ( $can_publish ) : // Contributors don't get to choose the date of publish ?>
<p class="curtime"><?php printf($stamp, $date, $time); ?> <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> &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; ?> <?php endif; ?>
</div> </div>
<p class="submit"> <p class="submit">
<?php do_action('page_submitbox_start'); ?> <?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 ) { ?> <?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> <a class="preview button" href="<?php echo clean_url(get_permalink($post->ID)); ?>" target="_blank" tabindex="4"><?php _e('View this Page'); ?></a>
@ -140,37 +163,19 @@ if ( 0 != $post->ID ) {
<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 } ?>
<?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 <?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') ) : ?> <?php if ( current_user_can('publish_pages') ) : ?>
<input name="publish" type="submit" class="button" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" /> <input name="publish" type="submit" class="button" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" />
<?php else : ?> <?php else : ?>
<input name="publish" type="submit" class="button" id="publish" tabindex="5" accesskey="p" value="<?php _e('Submit for Review') ?>" /> <input name="publish" type="submit" class="button" id="publish" tabindex="5" accesskey="p" value="<?php _e('Submit for Review') ?>" />
<?php endif; ?> <?php endif; ?>
<?php <?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> </p>
<div class="clear"></div>
</div> </div>
<?php <?php
} }
add_meta_box('pagesubmitdiv', __('Publish'), 'page_submit_meta_box', 'page', 'side', 'core'); add_meta_box('pagesubmitdiv', __('Publish'), 'page_submit_meta_box', 'page', 'side', 'core');

View File

@ -62,22 +62,19 @@ function _wp_translate_postdata( $update = false, $post_data = null ) {
$post_data['post_status'] = 'publish'; $post_data['post_status'] = 'publish';
if ( isset($post_data['advanced']) && '' != $post_data['advanced'] ) if ( isset($post_data['advanced']) && '' != $post_data['advanced'] )
$post_data['post_status'] = 'draft'; $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']); $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. // 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. // Change status from 'publish' to 'pending' if user lacks permissions to publish or to resave published posts.
if ( 'page' == $post_data['post_type'] ) { if ( isset($post_data['post_status']) && ('publish' == $post_data['post_status'] && !current_user_can( 'publish_posts' )) )
if ( 'publish' == $post_data['post_status'] && !current_user_can( 'publish_pages' ) )
if ( $previous_status != 'publish' OR !current_user_can( 'edit_published_pages') ) if ( $previous_status != 'publish' OR !current_user_can( 'edit_published_pages') )
$post_data['post_status'] = 'pending'; $post_data['post_status'] = 'pending';
} else {
if ( isset($post_data['post_status']) && ('publish' == $post_data['post_status'] && !current_user_can( 'publish_posts' )) ) : if ( ! isset($post_data['post_status']) )
// Stop attempts to publish new posts, but allow already published posts to be saved if appropriate. $post_data['post_status'] = $previous_status;
if ( $previous_status != 'publish' OR !current_user_can( 'edit_published_posts') )
$post_data['post_status'] = 'pending';
endif;
}
if (!isset( $post_data['comment_status'] )) if (!isset( $post_data['comment_status'] ))
$post_data['comment_status'] = 'closed'; $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" /> <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="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 <?php
} }

View File

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

View File

@ -154,34 +154,41 @@ jQuery(document).ready( function($) {
return false; return false;
} ); } );
jQuery('.categorychecklist .popular-category :checkbox').change( syncChecks ).filter( ':checked' ).change(); jQuery('.categorychecklist .popular-category :checkbox').change( syncChecks ).filter( ':checked' ).change();
var stamp = $('#timestamp').html();
jQuery('.edit-timestamp').click(function () { $('.edit-timestamp').click(function () {
if (jQuery('#timestampdiv').is(":hidden")) { if ($('#timestampdiv').is(":hidden")) {
jQuery('#curtime').slideUp("normal"); $('#timestampdiv').slideDown("normal");
jQuery('#timestampdiv').slideDown("normal"); $('.edit-timestamp').hide();
} 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");
} }
return false; return false;
}); });
jQuery('.save-timestamp').click(function () { // crazyhorse - multiple ok cancels $('.cancel-timestamp').click(function() {
jQuery('#timestampdiv').hide(); $('#timestampdiv').slideUp("normal");
var link = jQuery('.timestamp a').clone( true ); $('#mm').val($('#hidden_mm').val());
jQuery('.timestamp').show().html( $('#jj').val($('#hidden_jj').val());
jQuery( '#mm option[value=' + jQuery('#mm').val() + ']' ).text() + ' ' + $('#aa').val($('#hidden_aa').val());
jQuery('#jj').val() + ',' + $('#hh').val($('#hidden_hh').val());
jQuery('#aa').val() + '@' + $('#mn').val($('#hidden_mn').val());
jQuery('#hh').val() + ':' + $('#timestamp').html(stamp);
jQuery('#mn').val() + ' ' $('.edit-timestamp').show();
).append( link );
jQuery('#curtime').slideDown("normal"); 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; return false;
}); });
@ -217,14 +224,29 @@ jQuery(document).ready( function($) {
} }
}); });
jQuery('.edit-post-status').click(function () { $('.edit-post-status').click(function() {
if (jQuery('#post-status-select').is(":hidden")) { if ($('#post-status-select').is(":hidden")) {
jQuery('#post-status-select').slideDown("normal"); $('#post-status-select').slideDown("normal");
} else { $(this).hide();
jQuery('#post-status-select').slideUp("normal");
jQuery('#post-status-display').html(jQuery('#post_status :selected').text());
} }
return false; 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 = { postboxes = {
add_postbox_toggles : function(page) { add_postbox_toggles : function(page) {
$('.postbox h3').before('<a class="togbox">+</a> '); $('.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() { $('.hide-postbox-tog').click( function() {
var box = jQuery(this).val(); var box = jQuery(this).val();
@ -13,7 +16,7 @@
} else { } else {
jQuery('#' + box).hide(); jQuery('#' + box).hide();
} }
save_postboxes_state(page); postboxes.save_state(page);
} ); } );
if ( $.browser.msie ) { if ( $.browser.msie ) {
@ -42,7 +45,6 @@
items: '> .postbox', items: '> .postbox',
handle: '.hndle', handle: '.hndle',
distance: 2, distance: 2,
containment: '#wpbody-content',
stop: function() { stop: function() {
if ( 'side-sortables' == this.id ) { // doing this with jQuery doesn't work for some reason: make-it-tall gets duplicated 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' ); var makeItTall = document.getElementById( 'make-it-tall' );
@ -69,20 +71,21 @@
postboxes.expandSidebar( true ); postboxes.expandSidebar( true );
} }
} ); } );
} },
}
}(jQuery));
jQuery(document).ready(function(){postboxes.expandSidebar();}); save_state : function(page) {
var closed = $('.postbox').filter('.closed').map(function() { return this.id; }).get().join(',');
function save_postboxes_state(page) { var hidden = $('.postbox').filter(':hidden').map(function() { return this.id; }).get().join(',');
var closed = jQuery('.postbox').filter('.closed').map(function() { return this.id; }).get().join(','); $.post(postboxL10n.requestFile, {
var hidden = jQuery('.postbox').filter(':hidden').map(function() { return this.id; }).get().join(',');
jQuery.post(postboxL10n.requestFile, {
action: 'closed-postboxes', action: 'closed-postboxes',
closed: closed, closed: closed,
hidden: hidden, hidden: hidden,
closedpostboxesnonce: jQuery('#closedpostboxesnonce').val(), closedpostboxesnonce: jQuery('#closedpostboxesnonce').val(),
page: page page: page
}); });
} }
};
$(document).ready(function(){postboxes.expandSidebar();});
}(jQuery));

View File

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