Make Password protected and private mutually exclusive when using Quick Edit.

git-svn-id: http://svn.automattic.com/wordpress/trunk@10088 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
markjaquith 2008-12-06 11:10:24 +00:00
parent d9778f61f3
commit fc5e8dfe58
6 changed files with 29 additions and 13 deletions

View File

@ -146,12 +146,13 @@ switch ( $post->post_status ) {
<div class="misc-pub-section " id="visibility">
<?php _e('Visibility:'); ?> <b><span id="post-visibility-display"><?php
if ( !empty( $post->post_password ) ) {
$visibility = 'password';
$visibility_trans = __('Password protected');
} elseif ( 'private' == $post->post_status ) {
if ( 'private' == $post->post_status ) {
$post->post_password = '';
$visibility = 'private';
$visibility_trans = __('Private');
} elseif ( !empty( $post->post_password ) ) {
$visibility = 'password';
$visibility_trans = __('Password protected');
} elseif ( is_sticky( $post->ID ) ) {
$visibility = 'public';
$visibility_trans = __('Public, Sticky');

View File

@ -141,12 +141,13 @@ switch ( $post->post_status ) {
<div class="misc-pub-section " id="visibility">
<?php _e('Visibility:'); ?> <b><span id="post-visibility-display"><?php
if ( !empty( $post->post_password ) ) {
$visibility = 'password';
$visibility_trans = __('Password protected');
} elseif ( 'private' == $post->post_status ) {
if ( 'private' == $post->post_status ) {
$post->post_password = '';
$visibility = 'private';
$visibility_trans = __('Private');
} elseif ( !empty( $post->post_password ) ) {
$visibility = 'password';
$visibility_trans = __('Password protected');
} else {
$visibility = 'public';
$visibility_trans = __('Public');

View File

@ -1011,8 +1011,10 @@ function inline_edit_row( $type ) {
<span class="input-text-wrap"><input type="text" name="post_password" class="inline-edit-password-input" value="" /></span>
</label>
<em style="margin:5px 10px 0 0" class="alignleft"><?php echo _c( '&ndash;OR&ndash;|Between password field and private checkbox on post quick edit interface' ); ?></em>
<label class="alignleft inline-edit-private">
<input type="checkbox" name="keep_private" value="private" <?php checked($post->post_status, 'private'); ?> />
<input type="checkbox" name="keep_private" value="private" />
<span class="checkbox-title"><?php echo $is_page ? __('Private page') : __('Private post'); ?></span>
</label>
</div>
@ -3248,7 +3250,7 @@ function _post_states($post) {
$post_status = '';
if ( !empty($post->post_password) )
$post_states[] = __('Protected');
$post_states[] = __('Password protected');
if ( 'private' == $post->post_status && 'private' != $post_status )
$post_states[] = __('Private');
if ( 'draft' == $post->post_status && 'draft' != $post_status )

View File

@ -21,6 +21,15 @@ inlineEditPost = {
$('a.cancel', bulkRow).click(function() { return inlineEditPost.revert(); });
$('#inline-edit .inline-edit-private input[value=private]').click( function(){
var pw = $('input.inline-edit-password-input');
if ( $(this).attr('checked') ) {
pw.val('').attr('disabled', 'disabled');
} else {
pw.attr('disabled', '');
}
});
// add events
t.addEvents(t.rows);
@ -146,7 +155,10 @@ inlineEditPost = {
// handle the post status
var status = $('._status', rowData).text();
if ( status != 'future' ) $('select[name="_status"] option[value="future"]', editRow).remove();
if ( status == 'private' ) $('input[name="keep_private"]', editRow).attr("checked", "checked");
if ( status == 'private' ) {
$('input[name="keep_private"]', editRow).attr("checked", "checked");
$('input.inline-edit-password-input').val('').attr('disabled', 'disabled');
}
// remove the current page and children from the parent dropdown
var pageOpt = $('select[name="post_parent"] option[value="'+id+'"]', editRow);

View File

@ -1422,7 +1422,7 @@ function wp_insert_post($postarr = array(), $wp_error = false) {
else
$menu_order = 0;
if ( !isset($post_password) )
if ( !isset($post_password) || 'private' == $post_status )
$post_password = '';
if ( !in_array( $post_status, array( 'draft', 'pending' ) ) ) {

View File

@ -250,7 +250,7 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'theme-preview', '/wp-admin/js/theme-preview.js', array( 'thickbox', 'jquery' ), '20080625' );
$scripts->add( 'inline-edit-post', '/wp-admin/js/inline-edit-post.js', array( 'jquery', 'jquery-form', 'suggest' ), '20081129' );
$scripts->add( 'inline-edit-post', '/wp-admin/js/inline-edit-post.js', array( 'jquery', 'jquery-form', 'suggest' ), '20081206' );
$scripts->localize( 'inline-edit-post', 'inlineEditL10n', array(
'error' => __('Error while saving the changes.'),
'ntdeltitle' => __('Remove From Bulk Edit'),