Ticket #15898: 15898.6.diff
File 15898.6.diff, 10.8 KB (added by , 13 years ago) |
---|
-
wp-admin/admin-ajax.php
diff --git wp-admin/admin-ajax.php wp-admin/admin-ajax.php index d2a8d4d..2c57750 100644
case 'replyto-comment' : 665 665 $comment_id = wp_new_comment( $commentdata ); 666 666 $comment = get_comment($comment_id); 667 667 if ( ! $comment ) die('1'); 668 668 669 $parent = get_comment( $comment_parent ); 670 669 671 $position = ( isset($_POST['position']) && (int) $_POST['position']) ? (int) $_POST['position'] : '-1'; 670 672 671 673 $x = new WP_Ajax_Response(); … … case 'replyto-comment' : 684 686 } 685 687 $comment_list_item = ob_get_contents(); 686 688 ob_end_clean(); 687 688 $ x->add(array(689 690 $response = array( 689 691 'what' => 'comment', 690 692 'id' => $comment->comment_ID, 691 693 'data' => $comment_list_item, 692 694 'position' => $position 693 )); 694 695 ); 696 697 // automatically approve parent comment 698 if ( ! $parent->comment_approved ) { 699 if ( ! wp_update_comment( array( 'comment_ID' => $comment_parent, 'comment_approved' => 'approve' ) ) ) 700 die( '1' ); 701 702 // include total_items_i18n to update total item number 703 if ( $_POST['status'] == 'moderated' ) { 704 $total = wp_count_comments()->moderated; 705 $per_page = (int) $_POST['_per_page']; 706 $response['supplemental'] = array( 707 'total_items_i18n' => sprintf( _n( '1 item', '%s items', $total ), number_format_i18n( $total ) ), 708 'total_pages' => ceil( $total / $per_page ), 709 'total_pages_i18n' => number_format_i18n( ceil( $total / $per_page ) ), 710 'total' => $total, 711 'time' => time() 712 ); 713 } 714 } 715 $x->add( $response ); 695 716 $x->send(); 696 717 break; 697 718 case 'edit-comment' : -
wp-admin/css/wp-admin.dev.css
diff --git wp-admin/css/wp-admin.dev.css wp-admin/css/wp-admin.dev.css index 8506810..fc1b7bd 100644
table.fixed { 1373 1373 #comments-form .fixed .column-author { 1374 1374 width: 20%; 1375 1375 } 1376 .comments tr.focus th, .comments tr.focus td { 1377 border-top-width:1px; 1378 border-top-style:solid; 1379 } 1380 1381 .comments tr.blur th, .comments tr.blur td { 1382 border-bottom-width:0; 1383 } 1376 1384 #commentsdiv.postbox .inside { 1377 1385 line-height:1.4em; 1378 1386 margin:0; -
wp-admin/js/edit-comments.dev.js
diff --git wp-admin/js/edit-comments.dev.js wp-admin/js/edit-comments.dev.js index fbadeba..f83dcf0 100644
1 1 var theList, theExtraList, toggleWithKeyboard = false; 2 2 (function($) { 3 3 4 var dashboardTotals = function(n) { 5 var dash = $('#dashboard_right_now'), total, appr, totalN, apprN; 6 7 n = n || 0; 8 if ( isNaN(n) || !dash.length ) 9 return; 10 11 total = $('span.total-count', dash); 12 appr = $('span.approved-count', dash); 13 totalN = getCount(total); 14 15 totalN = totalN + n; 16 apprN = totalN - getCount( $('span.pending-count', dash) ) - getCount( $('span.spam-count', dash) ); 17 updateCount(total, totalN); 18 updateCount(appr, apprN); 19 20 } 21 22 var getCount = function(el) { 23 var n = parseInt( el.html().replace(/[^0-9]+/g, ''), 10 ); 24 if ( isNaN(n) ) 25 return 0; 26 return n; 27 } 28 29 var updateCount = function(el, n) { 30 var n1 = ''; 31 if ( isNaN(n) ) 32 return; 33 n = n < 1 ? '0' : n.toString(); 34 if ( n.length > 3 ) { 35 while ( n.length > 3 ) { 36 n1 = thousandsSeparator + n.substr(n.length - 3) + n1; 37 n = n.substr(0, n.length - 3); 38 } 39 n = n + n1; 40 } 41 el.html(n); 42 } 43 44 var updatePagination = function(r) { 45 total_items_i18n = r.total_items_i18n || ''; 46 if ( total_items_i18n ) { 47 $('.displaying-num').text( total_items_i18n ); 48 $('.total-pages').text( r.total_pages_i18n ); 49 $('.tablenav-pages').find('.next-page, .last-page').toggleClass('disabled', r.total_pages == $('.current-page').val()); 50 } 51 } 52 4 53 setCommentsList = function() { 5 54 var totalInput, perPageInput, pageInput, lastConfidentTime = 0, dimAfter, delBefore, updateTotalCount, delAfter; 6 55 … … setCommentsList = function() { 99 148 }); 100 149 }; 101 150 102 function dashboardTotals(n) {103 var dash = $('#dashboard_right_now'), total, appr, totalN, apprN;104 105 n = n || 0;106 if ( isNaN(n) || !dash.length )107 return;108 109 total = $('span.total-count', dash);110 appr = $('span.approved-count', dash);111 totalN = getCount(total);112 113 totalN = totalN + n;114 apprN = totalN - getCount( $('span.pending-count', dash) ) - getCount( $('span.spam-count', dash) );115 updateCount(total, totalN);116 updateCount(appr, apprN);117 118 }119 120 function getCount(el) {121 var n = parseInt( el.html().replace(/[^0-9]+/g, ''), 10 );122 if ( isNaN(n) )123 return 0;124 return n;125 }126 127 function updateCount(el, n) {128 var n1 = '';129 if ( isNaN(n) )130 return;131 n = n < 1 ? '0' : n.toString();132 if ( n.length > 3 ) {133 while ( n.length > 3 ) {134 n1 = thousandsSeparator + n.substr(n.length - 3) + n1;135 n = n.substr(0, n.length - 3);136 }137 n = n + n1;138 }139 el.html(n);140 }141 142 151 // In admin-ajax.php, we send back the unix time stamp instead of 1 on success 143 152 delAfter = function( r, settings ) { 144 153 var total, pageLinks, N, untrash = $(settings.target).parent().is('span.untrash'), unspam = $(settings.target).parent().is('span.unspam'), spam, trash; … … setCommentsList = function() { 185 194 186 195 if ( $('#dashboard_right_now').length ) { 187 196 N = trash ? -1 * trash : 0; 188 dashboardTotals(N); 197 dashboardTotals(N); 189 198 } else { 190 199 total = totalInput.val() ? parseInt( totalInput.val(), 10 ) : 0; 191 200 total = total - spam - trash; … … setCommentsList = function() { 193 202 total = 0; 194 203 195 204 if ( ( 'object' == typeof r ) && lastConfidentTime < settings.parsed.responses[0].supplemental.time ) { 196 total_items_i18n = settings.parsed.responses[0].supplemental.total_items_i18n || ''; 197 if ( total_items_i18n ) { 198 $('.displaying-num').text( total_items_i18n ); 199 $('.total-pages').text( settings.parsed.responses[0].supplemental.total_pages_i18n ); 200 $('.tablenav-pages').find('.next-page, .last-page').toggleClass('disabled', settings.parsed.responses[0].supplemental.total_pages == $('.current-page').val()); 201 } 205 updatePagination(settings.parsed.responses[0].supplemental); 202 206 updateTotalCount( total, settings.parsed.responses[0].supplemental.time, true ); 203 207 } else { 204 208 updateTotalCount( total, r, false ); … … setCommentsList = function() { 273 277 commentReply = { 274 278 cid : '', 275 279 act : '', 280 281 focusOn : function(id) { 282 var c = $('#comment-' + id), 283 excluded = c.find('td, th').css('opacity', 1).add('td, th', '#replyrow'); 284 theList.find('td, th').not(excluded).animate({opacity:'0.2'}, 300); 285 c.addClass('focus'); 286 c.prev().addClass('blur'); 287 }, 288 289 focusOff : function() { 290 theList. 291 find('.blur').removeClass('blur').end(). 292 find('.focus').removeClass('focus'); 293 }, 276 294 277 295 init : function() { 278 296 var row = $('#replyrow'); … … commentReply = { 321 339 322 340 if ( $('#the-comment-list #replyrow').length < 1 ) 323 341 return false; 342 343 theList.find('th, td').animate({opacity : 1}, 300); 324 344 325 345 $('#replyrow').fadeOut('fast', function(){ 326 346 commentReply.close(); … … commentReply = { 344 364 $('input', '#edithead').val(''); 345 365 $('.error', '#replysubmit').html('').hide(); 346 366 $('.waiting', '#replysubmit').hide(); 367 this.focusOff(); 347 368 348 369 if ( $.browser.msie ) 349 370 $('#replycontainer, #replycontent').css('height', '120px'); … … commentReply = { 355 376 }, 356 377 357 378 open : function(id, p, a) { 358 var t = this, editRow, rowData, act, h, c = $('#comment-' + id) ;379 var t = this, editRow, rowData, act, h, c = $('#comment-' + id), replyButton; 359 380 t.close(); 360 381 t.cid = id; 361 382 … … commentReply = { 366 387 $('#action', editRow).val(act); 367 388 $('#comment_post_ID', editRow).val(p); 368 389 $('#comment_ID', editRow).val(id); 390 t.focusOn(id); 369 391 370 392 if ( a == 'edit' ) { 371 393 $('#author', editRow).val( $('div.author', rowData).text() ); … … commentReply = { 387 409 $('#replyrow').fadeIn(300, function(){ $(this).show() }); 388 410 }); 389 411 } else { 412 replyButton = $('#replybtn', editRow); 390 413 $('#edithead, #savebtn', editRow).hide(); 391 414 $('#replyhead, #replybtn', editRow).show(); 415 $('#status', editRow).val($('input[name=comment_status]').val()); 392 416 c.after(editRow); 417 if (c.hasClass('unapproved')) { 418 replyButton.text(adminCommentsL10n.replyApprove); 419 } else { 420 replyButton.text(adminCommentsL10n.reply); 421 } 393 422 $('#replyrow').fadeIn(300, function(){ $(this).show() }); 394 423 } 395 424 … … commentReply = { 427 456 }, 428 457 429 458 send : function() { 430 var post = {} ;459 var post = {}, c; 431 460 432 461 $('#replysubmit .error').hide(); 433 462 $('#replysubmit .waiting').show(); … … commentReply = { 440 469 post.id = post.comment_post_ID; 441 470 post.comments_listing = this.comments_listing; 442 471 post.p = $('[name=p]').val(); 443 472 post._per_page = $('input[name="_per_page"]', '#comments-form').val(); 473 c = $('#comment-' + post.comment_ID); 444 474 $.ajax({ 445 475 type : 'POST', 446 476 url : ajaxurl, 447 477 data : post, 448 success : function(x) { commentReply.show(x); }, 478 success : function(x) { 479 var pending_count; 480 481 /** 482 * Check if reply creation was successful. 483 * Show error, if error -- otherwise show reply and approve. 484 */ 485 if (commentReply.show(x) != false) { 486 if (c.hasClass('unapproved')) { 487 c.removeClass('unapproved').addClass('approved'); 488 $('span.pending-count').each( function() { 489 var a = $(this), n = getCount(a); 490 if (! isNaN(n)) { 491 n = n - 1; 492 if ( n < 0 ) { n = 0; } 493 a.closest('#awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0'); 494 updateCount(a, n); 495 dashboardTotals(); 496 } 497 }); 498 } 499 } 500 }, 449 501 error : function(r) { commentReply.error(r); } 450 502 }); 451 503 … … commentReply = { 483 526 .animate( { 'backgroundColor':'#CCEEBB' }, 600 ) 484 527 .animate( { 'backgroundColor': bg }, 600 ); 485 528 529 if (r.supplemental) 530 updatePagination(r.supplemental); 531 486 532 // $.fn.wpList.process($(id)); 487 533 }, 488 534 -
wp-admin/js/post.dev.js
diff --git wp-admin/js/post.dev.js wp-admin/js/post.dev.js index 1c39edf..d3bcd52 100644
commentsBox = { 185 185 if ( 'object' == typeof r && r.responses[0] ) { 186 186 $('#the-comment-list').append( r.responses[0].data ); 187 187 188 theList = theExtraList = null;188 // theList = theExtraList = null; 189 189 $("a[className*=':']").unbind(); 190 190 191 191 if ( commentsBox.st > commentsBox.total ) -
wp-includes/script-loader.php
diff --git wp-includes/script-loader.php wp-includes/script-loader.php index b8d234e..d3f32cb 100644
function wp_default_scripts( &$scripts ) { 303 303 $scripts->add_data( 'admin-comments', 'group', 1 ); 304 304 $scripts->localize( 'admin-comments', 'adminCommentsL10n', array( 305 305 'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']), 306 'hotkeys_highlight_last' => isset($_GET['hotkeys_highlight_last']) 306 'hotkeys_highlight_last' => isset($_GET['hotkeys_highlight_last']), 307 'replyApprove' => __( 'Approve and Reply' ), 308 'reply' => __( 'Reply' ), 307 309 ) ); 308 310 309 311 $scripts->add( 'xfn', "/wp-admin/js/xfn$suffix.js", array('jquery'), '20100403' );