Fix comment manipulation on edit post screen. Props garyc40. fixes #15876

git-svn-id: http://svn.automattic.com/wordpress/trunk@17113 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2010-12-22 19:03:43 +00:00
parent ec8e5fe129
commit edc2f694ad
11 changed files with 84 additions and 32 deletions

View File

@ -625,9 +625,6 @@ case 'replyto-comment' :
set_current_screen( 'edit-comments' );
$wp_list_table = get_list_table('WP_Comments_List_Table');
$wp_list_table->checkbox = ( isset($_POST['checkbox']) && true == $_POST['checkbox'] ) ? 1 : 0;
$comment_post_ID = (int) $_POST['comment_post_ID'];
if ( !current_user_can( 'edit_post', $comment_post_ID ) )
die('-1');
@ -674,6 +671,11 @@ case 'replyto-comment' :
require_once( ABSPATH . 'wp-admin/includes/dashboard.php' );
_wp_dashboard_recent_comments_row( $comment );
} else {
if ( 'single' == $_REQUEST['mode'] ) {
$wp_list_table = get_list_table('WP_Post_Comments_List_Table');
} else {
$wp_list_table = get_list_table('WP_Comments_List_Table');
}
$wp_list_table->single_row( $comment );
}
$comment_list_item = ob_get_contents();

File diff suppressed because one or more lines are too long

View File

@ -1373,7 +1373,30 @@ table.fixed {
#comments-form .fixed .column-author {
width: 20%;
}
#commentsdiv.postbox .inside {
line-height:1.4em;
margin:0;
}
#commentsdiv.postbox .inside .row-actions {
line-height:18px;
}
#commentsdiv.postbox .inside td {
padding:1em 10px;
}
#commentsdiv.postbox .inside .column-comment p {
}
#commentsdiv.postbox .inside .column-author {
width:33%;
}
#commentsdiv.postbox .inside p {
margin:6px 10px 8px;
}
#commentsdiv.postbox .column-comment p {
margin:0.6em 0;
}
#commentsdiv.postbox #replyrow td {
padding:0;
}
.sorting-indicator {
display: none;
width: 7px;
@ -3426,6 +3449,7 @@ span.imgedit-scale-warn {
#replysubmit {
margin: 0;
padding: 3px 7px;
text-align:center;
}
#replysubmit img.waiting,
@ -3439,6 +3463,13 @@ span.imgedit-scale-warn {
margin-right: 5px;
}
#replysubmit .error {
color:red;
line-height:21px;
text-align:center;
vertical-align:center;
}
#replyrow #editor-toolbar {
display: none;
}

View File

@ -29,7 +29,8 @@ class WP_Comments_List_Table extends WP_List_Table {
add_filter( 'comment_author', 'floated_admin_avatar' );
parent::WP_List_Table( array(
'plural' => 'comments'
'plural' => 'comments',
'singular' => 'comment',
) );
}
@ -66,8 +67,12 @@ class WP_Comments_List_Table extends WP_List_Table {
}
$page = $this->get_pagenum();
$start = ( $page - 1 ) * $comments_per_page;
if ( isset( $_REQUEST['start'] ) ) {
$start = $_REQUEST['start'];
} else {
$start = ( $page - 1 ) * $comments_per_page;
}
if ( $doing_ajax && isset( $_REQUEST['offset'] ) ) {
$start += $_REQUEST['offset'];
@ -502,15 +507,34 @@ class WP_Comments_List_Table extends WP_List_Table {
*/
class WP_Post_Comments_List_Table extends WP_Comments_List_Table {
function get_columns() {
return array(
function get_column_info() {
$this->_column_headers = array(
array(
'author' => __( 'Author' ),
'comment' => _x( 'Comment', 'column name' ),
),
array(),
array(),
);
return $this->_column_headers;
}
function get_sortable_columns() {
return array();
function get_table_classes() {
$classes = parent::get_table_classes();
$classes[] = 'comments-box';
return $classes;
}
function display( $output_empty = false ) {
extract( $this->_args );
?>
<table class="<?php echo implode( ' ', $this->get_table_classes() ); ?>" cellspacing="0" style="display:none;">
<tbody id="the-comment-list"<?php if ( $singular ) echo " class='list:$singular'"; ?>>
<?php if ( ! $output_empty ) $this->display_rows_or_placeholder(); ?>
</tbody>
</table>
<?php
}
}

View File

@ -488,14 +488,8 @@ function post_comment_meta_box($post) {
wp_nonce_field( 'get-comments', 'add_comment_nonce', false );
$wp_list_table = get_list_table('WP_Post_Comments_List_Table');
$wp_list_table->display( true );
?>
<table class="widefat comments-box fixed" cellspacing="0" style="display:none;">
<thead><tr>
<?php $wp_list_table->print_column_headers(); ?>
</tr></thead>
<tbody id="the-comment-list" class="list:comment"></tbody>
</table>
<p class="hide-if-no-js"><a href="#commentstatusdiv" id="show-comments" onclick="commentsBox.get(<?php echo $total; ?>);return false;"><?php _e('Show comments'); ?></a> <img class="waiting" style="display:none;" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" /></p>
<?php
$hidden = get_hidden_meta_boxes('post');

View File

@ -204,7 +204,8 @@ setCommentsList = function() {
}
}
if ( theExtraList.size() == 0 || theExtraList.children().size() == 0 || untrash || unspam ) {
if ( ! theExtraList || theExtraList.size() == 0 || theExtraList.children().size() == 0 || untrash || unspam ) {
return;
}
@ -408,6 +409,7 @@ commentReply = {
send : function() {
var post = {};
$('#replysubmit .error').hide();
$('#replysubmit .waiting').show();
$('#replyrow input').each(function() {
@ -461,7 +463,7 @@ commentReply = {
.animate( { 'backgroundColor':'#CCEEBB' }, 600 )
.animate( { 'backgroundColor': bg }, 600 );
$.fn.wpList.process($(id))
$.fn.wpList.process($(id));
},
error : function(r) {

File diff suppressed because one or more lines are too long

View File

@ -173,7 +173,7 @@ commentsBox = {
'_ajax_nonce' : $('#add_comment_nonce').val(),
'p' : $('#post_ID').val(),
'start' : st,
'num' : num
'number' : num
};
$.post(ajaxurl, data,
@ -187,7 +187,6 @@ commentsBox = {
theList = theExtraList = null;
$("a[className*=':']").unbind();
setCommentsList();
if ( commentsBox.st > commentsBox.total )
$('#show-comments').hide();

File diff suppressed because one or more lines are too long

View File

@ -207,7 +207,7 @@ wpList = {
element = $('#' + s.element);
isClass = element.toggleClass(s.dimClass).is('.' + s.dimClass);
color = wpList.getColor( element );
element.toggleClass( s.dimClass )
element.toggleClass( s.dimClass );
dimColor = isClass ? s.dimAddColor : s.dimDelColor;
if ( 'none' != dimColor ) {
element
@ -323,7 +323,7 @@ wpList = {
process: function(el) {
var list = this,
$el = $(el || document);
$el.delegate( "form[class^=add:" + list.id + ":]", 'submit', function(){
return list.wpList.add(this);
});
@ -331,7 +331,7 @@ wpList = {
$el.delegate( "[class^=add:" + list.id + ":]:not(form)", 'click', function(){
return list.wpList.add(this);
});
$el.delegate( "[class^=delete:" + list.id + ":]", 'click', function(){
return list.wpList.del(this);
});

View File

@ -106,7 +106,7 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array('schedule', 'wp-ajax-response'), '20101004' );
$scripts->add_data( 'autosave', 'group', 1 );
$scripts->add( 'wp-lists', "/wp-includes/js/wp-lists$suffix.js", array('wp-ajax-response'), '20101119' );
$scripts->add( 'wp-lists', "/wp-includes/js/wp-lists$suffix.js", array('wp-ajax-response'), '20101222' );
$scripts->add_data( 'wp-lists', 'group', 1 );
$scripts->add( 'scriptaculous-root', '/wp-includes/js/scriptaculous/wp-scriptaculous.js', array('prototype'), '1.8.3');
@ -312,7 +312,7 @@ function wp_default_scripts( &$scripts ) {
'l10n_print_after' => 'try{convertEntities(listTableL10n);}catch(e){};'
) );
$scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'list-table', 'jquery-ui-resizable', 'quicktags'), '20101220' );
$scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'list-table', 'jquery-ui-resizable', 'quicktags'), '20101222' );
$scripts->add_data( 'admin-comments', 'group', 1 );
$scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']),
@ -325,7 +325,7 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), '20091012' );
$scripts->add_data( 'postbox', 'group', 1 );
$scripts->add( 'post', "/wp-admin/js/post$suffix.js", array('suggest', 'wp-lists', 'postbox'), '20101201' );
$scripts->add( 'post', "/wp-admin/js/post$suffix.js", array('suggest', 'wp-lists', 'postbox'), '20101222' );
$scripts->add_data( 'post', 'group', 1 );
$scripts->localize( 'post', 'postL10n', array(
'tagsUsed' => __('Tags used on this post:'),