Column hiding for comments. Settings box JS consolidation. Props Viper007Bond. see #7725

git-svn-id: http://svn.automattic.com/wordpress/trunk@8988 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-09-26 01:05:52 +00:00
parent 4bff75f637
commit b10412eab9
18 changed files with 157 additions and 318 deletions

View File

@ -520,11 +520,6 @@ input.readonly {
background: url(../images/xit.gif) no-repeat -10px 0;
}
#the-comment-list .comment a {
border-bottom-color: #ababab;
color: #666;
}
#update-nag, .plugin-update {
background-color: #fffeeb;
border-bottom-color: #ccc;

View File

@ -508,11 +508,6 @@ input.readonly {
background: url(../images/xit.gif) no-repeat -10px 0;
}
#the-comment-list .comment a {
border-bottom-color: #ababab;
color: #666;
}
#update-nag, .plugin-update {
background-color: #fffeeb;
border-bottom-color: #ccc;

View File

@ -96,6 +96,21 @@ if ( isset( $_GET['approved'] ) || isset( $_GET['deleted'] ) || isset( $_GET['sp
}
?>
<div class="wrap">
<form id="adv-settings" action="" method="get">
<div id="show-settings" class="hide-if-no-js"><a href="#edit_settings" id="show-settings-link"><?php _e('Advanced Options') ?></a>
<a href="#edit_settings" id="hide-settings-link" class="hide-if-js"><?php _e('Hide Options') ?></a></div>
<div id="edit-settings" class="hide-if-js hide-if-no-js">
<div id="edit-settings-wrap">
<h5><?php _e('Show on screen') ?></h5>
<div class="metabox-prefs">
<?php manage_columns_prefs('comment') ?>
<br class="clear" />
</div></div>
<?php wp_nonce_field( 'hiddencolumns', 'hiddencolumnsnonce', false ); ?>
</div></form>
<form id="posts-filter" action="" method="get">
<h2><?php _e('Manage Comments'); ?></h2>
@ -209,11 +224,7 @@ if ($comments) {
<table class="widefat">
<thead>
<tr>
<th scope="col" class="check-column"><input type="checkbox" /></th>
<th scope="col" class="comment-column"><?php _e('Comment') ?></th>
<th scope="col" class="author-column"><?php _e('Author') ?></th>
<th scope="col" class="date-column"><?php _e('Submitted') ?></th>
<th scope="col" class="response-column"><?php _e('In Response To This Post') ?></th>
<?php print_column_headers('comment'); ?>
</tr>
</thead>
<tbody id="the-comment-list" class="list:comment">

View File

@ -516,6 +516,16 @@ function get_column_headers($page) {
return wp_manage_posts_columns();
case 'page':
return wp_manage_pages_columns();
case 'comment':
$columns = array(
'cb' => '<input type="checkbox" />',
'comment' => __('Comment'),
'author' => __('Author'),
'date' => __('Submitted'),
'response' => __('In Response To This Post')
);
return apply_filters('manage_comments_columns', $columns);
case 'link':
$columns = array(
'cb' => '<input type="checkbox" />',
@ -1587,15 +1597,29 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true
$unapprove_url = clean_url( wp_nonce_url( "comment.php?action=unapprovecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "unapprove-comment_$comment->comment_ID" ) );
$spam_url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&dt=spam&p=$comment->comment_post_ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) );
?>
<tr id="comment-<?php echo $comment->comment_ID; ?>" class='<?php echo $the_comment_status; ?>'>
<?php if ( $checkbox ) : ?>
<td class="check-column"><?php if ( current_user_can('edit_post', $comment->comment_post_ID) ) { ?><input type="checkbox" name="delete_comments[]" value="<?php echo $comment->comment_ID; ?>" /><?php } ?></td>
<?php endif; ?>
<td class="comment-column">
<?php if ( 'detail' == $mode || 'single' == $mode ) comment_text(); ?>
echo "<tr id='comment-$comment->comment_ID' class='$the_comment_status'>";
$columns = get_column_headers('comment');
$hidden = (array) get_user_option( 'manage-comment-columns-hidden' );
foreach ( $columns as $column_name => $column_display_name ) {
$class = "class=\"$column_name column-$column_name\"";
$style = '';
if ( in_array($column_name, $hidden) )
$style = ' style="display:none;"';
$attributes = "$class$style";
switch ($column_name) {
case 'cb':
if ( !$checkbox ) break;
echo '<th scope="row" class="check-column">';
if ( current_user_can('edit_post', $comment->comment_post_ID) ) echo "<input type='checkbox' name='delete_comments[]' value='$comment->comment_ID' />";
echo '</th>';
break;
case 'comment':
echo "<td $attributes>";
if ( 'detail' == $mode || 'single' == $mode ) comment_text();
<?php
$actions = array();
if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
@ -1634,29 +1658,35 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true
echo "<span class='$action'>$link$sep</span>";
}
}
?>
</td>
<td class="author-column">
<strong><?php comment_author(); ?></strong><br />
<?php if ( !empty($author_url) ) : ?>
<a href="<?php echo $author_url ?>"><?php echo $author_url_display; ?></a><br />
<?php endif; ?>
<?php if ( current_user_can( 'edit_post', $post->ID ) ) : ?>
<?php if ( !empty($comment->comment_author_email) ): ?>
<?php comment_author_email_link() ?><br />
<?php endif; ?>
<a href="edit-comments.php?s=<?php comment_author_IP() ?>&amp;mode=detail"><?php comment_author_IP() ?></a>
<?php endif; //current_user_can?>
</td>
<td class="date-column"><?php comment_date(__('Y/m/d \a\t g:ia')); ?></td>
<?php if ( 'single' !== $mode ) : ?>
<td class="response-column">
"<?php echo $post_link ?>" <?php echo sprintf('(%s comments)', $post->comment_count); ?><br />
<?php echo get_the_time(__('Y/m/d \a\t g:ia')); ?>
</td>
<?php endif; ?>
</tr>
<?php
echo '</td>';
break;
case 'author':
echo "<td $attributes><strong>"; comment_author(); echo '</strong><br />';
if ( !empty($author_url) )
echo "<a href='$author_url'>$author_url_display</a><br />";
if ( current_user_can( 'edit_post', $post->ID ) ) {
if ( !empty($comment->comment_author_email) ) {
comment_author_email_link();
echo '<br />';
}
echo '<a href="edit-comments.php?s=';
comment_author_IP();
echo '&amp;mode=detail">';
comment_author_IP();
echo '</a>';
} //current_user_can
echo '</td>';
break;
case 'date':
echo "<td $attributes>" . get_comment_date(__('Y/m/d \a\t g:ia')) . '</td>';
break;
case 'response':
if ( 'single' !== $mode )
echo "<td $attributes>&quot;$post_link&quot; " . sprintf('(%s comments)', $post->comment_count) . '<br />' . get_the_time(__('Y/m/d \a\t g:ia')) . '</td>';
}
}
echo "</tr>\n";
}
function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single') {
@ -2292,7 +2322,7 @@ function manage_columns_prefs($page) {
foreach ( $columns as $column => $title ) {
// Can't hide these
if ( 'cb' == $column || 'title' == $column || 'name' == $column || 'username' == $column || 'media' == $column )
if ( 'cb' == $column || 'title' == $column || 'name' == $column || 'username' == $column || 'media' == $column || 'comment' == $column )
continue;
if ( empty($title) )
continue;

View File

@ -26,25 +26,4 @@ jQuery(function($) {
} else {
columns.init('category');
}
// Edit Settings
$('#show-settings-link').click(function () {
$('#edit-settings').slideDown('normal', function(){
$('#show-settings-link').hide();
$('#hide-settings-link').show();
});
$('#show-settings').addClass('show-settings-opened');
return false;
});
$('#hide-settings-link').click(function () {
$('#edit-settings').slideUp('normal', function(){
$('#hide-settings-link').hide();
$('#show-settings-link').show();
$('#show-settings').removeClass('show-settings-opened');
});
return false;
});
});

View File

@ -231,6 +231,8 @@ commentReply = {
};
$(document).ready(function(){
columns.init('comment');
if ( typeof QTags != 'undefined' )
ed_reply = new QTags('ed_reply', 'replycontent', 'replycontainer', 'more');

View File

@ -48,25 +48,4 @@ jQuery(document).ready( function($) {
return false;
} );
jQuery('.categorychecklist :checkbox').change( syncChecks ).filter( ':checked' ).change();
// Edit Settings
$('#show-settings-link').click(function () {
$('#edit-settings').slideDown('normal', function(){
$('#show-settings-link').hide();
$('#hide-settings-link').show();
});
$('#show-settings').addClass('show-settings-opened');
return false;
});
$('#hide-settings-link').click(function () {
$('#edit-settings').slideUp('normal', function(){
$('#hide-settings-link').hide();
$('#show-settings-link').show();
$('#show-settings').removeClass('show-settings-opened');
});
return false;
});
});

View File

@ -1,24 +1,3 @@
jQuery(document).ready( function($) {
columns.init('link');
// Edit Settings
$('#show-settings-link').click(function () {
$('#edit-settings').slideDown('normal', function(){
$('#show-settings-link').hide();
$('#hide-settings-link').show();
});
$('#show-settings').addClass('show-settings-opened');
return false;
});
$('#hide-settings-link').click(function () {
$('#edit-settings').slideUp('normal', function(){
$('#hide-settings-link').hide();
$('#show-settings-link').show();
$('#show-settings').removeClass('show-settings-opened');
});
return false;
});
});

View File

@ -1,24 +1,3 @@
jQuery(document).ready( function($) {
columns.init('media');
// Edit Settings
$('#show-settings-link').click(function () {
$('#edit-settings').slideDown('normal', function(){
$('#show-settings-link').hide();
$('#hide-settings-link').show();
});
$('#show-settings').addClass('show-settings-opened');
return false;
});
$('#hide-settings-link').click(function () {
$('#edit-settings').slideUp('normal', function(){
$('#hide-settings-link').hide();
$('#show-settings-link').show();
$('#show-settings').removeClass('show-settings-opened');
});
return false;
});
});

View File

@ -48,27 +48,6 @@ jQuery(document).ready( function($) {
return false;
});
// Edit Settings
$('#show-settings-link').click(function () {
$('#edit-settings').slideDown('normal', function(){
$('#show-settings-link').hide();
$('#hide-settings-link').show();
});
$('#show-settings').addClass('show-settings-opened');
return false;
});
$('#hide-settings-link').click(function () {
$('#edit-settings').slideUp('normal', function(){
$('#hide-settings-link').hide();
$('#show-settings-link').show();
$('#show-settings').removeClass('show-settings-opened');
});
return false;
});
$('.edit-post-status').click(function() {
if ($('#post-status-select').is(":hidden")) {
$('#post-status-select').slideDown("normal");

View File

@ -1,24 +1,3 @@
jQuery(document).ready( function($) {
columns.init('page');
// Edit Settings
$('#show-settings-link').click(function () {
$('#edit-settings').slideDown('normal', function(){
$('#show-settings-link').hide();
$('#hide-settings-link').show();
});
$('#show-settings').addClass('show-settings-opened');
return false;
});
$('#hide-settings-link').click(function () {
$('#edit-settings').slideUp('normal', function(){
$('#hide-settings-link').hide();
$('#show-settings-link').show();
$('#show-settings').removeClass('show-settings-opened');
});
return false;
});
});

View File

@ -192,27 +192,6 @@ jQuery(document).ready( function($) {
return false;
});
// Edit Settings
$('#show-settings-link').click(function () {
$('#edit-settings').slideDown('normal', function(){
$('#show-settings-link').hide();
$('#hide-settings-link').show();
});
$('#show-settings').addClass('show-settings-opened');
return false;
});
$('#hide-settings-link').click(function () {
$('#edit-settings').slideUp('normal', function(){
$('#hide-settings-link').hide();
$('#show-settings-link').show();
$('#show-settings').removeClass('show-settings-opened');
});
return false;
});
// Custom Fields
jQuery('#the-list').wpList( { addAfter: function( xml, s ) {
if ( jQuery.isFunction( autosave_update_post_ID ) ) {

View File

@ -1,24 +1,3 @@
jQuery(document).ready( function($) {
columns.init('post');
// Edit Settings
$('#show-settings-link').click(function () {
$('#edit-settings').slideDown('normal', function(){
$('#show-settings-link').hide();
$('#hide-settings-link').show();
});
$('#show-settings').addClass('show-settings-opened');
return false;
});
$('#hide-settings-link').click(function () {
$('#edit-settings').slideUp('normal', function(){
$('#hide-settings-link').hide();
$('#show-settings-link').show();
$('#show-settings').removeClass('show-settings-opened');
});
return false;
});
});

View File

@ -0,0 +1,21 @@
jQuery(document).ready( function($) {
$('#show-settings-link').click(function () {
$('#edit-settings').slideDown('normal', function(){
$('#show-settings-link').hide();
$('#hide-settings-link').show();
});
$('#show-settings').addClass('show-settings-opened');
return false;
});
$('#hide-settings-link').click(function () {
$('#edit-settings').slideUp('normal', function(){
$('#hide-settings-link').hide();
$('#show-settings-link').show();
$('#show-settings').removeClass('show-settings-opened');
});
return false;
});
});

View File

@ -20,25 +20,4 @@ jQuery(function($) {
$('#the-list').wpList();
columns.init('tag');
// Edit Settings
$('#show-settings-link').click(function () {
$('#edit-settings').slideDown('normal', function(){
$('#show-settings-link').hide();
$('#hide-settings-link').show();
});
$('#show-settings').addClass('show-settings-opened');
return false;
});
$('#hide-settings-link').click(function () {
$('#edit-settings').slideUp('normal', function(){
$('#hide-settings-link').hide();
$('#show-settings-link').show();
$('#show-settings').removeClass('show-settings-opened');
});
return false;
});
});

View File

@ -2,25 +2,4 @@ jQuery( function($) {
$('#users').wpList();
columns.init('user');
// Edit Settings
$('#show-settings-link').click(function () {
$('#edit-settings').slideDown('normal', function(){
$('#show-settings-link').hide();
$('#hide-settings-link').show();
});
$('#show-settings').addClass('show-settings-opened');
return false;
});
$('#hide-settings-link').click(function () {
$('#edit-settings').slideUp('normal', function(){
$('#hide-settings-link').hide();
$('#show-settings-link').show();
$('#show-settings').removeClass('show-settings-opened');
});
return false;
});
});

View File

@ -512,20 +512,20 @@ p.pagenav {
font-weight: bold;
}
.comment-column p {
.column-comment p {
margin-top: 0;
}
.comment-column {
.column-comment {
width: 50%;
}
.author-column,
.response-column {
.column-author,
.column-response {
width: 20%;
}
.author-column img {
.column-author img {
float: left;
margin-right: 10px;
margin-top: 3px;
@ -1665,15 +1665,6 @@ ul.view-switch li.current {
border-top-right-radius: 3px;
}
#the-comment-list .comment a {
padding-bottom: 1px;
text-decoration: none;
border-bottom-width: 1px;
border-bottom-style: solid;
}
#the-comment-list td.comment p.comment-author {
margin-top: 0;
margin-left: 0;
@ -1693,8 +1684,10 @@ ul.view-switch li.current {
}
#the-comment-list td.comment {
/*
width: 65%;
max-width: 460px;
*/
word-wrap: break-word;
}

View File

@ -149,8 +149,8 @@ function wp_default_scripts( &$scripts ) {
'add' => attribute_escape(__('Add')),
'how' => __('Separate multiple categories with commas.')
) );
$scripts->add( 'admin-categories', '/wp-admin/js/categories.js', array('wp-lists', 'columns'), '20071031' );
$scripts->add( 'admin-tags', '/wp-admin/js/tags.js', array('wp-lists', 'columns'), '20080918' );
$scripts->add( 'admin-categories', '/wp-admin/js/categories.js', array('wp-lists', 'columns', 'settings-box'), '20080925' );
$scripts->add( 'admin-tags', '/wp-admin/js/tags.js', array('wp-lists', 'columns', 'settings-box'), '20080925' );
$scripts->add( 'admin-custom-fields', '/wp-admin/js/custom-fields.js', array('wp-lists'), '20070823' );
$scripts->add( 'password-strength-meter', '/wp-admin/js/password-strength-meter.js', array('jquery'), '20080824' );
$scripts->localize( 'password-strength-meter', 'pwsL10n', array(
@ -160,13 +160,13 @@ 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'), '20080905' );
$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->localize( 'admin-comments', 'adminCommentsL10n', array(
'pending' => __('%i% pending'), // must look like: "# blah blah"
'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']),
'hotkeys_highlight_last' => isset($_GET['hotkeys_highlight_last']),
) );
$scripts->add( 'admin-users', '/wp-admin/js/users.js', array('wp-lists', 'columns'), '20080918' );
$scripts->add( 'admin-users', '/wp-admin/js/users.js', array('wp-lists', 'columns', 'settings-box'), '20080925' );
$scripts->add( 'admin-forms', '/wp-admin/js/forms.js', array('jquery'), '20080729');
$scripts->add( 'xfn', '/wp-admin/js/xfn.js', false, '3517' );
$scripts->add( 'upload', '/wp-admin/js/upload.js', array('jquery'), '20070518' );
@ -180,7 +180,7 @@ function wp_default_scripts( &$scripts ) {
'save' => __('Save'),
'cancel' => __('Cancel'),
) );
$scripts->add( 'post', '/wp-admin/js/post.js', array('suggest', 'jquery-ui-tabs', 'wp-lists', 'postbox', 'slug'), '20080701' );
$scripts->add( 'post', '/wp-admin/js/post.js', array('suggest', 'jquery-ui-tabs', 'wp-lists', 'postbox', 'slug', 'settings-box'), '20080925' );
$scripts->localize( 'post', 'postL10n', array(
'tagsUsed' => __('Tags used on this post:'),
'add' => attribute_escape(__('Add')),
@ -189,12 +189,12 @@ function wp_default_scripts( &$scripts ) {
'cancel' => __('Cancel'),
'edit' => __('Edit'),
) );
$scripts->add( 'page', '/wp-admin/js/page.js', array('jquery', 'slug', 'postbox'), '20080318' );
$scripts->add( 'page', '/wp-admin/js/page.js', array('jquery', 'slug', 'postbox', 'settings-box'), '20080925' );
$scripts->localize( 'page', 'postL10n', array(
'cancel' => __('Cancel'),
'edit' => __('Edit'),
) );
$scripts->add( 'link', '/wp-admin/js/link.js', array('jquery-ui-tabs', 'wp-lists', 'postbox'), '20080131' );
$scripts->add( 'link', '/wp-admin/js/link.js', array('jquery-ui-tabs', 'wp-lists', 'postbox', 'settings-box'), '20080925' );
$scripts->add( 'comment', '/wp-admin/js/comment.js', array('postbox'), '20080219' );
$scripts->localize( 'comment', 'commentL10n', array(
'cancel' => __('Cancel'),
@ -263,15 +263,17 @@ function wp_default_scripts( &$scripts ) {
'time' => time()
) );
$scripts->add( 'posts', '/wp-admin/js/posts.js', array('columns'), '20080910' );
$scripts->add( 'pages', '/wp-admin/js/pages.js', array('columns'), '20080910' );
$scripts->add( 'links', '/wp-admin/js/links.js', array('columns'), '20080913' );
$scripts->add( 'media', '/wp-admin/js/media.js', array('columns'), '20080915' );
$scripts->add( 'posts', '/wp-admin/js/posts.js', array('columns', 'settings-box'), '20080925' );
$scripts->add( 'pages', '/wp-admin/js/pages.js', array('columns', 'settings-box'), '20080925' );
$scripts->add( 'links', '/wp-admin/js/links.js', array('columns', 'settings-box'), '20080925' );
$scripts->add( 'media', '/wp-admin/js/media.js', array('columns', 'settings-box'), '20080925' );
$scripts->add( 'columns', '/wp-admin/js/columns.js', false, '20080910' );
$scripts->localize( 'columns', 'columnsL10n', array(
'requestFile' => admin_url('admin-ajax.php'),
) );
$scripts->add( 'settings-box', '/wp-admin/js/settings-box.js', array( 'jquery' ), '20080925' );
}
}