Add opt-in optioon for comment hotkeys. Props nbachiyski. fixes #7643
git-svn-id: http://svn.automattic.com/wordpress/trunk@9217 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
72577aacd8
commit
ae2c4bc50c
|
@ -12,7 +12,7 @@ require_once('admin.php');
|
||||||
$title = __('Edit Comments');
|
$title = __('Edit Comments');
|
||||||
wp_enqueue_script( 'admin-comments' );
|
wp_enqueue_script( 'admin-comments' );
|
||||||
wp_enqueue_script( 'admin-forms' );
|
wp_enqueue_script( 'admin-forms' );
|
||||||
wp_enqueue_script( 'jquery-table-hotkeys' );
|
enqueue_comment_hotkeys_js();
|
||||||
|
|
||||||
if ( ( isset( $_POST['delete_all_spam'] ) || isset( $_POST['delete_all_spam2'] ) ) && !empty( $_POST['pagegen_timestamp'] ) ) {
|
if ( ( isset( $_POST['delete_all_spam'] ) || isset( $_POST['delete_all_spam2'] ) ) && !empty( $_POST['pagegen_timestamp'] ) ) {
|
||||||
check_admin_referer('bulk-spam-delete');
|
check_admin_referer('bulk-spam-delete');
|
||||||
|
|
|
@ -95,7 +95,7 @@ wp($query_str);
|
||||||
|
|
||||||
if ( is_singular() ) {
|
if ( is_singular() ) {
|
||||||
wp_enqueue_script( 'admin-comments' );
|
wp_enqueue_script( 'admin-comments' );
|
||||||
wp_enqueue_script( 'jquery-table-hotkeys' );
|
enqueue_comment_hotkeys_js();
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once('admin-header.php'); ?>
|
require_once('admin-header.php'); ?>
|
||||||
|
|
|
@ -77,7 +77,7 @@ 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( 'admin-comments' );
|
||||||
wp_enqueue_script( 'jquery-table-hotkeys' );
|
enqueue_comment_hotkeys_js();
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once('admin-header.php');
|
require_once('admin-header.php');
|
||||||
|
|
|
@ -151,6 +151,11 @@ function floated_admin_avatar( $name ) {
|
||||||
return "$avatar $name";
|
return "$avatar $name";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function enqueue_comment_hotkeys_js() {
|
||||||
|
if ( 'true' == get_user_option( 'comment_shortcuts' ) )
|
||||||
|
wp_enqueue_script( 'jquery-table-hotkeys' );
|
||||||
|
}
|
||||||
|
|
||||||
if ( is_admin() && ('edit-comments.php' == $pagenow || 'edit.php' == $pagenow) ) {
|
if ( is_admin() && ('edit-comments.php' == $pagenow || 'edit.php' == $pagenow) ) {
|
||||||
if ( get_option('show_avatars') )
|
if ( get_option('show_avatars') )
|
||||||
add_filter( 'comment_author', 'floated_admin_avatar' );
|
add_filter( 'comment_author', 'floated_admin_avatar' );
|
||||||
|
|
|
@ -98,6 +98,8 @@ function edit_user( $user_id = 0 ) {
|
||||||
else
|
else
|
||||||
$user->rich_editing = 'true';
|
$user->rich_editing = 'true';
|
||||||
|
|
||||||
|
$user->comment_shortcuts = isset( $_POST['comment_shortcuts'] )? $_POST['comment_shortcuts'] : '';
|
||||||
|
|
||||||
$user->use_ssl = 0;
|
$user->use_ssl = 0;
|
||||||
if ( !empty($_POST['use_ssl']) )
|
if ( !empty($_POST['use_ssl']) )
|
||||||
$user->use_ssl = 1;
|
$user->use_ssl = 1;
|
||||||
|
|
|
@ -320,7 +320,8 @@ $(document).ready(function(){
|
||||||
};
|
};
|
||||||
$.table_hotkeys($('table.widefat'),['a', 'u', 's', 'd', 'r', ['e', edit_comment],
|
$.table_hotkeys($('table.widefat'),['a', 'u', 's', 'd', 'r', ['e', edit_comment],
|
||||||
['shift+a', make_bulk('approve')], ['shift+s', make_bulk('markspam')],
|
['shift+a', make_bulk('approve')], ['shift+s', make_bulk('markspam')],
|
||||||
['shift+d', make_bulk('delete')], ['shift+x', toggle_all]],
|
['shift+d', make_bulk('delete')], ['shift+x', toggle_all],
|
||||||
|
['shift+u', make_bulk('unapprove')]],
|
||||||
{highlight_first: adminCommentsL10n.hotkeys_highlight_first, highlight_last: adminCommentsL10n.hotkeys_highlight_last,
|
{highlight_first: adminCommentsL10n.hotkeys_highlight_first, highlight_last: adminCommentsL10n.hotkeys_highlight_last,
|
||||||
prev_page_link_cb: make_hotkeys_redirect('prev'), next_page_link_cb: make_hotkeys_redirect('next')}
|
prev_page_link_cb: make_hotkeys_redirect('prev'), next_page_link_cb: make_hotkeys_redirect('next')}
|
||||||
);
|
);
|
||||||
|
|
|
@ -140,7 +140,7 @@ case 'edit':
|
||||||
wp_enqueue_script('media-upload');
|
wp_enqueue_script('media-upload');
|
||||||
wp_enqueue_script('word-count');
|
wp_enqueue_script('word-count');
|
||||||
wp_enqueue_script( 'admin-comments' );
|
wp_enqueue_script( 'admin-comments' );
|
||||||
wp_enqueue_script( 'jquery-table-hotkeys' );
|
enqueue_comment_hotkeys_js();
|
||||||
|
|
||||||
if ( current_user_can('edit_post', $post_ID) ) {
|
if ( current_user_can('edit_post', $post_ID) ) {
|
||||||
if ( $last = wp_check_post_lock( $post->ID ) ) {
|
if ( $last = wp_check_post_lock( $post->ID ) ) {
|
||||||
|
|
|
@ -140,7 +140,7 @@ if ( isset($_GET['detached']) ) {
|
||||||
|
|
||||||
if ( is_singular() ) {
|
if ( is_singular() ) {
|
||||||
wp_enqueue_script( 'admin-comments' );
|
wp_enqueue_script( 'admin-comments' );
|
||||||
wp_enqueue_script( 'jquery-table-hotkeys' );
|
enqueue_comment_hotkeys_js();
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once('admin-header.php'); ?>
|
require_once('admin-header.php'); ?>
|
||||||
|
|
|
@ -220,6 +220,10 @@ foreach ( $_wp_admin_css_colors as $color => $color_info ): ?>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</fieldset></td>
|
</fieldset></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row"><?php _e( 'Keyboard Shortcuts' ); ?></th>
|
||||||
|
<td><label for="comment_shortcuts"><input type="checkbox" name="comment_shortcuts" id="comment_shortcuts" value="true" <?php checked('true', $profileuser->comment_shortcuts); ?> /> <?php _e( 'Enable keyboard shortcuts for comment moderation. <a href="http://codex.wordpress.org/Keyboard_Shortcuts">More information</a>' ); ?></label></td>
|
||||||
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
endif;
|
endif;
|
||||||
do_action('personal_options', $profileuser);
|
do_action('personal_options', $profileuser);
|
||||||
|
|
|
@ -154,6 +154,9 @@ function wp_insert_user($userdata) {
|
||||||
if ( empty($rich_editing) )
|
if ( empty($rich_editing) )
|
||||||
$rich_editing = 'true';
|
$rich_editing = 'true';
|
||||||
|
|
||||||
|
if ( empty($comment_shortcuts) )
|
||||||
|
$comment_shortcuts = 'false';
|
||||||
|
|
||||||
if ( empty($admin_color) )
|
if ( empty($admin_color) )
|
||||||
$admin_color = 'fresh';
|
$admin_color = 'fresh';
|
||||||
$admin_color = preg_replace('|[^a-z0-9 _.\-@]|i', '', $admin_color);
|
$admin_color = preg_replace('|[^a-z0-9 _.\-@]|i', '', $admin_color);
|
||||||
|
@ -183,6 +186,7 @@ function wp_insert_user($userdata) {
|
||||||
update_usermeta( $user_id, 'aim', $aim );
|
update_usermeta( $user_id, 'aim', $aim );
|
||||||
update_usermeta( $user_id, 'yim', $yim );
|
update_usermeta( $user_id, 'yim', $yim );
|
||||||
update_usermeta( $user_id, 'rich_editing', $rich_editing);
|
update_usermeta( $user_id, 'rich_editing', $rich_editing);
|
||||||
|
update_usermeta( $user_id, 'comment_shortcuts', $comment_shortcuts);
|
||||||
update_usermeta( $user_id, 'admin_color', $admin_color);
|
update_usermeta( $user_id, 'admin_color', $admin_color);
|
||||||
update_usermeta( $user_id, 'use_ssl', $use_ssl);
|
update_usermeta( $user_id, 'use_ssl', $use_ssl);
|
||||||
|
|
||||||
|
|
|
@ -155,7 +155,7 @@ function wp_default_scripts( &$scripts ) {
|
||||||
'good' => __('Medium'),
|
'good' => __('Medium'),
|
||||||
'strong' => __('Strong')
|
'strong' => __('Strong')
|
||||||
) );
|
) );
|
||||||
$scripts->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists', 'jquery-ui-resizable', 'quicktags', 'columns', 'settings-box'), '20081014' );
|
$scripts->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists', 'jquery-ui-resizable', 'quicktags', 'columns', 'settings-box'), '20081016' );
|
||||||
$scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
|
$scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
|
||||||
'pending' => __('%i% pending'), // must look like: "# blah blah"
|
'pending' => __('%i% pending'), // must look like: "# blah blah"
|
||||||
'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']),
|
'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']),
|
||||||
|
@ -435,4 +435,4 @@ add_filter( 'wp_print_scripts', 'wp_just_in_time_script_localization' );
|
||||||
add_filter( 'print_scripts_array', 'wp_prototype_before_jquery' );
|
add_filter( 'print_scripts_array', 'wp_prototype_before_jquery' );
|
||||||
|
|
||||||
add_action( 'wp_default_styles', 'wp_default_styles' );
|
add_action( 'wp_default_styles', 'wp_default_styles' );
|
||||||
add_filter( 'style_loader_src', 'wp_style_loader_src', 10, 2 );
|
add_filter( 'style_loader_src', 'wp_style_loader_src', 10, 2 );
|
||||||
|
|
Loading…
Reference in New Issue