From 01a8c764b31a2a1da0cd8015f54b17fca60a273a Mon Sep 17 00:00:00 2001 From: azaozz Date: Fri, 29 Aug 2008 05:07:40 +0000 Subject: [PATCH] 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 --- wp-admin/css/colors-classic.css | 15 +++ wp-admin/css/colors-fresh.css | 15 +++ wp-admin/edit-comments.php | 1 - wp-admin/edit-form-advanced.php | 2 +- wp-admin/edit-page-form.php | 2 +- wp-admin/edit.php | 4 +- wp-admin/includes/template.php | 7 +- wp-admin/js/edit-comments.js | 168 +++++++++++++++++--------------- wp-admin/upload.php | 1 - wp-admin/wp-admin.css | 36 ++++--- wp-includes/script-loader.php | 2 +- 11 files changed, 152 insertions(+), 101 deletions(-) diff --git a/wp-admin/css/colors-classic.css b/wp-admin/css/colors-classic.css index bd6f88891f..ed75f13afb 100644 --- a/wp-admin/css/colors-classic.css +++ b/wp-admin/css/colors-classic.css @@ -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; +} diff --git a/wp-admin/css/colors-fresh.css b/wp-admin/css/colors-fresh.css index c26a26c2e5..867b6fd4dc 100644 --- a/wp-admin/css/colors-fresh.css +++ b/wp-admin/css/colors-fresh.css @@ -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; +} diff --git a/wp-admin/edit-comments.php b/wp-admin/edit-comments.php index 801abd6808..2a7a30711e 100644 --- a/wp-admin/edit-comments.php +++ b/wp-admin/edit-comments.php @@ -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'); diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php index 258a3f78d2..9bf44ff0c3 100644 --- a/wp-admin/edit-form-advanced.php +++ b/wp-admin/edit-form-advanced.php @@ -333,7 +333,7 @@ add_meta_box('commentstatusdiv', __('Comments on this Post'), 'post_comment_stat function post_password_meta_box($post) { ?>

- post_status, 'private'); ?> tabindex="4" /> +

diff --git a/wp-admin/edit-page-form.php b/wp-admin/edit-page-form.php index 9905b4c397..b48f033ba1 100644 --- a/wp-admin/edit-page-form.php +++ b/wp-admin/edit-page-form.php @@ -299,7 +299,7 @@ if ( current_user_can('publish_pages') OR ( $post->post_status == 'publish' AND

-

+

diff --git a/wp-admin/edit.php b/wp-admin/edit.php index 7422b1b2e1..e0d9965bd1 100644 --- a/wp-admin/edit.php +++ b/wp-admin/edit.php @@ -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'); diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index fdd8450a85..b0be9277bf 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -1081,7 +1081,8 @@ function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single')

-

+

+

+ '); ?>

diff --git a/wp-admin/js/edit-comments.js b/wp-admin/js/edit-comments.js index 8babaa66d0..673c6ada39 100644 --- a/wp-admin/js/edit-comments.js +++ b/wp-admin/js/edit-comments.js @@ -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() ); - }); + + theList.get(0).wpList.add( theExtraList.children(':eq(0)').remove().clone() ); + $('#get-extra-comments').submit(); + }; - if ( theExtraList.size() == 0 || theExtraList.children().size() == 0 ) { - return; - } - - 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' ) diff --git a/wp-admin/upload.php b/wp-admin/upload.php index 4f530953c3..a7946fb12a 100644 --- a/wp-admin/upload.php +++ b/wp-admin/upload.php @@ -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.')); diff --git a/wp-admin/wp-admin.css b/wp-admin/wp-admin.css index fa80c7ff6e..44e18c139c 100644 --- a/wp-admin/wp-admin.css +++ b/wp-admin/wp-admin.css @@ -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 { diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index 7451d3352a..76f620f1ed 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -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" ) );