Changeset 8277

Show
Ignore:
Timestamp:
07/07/08 22:49:52 (5 months ago)
Author:
mdawaffe
Message:

crazyhorse: let's try a spam list in edit-comments.php too

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/crazyhorse/wp-admin/admin-ajax.php

    r8242 r8277  
    136136        die('-1'); 
    137137 
    138     if ( 'unapproved' == wp_get_comment_status($comment->comment_ID) ) { 
     138    if ( in_array( wp_get_comment_status($comment->comment_ID), array( 'unapproved', 'spam' ) ) ) { 
    139139        check_ajax_referer( "approve-comment_$id" ); 
    140140        if ( wp_set_comment_status( $comment->comment_ID, 'approve' ) ) 
  • branches/crazyhorse/wp-admin/css/global.css

    r8222 r8277  
    111111 
    112112.subsubsub li { display: inline; margin: 0; padding: 0; } 
     113 
     114/* make it small? */ 
     115.subsubsub li.spam { 
     116    font-size: .9em; 
     117} 
    113118 
    114119.widefat { 
  • branches/crazyhorse/wp-admin/edit-comments.php

    r8146 r8277  
    9696$status_links = array(); 
    9797$num_comments = wp_count_comments(); 
    98 $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')); 
     98$stati = array( 
     99        '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>"), 
     100        'approved' => _c('Approved|plural'), 
     101        '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>") 
     102    ); 
    99103$class = ( '' === $comment_status ) ? ' class="current"' : ''; 
    100104$status_links[] = "<li><a href=\"edit-comments.php\"$class>".__('Show All Comments')."</a>"; 
     
    105109        $class = ' class="current"'; 
    106110 
    107     $status_links[] = "<li><a href=\"edit-comments.php?comment_status=$status\"$class>" . $label . '</a>'; 
     111 
     112    $status_links[] = "<li class='$status'><a href=\"edit-comments.php?comment_status=$status\"$class>$label</a>"; 
    108113} 
    109114 
     
    167172<select name="action"> 
    168173<option value="" selected>Actions</option> 
    169 <?php if ( 'approved' != $comment_status ): ?> 
     174<?php if ( 'approved' == $comment_status ): ?> 
     175<option value="unapprove"><?php _e('Unapprove'); ?></option> 
     176<?php else : ?> 
    170177<option value="approve"><?php _e('Approve'); ?> 
    171178<?php endif; ?> 
     179<?php if ( 'spam' != $comment_status ): ?> 
    172180<option value="markspam"><?php _e('Mark as Spam'); ?></option> 
    173 <?php if ( 'moderated' != $comment_status ): ?> 
    174 <option value="unapprove"><?php _e('Unapprove'); ?></option> 
    175181<?php endif; ?> 
    176182<option value="delete"><?php _e('Delete'); ?></option> 
  • branches/crazyhorse/wp-admin/includes/template.php

    r8242 r8277  
    710710    $authordata = get_userdata($post->post_author); 
    711711    $the_comment_status = wp_get_comment_status($comment->comment_ID); 
    712     $class = ('unapproved' == $the_comment_status) ? 'unapproved' : ''; 
    713712 
    714713    if ( current_user_can( 'edit_post', $post->ID ) ) { 
     
    738737 
    739738?> 
    740   <tr id="comment-<?php echo $comment->comment_ID; ?>" class='<?php echo $class; ?>'> 
     739  <tr id="comment-<?php echo $comment->comment_ID; ?>" class='<?php echo $the_comment_status; ?>'> 
    741740<?php if ( $checkbox ) : ?> 
    742741    <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> 
     
    761760        $actions['approve']   = "<a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a> | '; 
    762761        $actions['unapprove'] = "<a href='$unapprove_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a> | '; 
    763  
    764         // we're looking at list of only approved or only unapproved comments 
    765         if ( 'moderated' == $comment_status ) { 
    766             $actions['approve'] = "<a href='$approve_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a> | '; 
    767             unset($actions['unapprove']); 
    768         } elseif ( 'approved' == $comment_status ) { 
    769             $actions['unapprove'] = "<a href='$unapprove_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a> | '; 
    770             unset($actions['approve']); 
    771         } 
    772  
    773762        $actions['edit']      = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . __('Edit comment') . "'>". __('Edit') . '</a> | '; 
    774763        $actions['spam']      = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1' title='" . __( 'Mark this comment as spam' ) . "'>" . __( 'Spam' ) . '</a> | '; 
    775764        $actions['delete']    = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete'>" . __('Delete') . '</a>'; 
     765 
     766        if ( $comment_status ) { // not looking at all comments 
     767            if ( 'approved' == $the_comment_status ) { 
     768                $actions['unapprove'] = "<a href='$unapprove_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a> | '; 
     769                unset($actions['approve']); 
     770            } else { 
     771                $actions['approve'] = "<a href='$approve_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a> | '; 
     772                unset($actions['unapprove']); 
     773            } 
     774        } 
     775 
     776        if ( 'spam' == $the_comment_status ) 
     777            unset($actions['spam']); 
     778 
    776779        $actions = apply_filters( 'comment_row_actions', $actions, $comment ); 
     780 
    777781        foreach ( $actions as $action => $link ) 
    778782            echo "<span class='$action'>$link</span>"; 
  • branches/crazyhorse/wp-admin/js/edit-comments.js

    r7462 r8277  
    5656        a.html( n.toString() ); 
    5757    }); 
     58    $('li span.spam-comment-count' ).each( function() { 
     59        var a = $(this); 
     60        var n = parseInt(a.html(),10); 
     61        if ( $(settings.target).parents( 'span.spam' ).size() ) { // we marked a comment as spam 
     62            n = n + 1; 
     63        } else if ( $('#' + settings.element).is('.spam') ) { // we approved or deleted a comment marked as spam 
     64            n = n - 1; 
     65        } 
     66        if ( n < 0 ) { n = 0; } 
     67        a.html( n.toString() ); 
     68    }); 
    5869 
    5970    if ( theExtraList.size() == 0 || theExtraList.children().size() == 0 ) { 
  • branches/crazyhorse/wp-admin/wp-admin.css

    r8271 r8277  
    247247} 
    248248 
    249 .unapproved .approve
     249.unapproved .approve, .spam .approve
    250250    display: inline; 
    251251}