Merge crazyhorse management pages. see #7552

git-svn-id: https://develop.svn.wordpress.org/trunk@8682 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2008-08-20 04:06:36 +00:00
parent ce083ccfaf
commit f284661233
12 changed files with 366 additions and 212 deletions

View File

@@ -10,11 +10,10 @@
require_once('admin.php');
$title = __('Edit Comments');
$parent_file = 'edit-comments.php';
wp_enqueue_script( 'admin-comments' );
wp_enqueue_script('admin-forms');
if ( !empty( $_REQUEST['delete_comments'] ) ) {
if ( !empty( $_REQUEST['delete_comments'] ) && isset($_REQUEST['action']) ) {
check_admin_referer('bulk-comments');
$comments_deleted = $comments_approved = $comments_unapproved = $comments_spammed = 0;
@@ -23,16 +22,16 @@ if ( !empty( $_REQUEST['delete_comments'] ) ) {
$post_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = %d", $comment) );
if ( !current_user_can('edit_post', $post_id) )
continue;
if ( !empty( $_REQUEST['spamit'] ) ) {
if ( $_REQUEST['action'] == 'markspam' ) {
wp_set_comment_status($comment, 'spam');
$comments_spammed++;
} elseif ( !empty( $_REQUEST['deleteit'] ) ) {
} elseif ( $_REQUEST['action'] == 'delete' ) {
wp_set_comment_status($comment, 'delete');
$comments_deleted++;
} elseif ( !empty( $_REQUEST['approveit'] ) ) {
} elseif ( $_REQUEST['action'] == 'approve' ) {
wp_set_comment_status($comment, 'approve');
$comments_approved++;
} elseif ( !empty( $_REQUEST['unapproveit'] ) ) {
} elseif ( $_REQUEST['action'] == 'unapprove' ) {
wp_set_comment_status($comment, 'hold');
$comments_unapproved++;
}
@@ -106,7 +105,11 @@ if ( isset( $_GET['approved'] ) || isset( $_GET['deleted'] ) || isset( $_GET['sp
<?php
$status_links = array();
$num_comments = wp_count_comments();
$stati = array('moderated' => sprintf(__ngettext('Awaiting Moderation (%s)', 'Awaiting Moderation (%s)', number_format_i18n($num_comments->moderated) ), "<span class='comment-count'>" . number_format_i18n($num_comments->moderated) . "</span>"), 'approved' => _c('Approved|plural'));
$stati = array(
'moderated' => sprintf(__ngettext('Awaiting Moderation (%s)', 'Awaiting Moderation (%s)', number_format_i18n($num_comments->moderated) ), "<span class='comment-count'>" . number_format_i18n($num_comments->moderated) . "</span>"),
'approved' => _c('Approved|plural'),
'spam' => sprintf(__ngettext('Spam (%s)', 'Spam (%s)', number_format_i18n($num_comments->spam) ), "<span class='spam-comment-count'>" . number_format_i18n($num_comments->spam) . "</span>")
);
$class = ( '' === $comment_status ) ? ' class="current"' : '';
$status_links[] = "<li><a href=\"edit-comments.php\"$class>".__('Show All Comments')."</a>";
foreach ( $stati as $status => $label ) {
@@ -115,7 +118,8 @@ foreach ( $stati as $status => $label ) {
if ( $status == $comment_status )
$class = ' class="current"';
$status_links[] = "<li><a href=\"edit-comments.php?comment_status=$status\"$class>" . $label . '</a>';
$status_links[] = "<li class='$status'><a href=\"edit-comments.php?comment_status=$status\"$class>$label</a>";
}
$status_links = apply_filters( 'comment_status_links', $status_links );
@@ -135,10 +139,12 @@ unset($status_links);
<input type="hidden" name="comment_status" value="<?php echo $comment_status; ?>" />
</form>
<!-- crazyhorse
<ul class="view-switch">
<li <?php if ( 'detail' == $mode ) echo "class='current'" ?>><a href="<?php echo clean_url(add_query_arg('mode', 'detail', $_SERVER['REQUEST_URI'])) ?>"><?php _e('Detail View') ?></a></li>
<li <?php if ( 'list' == $mode ) echo "class='current'" ?>><a href="<?php echo clean_url(add_query_arg('mode', 'list', $_SERVER['REQUEST_URI'])) ?>"><?php _e('List View') ?></a></li>
</ul>
-->
<?php
@@ -175,16 +181,21 @@ if ( $page_links )
?>
<div class="alignleft">
<?php if ( 'approved' != $comment_status ): ?>
<input type="submit" value="<?php _e('Approve'); ?>" name="approveit" class="button-secondary" />
<select name="action">
<option value="" selected>Actions</option>
<?php if ( 'approved' == $comment_status ): ?>
<option value="unapprove"><?php _e('Unapprove'); ?></option>
<?php else : ?>
<option value="approve"><?php _e('Approve'); ?>
<?php endif; ?>
<input type="submit" value="<?php _e('Mark as Spam'); ?>" name="spamit" class="button-secondary" />
<?php if ( 'moderated' != $comment_status ): ?>
<input type="submit" value="<?php _e('Unapprove'); ?>" name="unapproveit" class="button-secondary" />
<?php if ( 'spam' != $comment_status ): ?>
<option value="markspam"><?php _e('Mark as Spam'); ?></option>
<?php endif; ?>
<input type="submit" value="<?php _e('Delete'); ?>" name="deleteit" class="button-secondary delete" />
<option value="delete"><?php _e('Delete'); ?></option>
</select>
<?php do_action('manage_comments_nav', $comment_status); ?>
<?php wp_nonce_field('bulk-comments'); ?>
<input type="submit" name="doaction" value="Apply" class="button-secondary apply" />
<?php if ( isset($_GET['apage']) ) { ?>
<input type="hidden" name="apage" value="<?php echo absint( $_GET['apage'] ); ?>" />
<?php } ?>
@@ -202,9 +213,10 @@ if ($comments) {
<thead>
<tr>
<th scope="col" class="check-column"><input type="checkbox" /></th>
<th scope="col"><?php _e('Comment') ?></th>
<th scope="col"><?php _e('Date') ?></th>
<th scope="col" class="action-links"><?php _e('Actions') ?></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('Comment Submitted') ?></th>
<th scope="col" class="response-column"><?php _e('In Response To This Post') ?></th>
</tr>
</thead>
<tbody id="the-comment-list" class="list:comment">