Convert the comment reply popup to a temp table row for consistency, add Quick Edit for comments, see #7435
git-svn-id: http://svn.automattic.com/wordpress/trunk@9098 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ae65f5197c
commit
6288b2b867
|
@ -444,7 +444,7 @@ case 'replyto-comment' :
|
|||
$comment_author = $wpdb->escape($user->display_name);
|
||||
$comment_author_email = $wpdb->escape($user->user_email);
|
||||
$comment_author_url = $wpdb->escape($user->user_url);
|
||||
$comment_content = trim($_POST['comment']);
|
||||
$comment_content = trim($_POST['content']);
|
||||
if ( current_user_can('unfiltered_html') ) {
|
||||
if ( wp_create_nonce('unfiltered-html-comment_' . $comment_post_ID) != $_POST['_wp_unfiltered_html_comment'] ) {
|
||||
kses_remove_filters(); // start with a clean slate
|
||||
|
@ -486,6 +486,43 @@ case 'replyto-comment' :
|
|||
'position' => $position
|
||||
));
|
||||
|
||||
$x->send();
|
||||
break;
|
||||
case 'edit-comment' :
|
||||
check_ajax_referer( 'replyto-comment' );
|
||||
|
||||
$comment_post_ID = (int) $_POST['comment_post_ID'];
|
||||
if ( ! current_user_can( 'edit_post', $comment_post_ID ) )
|
||||
die('-1');
|
||||
|
||||
if ( '' == $_POST['content'] )
|
||||
die( __('Error: please type a comment.') );
|
||||
|
||||
$comment_id = (int) $_POST['comment_ID'];
|
||||
$_POST['comment_status'] = $_POST['status'];
|
||||
edit_comment();
|
||||
|
||||
$mode = ( isset($_POST['mode']) && 'single' == $_POST['mode'] ) ? 'single' : 'detail';
|
||||
$position = ( isset($_POST['position']) && (int) $_POST['position']) ? (int) $_POST['position'] : '-1';
|
||||
$checkbox = ( isset($_POST['checkbox']) && true == $_POST['checkbox'] ) ? 1 : 0;
|
||||
|
||||
if ( get_option('show_avatars') && 'single' != $mode )
|
||||
add_filter( 'comment_author', 'floated_admin_avatar' );
|
||||
|
||||
$x = new WP_Ajax_Response();
|
||||
|
||||
ob_start();
|
||||
_wp_comment_row( $comment_id, $mode, false, $checkbox );
|
||||
$comment_list_item = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
$x->add( array(
|
||||
'what' => 'edit_comment',
|
||||
'id' => $comment->comment_ID,
|
||||
'data' => $comment_list_item,
|
||||
'position' => $position
|
||||
));
|
||||
|
||||
$x->send();
|
||||
break;
|
||||
case 'add-meta' :
|
||||
|
|
|
@ -26,7 +26,8 @@ body > #upload-menu {
|
|||
|
||||
div#current-widgets, #postcustomstuff table, #your-profile fieldset,
|
||||
a.page-numbers, #rightnow, div.dashboard-widget,
|
||||
#dashboard-widgets p.dashboard-widget-links, .widefat {
|
||||
#dashboard-widgets p.dashboard-widget-links, .widefat,
|
||||
#replyrow #ed_reply_toolbar input {
|
||||
border-color: #ccc;
|
||||
}
|
||||
|
||||
|
@ -63,7 +64,7 @@ li.widget-list-control-item h4.widget-title a,
|
|||
li.widget-list-control-item, div.nav, .tablenav, #dashboard-widgets p.dashboard-widget-links,
|
||||
.form-table tr, #poststuff h3, #replyhandle,
|
||||
.login form, h3.info-box-title, #post-status-info, #edit-settings-wrap,
|
||||
#wpbody-content .describe tr {
|
||||
#wpbody-content .describe tr, #edithead, #replyhead {
|
||||
background-color: #cfebf7;
|
||||
}
|
||||
|
||||
|
@ -860,7 +861,8 @@ div.star.select:hover {
|
|||
|
||||
/* inline editor */
|
||||
.inline-editor input,
|
||||
.inline-editor textarea {
|
||||
.inline-editor textarea,
|
||||
#replyrow input {
|
||||
border-color: #ddd;
|
||||
}
|
||||
|
||||
|
@ -880,3 +882,8 @@ div.star.select:hover {
|
|||
.inline-editor .quick-edit-save {
|
||||
background-color: #CFEBF7;
|
||||
}
|
||||
|
||||
#replyrow #ed_reply_toolbar input:hover {
|
||||
border-color: #aaa;
|
||||
background: #ddd;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,8 @@ body > #upload-menu {
|
|||
|
||||
div#current-widgets, #postcustomstuff table, #your-profile fieldset,
|
||||
a.page-numbers, #rightnow, div.dashboard-widget,
|
||||
#dashboard-widgets p.dashboard-widget-links, .widefat {
|
||||
#dashboard-widgets p.dashboard-widget-links, .widefat,
|
||||
#replyrow #ed_reply_toolbar input {
|
||||
border-color: #ccc;
|
||||
}
|
||||
|
||||
|
@ -63,7 +64,7 @@ li.widget-list-control-item h4.widget-title a,
|
|||
li.widget-list-control-item, div.nav, .tablenav, #dashboard-widgets p.dashboard-widget-links,
|
||||
.form-table tr, #poststuff h3, #replyhandle,
|
||||
.login form, h3.info-box-title, #post-status-info, #edit-settings-wrap,
|
||||
#wpbody-content .describe tr {
|
||||
#wpbody-content .describe tr, #edithead, #replyhead {
|
||||
background-color: #eaf3fa;
|
||||
}
|
||||
|
||||
|
@ -839,7 +840,8 @@ div.star.select:hover {
|
|||
|
||||
/* inline editor */
|
||||
.inline-editor input,
|
||||
.inline-editor textarea {
|
||||
.inline-editor textarea,
|
||||
#replyrow input {
|
||||
border-color: #ddd;
|
||||
}
|
||||
|
||||
|
@ -859,3 +861,8 @@ div.star.select:hover {
|
|||
.inline-editor .quick-edit-save {
|
||||
background-color: #EAF3FA;
|
||||
}
|
||||
|
||||
#replyrow #ed_reply_toolbar input:hover {
|
||||
border-color: #aaa;
|
||||
background: #ddd;
|
||||
}
|
||||
|
|
|
@ -191,11 +191,11 @@ function _cat_row( $category, $level, $name_override = false ) {
|
|||
* {@internal Missing Short Description}}
|
||||
*
|
||||
* @since 2.7
|
||||
*
|
||||
*
|
||||
* Outputs the HTML for the hidden table rows used in Categories, Link Caregories and Tags quick edit.
|
||||
*
|
||||
* @param string $type "tag", "category" or "link-category"
|
||||
* @return
|
||||
* @return
|
||||
*/
|
||||
function inline_edit_term_row($type) {
|
||||
|
||||
|
@ -259,7 +259,8 @@ function inline_edit_term_row($type) {
|
|||
<div class="quick-edit-save">
|
||||
<a accesskey="c" href="#inline-edit" title="<?php _e('Cancel'); ?>" class="button-secondary cancel"><?php _e('Cancel'); ?></a>
|
||||
<a accesskey="s" href="#inline-edit" title="<?php _e('Save'); ?>" class="button-secondary save"><?php _e('Save'); ?></a>
|
||||
<span class="hidden error"></span>
|
||||
<img class="waiting" style="display:none;" src="images/loading.gif" alt="" />
|
||||
<span class="error" style="display:none;"></span>
|
||||
<?php wp_nonce_field( 'taxinlineeditnonce', '_inline_edit', false ); ?>
|
||||
</div>
|
||||
</td></tr>
|
||||
|
@ -892,8 +893,8 @@ function print_column_headers( $type, $id = true ) {
|
|||
/**
|
||||
* {@internal Missing Short Description}}
|
||||
*
|
||||
* Outputs the quick edit and bulk edit table rows
|
||||
*
|
||||
* Outputs the quick edit and bulk edit table rows for posts and pages
|
||||
*
|
||||
* @since 2.7
|
||||
*
|
||||
* @param string $type 'post' or 'page'
|
||||
|
@ -1129,7 +1130,10 @@ function inline_edit_row( $type ) {
|
|||
<div class="quick-edit-save">
|
||||
<a accesskey="c" href="#inline-edit" title="<?php _e('Cancel'); ?>" class="button-secondary cancel"><?php _e('Cancel'); ?></a>
|
||||
<a accesskey="s" href="#inline-edit" title="<?php _e('Save'); ?>" class="button-secondary save"><?php _e('Save'); ?></a>
|
||||
<?php if ( ! $bulk ) wp_nonce_field( 'inlineeditnonce', '_inline_edit', false ); ?>
|
||||
<?php if ( ! $bulk ) {
|
||||
wp_nonce_field( 'inlineeditnonce', '_inline_edit', false ); ?>
|
||||
<img class="waiting" style="display:none;" src="images/loading.gif" alt="" />
|
||||
<?php } ?>
|
||||
<input type="hidden" name="post_view" value="<?php echo $m; ?>" />
|
||||
</div>
|
||||
</td></tr>
|
||||
|
@ -1140,7 +1144,7 @@ function inline_edit_row( $type ) {
|
|||
<?php
|
||||
}
|
||||
|
||||
// adds hidden fields with the data for use in the inline editor
|
||||
// adds hidden fields with the data for use in the inline editor for posts and pages
|
||||
/**
|
||||
* {@internal Missing Short Description}}
|
||||
*
|
||||
|
@ -1969,8 +1973,15 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true
|
|||
break;
|
||||
case 'comment':
|
||||
echo "<td $attributes>";
|
||||
if ( 'detail' == $mode || 'single' == $mode ) comment_text();
|
||||
|
||||
if ( 'detail' == $mode || 'single' == $mode ) comment_text(); ?>
|
||||
<div id="inline-<?php echo $comment->comment_ID; ?>" class="hidden">
|
||||
<textarea class="comment"><?php echo $comment->comment_content; ?></textarea>
|
||||
<div class="author-email"><?php echo attribute_escape( $comment->comment_author_email ); ?></div>
|
||||
<div class="author"><?php echo attribute_escape( $comment->comment_author ); ?></div>
|
||||
<div class="author-url"><?php echo attribute_escape( $comment->comment_author_url ); ?></div>
|
||||
<div class="comment_status"><?php echo $comment->comment_approved; ?></div>
|
||||
</div>
|
||||
<?php
|
||||
$actions = array();
|
||||
|
||||
if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
|
||||
|
@ -1989,24 +2000,22 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true
|
|||
$actions['spam'] = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1 vim-s vim-destructive' title='" . __( 'Mark this comment as spam' ) . "'>" . __( 'Spam' ) . '</a>';
|
||||
$actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete vim-d vim-destructive'>" . __('Delete') . '</a>';
|
||||
$actions['edit'] = "<a href='comment.php?action=editcomment&c={$comment->comment_ID}' title='" . __('Edit comment') . "'>". __('Edit') . '</a>';
|
||||
$actions['quickedit'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$post->ID.'\',\'edit\');return false;" class="vim-q" title="'.__('Quick Edit').'" href="#">' . __('Quick Edit') . '</a>';
|
||||
if ( 'spam' != $the_comment_status )
|
||||
$actions['reply'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$post->ID.'\',this);return false;" class="vim-r" title="'.__('Reply to this comment').'" href="#">' . __('Reply') . '</a>';
|
||||
$actions['reply'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$post->ID.'\');return false;" class="vim-r" title="'.__('Reply to this comment').'" href="#">' . __('Reply') . '</a>';
|
||||
|
||||
$actions = apply_filters( 'comment_row_actions', $actions, $comment );
|
||||
|
||||
$action_count = count($actions);
|
||||
$i = 0;
|
||||
foreach ( $actions as $action => $link ) {
|
||||
++$i;
|
||||
( $i == $action_count ) ? $sep = '' : $sep = ' | ';
|
||||
// The action before reply shouldn't output a sep
|
||||
if ( 'edit' == $action )
|
||||
$sep = '';
|
||||
// Reply needs a hide-if-no-js span
|
||||
if ( 'reply' == $action )
|
||||
echo "<span class='$action'><span class='hide-if-no-js'> | $link</span>$sep</span>";
|
||||
else
|
||||
echo "<span class='$action'>$link$sep</span>";
|
||||
( ( ('approve' == $action || 'unapprove' == $action) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | ';
|
||||
|
||||
// Reply and quickedit need a hide-if-no-js span
|
||||
if ( 'reply' == $action || 'quickedit' == $action )
|
||||
$action .= ' hide-if-no-js';
|
||||
|
||||
echo "<span class='$action'>$sep$link</span>";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2053,42 +2062,60 @@ function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single')
|
|||
global $current_user;
|
||||
|
||||
// allow plugin to replace the popup content
|
||||
$content = apply_filters( 'wp_comment_reply', '', array('position'=>$position, 'checkbox'=>$checkbox, 'mode'=>$mode) );
|
||||
$content = apply_filters( 'wp_comment_reply', '', array('position' => $position, 'checkbox' => $checkbox, 'mode' => $mode) );
|
||||
|
||||
if ( ! empty($content) ) {
|
||||
echo $content;
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<div id="replyerror" style="display:none;">
|
||||
<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>
|
||||
<button id="back-button" onclick="commentReply.back();" class="button"><?php _e('Go back'); ?></button></p>
|
||||
<form method="get" action=""><table style="display:none;"><tbody id="com-reply">
|
||||
<tr id="replyrow"><td colspan="6">
|
||||
<div id="replyhead" style="display:none;"><?php _e('Reply to Comment'); ?></div>
|
||||
|
||||
<div id="edithead" style="display:none;">
|
||||
<div id="edittitle"><?php _e('Edit Comment'); ?></div>
|
||||
|
||||
<div class="inside">
|
||||
<label for="author"><?php _e('Name') ?></label>
|
||||
<input type="text" name="newcomment_author" size="50" value="" tabindex="101" id="author" />
|
||||
</div>
|
||||
|
||||
<div class="inside">
|
||||
<label for="author-email"><?php _e('E-mail') ?></label>
|
||||
<input type="text" name="newcomment_author_email" size="50" value="" tabindex="102" id="author-email" />
|
||||
</div>
|
||||
|
||||
<div class="inside">
|
||||
<label for="author-url"><?php _e('URL') ?></label>
|
||||
<input type="text" id="author-url" name="newcomment_author_url" size="103" value="" tabindex="103" />
|
||||
</div>
|
||||
<div style="clear:both;"></div>
|
||||
</div>
|
||||
|
||||
<div id="replydiv" style="display:none;">
|
||||
<p id="replyhandle"><?php _e('Reply'); ?></p>
|
||||
<form action="" method="post" id="replyform">
|
||||
<div id="replycontainer"><textarea rows="8" cols="40" name="replycontent" tabindex="104" id="replycontent"></textarea></div>
|
||||
|
||||
<p id="replysubmit">
|
||||
<a href="#comments-form" class="cancel button" tabindex="106"><?php _e('Cancel'); ?></a>
|
||||
<a href="#comments-form" class="save button" tabindex="105">
|
||||
<span id="savebtn" style="display:none;"><?php _e('Save'); ?></span>
|
||||
<span id="replybtn" style="display:none;"><?php _e('Submit Reply'); ?></span></a>
|
||||
<img class="waiting" style="display:none;" src="images/loading.gif" alt="" />
|
||||
<span class="error" style="display:none;"></span>
|
||||
</p>
|
||||
|
||||
<input type="hidden" name="user_ID" id="user_ID" value="<?php echo $current_user->ID; ?>" />
|
||||
<input type="hidden" name="action" value="replyto-comment" />
|
||||
<input type="hidden" name="action" id="action" value="" />
|
||||
<input type="hidden" name="comment_ID" id="comment_ID" value="" />
|
||||
<input type="hidden" name="comment_post_ID" id="comment_post_ID" value="" />
|
||||
<input type="hidden" name="status" id="status" value="" />
|
||||
<input type="hidden" name="position" id="position" value="<?php echo $position; ?>" />
|
||||
<input type="hidden" name="checkbox" id="checkbox" value="<?php echo $checkbox ? 1 : 0; ?>" />
|
||||
<input type="hidden" name="mode" id="mode" value="<?php echo $mode; ?>" />
|
||||
<?php wp_nonce_field( 'replyto-comment', '_ajax_nonce', false ); ?>
|
||||
<?php wp_comment_form_unfiltered_html_nonce(); ?>
|
||||
|
||||
<?php echo apply_filters( 'wp_comment_reply_content', '
|
||||
<div id="replycontainer"><textarea rows="5" cols="40" name="replycontent" tabindex="1000" id="replycontent"></textarea></div>
|
||||
'); ?>
|
||||
|
||||
<p id="replysubmit"><input type="button" onclick="commentReply.close();" class="button" tabindex="1002" value="<?php _e('Cancel'); ?>" />
|
||||
<input type="button" onclick="commentReply.send();" class="button" tabindex="1001" value="<?php _e('Submit Reply'); ?>" /></p>
|
||||
</form>
|
||||
</div>
|
||||
</td></tr>
|
||||
</tbody></table></form>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
@ -2986,7 +3013,7 @@ function find_posts_div($found_action = '') {
|
|||
|
||||
/**
|
||||
* Display the post password.
|
||||
*
|
||||
*
|
||||
* The password is passed through {@link attribute_escape()} to ensure that it
|
||||
* is safe for placing in an html attribute.
|
||||
*
|
||||
|
@ -3023,13 +3050,13 @@ function favorite_actions() {
|
|||
|
||||
/**
|
||||
* Get the post title.
|
||||
*
|
||||
*
|
||||
* The post title is fetched and if it is blank then a default string is
|
||||
* returned.
|
||||
*
|
||||
* @since 2.7.0
|
||||
* @param int $id The post id. If not supplied the global $post is used.
|
||||
*
|
||||
*
|
||||
*/
|
||||
function _draft_or_post_title($post_id = 0)
|
||||
{
|
||||
|
@ -3041,16 +3068,16 @@ function _draft_or_post_title($post_id = 0)
|
|||
|
||||
/**
|
||||
* Display the search query.
|
||||
*
|
||||
*
|
||||
* A simple wrapper to display the "s" parameter in a GET URI. This function
|
||||
* should only be used when {@link the_search_query()} cannot.
|
||||
*
|
||||
* @uses attribute_escape
|
||||
* @since 2.7.0
|
||||
*
|
||||
*
|
||||
*/
|
||||
function _admin_search_query() {
|
||||
echo ( isset($_GET['s']) ) ? attribute_escape( stripslashes( $_GET['s'] ) ) : '';
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -29,7 +29,7 @@ setCommentsList = function() {
|
|||
a.html( n.toString() );
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
var delAfter = function( r, settings ) {
|
||||
$('li span.comment-count').each( function() {
|
||||
var a = $(this);
|
||||
|
@ -67,17 +67,18 @@ setCommentsList = function() {
|
|||
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();
|
||||
};
|
||||
|
||||
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(){
|
||||
|
@ -86,77 +87,140 @@ $(document).ready(function(){
|
|||
|
||||
commentReply = {
|
||||
|
||||
open : function(c, p) {
|
||||
var d = $('#comment-'+c).offset(), H = $('#replydiv').height(), top = 200, left = 100, h = 120;
|
||||
init : function() {
|
||||
this.rows = $('#the-comment-list tr');
|
||||
var row = $('#replyrow');
|
||||
|
||||
if ( d && H ) {
|
||||
top = (d.top - H) < 10 ? 10 : d.top - H - 5;
|
||||
left = d.left;
|
||||
}
|
||||
$('a.cancel', row).click(function() { return commentReply.revert(); });
|
||||
$('a.save', row).click(function() { return commentReply.send(this); });
|
||||
|
||||
$('#replydiv #comment_post_ID').val(p);
|
||||
$('#replydiv #comment_ID').val(c);
|
||||
// add events
|
||||
this.addEvents(this.rows);
|
||||
|
||||
$('#replydiv').draggable({
|
||||
handle : '#replyhandle',
|
||||
containment : '#wpwrap'
|
||||
}).resizable({
|
||||
handles : 'se',
|
||||
minHeight : 200,
|
||||
minWidth : 400,
|
||||
containment : '#wpwrap',
|
||||
resize : function(e,o) {
|
||||
h = o.size.height - 80 - $('#ed_reply_qtags').height();
|
||||
$('#replycontainer').height(h);
|
||||
},
|
||||
stop : function(e,o) {
|
||||
if ( $.browser.msie )
|
||||
$('#replycontent').height(h);
|
||||
}
|
||||
$('#doaction, #doaction2, #post-query-submit').click(function(e){
|
||||
if ( $('#the-comment-list #replyrow').length > 0 )
|
||||
t.close();
|
||||
});
|
||||
|
||||
$('.ui-resizable-se').css({
|
||||
border: '0 none',
|
||||
width: '11px',
|
||||
height: '12px',
|
||||
background: 'transparent url(images/se.png) no-repeat scroll 0 0'
|
||||
},
|
||||
|
||||
addEvents : function(r) {
|
||||
r.each(function() {
|
||||
$(this).dblclick(function(){
|
||||
commentReply.toggle(this);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
toggle : function(el) {
|
||||
if ( $(el).css('display') != 'none' )
|
||||
$(el).find('a.vim-q').click();
|
||||
},
|
||||
|
||||
revert : function() {
|
||||
|
||||
if ( $('#the-comment-list #replyrow').length < 1 )
|
||||
return false;
|
||||
|
||||
$('#replyrow').fadeOut('fast', function(){
|
||||
commentReply.close();
|
||||
});
|
||||
|
||||
$('#replydiv').css({
|
||||
'position' : 'absolute',
|
||||
'top' : top,
|
||||
'left' : left
|
||||
}).show();
|
||||
|
||||
$('#replycontent').focus().keyup(function(e){
|
||||
if (e.which == 27) commentReply.close(); // close on Escape
|
||||
});
|
||||
|
||||
// emulate the Safari/Opera scrollIntoView
|
||||
var to = $('#replydiv').offset();
|
||||
var scr = document.documentElement.scrollTop ? document.documentElement.scrollTop : 0;
|
||||
|
||||
if ( scr - 20 > to.top )
|
||||
window.scroll(0, to.top - 100);
|
||||
return false;
|
||||
},
|
||||
|
||||
close : function() {
|
||||
$(this.o).fadeIn('fast').css('backgroundColor', '');
|
||||
$('#com-reply').append( $('#replyrow') );
|
||||
$('#replycontent').val('');
|
||||
$('#replyerror').hide();
|
||||
$('#edithead input').val('');
|
||||
$('#replysubmit .error').html('').hide();
|
||||
$('#replysubmit .waiting').hide();
|
||||
if ( $.browser.msie )
|
||||
$('#replycontainer, #replycontent').css('height', '120px');
|
||||
else
|
||||
$('#replycontainer').resizable('destroy').css('height', '120px');
|
||||
},
|
||||
|
||||
open : function(id, p, a) {
|
||||
var t = this;
|
||||
t.close();
|
||||
t.o = '#comment-'+id;
|
||||
|
||||
$('#replyrow td').attr('colspan', $('.widefat tfoot th:visible').length);
|
||||
var editRow = $('#replyrow'), rowData = $('#inline-'+id);
|
||||
var act = t.act = (a == 'edit') ? 'edit-comment' : 'replyto-comment';
|
||||
|
||||
$('#action', editRow).val(act);
|
||||
$('#comment_post_ID', editRow).val(p);
|
||||
$('#comment_ID', editRow).val(id);
|
||||
|
||||
if ( a == 'edit' ) {
|
||||
$('#author', editRow).val( $('div.author', rowData).text() );
|
||||
$('#author-email', editRow).val( $('div.author-email', rowData).text() );
|
||||
$('#author-url', editRow).val( $('div.author-url', rowData).text() );
|
||||
$('#status', editRow).val( $('div.comment_status', rowData).text() );
|
||||
$('#replycontent', editRow).val( $('textarea.comment', rowData).val() );
|
||||
$('#edithead, #savebtn', editRow).show();
|
||||
$('#replyhead, #replybtn', editRow).hide();
|
||||
|
||||
var h = $(t.o).height();
|
||||
if ( h > 220 )
|
||||
if ( $.browser.msie )
|
||||
$('#replycontainer, #replycontent', editRow).height(h-105);
|
||||
else
|
||||
$('#replycontainer', editRow).height(h-105);
|
||||
|
||||
$(t.o).after(editRow.hide()).fadeOut('fast', function(){
|
||||
$('#replyrow').fadeIn('fast');
|
||||
});
|
||||
} else {
|
||||
$('#edithead, #savebtn', editRow).hide();
|
||||
$('#replyhead, #replybtn', editRow).show();
|
||||
$(t.o).after(editRow).animate( { backgroundColor: '#eefee7' }, 800);
|
||||
$('#replyrow').hide().fadeIn('fast');
|
||||
}
|
||||
|
||||
if ( ! $.browser.msie )
|
||||
$('#replycontainer').resizable({
|
||||
handles : 's',
|
||||
axis : 'y',
|
||||
minHeight : 80,
|
||||
stop : function() {
|
||||
$('#replycontainer').width('auto');
|
||||
}
|
||||
});
|
||||
|
||||
setTimeout(function() {
|
||||
var rtop = $('#replyrow').offset().top;
|
||||
var rbottom = rtop + $('#replyrow').height();
|
||||
var scrollTop = window.pageYOffset || document.documentElement.scrollTop;
|
||||
var vp = document.documentElement.clientHeight || self.innerHeight || 0;
|
||||
var scrollBottom = scrollTop + vp;
|
||||
|
||||
if ( scrollBottom - 20 < rbottom )
|
||||
window.scroll(0, rbottom - vp + 35);
|
||||
else if ( rtop - 20 < scrollTop )
|
||||
window.scroll(0, rtop - 35);
|
||||
|
||||
$('#replycontent').focus().keyup(function(e){
|
||||
if (e.which == 27) commentReply.revert(); // close on Escape
|
||||
});
|
||||
}, 600);
|
||||
|
||||
$('#replydiv').draggable('destroy').resizable('destroy').css('position','relative');
|
||||
$('#replydiv').hide();
|
||||
return false;
|
||||
},
|
||||
|
||||
send : function() {
|
||||
var post = {};
|
||||
|
||||
$('#replyform input').each(function() {
|
||||
$('#replysubmit .waiting').show();
|
||||
|
||||
$('#replyrow input').each(function() {
|
||||
post[ $(this).attr('name') ] = $(this).val();
|
||||
});
|
||||
|
||||
post.comment = $('#replycontent').val();
|
||||
post.content = $('#replycontent').val();
|
||||
post.id = post.comment_post_ID;
|
||||
|
||||
$.ajax({
|
||||
|
@ -166,72 +230,63 @@ commentReply = {
|
|||
success : function(x) { commentReply.show(x); },
|
||||
error : function(r) { commentReply.error(r); }
|
||||
});
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
show : function(xml) {
|
||||
|
||||
if ( typeof(xml) == 'string' ) {
|
||||
this.error({'responseText': xml});
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
var r = wpAjax.parseAjaxResponse(xml);
|
||||
if ( r.errors )
|
||||
if ( r.errors ) {
|
||||
this.error({'responseText': wpAjax.broken});
|
||||
|
||||
r = r.responses[0];
|
||||
this.close();
|
||||
// var scr1 = $('#the-comment-list').offset(), scr2 = $('#the-comment-list').height();
|
||||
|
||||
if ( r.position == -1 ) {
|
||||
// window.scroll(0, scr1.top - 100); // Scroll to the new comment? Seems annoing..
|
||||
$('#the-comment-list').prepend(r.data);
|
||||
} else {
|
||||
// window.scroll(0, scr1.top + scr2 + 200);
|
||||
$('#the-comment-list').append(r.data);
|
||||
return false;
|
||||
}
|
||||
|
||||
$('#comment-'+r.id+' .hide-if-no-js').removeClass('hide-if-no-js');
|
||||
if ( 'edit-comment' == this.act )
|
||||
$(this.o).remove();
|
||||
|
||||
$('#comment-'+r.id)
|
||||
r = r.responses[0];
|
||||
var c = r.data;
|
||||
|
||||
$(c).hide()
|
||||
$('#replyrow').after(c);
|
||||
this.o = id = '#comment-'+r.id;
|
||||
$(id+' .hide-if-no-js').removeClass('hide-if-no-js');
|
||||
this.revert();
|
||||
this.addEvents($(id));
|
||||
|
||||
$(id)
|
||||
.animate( { backgroundColor:"#CCEEBB" }, 600 )
|
||||
.animate( { backgroundColor:"transparent" }, 600 );
|
||||
|
||||
|
||||
theList = theExtraList = null;
|
||||
$("#get-extra-comments, a[className*=':']").unbind();
|
||||
setCommentsList();
|
||||
|
||||
},
|
||||
|
||||
error : function(r) {
|
||||
var er = r.statusText;
|
||||
|
||||
$('#replysubmit .waiting').hide();
|
||||
|
||||
if ( r.responseText )
|
||||
er = r.responseText.replace( /<.[^<>]*?>/g, '' );
|
||||
|
||||
if ( er ) {
|
||||
var o = $('#replydiv').offset();
|
||||
$('#replydiv').hide();
|
||||
if ( er )
|
||||
$('#replysubmit .error').html(er).show();
|
||||
|
||||
$('#replyerror').css({
|
||||
'top' : o.top + 60 + 'px',
|
||||
'left' : o.left + 'px'
|
||||
}).show().draggable();
|
||||
|
||||
$('#replyerrtext').html(er)
|
||||
$('#close-button').css('outline','none').focus().keyup(function(e) {
|
||||
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(){
|
||||
columns.init('comment');
|
||||
commentReply.init();
|
||||
|
||||
if ( typeof QTags != 'undefined' )
|
||||
ed_reply = new QTags('ed_reply', 'replycontent', 'replycontainer', 'more');
|
||||
|
@ -239,7 +294,7 @@ $(document).ready(function(){
|
|||
if ( typeof $.table_hotkeys != 'undefined' ) {
|
||||
var make_hotkeys_redirect = function(which) {
|
||||
return function() {
|
||||
var first_last = 'next' == which? 'first' : 'last';
|
||||
var first_last = 'next' == which? 'first' : 'last';
|
||||
var l=$('.'+which+'.page-numbers');
|
||||
if (l.length)
|
||||
window.location = l[0].href.replace(/\&hotkeys_highlight_(first|last)=1/g, '')+'&hotkeys_highlight_'+first_last+'=1';
|
||||
|
@ -259,7 +314,7 @@ $(document).ready(function(){
|
|||
$('form#comments-form')[0].submit();
|
||||
}
|
||||
};
|
||||
$.table_hotkeys($('table.widefat'),['a', 'u', 's', 'd', 'r', ['e', edit_comment],
|
||||
$.table_hotkeys($('table.widefat'),['a', 'u', 's', 'd', 'r', 'q', ['e', edit_comment],
|
||||
['shift+a', make_bulk('approve')], ['shift+s', make_bulk('markspam')],
|
||||
['shift+d', make_bulk('delete')], ['shift+x', toggle_all]],
|
||||
{highlight_first: adminCommentsL10n.hotkeys_highlight_first, highlight_last: adminCommentsL10n.hotkeys_highlight_last,
|
||||
|
|
|
@ -186,7 +186,7 @@ inlineEditPost = {
|
|||
if( typeof(id) == 'object' )
|
||||
id = this.getId(id);
|
||||
|
||||
$('#edit-'+id+'.quick-edit-save').append('<img style="padding:0 15px;" src="images/loading.gif" alt="" />');
|
||||
$('table.widefat .quick-edit-save .waiting').show();
|
||||
|
||||
var params = {
|
||||
action: 'inline-save',
|
||||
|
@ -225,6 +225,8 @@ inlineEditPost = {
|
|||
var id;
|
||||
|
||||
if ( id = $('table.widefat tr.inline-editor').attr('id') ) {
|
||||
$('table.widefat .quick-edit-save .waiting').hide();
|
||||
|
||||
if ( 'bulk-edit' == id ) {
|
||||
$('table.widefat #bulk-edit').removeClass('inline-editor').hide();
|
||||
$('#bulk-titles').html('');
|
||||
|
|
|
@ -90,7 +90,7 @@ inlineEditTax = {
|
|||
if( typeof(id) == 'object' )
|
||||
id = this.getId(id);
|
||||
|
||||
$('#edit-'+id+'.quick-edit-save').append('<img style="padding:0 15px;" src="images/loading.gif" alt="" />');
|
||||
$('table.widefat .quick-edit-save .waiting').show();
|
||||
|
||||
var params = {
|
||||
action: 'inline-save-tax',
|
||||
|
@ -126,6 +126,7 @@ inlineEditTax = {
|
|||
var id = $('table.widefat tr.inline-editor').attr('id');
|
||||
|
||||
if ( id ) {
|
||||
$('table.widefat .quick-edit-save .waiting').hide();
|
||||
$('#'+id).remove();
|
||||
id = id.substr( id.lastIndexOf('-') + 1 );
|
||||
$(this.what+id).show();
|
||||
|
|
|
@ -329,8 +329,7 @@ textarea.all-options, input.all-options {
|
|||
padding: 2px 4px;
|
||||
}
|
||||
|
||||
#ed_toolbar input,
|
||||
#ed_reply_toolbar input {
|
||||
#ed_toolbar input {
|
||||
margin: 3px 2px 2px;
|
||||
padding: 2px 4px;
|
||||
line-height: 18px;
|
||||
|
@ -514,15 +513,6 @@ p.pagenav {
|
|||
margin-top: 0;
|
||||
}
|
||||
|
||||
.column-comment {
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.column-author,
|
||||
.column-response {
|
||||
width: 20%;
|
||||
}
|
||||
|
||||
.column-author img {
|
||||
float: left;
|
||||
margin-right: 10px;
|
||||
|
@ -1960,49 +1950,84 @@ a.togbox {
|
|||
}
|
||||
|
||||
/* reply to comments */
|
||||
#replydiv {
|
||||
width: 700px;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
padding: 2px;
|
||||
left: 20px;
|
||||
top: 200px;
|
||||
z-index: 100;
|
||||
#replyrow {
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
#replydiv #editorcontainer {
|
||||
#replyrow input {
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
}
|
||||
|
||||
#replyrow td {
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
#replyrow #editorcontainer {
|
||||
border: 0 none;
|
||||
}
|
||||
|
||||
#replysubmit {
|
||||
margin: 0;
|
||||
padding: 3px 5px;
|
||||
padding: 5px;
|
||||
border-top-width: 1px;
|
||||
border-top-style: solid;
|
||||
}
|
||||
|
||||
#replysubmit .button,
|
||||
#replyerror .button {
|
||||
#replysubmit img.waiting,
|
||||
.quick-edit-save img.waiting {
|
||||
padding: 0 10px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
#replysubmit .button {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
#replydiv #editor-toolbar {
|
||||
#replyrow #editor-toolbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#replydiv #replyhandle {
|
||||
cursor: move;
|
||||
margin: 0;
|
||||
font-size: 14px;
|
||||
#replyhead {
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
padding: 7px;
|
||||
padding: 2px 10px 4px;
|
||||
}
|
||||
|
||||
#edithead #edittitle {
|
||||
float: left;
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
height: 20px;
|
||||
line-height: 19px;
|
||||
margin: 0 4px 0 0;
|
||||
padding: 4px 10px;
|
||||
}
|
||||
|
||||
#edithead .inside {
|
||||
float: left;
|
||||
margin: 0 4px 2px 0;
|
||||
padding: 3px 0 2px;
|
||||
text-align: center;
|
||||
width: 260px;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
#edithead .inside input {
|
||||
width: 200px;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
#edithead label {
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
#replycontainer {
|
||||
padding: 6px;
|
||||
padding: 5px;
|
||||
border: 0 none;
|
||||
height: 100%;
|
||||
height: 120px;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#replycontent {
|
||||
|
@ -2014,34 +2039,23 @@ a.togbox {
|
|||
line-height: 150%;
|
||||
border: 0 none;
|
||||
outline: none;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
#ed_reply_toolbar {
|
||||
#replyrow #ed_reply_toolbar {
|
||||
margin: 0;
|
||||
padding: 2px 4px;
|
||||
padding: 2px 3px;
|
||||
}
|
||||
|
||||
#replyerror {
|
||||
border-width: 5px;
|
||||
border-style: solid;
|
||||
position: absolute;
|
||||
padding: 15px 15px 10px;
|
||||
width: 500px;
|
||||
z-index: 1000;
|
||||
display: none;
|
||||
}
|
||||
|
||||
#replyerror img {
|
||||
float: right;
|
||||
margin: 15px;
|
||||
}
|
||||
|
||||
#replyerror p.submit {
|
||||
padding: 10px 0 0;
|
||||
}
|
||||
|
||||
#replyerror .error {
|
||||
margin: 15px 0 0;
|
||||
#replyrow #ed_reply_toolbar input {
|
||||
margin: 1px 2px 1px 1px;
|
||||
min-width: 26px;
|
||||
padding: 3px 4px;
|
||||
font-size: 12px;
|
||||
-moz-border-radius: 3px;
|
||||
-khtml-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
/* show/hide settings */
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
}
|
||||
};
|
||||
var first_row = get_first_row();
|
||||
if (!first_row.length) return;
|
||||
if (!first_row.length) return;
|
||||
if (opts.highlight_first)
|
||||
set_current_row(first_row);
|
||||
else if (opts.highlight_last)
|
||||
|
@ -83,7 +83,7 @@
|
|||
jQuery.hotkeys.add(key, opts.hotkeys_opts, make_key_callback('.'+opts.class_prefix+key));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
$.table_hotkeys.current_row = null;
|
||||
$.table_hotkeys.defaults = {cycle_expr: 'tr', class_prefix: 'vim-', selected_suffix: 'current',
|
||||
|
|
|
@ -158,7 +158,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', 'quicktags', 'columns', 'settings-box'), '20080925' );
|
||||
$scripts->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists', 'jquery-ui-resizable', 'quicktags', 'columns', 'settings-box'), '20081007' );
|
||||
$scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
|
||||
'pending' => __('%i% pending'), // must look like: "# blah blah"
|
||||
'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']),
|
||||
|
@ -242,12 +242,13 @@ function wp_default_scripts( &$scripts ) {
|
|||
|
||||
$scripts->add( 'theme-preview', '/wp-admin/js/theme-preview.js', array( 'thickbox', 'jquery' ), '20080625' );
|
||||
|
||||
$scripts->add( 'inline-edit-post', '/wp-admin/js/inline-edit-post.js', array( 'jquery', 'jquery-form', 'suggest' ), '20080930' );
|
||||
$scripts->add( 'inline-edit-post', '/wp-admin/js/inline-edit-post.js', array( 'jquery', 'jquery-form', 'suggest' ), '20081007' );
|
||||
$scripts->localize( 'inline-edit-post', 'inlineEditL10n', array(
|
||||
'edit' => __('Double-click to edit')
|
||||
'edit' => __('Double-click to edit'),
|
||||
'error' => __('Error while saving the changes.')
|
||||
) );
|
||||
|
||||
$scripts->add( 'inline-edit-tax', '/wp-admin/js/inline-edit-tax.js', array( 'jquery', 'jquery-form' ), '20081003' );
|
||||
$scripts->add( 'inline-edit-tax', '/wp-admin/js/inline-edit-tax.js', array( 'jquery', 'jquery-form' ), '20081007' );
|
||||
$scripts->localize( 'inline-edit-tax', 'inlineEditL10n', array(
|
||||
'edit' => __('Double-click to edit'),
|
||||
'error' => __('Error while saving the changes.')
|
||||
|
|
Loading…
Reference in New Issue