Fix QE returned data for Pending and Scheduled posts screens, use jQuery.live() for QE events, fixes #10478

git-svn-id: http://svn.automattic.com/wordpress/trunk@11742 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2009-07-25 10:58:05 +00:00
parent 2040971211
commit bdbaca9056
4 changed files with 23 additions and 28 deletions

View File

@ -753,7 +753,14 @@ function wp_manage_posts_columns() {
$posts_columns['author'] = __('Author');
$posts_columns['categories'] = __('Categories');
$posts_columns['tags'] = __('Tags');
if ( !isset($_GET['post_status']) || !in_array($_GET['post_status'], array('pending', 'draft', 'future')) )
$post_status = 'all';
if ( isset($_GET['post_status']) )
$post_status = $_GET['post_status'];
elseif ( isset($_POST['_status']) )
$post_status = $_POST['_status'];
if ( !in_array( $post_status, array('pending', 'draft', 'future') ) )
$posts_columns['comments'] = '<div class="vers"><img alt="Comments" src="images/comment-grey-bubble.png" /></div>';
$posts_columns['date'] = __('Date');
$posts_columns = apply_filters('manage_posts_columns', $posts_columns);
@ -800,10 +807,14 @@ function wp_manage_pages_columns() {
$posts_columns['cb'] = '<input type="checkbox" />';
$posts_columns['title'] = __('Title');
$posts_columns['author'] = __('Author');
$post_status = 'all';
if ( !empty($_GET['post_status']) )
if ( isset($_GET['post_status']) )
$post_status = $_GET['post_status'];
if ( !in_array($post_status, array('pending', 'draft', 'future')) )
elseif ( isset($_POST['_status']) )
$post_status = $_POST['_status'];
if ( !in_array( $post_status, array('pending', 'draft', 'future') ) )
$posts_columns['comments'] = '<div class="vers"><img alt="" src="images/comment-grey-bubble.png" /></div>';
$posts_columns['date'] = __('Date');
$posts_columns = apply_filters('manage_pages_columns', $posts_columns);
@ -1362,7 +1373,7 @@ function post_rows( $posts = array() ) {
* @param unknown_type $mode
*/
function _post_row($a_post, $pending_comments, $mode) {
global $post;
global $post, $current_user;
static $rowclass;
$global_post = $post;
@ -1370,7 +1381,6 @@ function _post_row($a_post, $pending_comments, $mode) {
setup_postdata($post);
$rowclass = 'alternate' == $rowclass ? '' : 'alternate';
global $current_user;
$post_owner = ( $current_user->ID == $post->post_author ? 'self' : 'other' );
$edit_link = get_edit_post_link( $post->ID );
$title = _draft_or_post_title();

View File

@ -8,9 +8,6 @@ inlineEditPost = {
t.type = $('table.widefat').hasClass('page') ? 'page' : 'post';
t.what = '#'+t.type+'-';
// get all editable rows
t.rows = $('tr.iedit');
// prepare the edit rows
qeRow.keyup(function(e) { if(e.which == 27) return inlineEditPost.revert(); });
bulkRow.keyup(function(e) { if (e.which == 27) return inlineEditPost.revert(); });
@ -31,7 +28,7 @@ inlineEditPost = {
});
// add events
t.addEvents(t.rows);
$('a.editinline').live('click', function() { inlineEditPost.edit(this); return false; });
$('#bulk-title-div').parents('fieldset').after(
$('#inline-edit fieldset.inline-edit-categories').clone()
@ -76,13 +73,6 @@ inlineEditPost = {
$(t.what+t.getId(el)).css('display') == 'none' ? t.revert() : t.edit(el);
},
addEvents : function(r) {
r.each(function() {
var row = $(this);
$('a.editinline', row).click(function() { inlineEditPost.edit(this); return false; });
});
},
setBulk : function() {
var te = '', type = this.type, tax;
this.revert();
@ -205,7 +195,7 @@ inlineEditPost = {
edit_date: 'true'
};
fields = $('#edit-'+id+' :input').fieldSerialize();
fields = $('#edit-'+id+' :input').serialize();
params = fields + '&' + $.param(params);
// make ajax request
@ -217,15 +207,7 @@ inlineEditPost = {
if ( -1 != r.indexOf('<tr') ) {
$(inlineEditPost.what+id).remove();
$('#edit-'+id).before(r).remove();
var row = $(inlineEditPost.what+id);
row.hide();
if ( 'draft' == $('input[name="post_status"]').val() )
row.find('td.column-comments').hide();
inlineEditPost.addEvents(row);
row.fadeIn();
$(inlineEditPost.what+id).hide().fadeIn();
} else {
r = r.replace( /<.[^<>]*?>/g, '' );
$('#edit-'+id+' .inline-edit-save').append('<span class="error">'+r+'</span>');

File diff suppressed because one or more lines are too long

View File

@ -116,6 +116,7 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'scriptaculous-controls', '/wp-includes/js/scriptaculous/controls.js', array('scriptaculous-root'), '1.8.0');
$scripts->add( 'scriptaculous', '', array('scriptaculous-dragdrop', 'scriptaculous-slider', 'scriptaculous-controls'), '1.8.0');
// not used in core, replaced by Jcrop.js
$scripts->add( 'cropper', '/wp-includes/js/crop/cropper.js', array('scriptaculous-dragdrop'), '20070118');
$scripts->add( 'jquery', '/wp-includes/js/jquery/jquery.js', false, '1.3.2');
@ -144,12 +145,14 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'jquery-ui-dialog', '/wp-includes/js/jquery/ui.dialog.js', array('jquery-ui-resizable', 'jquery-ui-draggable'), '1.7.1' );
$scripts->add_data( 'jquery-ui-dialog', 'group', 1 );
// deprecated, not used in core, most functionality is included in jQuery 1.3
$scripts->add( 'jquery-form', "/wp-includes/js/jquery/jquery.form$suffix.js", array('jquery'), '2.02m');
$scripts->add_data( 'jquery-form', 'group', 1 );
$scripts->add( 'jquery-color', "/wp-includes/js/jquery/jquery.color$suffix.js", array('jquery'), '2.0-4561m');
$scripts->add_data( 'jquery-color', 'group', 1 );
// deprecated, not used in core
$scripts->add( 'interface', '/wp-includes/js/jquery/interface.js', array('jquery'), '1.2' );
$scripts->add( 'suggest', "/wp-includes/js/jquery/suggest$suffix.js", array('jquery'), '1.1-20090125');
@ -357,7 +360,7 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'theme-preview', "/wp-admin/js/theme-preview$suffix.js", array( 'thickbox', 'jquery' ), '20090319' );
$scripts->add_data( 'theme-preview', 'group', 1 );
$scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery-form', 'suggest' ), '20090125' );
$scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'suggest' ), '20090725' );
$scripts->add_data( 'inline-edit-post', 'group', 1 );
$scripts->localize( 'inline-edit-post', 'inlineEditL10n', array(
'error' => __('Error while saving the changes.'),