Reply to comments from admin, small improvements and fixes, see #7435
git-svn-id: http://svn.automattic.com/wordpress/trunk@8767 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d927db8f2d
commit
01a8c764b3
|
@ -780,3 +780,18 @@ table.diff .diff-addedline ins {
|
|||
#show-settings.show-settings-opened {
|
||||
border-bottom-color: #14568A;
|
||||
}
|
||||
|
||||
#replydiv {
|
||||
border-color: #EBEBEB #CCC #CCC #EBEBEB;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
#replysubmit {
|
||||
background-color: #EAF3FA;
|
||||
border-top-color: #ddd;
|
||||
}
|
||||
|
||||
#replyerror {
|
||||
border-color: #ddd;
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
|
|
|
@ -763,3 +763,18 @@ table.diff .diff-addedline ins {
|
|||
#show-settings.show-settings-opened {
|
||||
border-bottom-color: #E4F2FD;
|
||||
}
|
||||
|
||||
#replydiv {
|
||||
border-color: #EBEBEB #CCC #CCC #EBEBEB;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
#replysubmit {
|
||||
background-color: #EAF3FA;
|
||||
border-top-color: #ddd;
|
||||
}
|
||||
|
||||
#replyerror {
|
||||
border-color: #ddd;
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ require_once('admin.php');
|
|||
$title = __('Edit Comments');
|
||||
wp_enqueue_script( 'admin-comments' );
|
||||
wp_enqueue_script( 'admin-forms' );
|
||||
wp_enqueue_script( 'quicktags' );
|
||||
|
||||
if ( !empty( $_REQUEST['delete_comments'] ) && isset($_REQUEST['action']) ) {
|
||||
check_admin_referer('bulk-comments');
|
||||
|
|
|
@ -333,7 +333,7 @@ add_meta_box('commentstatusdiv', __('Comments on this Post'), 'post_comment_stat
|
|||
function post_password_meta_box($post) {
|
||||
?>
|
||||
<p>
|
||||
<input id="post_status_private" name="post_status" type="checkbox" value="private" <?php checked($post->post_status, 'private'); ?> tabindex="4" /> <?php _e('Keep this post private') ?></label>
|
||||
<label for="post_status_private2" class="selectit"><input id="post_status_private2" name="post_status" type="checkbox" value="private" <?php checked($post->post_status, 'private'); ?> tabindex="4" /> <?php _e('Keep this post private') ?></label>
|
||||
</p>
|
||||
<h4><?php _e( 'Post Password' ); ?></h4>
|
||||
<p><label class="hidden" for="post_password"><?php _e('Password Protect This Post') ?></label><input name="post_password" type="text" size="25" id="post_password" value="<?php echo attribute_escape( $post->post_password ); ?>" /></p>
|
||||
|
|
|
@ -299,7 +299,7 @@ if ( current_user_can('publish_pages') OR ( $post->post_status == 'publish' AND
|
|||
</select>
|
||||
</p>
|
||||
<?php if ( current_user_can( 'publish_posts' ) ) : ?>
|
||||
<p><label for="post_status_private" class="selectit"><input id="post_status_private" name="post_status" type="checkbox" value="private" <?php checked($post->post_status, 'private'); ?> tabindex='4' /> <?php _e('Keep this page private') ?></label></p>
|
||||
<p><label for="post_status_private2" class="selectit"><input id="post_status_private2" name="post_status" type="checkbox" value="private" <?php checked($post->post_status, 'private'); ?> tabindex='4' /> <?php _e('Keep this page private') ?></label></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<h5><?php _e('Related') ?></h5>
|
||||
|
|
|
@ -53,10 +53,8 @@ wp_enqueue_script('admin-forms');
|
|||
|
||||
list($post_stati, $avail_post_stati) = wp_edit_posts_query();
|
||||
|
||||
if ( 1 == count($posts) && is_singular() ) {
|
||||
if ( 1 == count($posts) && is_singular() )
|
||||
wp_enqueue_script( 'admin-comments' );
|
||||
wp_enqueue_script( 'quicktags' );
|
||||
}
|
||||
|
||||
require_once('admin-header.php');
|
||||
|
||||
|
|
|
@ -1081,7 +1081,8 @@ function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single')
|
|||
<img src="images/logo.gif" />
|
||||
<h3 class="info-box-title"><?php _e('Comment Reply Error'); ?></h3>
|
||||
<p id="replyerrtext"></p>
|
||||
<p class="submit"><button id="close-button" onclick="commentReply.close();" class="button"><?php _e('Close'); ?></button></p>
|
||||
<p class="submit"><button id="close-button" onclick="commentReply.close();" class="button"><?php _e('Close'); ?></button>
|
||||
<button id="back-button" onclick="commentReply.back();" class="button"><?php _e('Go back'); ?></button></p>
|
||||
</div>
|
||||
|
||||
<div id="replydiv" style="display:none;">
|
||||
|
@ -1097,7 +1098,9 @@ function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single')
|
|||
<?php wp_nonce_field( 'replyto-comment', '_ajax_nonce', false ); ?>
|
||||
<?php wp_comment_form_unfiltered_html_nonce(); ?>
|
||||
|
||||
<div id="replycontainer"><textarea rows="5" cols="50" name="replycontent" tabindex="10" id="replycontent"></textarea></div>
|
||||
<?php echo apply_filters( 'wp_comment_reply_content', '
|
||||
<div id="replycontainer"><textarea rows="5" cols="40" name="replycontent" tabindex="10" id="replycontent"></textarea></div>
|
||||
'); ?>
|
||||
|
||||
<p id="replysubmit"><input type="button" onclick="commentReply.close();" class="button" value="<?php _e('Cancel'); ?>" />
|
||||
<input type="button" onclick="commentReply.send();" class="button" value="<?php _e('Submit Reply'); ?>" /></p>
|
||||
|
|
|
@ -1,85 +1,91 @@
|
|||
var theList; var theExtraList;
|
||||
jQuery(function($) {
|
||||
(function($) {
|
||||
|
||||
var dimAfter = function( r, settings ) {
|
||||
$('li span.comment-count').each( function() {
|
||||
var a = $(this);
|
||||
var n = parseInt(a.html(),10);
|
||||
n = n + ( $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1 );
|
||||
if ( n < 0 ) { n = 0; }
|
||||
a.html( n.toString() );
|
||||
$('#awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0');
|
||||
});
|
||||
$('.post-com-count span.comment-count').each( function() {
|
||||
var a = $(this);
|
||||
var n = parseInt(a.html(),10);
|
||||
var t = parseInt(a.parent().attr('title'), 10);
|
||||
if ( $('#' + settings.element).is('.unapproved') ) { // we unapproved a formerly approved comment
|
||||
n = n - 1;
|
||||
t = t + 1;
|
||||
} else { // we approved a formerly unapproved comment
|
||||
n = n + 1;
|
||||
t = t - 1;
|
||||
}
|
||||
if ( n < 0 ) { n = 0; }
|
||||
if ( t < 0 ) { t = 0; }
|
||||
if ( t >= 0 ) { a.parent().attr('title', adminCommentsL10n.pending.replace( /%i%/, t.toString() ) ); }
|
||||
if ( 0 === t ) { a.parents('strong:first').replaceWith( a.parents('strong:first').html() ); }
|
||||
a.html( n.toString() );
|
||||
});
|
||||
}
|
||||
|
||||
var delAfter = function( r, settings ) {
|
||||
$('li span.comment-count').each( function() {
|
||||
var a = $(this);
|
||||
var n = parseInt(a.html(),10);
|
||||
if ( $('#' + settings.element).is('.unapproved') ) { // we deleted a formerly unapproved comment
|
||||
n = n - 1;
|
||||
} else if ( $(settings.target).parents( 'span.unapprove' ).size() ) { // we "deleted" an approved comment from the approved list by clicking "Unapprove"
|
||||
n = n + 1;
|
||||
}
|
||||
if ( n < 0 ) { n = 0; }
|
||||
a.html( n.toString() );
|
||||
$('#awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0');
|
||||
});
|
||||
$('.post-com-count span.comment-count').each( function() {
|
||||
var a = $(this);
|
||||
if ( $('#' + settings.element).is('.unapproved') ) { // we deleted a formerly unapproved comment
|
||||
setCommentsList = function() {
|
||||
var dimAfter = function( r, settings ) {
|
||||
$('li span.comment-count').each( function() {
|
||||
var a = $(this);
|
||||
var n = parseInt(a.html(),10);
|
||||
n = n + ( $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1 );
|
||||
if ( n < 0 ) { n = 0; }
|
||||
a.html( n.toString() );
|
||||
$('#awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0');
|
||||
});
|
||||
$('.post-com-count span.comment-count').each( function() {
|
||||
var a = $(this);
|
||||
var n = parseInt(a.html(),10);
|
||||
var t = parseInt(a.parent().attr('title'), 10);
|
||||
if ( t < 1 ) { return; }
|
||||
t = t - 1;
|
||||
a.parent().attr('title', adminCommentsL10n.pending.replace( /%i%/, t.toString() ) );
|
||||
if ( $('#' + settings.element).is('.unapproved') ) { // we unapproved a formerly approved comment
|
||||
n = n - 1;
|
||||
t = t + 1;
|
||||
} else { // we approved a formerly unapproved comment
|
||||
n = n + 1;
|
||||
t = t - 1;
|
||||
}
|
||||
if ( n < 0 ) { n = 0; }
|
||||
if ( t < 0 ) { t = 0; }
|
||||
if ( t >= 0 ) { a.parent().attr('title', adminCommentsL10n.pending.replace( /%i%/, t.toString() ) ); }
|
||||
if ( 0 === t ) { a.parents('strong:first').replaceWith( a.parents('strong:first').html() ); }
|
||||
a.html( n.toString() );
|
||||
});
|
||||
};
|
||||
|
||||
var delAfter = function( r, settings ) {
|
||||
$('li span.comment-count').each( function() {
|
||||
var a = $(this);
|
||||
var n = parseInt(a.html(),10);
|
||||
if ( $('#' + settings.element).is('.unapproved') ) { // we deleted a formerly unapproved comment
|
||||
n = n - 1;
|
||||
} else if ( $(settings.target).parents( 'span.unapprove' ).size() ) { // we "deleted" an approved comment from the approved list by clicking "Unapprove"
|
||||
n = n + 1;
|
||||
}
|
||||
if ( n < 0 ) { n = 0; }
|
||||
a.html( n.toString() );
|
||||
$('#awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0');
|
||||
});
|
||||
$('.post-com-count span.comment-count').each( function() {
|
||||
var a = $(this);
|
||||
if ( $('#' + settings.element).is('.unapproved') ) { // we deleted a formerly unapproved comment
|
||||
var t = parseInt(a.parent().attr('title'), 10);
|
||||
if ( t < 1 ) { return; }
|
||||
t = t - 1;
|
||||
a.parent().attr('title', adminCommentsL10n.pending.replace( /%i%/, t.toString() ) );
|
||||
if ( 0 === t ) { a.parents('strong:first').replaceWith( a.parents('strong:first').html() ); }
|
||||
return;
|
||||
}
|
||||
var n = parseInt(a.html(),10) - 1;
|
||||
a.html( n.toString() );
|
||||
});
|
||||
$('li span.spam-comment-count' ).each( function() {
|
||||
var a = $(this);
|
||||
var n = parseInt(a.html(),10);
|
||||
if ( $(settings.target).parents( 'span.spam' ).size() ) { // we marked a comment as spam
|
||||
n = n + 1;
|
||||
} else if ( $('#' + settings.element).is('.spam') ) { // we approved or deleted a comment marked as spam
|
||||
n = n - 1;
|
||||
}
|
||||
if ( n < 0 ) { n = 0; }
|
||||
a.html( n.toString() );
|
||||
});
|
||||
|
||||
if ( theExtraList.size() == 0 || theExtraList.children().size() == 0 ) {
|
||||
return;
|
||||
}
|
||||
var n = parseInt(a.html(),10) - 1;
|
||||
a.html( n.toString() );
|
||||
});
|
||||
$('li span.spam-comment-count' ).each( function() {
|
||||
var a = $(this);
|
||||
var n = parseInt(a.html(),10);
|
||||
if ( $(settings.target).parents( 'span.spam' ).size() ) { // we marked a comment as spam
|
||||
n = n + 1;
|
||||
} else if ( $('#' + settings.element).is('.spam') ) { // we approved or deleted a comment marked as spam
|
||||
n = n - 1;
|
||||
}
|
||||
if ( n < 0 ) { n = 0; }
|
||||
a.html( n.toString() );
|
||||
});
|
||||
|
||||
if ( theExtraList.size() == 0 || theExtraList.children().size() == 0 ) {
|
||||
return;
|
||||
}
|
||||
theList.get(0).wpList.add( theExtraList.children(':eq(0)').remove().clone() );
|
||||
$('#get-extra-comments').submit();
|
||||
};
|
||||
|
||||
theList.get(0).wpList.add( theExtraList.children(':eq(0)').remove().clone() );
|
||||
$('#get-extra-comments').submit();
|
||||
}
|
||||
|
||||
theExtraList = $('#the-extra-comment-list').wpList( { alt: '', delColor: 'none', addColor: 'none' } );
|
||||
theList = $('#the-comment-list').wpList( { alt: '', dimAfter: dimAfter, delAfter: delAfter, addColor: 'none' } );
|
||||
theExtraList = $('#the-extra-comment-list').wpList( { alt: '', delColor: 'none', addColor: 'none' } );
|
||||
theList = $('#the-comment-list').wpList( { alt: '', dimAfter: dimAfter, delAfter: delAfter, addColor: 'none' } );
|
||||
};
|
||||
|
||||
$(document).ready(function(){
|
||||
setCommentsList();
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
||||
(function($){
|
||||
|
||||
commentReply = {
|
||||
|
@ -92,16 +98,13 @@ commentReply = {
|
|||
left = d.left;
|
||||
}
|
||||
|
||||
$('#replydiv').show();
|
||||
$('#replydiv #comment_post_ID').val(p);
|
||||
$('#replydiv #comment_ID').val(c);
|
||||
|
||||
$('#replydiv').draggable({
|
||||
handle : '#replyhandle',
|
||||
containment : '#wpwrap'
|
||||
});
|
||||
|
||||
$('#replydiv').resizable({
|
||||
}).resizable({
|
||||
handles : 'se',
|
||||
minHeight : 200,
|
||||
minWidth : 400,
|
||||
|
@ -127,7 +130,7 @@ commentReply = {
|
|||
'position' : 'absolute',
|
||||
'top' : top,
|
||||
'left' : left
|
||||
});
|
||||
}).show();
|
||||
|
||||
$('#replycontent').focus().keyup(function(e){
|
||||
if (e.which == 27) commentReply.close(); // close on Escape
|
||||
|
@ -195,6 +198,8 @@ commentReply = {
|
|||
$('#comment-'+r.id)
|
||||
.animate( { backgroundColor:"#CFEBF7" }, 600 )
|
||||
.animate( { backgroundColor:"transparent" }, 600 );
|
||||
|
||||
setCommentsList();
|
||||
},
|
||||
|
||||
error : function(r) {
|
||||
|
@ -217,8 +222,15 @@ commentReply = {
|
|||
if (e.which == 27) commentReply.close(); // close on Escape
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
back : function() {
|
||||
if ( $('#replydiv').is(':hidden') && $('#replyerror').is(':visible') ) {
|
||||
$('#replyerror').hide();
|
||||
$('#replydiv').show();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$(document).ready(function(){
|
||||
if ( typeof QTags != 'undefined' )
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
require_once('admin.php');
|
||||
add_thickbox();
|
||||
wp_enqueue_script( 'media-upload' );
|
||||
wp_enqueue_script( 'quicktags' );
|
||||
|
||||
if (!current_user_can('upload_files'))
|
||||
wp_die(__('You do not have permission to upload files.'));
|
||||
|
|
|
@ -1917,13 +1917,12 @@ p#post-search-prep {
|
|||
/* reply to comments */
|
||||
#replydiv {
|
||||
width: 700px;
|
||||
border-color: #EBEBEB #CCC #CCC #EBEBEB;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
padding: 2px;
|
||||
background-color: #fff;
|
||||
left: 20px;
|
||||
top: 300px;
|
||||
top: 200px;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
#replydiv #editorcontainer {
|
||||
|
@ -1933,8 +1932,13 @@ p#post-search-prep {
|
|||
#replysubmit {
|
||||
margin: 0;
|
||||
padding: 3px 5px;
|
||||
background-color: #EAF3FA;
|
||||
border-top: 1px solid #ddd;
|
||||
border-top-width: 1px;
|
||||
border-top-style: solid;
|
||||
}
|
||||
|
||||
#replysubmit .button,
|
||||
#replyerror .button {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
#replydiv #editor-toolbar {
|
||||
|
@ -1973,8 +1977,8 @@ p#post-search-prep {
|
|||
}
|
||||
|
||||
#replyerror {
|
||||
border: 5px solid #ddd;
|
||||
background-color: #f8f8f8;
|
||||
border-width: 5px;
|
||||
border-style: solid;
|
||||
position: absolute;
|
||||
padding: 15px 15px 10px;
|
||||
width: 500px;
|
||||
|
@ -2028,7 +2032,7 @@ p#post-search-prep {
|
|||
}
|
||||
|
||||
#edit-settings {
|
||||
padding: 28px 0 0;
|
||||
padding: 29px 0 0;
|
||||
margin: 0 0 20px;
|
||||
}
|
||||
|
||||
|
@ -2041,17 +2045,23 @@ p#post-search-prep {
|
|||
#edit-settings-wrap {
|
||||
-moz-border-radius: 4px 0 4px 4px;
|
||||
-khtml-border-radius: 4px;
|
||||
-khtml-border-top-right-radius: 0;
|
||||
-webkit-border-radius: 4px;
|
||||
border-radius: 4px 0 4px 4px;
|
||||
-webkit-border-top-right-radius: 0;
|
||||
border-radius: 4px;
|
||||
border-top-right-radius: 0;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
}
|
||||
|
||||
.show-settings-opened {
|
||||
#show-settings.show-settings-opened {
|
||||
-moz-border-radius: 4px 4px 0 0;
|
||||
-khtml-border-radius: 4px;
|
||||
-webkit-border-radius: 4px;
|
||||
border-radius: 4px 4px 0 0;
|
||||
-webkit-border-bottom-left-radius: 0;
|
||||
-webkit-border-bottom-right-radius: 0;
|
||||
-khtml-border-bottom-left-radius: 0;
|
||||
-khtml-border-bottom-right-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
}
|
||||
|
||||
.metabox-prefs {
|
||||
|
|
|
@ -124,7 +124,7 @@ function wp_default_scripts( &$scripts ) {
|
|||
'good' => __('Medium'),
|
||||
'strong' => __('Strong')
|
||||
) );
|
||||
$scripts->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists', 'jquery-ui-draggable', 'jquery-ui-resizable'), '20080821' );
|
||||
$scripts->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists', 'jquery-ui-draggable', 'jquery-ui-resizable', 'quicktags'), '20080828' );
|
||||
$scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
|
||||
'pending' => __('%i% pending') // must look like: "# blah blah"
|
||||
) );
|
||||
|
|
Loading…
Reference in New Issue