Fix comment manipulation on edit post screen. Props garyc40. fixes #15876
git-svn-id: https://develop.svn.wordpress.org/trunk@17113 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
84dfe07aa9
commit
9f9f401c42
|
@ -625,9 +625,6 @@ case 'replyto-comment' :
|
||||||
|
|
||||||
set_current_screen( 'edit-comments' );
|
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'];
|
$comment_post_ID = (int) $_POST['comment_post_ID'];
|
||||||
if ( !current_user_can( 'edit_post', $comment_post_ID ) )
|
if ( !current_user_can( 'edit_post', $comment_post_ID ) )
|
||||||
die('-1');
|
die('-1');
|
||||||
|
@ -674,6 +671,11 @@ case 'replyto-comment' :
|
||||||
require_once( ABSPATH . 'wp-admin/includes/dashboard.php' );
|
require_once( ABSPATH . 'wp-admin/includes/dashboard.php' );
|
||||||
_wp_dashboard_recent_comments_row( $comment );
|
_wp_dashboard_recent_comments_row( $comment );
|
||||||
} else {
|
} 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 );
|
$wp_list_table->single_row( $comment );
|
||||||
}
|
}
|
||||||
$comment_list_item = ob_get_contents();
|
$comment_list_item = ob_get_contents();
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1373,7 +1373,30 @@ table.fixed {
|
||||||
#comments-form .fixed .column-author {
|
#comments-form .fixed .column-author {
|
||||||
width: 20%;
|
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 {
|
.sorting-indicator {
|
||||||
display: none;
|
display: none;
|
||||||
width: 7px;
|
width: 7px;
|
||||||
|
@ -3426,6 +3449,7 @@ span.imgedit-scale-warn {
|
||||||
#replysubmit {
|
#replysubmit {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 3px 7px;
|
padding: 3px 7px;
|
||||||
|
text-align:center;
|
||||||
}
|
}
|
||||||
|
|
||||||
#replysubmit img.waiting,
|
#replysubmit img.waiting,
|
||||||
|
@ -3439,6 +3463,13 @@ span.imgedit-scale-warn {
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#replysubmit .error {
|
||||||
|
color:red;
|
||||||
|
line-height:21px;
|
||||||
|
text-align:center;
|
||||||
|
vertical-align:center;
|
||||||
|
}
|
||||||
|
|
||||||
#replyrow #editor-toolbar {
|
#replyrow #editor-toolbar {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,8 @@ class WP_Comments_List_Table extends WP_List_Table {
|
||||||
add_filter( 'comment_author', 'floated_admin_avatar' );
|
add_filter( 'comment_author', 'floated_admin_avatar' );
|
||||||
|
|
||||||
parent::WP_List_Table( array(
|
parent::WP_List_Table( array(
|
||||||
'plural' => 'comments'
|
'plural' => 'comments',
|
||||||
|
'singular' => 'comment',
|
||||||
) );
|
) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +68,11 @@ class WP_Comments_List_Table extends WP_List_Table {
|
||||||
|
|
||||||
$page = $this->get_pagenum();
|
$page = $this->get_pagenum();
|
||||||
|
|
||||||
|
if ( isset( $_REQUEST['start'] ) ) {
|
||||||
|
$start = $_REQUEST['start'];
|
||||||
|
} else {
|
||||||
$start = ( $page - 1 ) * $comments_per_page;
|
$start = ( $page - 1 ) * $comments_per_page;
|
||||||
|
}
|
||||||
|
|
||||||
if ( $doing_ajax && isset( $_REQUEST['offset'] ) ) {
|
if ( $doing_ajax && isset( $_REQUEST['offset'] ) ) {
|
||||||
$start += $_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 {
|
class WP_Post_Comments_List_Table extends WP_Comments_List_Table {
|
||||||
|
|
||||||
function get_columns() {
|
function get_column_info() {
|
||||||
return array(
|
$this->_column_headers = array(
|
||||||
|
array(
|
||||||
'author' => __( 'Author' ),
|
'author' => __( 'Author' ),
|
||||||
'comment' => _x( 'Comment', 'column name' ),
|
'comment' => _x( 'Comment', 'column name' ),
|
||||||
|
),
|
||||||
|
array(),
|
||||||
|
array(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
return $this->_column_headers;
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_sortable_columns() {
|
function get_table_classes() {
|
||||||
return array();
|
$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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -488,14 +488,8 @@ function post_comment_meta_box($post) {
|
||||||
wp_nonce_field( 'get-comments', 'add_comment_nonce', false );
|
wp_nonce_field( 'get-comments', 'add_comment_nonce', false );
|
||||||
|
|
||||||
$wp_list_table = get_list_table('WP_Post_Comments_List_Table');
|
$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>
|
<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
|
<?php
|
||||||
$hidden = get_hidden_meta_boxes('post');
|
$hidden = get_hidden_meta_boxes('post');
|
||||||
|
|
|
@ -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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -408,6 +409,7 @@ commentReply = {
|
||||||
send : function() {
|
send : function() {
|
||||||
var post = {};
|
var post = {};
|
||||||
|
|
||||||
|
$('#replysubmit .error').hide();
|
||||||
$('#replysubmit .waiting').show();
|
$('#replysubmit .waiting').show();
|
||||||
|
|
||||||
$('#replyrow input').each(function() {
|
$('#replyrow input').each(function() {
|
||||||
|
@ -461,7 +463,7 @@ commentReply = {
|
||||||
.animate( { 'backgroundColor':'#CCEEBB' }, 600 )
|
.animate( { 'backgroundColor':'#CCEEBB' }, 600 )
|
||||||
.animate( { 'backgroundColor': bg }, 600 );
|
.animate( { 'backgroundColor': bg }, 600 );
|
||||||
|
|
||||||
$.fn.wpList.process($(id))
|
$.fn.wpList.process($(id));
|
||||||
},
|
},
|
||||||
|
|
||||||
error : function(r) {
|
error : function(r) {
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -173,7 +173,7 @@ commentsBox = {
|
||||||
'_ajax_nonce' : $('#add_comment_nonce').val(),
|
'_ajax_nonce' : $('#add_comment_nonce').val(),
|
||||||
'p' : $('#post_ID').val(),
|
'p' : $('#post_ID').val(),
|
||||||
'start' : st,
|
'start' : st,
|
||||||
'num' : num
|
'number' : num
|
||||||
};
|
};
|
||||||
|
|
||||||
$.post(ajaxurl, data,
|
$.post(ajaxurl, data,
|
||||||
|
@ -187,7 +187,6 @@ commentsBox = {
|
||||||
|
|
||||||
theList = theExtraList = null;
|
theList = theExtraList = null;
|
||||||
$("a[className*=':']").unbind();
|
$("a[className*=':']").unbind();
|
||||||
setCommentsList();
|
|
||||||
|
|
||||||
if ( commentsBox.st > commentsBox.total )
|
if ( commentsBox.st > commentsBox.total )
|
||||||
$('#show-comments').hide();
|
$('#show-comments').hide();
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -207,7 +207,7 @@ wpList = {
|
||||||
element = $('#' + s.element);
|
element = $('#' + s.element);
|
||||||
isClass = element.toggleClass(s.dimClass).is('.' + s.dimClass);
|
isClass = element.toggleClass(s.dimClass).is('.' + s.dimClass);
|
||||||
color = wpList.getColor( element );
|
color = wpList.getColor( element );
|
||||||
element.toggleClass( s.dimClass )
|
element.toggleClass( s.dimClass );
|
||||||
dimColor = isClass ? s.dimAddColor : s.dimDelColor;
|
dimColor = isClass ? s.dimAddColor : s.dimDelColor;
|
||||||
if ( 'none' != dimColor ) {
|
if ( 'none' != dimColor ) {
|
||||||
element
|
element
|
||||||
|
|
|
@ -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( 'autosave', "/wp-includes/js/autosave$suffix.js", array('schedule', 'wp-ajax-response'), '20101004' );
|
||||||
$scripts->add_data( 'autosave', 'group', 1 );
|
$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_data( 'wp-lists', 'group', 1 );
|
||||||
|
|
||||||
$scripts->add( 'scriptaculous-root', '/wp-includes/js/scriptaculous/wp-scriptaculous.js', array('prototype'), '1.8.3');
|
$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){};'
|
'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->add_data( 'admin-comments', 'group', 1 );
|
||||||
$scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
|
$scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
|
||||||
'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']),
|
'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( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), '20091012' );
|
||||||
$scripts->add_data( 'postbox', 'group', 1 );
|
$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->add_data( 'post', 'group', 1 );
|
||||||
$scripts->localize( 'post', 'postL10n', array(
|
$scripts->localize( 'post', 'postL10n', array(
|
||||||
'tagsUsed' => __('Tags used on this post:'),
|
'tagsUsed' => __('Tags used on this post:'),
|
||||||
|
|
Loading…
Reference in New Issue