WordPress.org

Make WordPress Core

Changeset 11731


Ignore:
Timestamp:
07/21/2009 03:11:12 AM (11 years ago)
Author:
azaozz
Message:

"Trash" status for comments, first run, props caesarsgrunt, see #4529

Location:
trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-ajax.php

    r11694 r11731  
    193193        $r = wp_set_comment_status( $comment->comment_ID, 'spam' );
    194194    } else {
    195         $r = wp_delete_comment( $comment->comment_ID );
     195        $r = wp_set_comment_status( $comment->comment_ID, 'delete' );
    196196    }
    197197    if ( $r ) // Decide if we need to send back '1' or a more complicated response including page links and comment counts
  • trunk/wp-admin/comment.php

    r11721 r11731  
    4545        comment_footer_die( __('You are not allowed to edit comments on this post.') );
    4646
     47    if ( 'deleted' == $comment->comment_status )
     48        comment_footer_die( __('This comment has been deleted. Please move it out of the Trash if you want to edit it.') );
     49   
    4750    $comment = get_comment_to_edit( $comment_id );
    4851
  • trunk/wp-admin/css/colors-classic.css

    r11647 r11731  
    5959}
    6060
    61 #poststuff .inside label.spam {
     61#poststuff .inside label.spam,
     62#poststuff .inside label.deleted {
    6263    color: red;
    6364}
  • trunk/wp-admin/css/colors-fresh.css

    r11647 r11731  
    5959}
    6060
    61 #poststuff .inside label.spam {
     61#poststuff .inside label.spam,
     62#poststuff .inside label.deleted {
    6263    color: red;
    6364}
  • trunk/wp-admin/edit-comments.php

    r11660 r11731  
    1515$post_id = isset($_REQUEST['p']) ? (int) $_REQUEST['p'] : 0;
    1616
    17 if ( ( isset( $_REQUEST['delete_all_spam'] ) || isset( $_REQUEST['delete_all_spam2'] ) ) && !empty( $_REQUEST['pagegen_timestamp'] ) ) {
    18     check_admin_referer('bulk-spam-delete', '_spam_nonce');
    19 
    20     $delete_time = $wpdb->escape( $_REQUEST['pagegen_timestamp'] );
    21     if ( current_user_can('moderate_comments')) {
    22         $deleted_spam = $wpdb->query( "DELETE FROM $wpdb->comments WHERE comment_approved = 'spam' AND '$delete_time' > comment_date_gmt" );
    23     } else {
    24         $deleted_spam = 0;
    25     }
    26     $redirect_to = 'edit-comments.php?comment_status=spam&deleted=' . (int) $deleted_spam;
    27     if ( $post_id )
    28         $redirect_to = add_query_arg( 'p', absint( $post_id ), $redirect_to );
    29     wp_redirect( $redirect_to );
    30 } elseif ( isset($_REQUEST['delete_comments']) && isset($_REQUEST['action']) && ( -1 != $_REQUEST['action'] || -1 != $_REQUEST['action2'] ) ) {
     17if ( isset($_REQUEST['doaction']) ||  isset($_REQUEST['doaction2']) || isset($_REQUEST['destroy_all']) || isset($_REQUEST['destroy_all2']) ) {
    3118    check_admin_referer('bulk-comments');
    32     $doaction = ( -1 != $_REQUEST['action'] ) ? $_REQUEST['action'] : $_REQUEST['action2'];
    33 
    34     $deleted = $approved = $unapproved = $spammed = 0;
    35     foreach ( (array) $_REQUEST['delete_comments'] as $comment_id) : // Check the permissions on each
    36         $comment_id = (int) $comment_id;
     19   
     20    if ((isset($_REQUEST['destroy_all']) || isset($_REQUEST['destroy_all2'])) && !empty($_REQUEST['pagegen_timestamp'])) {
     21        $comment_status = $wpdb->escape($_REQUEST['comment_status']);
     22        $delete_time = $wpdb->escape($_REQUEST['pagegen_timestamp']);
     23        $comment_ids = $wpdb->get_col( "SELECT comment_ID FROM $wpdb->comments WHERE comment_approved = '$comment_status' AND '$delete_time' > comment_date_gmt" );
     24        $doaction = 'destroy';
     25    } elseif (($_REQUEST['action'] != -1 || $_REQUEST['action2'] != -1) && isset($_REQUEST['delete_comments'])) {
     26        $comment_ids = $_REQUEST['delete_comments'];
     27        $doaction = ($_REQUEST['action'] != -1) ? $_REQUEST['action'] : $_REQUEST['action2'];
     28    } else wp_redirect($_SERVER['HTTP_REFERER']);
     29   
     30    $approved = $unapproved = $spammed = $deleted = $destroyed = 0;
     31   
     32    foreach ($comment_ids as $comment_id) { // Check the permissions on each
    3733        $_post_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = %d", $comment_id) );
    3834
     
    4137
    4238        switch( $doaction ) {
     39            case 'approve' :
     40                wp_set_comment_status($comment_id, 'approve');
     41                $approved++;
     42                break;
     43            case 'unapprove' :
     44                wp_set_comment_status($comment_id, 'hold');
     45                $unapproved++;
     46                break;
    4347            case 'markspam' :
    4448                wp_set_comment_status($comment_id, 'spam');
     
    4953                $deleted++;
    5054                break;
    51             case 'approve' :
    52                 wp_set_comment_status($comment_id, 'approve');
    53                 $approved++;
    54                 break;
    55             case 'unapprove' :
    56                 wp_set_comment_status($comment_id, 'hold');
    57                 $unapproved++;
    58                 break;
    59         }
    60     endforeach;
    61 
    62     $redirect_to = 'edit-comments.php?deleted=' . $deleted . '&approved=' . $approved . '&spam=' . $spammed . '&unapproved=' . $unapproved;
     55            case 'destroy' :
     56                wp_set_comment_status($comment_id, 'delete');
     57                $destroyed++;
     58                break;
     59        }
     60    }
     61
     62    $redirect_to = 'edit-comments.php?approved=' . $approved . '&unapproved=' . $unapproved . '&spam=' . $spammed . '&deleted=' . $deleted . '&destroyed=' . $destroyed;
    6363    if ( $post_id )
    6464        $redirect_to = add_query_arg( 'p', absint( $post_id ), $redirect_to );
     
    8787
    8888$comment_status = isset($_REQUEST['comment_status']) ? $_REQUEST['comment_status'] : 'all';
    89 if ( !in_array($comment_status, array('all', 'moderated', 'approved', 'spam')) )
     89if ( !in_array($comment_status, array('all', 'moderated', 'approved', 'spam', 'deleted')) )
    9090    $comment_status = 'all';
    9191
     
    103103
    104104<?php
    105 if ( isset( $_GET['approved'] ) || isset( $_GET['deleted'] ) || isset( $_GET['spam'] ) ) {
     105if ( isset( $_GET['approved'] ) || isset( $_GET['deleted'] ) || isset( $_GET['destroyed'] ) || isset( $_GET['spam'] ) ) {
    106106    $approved = isset( $_GET['approved'] ) ? (int) $_GET['approved'] : 0;
    107107    $deleted = isset( $_GET['deleted'] ) ? (int) $_GET['deleted'] : 0;
     108    $destroyed = isset( $_GET['destroyed'] ) ? (int) $_GET['destroyed'] : 0;
    108109    $spam = isset( $_GET['spam'] ) ? (int) $_GET['spam'] : 0;
    109110
    110     if ( $approved > 0 || $deleted > 0 || $spam > 0 ) {
     111    if ( $approved > 0 || $deleted > 0 || $destroyed > 0 || $spam > 0 ) {
    111112        echo '<div id="moderated" class="updated fade"><p>';
    112113
     
    115116            echo '<br />';
    116117        }
    117 
     118        if ( $spam > 0 ) {
     119            printf( _n( '%s comment marked as spam', '%s comments marked as spam', $spam ), $spam );
     120            echo '<br />';
     121        }
    118122        if ( $deleted > 0 ) {
    119123            printf( _n( '%s comment deleted', '%s comments deleted', $deleted ), $deleted );
    120124            echo '<br />';
    121125        }
    122 
    123         if ( $spam > 0 ) {
    124             printf( _n( '%s comment marked as spam', '%s comments marked as spam', $spam ), $spam );
     126        if ( $destroyed > 0 ) {
     127            printf( _n( '%s comment permanently deleted', '%s comments permanently deleted', $destroyed ), $destroyed );
    125128            echo '<br />';
    126129        }
     
    140143$stati = array(
    141144        'all' => _n_noop('All', 'All'), // singular not used
    142         'moderated' => _n_noop('Pending (<span class="pending-count">%s</span>)', 'Pending (<span class="pending-count">%s</span>)'),
     145        'moderated' => _n_noop('Pending <span class="count">(<span class="pending-count">%s</span>)</span>', 'Pending <span class="count">(<span class="pending-count">%s</span>)</span>'),
    143146        'approved' => _n_noop('Approved', 'Approved'), // singular not used
    144         'spam' => _n_noop('Spam (<span class="spam-count">%s</span>)', 'Spam (<span class="spam-count">%s</span>)')
     147        'spam' => _n_noop('Spam <span class="count">(<span class="spam-count">%s</span>)</span>', 'Spam <span class="count">(<span class="spam-count">%s</span>)</span>'),
     148        'deleted' => _n_noop('Trash <span class="count">(<span class="deleted-count">%s</span>)</span>', 'Trash <span class="count">(<span class="deleted-count">%s</span>)</span>')
    145149    );
    146150$link = 'edit-comments.php';
     
    247251<option value="unapprove"><?php _e('Unapprove'); ?></option>
    248252<?php endif; ?>
    249 <?php if ( 'all' == $comment_status || 'moderated' == $comment_status || 'spam' == $comment_status ): ?>
     253<?php if ( 'approved' != $comment_status ): ?>
    250254<option value="approve"><?php _e('Approve'); ?></option>
    251255<?php endif; ?>
     
    253257<option value="markspam"><?php _e('Mark as Spam'); ?></option>
    254258<?php endif; ?>
     259<?php if ( 'deleted' == $comment_status || 'spam' == $comment_status ): ?>
     260<option value="destroy"><?php _e('Delete Permanently'); ?></option>
     261<?php else: ?>
    255262<option value="delete"><?php _e('Delete'); ?></option>
     263<?php endif; ?>
    256264</select>
    257265<input type="submit" name="doaction" id="doaction" value="<?php esc_attr_e('Apply'); ?>" class="button-secondary apply" />
     
    279287<?php }
    280288
    281 if ( 'spam' == $comment_status ) {
    282     wp_nonce_field('bulk-spam-delete', '_spam_nonce');
     289if ( 'spam' == $comment_status || 'deleted' == $comment_status ) {
     290    wp_nonce_field('bulk-destroy', '_destroy_nonce');
    283291        if ( current_user_can ('moderate_comments')) { ?>
    284         <input type="submit" name="delete_all_spam" value="<?php esc_attr_e('Delete All Spam'); ?>" class="button-secondary apply" />
    285 <?php   }
     292        <input type="submit" name="destroy_all" id="destroy_all" value="<?php esc_attr_e('Permanently Delete All'); ?>" class="button-secondary apply" />
     293<?php }
    286294} ?>
    287295<?php do_action('manage_comments_nav', $comment_status); ?>
     
    334342<option value="unapprove"><?php _e('Unapprove'); ?></option>
    335343<?php endif; ?>
    336 <?php if ( 'all' == $comment_status || 'moderated' == $comment_status || 'spam' == $comment_status ): ?>
     344<?php if ( 'approved' != $comment_status ): ?>
    337345<option value="approve"><?php _e('Approve'); ?></option>
    338346<?php endif; ?>
     
    340348<option value="markspam"><?php _e('Mark as Spam'); ?></option>
    341349<?php endif; ?>
     350<?php if ( 'deleted' == $comment_status || 'spam' == $comment_status ): ?>
     351<option value="destroy"><?php _e('Delete Permanently'); ?></option>
     352<?php else: ?>
    342353<option value="delete"><?php _e('Delete'); ?></option>
     354<?php endif; ?>
    343355</select>
    344356<input type="submit" name="doaction2" id="doaction2" value="<?php esc_attr_e('Apply'); ?>" class="button-secondary apply" />
    345357
    346 <?php if ( 'spam' == $comment_status ) { ?>
    347 <input type="submit" name="delete_all_spam2" value="<?php esc_attr_e('Delete All Spam'); ?>" class="button-secondary apply" />
     358<?php if ( 'spam' == $comment_status || 'deleted' == $comment_status ) { ?>
     359<input type="submit" name="destroy_all2" id="destroy_all2" value="<?php esc_attr_e('Permanently Delete All'); ?>" class="button-secondary apply" />
    348360<?php } ?>
    349361<?php do_action('manage_comments_nav', $comment_status); ?>
  • trunk/wp-admin/includes/template.php

    r11721 r11731  
    20102010        $approved = "comment_approved = 'spam'";
    20112011        $total = $count->spam;
     2012    } elseif ( 'deleted' == $status ) {
     2013        $approved = "comment_approved = 'deleted'";
     2014        $total = $count->deleted;
    20122015    } else {
    20132016        $approved = "( comment_approved = '0' OR comment_approved = '1' )";
     
    21362139
    21372140                if ( $user_can ) {
    2138                     $actions['approve'] = "<a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved vim-a' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
    2139                     $actions['unapprove'] = "<a href='$unapprove_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved vim-u' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
    2140                     if ( $comment_status && 'all' != $comment_status ) { // not looking at all comments
    2141                         if ( 'approved' == $the_comment_status ) {
    2142                             $actions['unapprove'] = "<a href='$unapprove_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&amp;new=unapproved vim-u vim-destructive' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
    2143                             unset($actions['approve']);
     2141                    if ( 'deleted' == $the_comment_status ) {
     2142                        $actions['unapprove'] = "<a href='$unapprove_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&amp;new=unapproved vim-u vim-destructive' title='" . __( 'Return this comment to Unapproved status' ) . "'>" . __( 'Return to Pending' ) . '</a>';
     2143                        $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID::deleted=1 delete vim-d vim-destructive'>" . __('Delete Permanently') . '</a>';
     2144                    } else {
     2145                        $actions['approve'] = "<a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved vim-a' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
     2146                        $actions['unapprove'] = "<a href='$unapprove_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved vim-u' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
     2147
     2148                        if ( $comment_status && 'all' != $comment_status ) { // not looking at all comments
     2149                            if ( 'approved' == $the_comment_status ) {
     2150                                $actions['unapprove'] = "<a href='$unapprove_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&amp;new=unapproved vim-u vim-destructive' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
     2151                                unset($actions['approve']);
     2152                            } else {
     2153                                $actions['approve'] = "<a href='$approve_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&amp;new=approved vim-a vim-destructive' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
     2154                                unset($actions['unapprove']);
     2155                            }
     2156                        }
     2157
     2158                        if ( 'spam' == $the_comment_status ) {
     2159                            $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID::deleted=1 delete vim-d vim-destructive'>" . __('Delete Permanently') . '</a>';
    21442160                        } else {
    2145                             $actions['approve'] = "<a href='$approve_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&amp;new=approved vim-a vim-destructive' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
    2146                             unset($actions['unapprove']);
     2161                            $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' ) . "'>" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . '</a>';
     2162                            $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete vim-d vim-destructive'>" . __('Delete') . '</a>';
    21472163                        }
     2164
     2165                        $actions['edit'] = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . __('Edit comment') . "'>". __('Edit') . '</a>';
     2166                        $actions['quickedit'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$post->ID.'\',\'edit\');return false;" class="vim-q" title="'.__('Quick Edit').'" href="#">' . __('Quick&nbsp;Edit') . '</a>';
     2167
     2168                        if ( 'spam' != $the_comment_status )
     2169                            $actions['reply'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$post->ID.'\');return false;" class="vim-r" title="'.__('Reply to this comment').'" href="#">' . __('Reply') . '</a>';
    21482170                    }
    2149                     if ( 'spam' != $the_comment_status )
    2150                         $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' ) . "'>" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . '</a>';
    2151                     $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete vim-d vim-destructive'>" . __('Delete') . '</a>';
    2152                     $actions['edit'] = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . __('Edit comment') . "'>". __('Edit') . '</a>';
    2153                     $actions['quickedit'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$post->ID.'\',\'edit\');return false;" class="vim-q" title="'.__('Quick Edit').'" href="#">' . __('Quick&nbsp;Edit') . '</a>';
    2154                     if ( 'spam' != $the_comment_status )
    2155                         $actions['reply'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$post->ID.'\');return false;" class="vim-r" title="'.__('Reply to this comment').'" href="#">' . __('Reply') . '</a>';
    21562171
    21572172                    $actions = apply_filters( 'comment_row_actions', $actions, $comment );
  • trunk/wp-admin/js/common.dev.js

    r11676 r11731  
    157157    // show warnings
    158158    $('#doaction, #doaction2').click(function(){
    159         if ( $('select[name="action"]').val() == 'delete' || $('select[name="action2"]').val() == 'delete' ) {
     159        if ( $('select[name="action"]').val() == 'destroy' || $('select[name="action2"]').val() == 'destroy' ) {
    160160            return showNotice.warn();
    161161        }
     162    });
     163    $('#destroy_all, #destroy_all2').click(function(){
     164        return showNotice.warn();
    162165    });
    163166
  • trunk/wp-admin/js/common.js

    r11676 r11731  
    1 var showNotice,adminMenu,columns,validateForm;(function(a){adminMenu={init:function(){a("#adminmenu div.wp-menu-toggle").each(function(){if(a(this).siblings(".wp-submenu").length){a(this).click(function(){adminMenu.toggle(a(this).siblings(".wp-submenu"))})}else{a(this).hide()}});this.favorites();a("a.separator").click(function(){if(a("body").hasClass("folded")){adminMenu.fold(1);deleteUserSetting("mfold")}else{adminMenu.fold();setUserSetting("mfold","f")}return false});if(a("body").hasClass("folded")){this.fold()}this.restoreMenuState()},restoreMenuState:function(){a("#adminmenu li.wp-has-submenu").each(function(c,d){var b=getUserSetting("m"+c);if(a(d).hasClass("wp-has-current-submenu")){return true}if("o"==b){a(d).addClass("wp-menu-open")}else{if("c"==b){a(d).removeClass("wp-menu-open")}}})},toggle:function(b){b.slideToggle(150,function(){b.css("display","")}).parent().toggleClass("wp-menu-open");a("#adminmenu li.wp-has-submenu").each(function(d,f){var c=a(f).hasClass("wp-menu-open")?"o":"c";setUserSetting("m"+d,c)});return false},fold:function(b){if(b){a("body").removeClass("folded");a("#adminmenu li.wp-has-submenu").unbind()}else{a("body").addClass("folded");a("#adminmenu li.wp-has-submenu").hoverIntent({over:function(j){var d,c,g,k,i;d=a(this).find(".wp-submenu");c=d.parent().offset().top+d.height()+1;g=a("#wpwrap").height();k=60+c-g;i=a(window).height()+a("body").scrollTop()-15;if(i<(c-k)){k=c-i}if(k>1){d.css({marginTop:"-"+k+"px"})}else{if(d.css("marginTop")){d.css({marginTop:""})}}d.addClass("sub-open")},out:function(){a(this).find(".wp-submenu").removeClass("sub-open").css({marginTop:""})},timeout:220,sensitivity:8,interval:100})}},favorites:function(){a("#favorite-inside").width(a("#favorite-actions").width()-4);a("#favorite-toggle, #favorite-inside").bind("mouseenter",function(){a("#favorite-inside").removeClass("slideUp").addClass("slideDown");setTimeout(function(){if(a("#favorite-inside").hasClass("slideDown")){a("#favorite-inside").slideDown(100);a("#favorite-first").addClass("slide-down")}},200)});a("#favorite-toggle, #favorite-inside").bind("mouseleave",function(){a("#favorite-inside").removeClass("slideDown").addClass("slideUp");setTimeout(function(){if(a("#favorite-inside").hasClass("slideUp")){a("#favorite-inside").slideUp(100,function(){a("#favorite-first").removeClass("slide-down")})}},300)})}};a(document).ready(function(){adminMenu.init()});columns={init:function(){a(".hide-column-tog").click(function(){var c=a(this).val(),b=a(this).attr("checked");if(b){a(".column-"+c).show()}else{a(".column-"+c).hide()}columns.save_manage_columns_state()})},save_manage_columns_state:function(){var b=a(".manage-column").filter(":hidden").map(function(){return this.id}).get().join(",");a.post(ajaxurl,{action:"hidden-columns",hidden:b,screenoptionnonce:a("#screenoptionnonce").val(),page:pagenow})}};a(document).ready(function(){columns.init()});validateForm=function(b){return !a(b).find(".form-required").filter(function(){return a("input:visible",this).val()==""}).addClass("form-invalid").change(function(){a(this).removeClass("form-invalid")}).size()}})(jQuery);showNotice={warn:function(){var a=commonL10n.warnDelete||"";if(confirm(a)){return true}return false},note:function(a){alert(a)}};jQuery(document).ready(function(d){var f=false,a,e,c,b;d(".fade").animate({backgroundColor:"#ffffe0"},300).animate({backgroundColor:"#fffbcc"},300).animate({backgroundColor:"#ffffe0"},300).animate({backgroundColor:"#fffbcc"},300);d("div.wrap h2 ~ div.updated, div.wrap h2 ~ div.error").addClass("below-h2");d("div.updated, div.error").not(".below-h2").insertAfter("div.wrap h2:first");d("#doaction, #doaction2").click(function(){if(d('select[name="action"]').val()=="delete"||d('select[name="action2"]').val()=="delete"){return showNotice.warn()}});d("#show-settings-link").click(function(){if(!d("#screen-options-wrap").hasClass("screen-options-open")){d("#contextual-help-link-wrap").css("visibility","hidden")}d("#screen-options-wrap").slideToggle("fast",function(){if(d(this).hasClass("screen-options-open")){d("#show-settings-link").css({backgroundImage:'url("images/screen-options-right.gif")'});d("#contextual-help-link-wrap").css("visibility","");d(this).removeClass("screen-options-open")}else{d("#show-settings-link").css({backgroundImage:'url("images/screen-options-right-up.gif")'});d(this).addClass("screen-options-open")}});return false});d("#contextual-help-link").click(function(){if(!d("#contextual-help-wrap").hasClass("contextual-help-open")){d("#screen-options-link-wrap").css("visibility","hidden")}d("#contextual-help-wrap").slideToggle("fast",function(){if(d(this).hasClass("contextual-help-open")){d("#contextual-help-link").css({backgroundImage:'url("images/screen-options-right.gif")'});d("#screen-options-link-wrap").css("visibility","");d(this).removeClass("contextual-help-open")}else{d("#contextual-help-link").css({backgroundImage:'url("images/screen-options-right-up.gif")'});d(this).addClass("contextual-help-open")}});return false});d("#contextual-help-link-wrap, #screen-options-link-wrap").show();d("table:visible tbody .check-column :checkbox").click(function(g){if("undefined"==g.shiftKey){return true}if(g.shiftKey){if(!f){return true}a=d(f).parents("form:first").find(":checkbox");e=a.index(f);c=a.index(this);b=d(this).attr("checked");if(0<e&&0<c&&e!=c){a.slice(e,c).attr("checked",function(){if(d(this).parents("tr").is(":visible")){return b?"checked":""}return""})}}f=this;return true});d("thead :checkbox, tfoot :checkbox").click(function(i){var j=d(this).attr("checked"),h="undefined"==typeof toggleWithKeyboard?false:toggleWithKeyboard,g=i.shiftKey||h;d(this).parents("form:first").find("table tbody:visible").find(".check-column :checkbox").attr("checked",function(){if(d(this).parents("tr").is(":hidden")){return""}if(g){return d(this).attr("checked")?"":"checked"}else{if(j){return"checked"}}return""});d(this).parents("form:first").find("table thead:visible, table tfoot:visible").find(".check-column :checkbox").attr("checked",function(){if(g){return""}else{if(j){return"checked"}}return""})});d("#default-password-nag-no").click(function(){setUserSetting("default_password_nag","hide");d("div.default-password-nag").hide();return false})});jQuery(document).ready(function(b){var a=b(".turbo-nag");if(!a.length||("undefined"!=typeof(google)&&google.gears)){return}if("undefined"!=typeof GearsFactory){return}else{try{if(("undefined"!=typeof window.ActiveXObject&&ActiveXObject("Gears.Factory"))||("undefined"!=typeof navigator.mimeTypes&&navigator.mimeTypes["application/x-googlegears"])){return}}catch(c){}}a.show()});
     1var showNotice,adminMenu,columns,validateForm;(function(a){adminMenu={init:function(){a("#adminmenu div.wp-menu-toggle").each(function(){if(a(this).siblings(".wp-submenu").length){a(this).click(function(){adminMenu.toggle(a(this).siblings(".wp-submenu"))})}else{a(this).hide()}});this.favorites();a("a.separator").click(function(){if(a("body").hasClass("folded")){adminMenu.fold(1);deleteUserSetting("mfold")}else{adminMenu.fold();setUserSetting("mfold","f")}return false});if(a("body").hasClass("folded")){this.fold()}this.restoreMenuState()},restoreMenuState:function(){a("#adminmenu li.wp-has-submenu").each(function(c,d){var b=getUserSetting("m"+c);if(a(d).hasClass("wp-has-current-submenu")){return true}if("o"==b){a(d).addClass("wp-menu-open")}else{if("c"==b){a(d).removeClass("wp-menu-open")}}})},toggle:function(b){b.slideToggle(150,function(){b.css("display","")}).parent().toggleClass("wp-menu-open");a("#adminmenu li.wp-has-submenu").each(function(d,f){var c=a(f).hasClass("wp-menu-open")?"o":"c";setUserSetting("m"+d,c)});return false},fold:function(b){if(b){a("body").removeClass("folded");a("#adminmenu li.wp-has-submenu").unbind()}else{a("body").addClass("folded");a("#adminmenu li.wp-has-submenu").hoverIntent({over:function(j){var d,c,g,k,i;d=a(this).find(".wp-submenu");c=d.parent().offset().top+d.height()+1;g=a("#wpwrap").height();k=60+c-g;i=a(window).height()+a("body").scrollTop()-15;if(i<(c-k)){k=c-i}if(k>1){d.css({marginTop:"-"+k+"px"})}else{if(d.css("marginTop")){d.css({marginTop:""})}}d.addClass("sub-open")},out:function(){a(this).find(".wp-submenu").removeClass("sub-open").css({marginTop:""})},timeout:220,sensitivity:8,interval:100})}},favorites:function(){a("#favorite-inside").width(a("#favorite-actions").width()-4);a("#favorite-toggle, #favorite-inside").bind("mouseenter",function(){a("#favorite-inside").removeClass("slideUp").addClass("slideDown");setTimeout(function(){if(a("#favorite-inside").hasClass("slideDown")){a("#favorite-inside").slideDown(100);a("#favorite-first").addClass("slide-down")}},200)});a("#favorite-toggle, #favorite-inside").bind("mouseleave",function(){a("#favorite-inside").removeClass("slideDown").addClass("slideUp");setTimeout(function(){if(a("#favorite-inside").hasClass("slideUp")){a("#favorite-inside").slideUp(100,function(){a("#favorite-first").removeClass("slide-down")})}},300)})}};a(document).ready(function(){adminMenu.init()});columns={init:function(){a(".hide-column-tog").click(function(){var c=a(this).val(),b=a(this).attr("checked");if(b){a(".column-"+c).show()}else{a(".column-"+c).hide()}columns.save_manage_columns_state()})},save_manage_columns_state:function(){var b=a(".manage-column").filter(":hidden").map(function(){return this.id}).get().join(",");a.post(ajaxurl,{action:"hidden-columns",hidden:b,screenoptionnonce:a("#screenoptionnonce").val(),page:pagenow})}};a(document).ready(function(){columns.init()});validateForm=function(b){return !a(b).find(".form-required").filter(function(){return a("input:visible",this).val()==""}).addClass("form-invalid").change(function(){a(this).removeClass("form-invalid")}).size()}})(jQuery);showNotice={warn:function(){var a=commonL10n.warnDelete||"";if(confirm(a)){return true}return false},note:function(a){alert(a)}};jQuery(document).ready(function(d){var f=false,a,e,c,b;d(".fade").animate({backgroundColor:"#ffffe0"},300).animate({backgroundColor:"#fffbcc"},300).animate({backgroundColor:"#ffffe0"},300).animate({backgroundColor:"#fffbcc"},300);d("div.wrap h2 ~ div.updated, div.wrap h2 ~ div.error").addClass("below-h2");d("div.updated, div.error").not(".below-h2").insertAfter("div.wrap h2:first");d("#doaction, #doaction2").click(function(){if(d('select[name="action"]').val()=="destroy"||d('select[name="action2"]').val()=="destroy"){return showNotice.warn()}});d("#destroy_all, #destroy_all2").click(function(){return showNotice.warn()});d("#show-settings-link").click(function(){if(!d("#screen-options-wrap").hasClass("screen-options-open")){d("#contextual-help-link-wrap").css("visibility","hidden")}d("#screen-options-wrap").slideToggle("fast",function(){if(d(this).hasClass("screen-options-open")){d("#show-settings-link").css({backgroundImage:'url("images/screen-options-right.gif")'});d("#contextual-help-link-wrap").css("visibility","");d(this).removeClass("screen-options-open")}else{d("#show-settings-link").css({backgroundImage:'url("images/screen-options-right-up.gif")'});d(this).addClass("screen-options-open")}});return false});d("#contextual-help-link").click(function(){if(!d("#contextual-help-wrap").hasClass("contextual-help-open")){d("#screen-options-link-wrap").css("visibility","hidden")}d("#contextual-help-wrap").slideToggle("fast",function(){if(d(this).hasClass("contextual-help-open")){d("#contextual-help-link").css({backgroundImage:'url("images/screen-options-right.gif")'});d("#screen-options-link-wrap").css("visibility","");d(this).removeClass("contextual-help-open")}else{d("#contextual-help-link").css({backgroundImage:'url("images/screen-options-right-up.gif")'});d(this).addClass("contextual-help-open")}});return false});d("#contextual-help-link-wrap, #screen-options-link-wrap").show();d("table:visible tbody .check-column :checkbox").click(function(g){if("undefined"==g.shiftKey){return true}if(g.shiftKey){if(!f){return true}a=d(f).parents("form:first").find(":checkbox");e=a.index(f);c=a.index(this);b=d(this).attr("checked");if(0<e&&0<c&&e!=c){a.slice(e,c).attr("checked",function(){if(d(this).parents("tr").is(":visible")){return b?"checked":""}return""})}}f=this;return true});d("thead :checkbox, tfoot :checkbox").click(function(i){var j=d(this).attr("checked"),h="undefined"==typeof toggleWithKeyboard?false:toggleWithKeyboard,g=i.shiftKey||h;d(this).parents("form:first").find("table tbody:visible").find(".check-column :checkbox").attr("checked",function(){if(d(this).parents("tr").is(":hidden")){return""}if(g){return d(this).attr("checked")?"":"checked"}else{if(j){return"checked"}}return""});d(this).parents("form:first").find("table thead:visible, table tfoot:visible").find(".check-column :checkbox").attr("checked",function(){if(g){return""}else{if(j){return"checked"}}return""})});d("#default-password-nag-no").click(function(){setUserSetting("default_password_nag","hide");d("div.default-password-nag").hide();return false})});jQuery(document).ready(function(b){var a=b(".turbo-nag");if(!a.length||("undefined"!=typeof(google)&&google.gears)){return}if("undefined"!=typeof GearsFactory){return}else{try{if(("undefined"!=typeof window.ActiveXObject&&ActiveXObject("Gears.Factory"))||("undefined"!=typeof navigator.mimeTypes&&navigator.mimeTypes["application/x-googlegears"])){return}}catch(c){}}a.show()});
  • trunk/wp-admin/js/edit-comments.dev.js

    r11660 r11731  
    3939        settings.data._url = document.location.href;
    4040
    41         if ( 'undefined' != showNotice && settings.data.action && settings.data.action == 'delete-comment' && !settings.data.spam )
     41        if ( 'undefined' != showNotice && settings.data.action && settings.data.action == 'delete-comment' && settings.data.deleted)
    4242            return showNotice.warn() ? settings : false;
    4343
     
    9292            if ( $(settings.target).parents( 'span.spam' ).size() ) { // we marked a comment as spam
    9393                n = n + 1;
    94             } else if ( $('#' + settings.element).is('.spam') ) { // we approved or deleted a comment marked as spam
     94            } else if ( $('#' + settings.element).is('.spam') ) { // we approved, deleted, or destroyed a comment marked as spam
    9595                n = n - 1;
     96            }
     97            if ( n < 0 ) { n = 0; }
     98            n = n.toString();
     99            if ( n.length > 3 )
     100                n = n.substr(0, n.length-3)+' '+n.substr(-3);
     101            a.html(n);
     102        });
     103
     104        $('span.deleted-count').each( function() {
     105            var a = $(this), n;
     106            n = a.html().replace(/[ ,.]+/g, '');
     107            n = parseInt(n,10);
     108            if ( isNaN(n) ) return;
     109            if ( $(settings.target).parents( 'span.delete' ).size() && $('#' + settings.element).is('.deleted,.spam') ) { // we destroyed a deleted or spam comment
     110                n--;
     111            } else if ( $(settings.target).parents( 'span.delete' ).size() ) { // we deleted a comment
     112                n++;
     113            } else if ( $('#' + settings.element).is('.deleted') ) { // we approved or spammed a deleted comment
     114                n--;
    96115            }
    97116            if ( n < 0 ) { n = 0; }
  • trunk/wp-admin/js/edit-comments.js

    r11660 r11731  
    1 var theList,theExtraList,toggleWithKeyboard=false;(function(a){setCommentsList=function(){var g,i,h,f=0,c,e,d,b;g=a('#comments-form .tablenav :input[name="_total"]');i=a('#comments-form .tablenav :input[name="_per_page"]');h=a('#comments-form .tablenav :input[name="_page"]');c=function(k,j){var l=a("#"+j.element);if(l.is(".unapproved")){l.find("div.comment_status").html("0")}else{l.find("div.comment_status").html("1")}a("span.pending-count").each(function(){var m=a(this),o;o=m.html().replace(/[ ,.]+/g,"");o=parseInt(o,10);if(isNaN(o)){return}o=o+(a("#"+j.element).is("."+j.dimClass)?1:-1);if(o<0){o=0}m.parents("#awaiting-mod")[0==o?"addClass":"removeClass"]("count-0");o=o.toString();if(o.length>3){o=o.substr(0,o.length-3)+" "+o.substr(-3)}m.html(o)})};e=function(j){j.data._total=g.val();j.data._per_page=i.val();j.data._page=h.val();j.data._url=document.location.href;if("undefined"!=showNotice&&j.data.action&&j.data.action=="delete-comment"&&!j.data.spam){return showNotice.warn()?j:false}return j};d=function(j,k,l){if(k<f){return}g.val(j.toString());if(l){f=k}a("span.total-type-count").each(function(){var m=a(this),o;o=g.val().toString();if(o.length>3){o=o.substr(0,o.length-3)+" "+o.substr(-3)}m.html(o)})};b=function(l,j){a("span.pending-count").each(function(){var m=a(this),o;o=m.html().replace(/[ ,.]+/g,"");o=parseInt(o,10);if(isNaN(o)){return}if(a("#"+j.element).is(".unapproved")){o=o-1}else{if(a(j.target).parents("span.unapprove").size()){o=o+1}}if(o<0){o=0}m.parents("#awaiting-mod")[0==o?"addClass":"removeClass"]("count-0");o=o.toString();if(o.length>3){o=o.substr(0,o.length-3)+" "+o.substr(-3)}m.html(o)});a("span.spam-count").each(function(){var m=a(this),o;o=m.html().replace(/[ ,.]+/g,"");o=parseInt(o,10);if(isNaN(o)){return}if(a(j.target).parents("span.spam").size()){o=o+1}else{if(a("#"+j.element).is(".spam")){o=o-1}}if(o<0){o=0}o=o.toString();if(o.length>3){o=o.substr(0,o.length-3)+" "+o.substr(-3)}m.html(o)});if(("object"==typeof l)&&f<j.parsed.responses[0].supplemental.time){d(j.parsed.responses[0].supplemental.total,j.parsed.responses[0].supplemental.time,true);if(a.trim(j.parsed.responses[0].supplemental.pageLinks)){a(".tablenav-pages").find(".page-numbers").remove().end().append(a(j.parsed.responses[0].supplemental.pageLinks))}else{if("undefined"!=typeof j.parsed.responses[0].supplemental.pageLinks){a(".tablenav-pages").find(".page-numbers").remove()}}}else{var k=parseInt(g.val(),10);if(k--<0){k=0}d(k,l,false)}if(theExtraList.size()==0||theExtraList.children().size()==0){return}theList.get(0).wpList.add(theExtraList.children(":eq(0)").remove().clone());a("#get-extra-comments").submit()};theExtraList=a("#the-extra-comment-list").wpList({alt:"",delColor:"none",addColor:"none"});theList=a("#the-comment-list").wpList({alt:"",delBefore:e,dimAfter:c,delAfter:b,addColor:"none"})};commentReply={init:function(){var b=a("#replyrow");a("a.cancel",b).click(function(){return commentReply.revert()});a("a.save",b).click(function(){return commentReply.send()});a("input#author, input#author-email, input#author-url",b).keypress(function(c){if(c.which==13){commentReply.send();c.preventDefault();return false}});a("#the-comment-list .column-comment > p").dblclick(function(){commentReply.toggle(a(this).parent())});a("#doaction, #doaction2, #post-query-submit").click(function(c){if(a("#the-comment-list #replyrow").length>0){commentReply.close()}});this.comments_listing=a('#comments-form > input[name="comment_status"]').val()||""},addEvents:function(b){b.each(function(){a(this).find(".column-comment > p").dblclick(function(){commentReply.toggle(a(this).parent())})})},toggle:function(b){if(a(b).css("display")!="none"){a(b).find("a.vim-q").click()}},revert:function(){if(a("#the-comment-list #replyrow").length<1){return false}a("#replyrow").fadeOut("fast",function(){commentReply.close()});return false},close:function(){a(this.o).fadeIn("fast").css("backgroundColor","");a("#com-reply").append(a("#replyrow"));a("#replycontent").val("");a("#edithead input").val("");a("#replysubmit .error").html("").hide();a("#replysubmit .waiting").hide();if(a.browser.msie){a("#replycontainer, #replycontent").css("height","120px")}else{a("#replycontainer").resizable("destroy").css("height","120px")}},open:function(i,g,c){var e=this,d,b,f;e.close();e.o="#comment-"+i;a("#replyrow td").attr("colspan",a(".widefat thead th:visible").length);d=a("#replyrow"),rowData=a("#inline-"+i);b=e.act=(c=="edit")?"edit-comment":"replyto-comment";a("#action",d).val(b);a("#comment_post_ID",d).val(g);a("#comment_ID",d).val(i);if(c=="edit"){a("#author",d).val(a("div.author",rowData).text());a("#author-email",d).val(a("div.author-email",rowData).text());a("#author-url",d).val(a("div.author-url",rowData).text());a("#status",d).val(a("div.comment_status",rowData).text());a("#replycontent",d).val(a("textarea.comment",rowData).val());a("#edithead, #savebtn",d).show();a("#replyhead, #replybtn",d).hide();f=a(e.o).height();if(f>220){if(a.browser.msie){a("#replycontainer, #replycontent",d).height(f-105)}else{a("#replycontainer",d).height(f-105)}}a(e.o).after(d.hide()).fadeOut("fast",function(){a("#replyrow").fadeIn("fast")})}else{a("#edithead, #savebtn",d).hide();a("#replyhead, #replybtn",d).show();a(e.o).after(d);a("#replyrow").hide().fadeIn("fast")}if(!a.browser.msie){a("#replycontainer").resizable({handles:"s",axis:"y",minHeight:80,stop:function(){a("#replycontainer").width("auto")}})}setTimeout(function(){var l,j,m,h,k;l=a("#replyrow").offset().top;j=l+a("#replyrow").height();m=window.pageYOffset||document.documentElement.scrollTop;h=document.documentElement.clientHeight||self.innerHeight||0;k=m+h;if(k-20<j){window.scroll(0,j-h+35)}else{if(l-20<m){window.scroll(0,l-35)}}a("#replycontent").focus().keyup(function(n){if(n.which==27){commentReply.revert()}})},600);return false},send:function(){var b={};a("#replysubmit .waiting").show();a("#replyrow input").each(function(){b[a(this).attr("name")]=a(this).val()});b.content=a("#replycontent").val();b.id=b.comment_post_ID;b.comments_listing=this.comments_listing;a.ajax({type:"POST",url:wpListL10n.url,data:b,success:function(c){commentReply.show(c)},error:function(c){commentReply.error(c)}});return false},show:function(b){var e,g,f,d;if(typeof(b)=="string"){this.error({responseText:b});return false}e=wpAjax.parseAjaxResponse(b);if(e.errors){this.error({responseText:wpAjax.broken});return false}if("edit-comment"==this.act){a(this.o).remove()}e=e.responses[0];g=e.data;a(g).hide();a("#replyrow").after(g);this.o=f="#comment-"+e.id;this.revert();this.addEvents(a(f));d=a(f).hasClass("unapproved")?"#ffffe0":"#fff";a(f).animate({backgroundColor:"#CCEEBB"},600).animate({backgroundColor:d},600);a.fn.wpList.process(a(f))},error:function(b){var c=b.statusText;a("#replysubmit .waiting").hide();if(b.responseText){c=b.responseText.replace(/<.[^<>]*?>/g,"")}if(c){a("#replysubmit .error").html(c).show()}}};a(document).ready(function(){var e,b,c,d;setCommentsList();commentReply.init();a("span.delete a.delete").click(function(){return false});if(typeof QTags!="undefined"){ed_reply=new QTags("ed_reply","replycontent","replycontainer","more")}if(typeof a.table_hotkeys!="undefined"){e=function(f){return function(){var h,g;h="next"==f?"first":"last";g=a("."+f+".page-numbers");if(g.length){window.location=g[0].href.replace(/\&hotkeys_highlight_(first|last)=1/g,"")+"&hotkeys_highlight_"+h+"=1"}}};b=function(g,f){window.location=a("span.edit a",f).attr("href")};c=function(){toggleWithKeyboard=true;a("#comments-form thead #cb input:checkbox").click().attr("checked","");toggleWithKeyboard=false};d=function(f){return function(h,g){a("option[value="+f+"]").attr("selected","selected");a("form#comments-form")[0].submit()}};a.table_hotkeys(a("table.widefat"),["a","u","s","d","r","q",["e",b],["shift+a",d("approve")],["shift+s",d("markspam")],["shift+d",d("delete")],["shift+x",c],["shift+u",d("unapprove")]],{highlight_first:adminCommentsL10n.hotkeys_highlight_first,highlight_last:adminCommentsL10n.hotkeys_highlight_last,prev_page_link_cb:e("prev"),next_page_link_cb:e("next")})}})})(jQuery);
     1var theList,theExtraList,toggleWithKeyboard=false;(function(a){setCommentsList=function(){var g,i,h,f=0,c,e,d,b;g=a('#comments-form .tablenav :input[name="_total"]');i=a('#comments-form .tablenav :input[name="_per_page"]');h=a('#comments-form .tablenav :input[name="_page"]');c=function(k,j){var l=a("#"+j.element);if(l.is(".unapproved")){l.find("div.comment_status").html("0")}else{l.find("div.comment_status").html("1")}a("span.pending-count").each(function(){var m=a(this),o;o=m.html().replace(/[ ,.]+/g,"");o=parseInt(o,10);if(isNaN(o)){return}o=o+(a("#"+j.element).is("."+j.dimClass)?1:-1);if(o<0){o=0}m.parents("#awaiting-mod")[0==o?"addClass":"removeClass"]("count-0");o=o.toString();if(o.length>3){o=o.substr(0,o.length-3)+" "+o.substr(-3)}m.html(o)})};e=function(j){j.data._total=g.val();j.data._per_page=i.val();j.data._page=h.val();j.data._url=document.location.href;if("undefined"!=showNotice&&j.data.action&&j.data.action=="delete-comment"&&j.data.deleted){return showNotice.warn()?j:false}return j};d=function(j,k,l){if(k<f){return}g.val(j.toString());if(l){f=k}a("span.total-type-count").each(function(){var m=a(this),o;o=g.val().toString();if(o.length>3){o=o.substr(0,o.length-3)+" "+o.substr(-3)}m.html(o)})};b=function(l,j){a("span.pending-count").each(function(){var m=a(this),o;o=m.html().replace(/[ ,.]+/g,"");o=parseInt(o,10);if(isNaN(o)){return}if(a("#"+j.element).is(".unapproved")){o=o-1}else{if(a(j.target).parents("span.unapprove").size()){o=o+1}}if(o<0){o=0}m.parents("#awaiting-mod")[0==o?"addClass":"removeClass"]("count-0");o=o.toString();if(o.length>3){o=o.substr(0,o.length-3)+" "+o.substr(-3)}m.html(o)});a("span.spam-count").each(function(){var m=a(this),o;o=m.html().replace(/[ ,.]+/g,"");o=parseInt(o,10);if(isNaN(o)){return}if(a(j.target).parents("span.spam").size()){o=o+1}else{if(a("#"+j.element).is(".spam")){o=o-1}}if(o<0){o=0}o=o.toString();if(o.length>3){o=o.substr(0,o.length-3)+" "+o.substr(-3)}m.html(o)});a("span.deleted-count").each(function(){var m=a(this),o;o=m.html().replace(/[ ,.]+/g,"");o=parseInt(o,10);if(isNaN(o)){return}if(a(j.target).parents("span.delete").size()&&a("#"+j.element).is(".deleted,.spam")){o--}else{if(a(j.target).parents("span.delete").size()){o++}else{if(a("#"+j.element).is(".deleted")){o--}}}if(o<0){o=0}o=o.toString();if(o.length>3){o=o.substr(0,o.length-3)+" "+o.substr(-3)}m.html(o)});if(("object"==typeof l)&&f<j.parsed.responses[0].supplemental.time){d(j.parsed.responses[0].supplemental.total,j.parsed.responses[0].supplemental.time,true);if(a.trim(j.parsed.responses[0].supplemental.pageLinks)){a(".tablenav-pages").find(".page-numbers").remove().end().append(a(j.parsed.responses[0].supplemental.pageLinks))}else{if("undefined"!=typeof j.parsed.responses[0].supplemental.pageLinks){a(".tablenav-pages").find(".page-numbers").remove()}}}else{var k=parseInt(g.val(),10);if(k--<0){k=0}d(k,l,false)}if(theExtraList.size()==0||theExtraList.children().size()==0){return}theList.get(0).wpList.add(theExtraList.children(":eq(0)").remove().clone());a("#get-extra-comments").submit()};theExtraList=a("#the-extra-comment-list").wpList({alt:"",delColor:"none",addColor:"none"});theList=a("#the-comment-list").wpList({alt:"",delBefore:e,dimAfter:c,delAfter:b,addColor:"none"})};commentReply={init:function(){var b=a("#replyrow");a("a.cancel",b).click(function(){return commentReply.revert()});a("a.save",b).click(function(){return commentReply.send()});a("input#author, input#author-email, input#author-url",b).keypress(function(c){if(c.which==13){commentReply.send();c.preventDefault();return false}});a("#the-comment-list .column-comment > p").dblclick(function(){commentReply.toggle(a(this).parent())});a("#doaction, #doaction2, #post-query-submit").click(function(c){if(a("#the-comment-list #replyrow").length>0){commentReply.close()}});this.comments_listing=a('#comments-form > input[name="comment_status"]').val()||""},addEvents:function(b){b.each(function(){a(this).find(".column-comment > p").dblclick(function(){commentReply.toggle(a(this).parent())})})},toggle:function(b){if(a(b).css("display")!="none"){a(b).find("a.vim-q").click()}},revert:function(){if(a("#the-comment-list #replyrow").length<1){return false}a("#replyrow").fadeOut("fast",function(){commentReply.close()});return false},close:function(){a(this.o).fadeIn("fast").css("backgroundColor","");a("#com-reply").append(a("#replyrow"));a("#replycontent").val("");a("#edithead input").val("");a("#replysubmit .error").html("").hide();a("#replysubmit .waiting").hide();if(a.browser.msie){a("#replycontainer, #replycontent").css("height","120px")}else{a("#replycontainer").resizable("destroy").css("height","120px")}},open:function(i,g,c){var e=this,d,b,f;e.close();e.o="#comment-"+i;a("#replyrow td").attr("colspan",a(".widefat thead th:visible").length);d=a("#replyrow"),rowData=a("#inline-"+i);b=e.act=(c=="edit")?"edit-comment":"replyto-comment";a("#action",d).val(b);a("#comment_post_ID",d).val(g);a("#comment_ID",d).val(i);if(c=="edit"){a("#author",d).val(a("div.author",rowData).text());a("#author-email",d).val(a("div.author-email",rowData).text());a("#author-url",d).val(a("div.author-url",rowData).text());a("#status",d).val(a("div.comment_status",rowData).text());a("#replycontent",d).val(a("textarea.comment",rowData).val());a("#edithead, #savebtn",d).show();a("#replyhead, #replybtn",d).hide();f=a(e.o).height();if(f>220){if(a.browser.msie){a("#replycontainer, #replycontent",d).height(f-105)}else{a("#replycontainer",d).height(f-105)}}a(e.o).after(d.hide()).fadeOut("fast",function(){a("#replyrow").fadeIn("fast")})}else{a("#edithead, #savebtn",d).hide();a("#replyhead, #replybtn",d).show();a(e.o).after(d);a("#replyrow").hide().fadeIn("fast")}if(!a.browser.msie){a("#replycontainer").resizable({handles:"s",axis:"y",minHeight:80,stop:function(){a("#replycontainer").width("auto")}})}setTimeout(function(){var l,j,m,h,k;l=a("#replyrow").offset().top;j=l+a("#replyrow").height();m=window.pageYOffset||document.documentElement.scrollTop;h=document.documentElement.clientHeight||self.innerHeight||0;k=m+h;if(k-20<j){window.scroll(0,j-h+35)}else{if(l-20<m){window.scroll(0,l-35)}}a("#replycontent").focus().keyup(function(n){if(n.which==27){commentReply.revert()}})},600);return false},send:function(){var b={};a("#replysubmit .waiting").show();a("#replyrow input").each(function(){b[a(this).attr("name")]=a(this).val()});b.content=a("#replycontent").val();b.id=b.comment_post_ID;b.comments_listing=this.comments_listing;a.ajax({type:"POST",url:wpListL10n.url,data:b,success:function(c){commentReply.show(c)},error:function(c){commentReply.error(c)}});return false},show:function(b){var e,g,f,d;if(typeof(b)=="string"){this.error({responseText:b});return false}e=wpAjax.parseAjaxResponse(b);if(e.errors){this.error({responseText:wpAjax.broken});return false}if("edit-comment"==this.act){a(this.o).remove()}e=e.responses[0];g=e.data;a(g).hide();a("#replyrow").after(g);this.o=f="#comment-"+e.id;this.revert();this.addEvents(a(f));d=a(f).hasClass("unapproved")?"#ffffe0":"#fff";a(f).animate({backgroundColor:"#CCEEBB"},600).animate({backgroundColor:d},600);a.fn.wpList.process(a(f))},error:function(b){var c=b.statusText;a("#replysubmit .waiting").hide();if(b.responseText){c=b.responseText.replace(/<.[^<>]*?>/g,"")}if(c){a("#replysubmit .error").html(c).show()}}};a(document).ready(function(){var e,b,c,d;setCommentsList();commentReply.init();a("span.delete a.delete").click(function(){return false});if(typeof QTags!="undefined"){ed_reply=new QTags("ed_reply","replycontent","replycontainer","more")}if(typeof a.table_hotkeys!="undefined"){e=function(f){return function(){var h,g;h="next"==f?"first":"last";g=a("."+f+".page-numbers");if(g.length){window.location=g[0].href.replace(/\&hotkeys_highlight_(first|last)=1/g,"")+"&hotkeys_highlight_"+h+"=1"}}};b=function(g,f){window.location=a("span.edit a",f).attr("href")};c=function(){toggleWithKeyboard=true;a("#comments-form thead #cb input:checkbox").click().attr("checked","");toggleWithKeyboard=false};d=function(f){return function(h,g){a("option[value="+f+"]").attr("selected","selected");a("form#comments-form")[0].submit()}};a.table_hotkeys(a("table.widefat"),["a","u","s","d","r","q",["e",b],["shift+a",d("approve")],["shift+s",d("markspam")],["shift+d",d("delete")],["shift+x",c],["shift+u",d("unapprove")]],{highlight_first:adminCommentsL10n.hotkeys_highlight_first,highlight_last:adminCommentsL10n.hotkeys_highlight_last,prev_page_link_cb:e("prev"),next_page_link_cb:e("next")})}})})(jQuery);
  • trunk/wp-admin/wp-admin.css

    r11711 r11731  
    445445}
    446446
    447 .unapproved .approve, .spam .approve {
     447.unapproved .approve, .spam .approve, .deleted .approve {
    448448    display: inline;
    449449}
  • trunk/wp-includes/comment.php

    r11713 r11731  
    209209    elseif ( 'spam' == $status )
    210210        $approved = "comment_approved = 'spam'";
     211    elseif ( 'deleted' == $status )
     212        $approved = "comment_approved = 'deleted'";
    211213    else
    212214        $approved = "( comment_approved = '0' OR comment_approved = '1' )";
     
    700702
    701703    $total = 0;
    702     $approved = array('0' => 'moderated', '1' => 'approved', 'spam' => 'spam');
     704    $approved = array('0' => 'moderated', '1' => 'approved', 'spam' => 'spam', 'deleted' => 'deleted');
    703705    $known_types = array_keys( $approved );
    704706    foreach( (array) $count as $row_num => $row ) {
     
    736738 */
    737739function wp_delete_comment($comment_id) {
     740    if (wp_get_comment_status($comment_id) != 'deleted' && wp_get_comment_status($comment_id) != 'spam')
     741        return wp_set_comment_status($comment_id, 'delete');
     742   
    738743    global $wpdb;
    739744    do_action('delete_comment', $comment_id);
     745   
     746    wp_unschedule_comment_destruction($comment_id);
    740747
    741748    $comment = get_comment($comment_id);
     
    785792    elseif ( $approved == 'spam' )
    786793        return 'spam';
     794    elseif ( $approved == 'deleted' )
     795        return 'deleted';
    787796    else
    788797        return false;
     
    10291038function wp_set_comment_status($comment_id, $comment_status, $wp_error = false) {
    10301039    global $wpdb;
    1031 
     1040    wp_unschedule_comment_destruction($comment_id);
     1041   
    10321042    $status = '0';
    10331043    switch ( $comment_status ) {
     
    10461056            break;
    10471057        case 'delete':
    1048             return wp_delete_comment($comment_id);
     1058            if (wp_get_comment_status($comment_id) == 'deleted' || wp_get_comment_status($comment_id) == 'spam')
     1059                return wp_delete_comment($comment_id);
     1060            $status = 'deleted';
     1061            wp_schedule_comment_destruction($comment_id);
    10491062            break;
    10501063        default:
     
    10691082
    10701083    return true;
     1084}
     1085
     1086/**
     1087 * Schedules a comment for destruction in 30 days.
     1088 *
     1089 * @since 2.9.0
     1090 *
     1091 * @param int $comment_id Comment ID.
     1092 * @return void
     1093 */
     1094function wp_schedule_comment_destruction($comment_id) {
     1095    $to_destroy = get_option('to_destroy');
     1096    if (!is_array($to_destroy))
     1097        $to_destroy = array();
     1098   
     1099    $to_destroy['comments'][$comment_id] = time();
     1100   
     1101    update_option('to_destroy', $to_destroy);
     1102}
     1103
     1104/**
     1105 * Unschedules a comment for destruction.
     1106 *
     1107 * @since 2.9.0
     1108 *
     1109 * @param int $comment_id Comment ID.
     1110 * @return void
     1111 */
     1112function wp_unschedule_comment_destruction($comment_id) {
     1113    $to_destroy = get_option('to_destroy');
     1114    if (!is_array($to_destroy))
     1115        return;
     1116   
     1117    unset($to_destroy['comments'][$comment_id]);
     1118   
     1119    update_option('to_destroy', $to_destroy);
    10711120}
    10721121
  • trunk/wp-includes/pluggable.php

    r11615 r11731  
    17681768endif;
    17691769
    1770 ?>
     1770/**
     1771 * Destroys comments which have previously been scheduled for destruction.
     1772 * Will do the same for posts, pages, etc in the future.
     1773 *
     1774 * @access private
     1775 * @since 2.9.0
     1776 *
     1777 * @return void
     1778 */
     1779function _scheduled_destruction() {
     1780    $to_destroy = get_option('to_destroy');
     1781    if (!is_array($to_destroy))
     1782        return;
     1783
     1784    $deletetimestamp = time()-(60*60*24*30);
     1785    foreach ($to_destroy['comments'] as $comment_id => $timestamp) {
     1786        if ($timestamp < $deletetimestamp) {
     1787            wp_delete_comment($comment_id);
     1788            unset($to_destroy['comments'][$comment_id]);
     1789        }
     1790    }
     1791
     1792    update_option('to_destroy', $to_destroy);
     1793}
     1794add_action( '_scheduled_destruction', '_scheduled_destruction' );
     1795if ( !wp_next_scheduled('_scheduled_destruction') && !defined('WP_INSTALLING') )
     1796    wp_schedule_event(time(), 'daily', '_scheduled_destruction');
     1797
     1798
  • trunk/wp-includes/script-loader.php

    r11719 r11731  
    6161    $scripts->add( 'utils', "/wp-admin/js/utils$suffix.js", false, '20090102' );
    6262
    63     $scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), '20090623' );
     63    $scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), '20090720' );
    6464    $scripts->add_data( 'common', 'group', 1 );
    6565    $scripts->localize( 'common', 'commonL10n', array(
    66         'warnDelete' => __("You are about to delete the selected items.\n  'Cancel' to stop, 'OK' to delete."),
     66        'warnDelete' => __("You are about to permanently delete the selected items.\n  'Cancel' to stop, 'OK' to delete."),
    6767        'l10n_print_after' => 'try{convertEntities(commonL10n);}catch(e){};'
    6868    ) );
     
    246246        $scripts->add_data( 'user-profile', 'group', 1 );
    247247
    248         $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20090627' );
     248        $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20090720' );
    249249        $scripts->add_data( 'admin-comments', 'group', 1 );
    250250        $scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
     
    427427
    428428    // all colors stylesheets need to have the same query strings (cache manifest compat)
    429     $colors_version = '20090625';
    430 
    431     $styles->add( 'wp-admin', '/wp-admin/wp-admin.css', array(), '20090625' );
     429    $colors_version = '20090720';
     430
     431    $styles->add( 'wp-admin', '/wp-admin/wp-admin.css', array(), '20090720' );
    432432    $styles->add_data( 'wp-admin', 'rtl', '/wp-admin/rtl.css' );
    433433
Note: See TracChangeset for help on using the changeset viewer.