Make WordPress Core

Ticket #13363: garyc40-13363.patch

File garyc40-13363.patch, 10.0 KB (added by garyc40, 14 years ago)

there's a patch for that

  • wp-admin/css/colors-fresh.dev.css

    diff --git wp-admin/css/colors-fresh.dev.css wp-admin/css/colors-fresh.dev.css
    index fccbed6..cf0ca7a 100644
    a, 
    494494#poststuff #edButtonPreview,
    495495#poststuff #edButtonHTML,
    496496#the-comment-list p.comment-author strong a,
     497#the-comment-list .undo .approve a,
     498#the-comment-list .undo .unapprove a,
    497499#media-upload a.del-link,
    498500#media-items a.delete,
    499501.plugins a.delete,
  • wp-admin/css/wp-admin.dev.css

    diff --git wp-admin/css/wp-admin.dev.css wp-admin/css/wp-admin.dev.css
    index 1781101..c87008d 100644
    span.imgedit-scale-warn { 
    35293529        border-right-width: 1px;
    35303530}
    35313531
    3532 .trash-undo-inside,
    3533 .spam-undo-inside {
     3532.undo-inside {
    35343533        margin: 1px 8px 1px 0;
    35353534        line-height: 16px;
    35363535}
    35373536
    3538 .spam-undo-inside .avatar,
    3539 .trash-undo-inside .avatar {
     3537.undo-inside .avatar {
    35403538        height: 20px;
    35413539        width: 20px;
    35423540        margin-right: 8px;
    35433541        vertical-align: middle;
    35443542}
    35453543
     3544.undo-inside .approve {
     3545        display:inline;
     3546}
     3547
    35463548.stuffbox .editcomment {
    35473549        clear: none;
    35483550}
  • wp-admin/includes/template.php

    diff --git wp-admin/includes/template.php wp-admin/includes/template.php
    index 5f5c1c3..a1bc7d5 100644
    function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single', 
    403403function wp_comment_trashnotice() {
    404404?>
    405405<div class="hidden" id="trash-undo-holder">
    406         <div class="trash-undo-inside"><?php printf(__('Comment by %s moved to the trash.'), '<strong></strong>'); ?> <span class="undo untrash"><a href="#"><?php _e('Undo'); ?></a></span></div>
     406        <div class="trash-undo-inside undo-inside"><?php printf(__('Comment by %s moved to the trash.'), '<strong></strong>'); ?> <span class="undo untrash"><a href="#"><?php _e('Undo'); ?></a></span></div>
    407407</div>
    408408<div class="hidden" id="spam-undo-holder">
    409         <div class="spam-undo-inside"><?php printf(__('Comment by %s marked as spam.'), '<strong></strong>'); ?> <span class="undo unspam"><a href="#"><?php _e('Undo'); ?></a></span></div>
     409        <div class="spam-undo-inside undo-inside"><?php printf(__('Comment by %s marked as spam.'), '<strong></strong>'); ?> <span class="undo unspam"><a href="#"><?php _e('Undo'); ?></a></span></div>
     410</div>
     411<div class="hidden" id="approve-undo-holder">
     412        <div class="approve-undo-inside undo-inside"><?php printf(__('Comment by %s approved.'), '<strong></strong>'); ?> <span class="undo unapprove"><a href="#"><?php _e('Undo'); ?></a></span></div>
     413</div>
     414<div class="hidden" id="unapprove-undo-holder">
     415        <div class="unapprove-undo-inside undo-inside"><?php printf(__('Comment by %s unapproved.'), '<strong></strong>'); ?> <span class="undo approve"><a href="#"><?php _e('Undo'); ?></a></span></div>
    410416</div>
    411417<?php
    412418}
  • wp-admin/js/edit-comments.dev.js

    diff --git wp-admin/js/edit-comments.dev.js wp-admin/js/edit-comments.dev.js
    index 177dc86..5e178a2 100644
    var theList, theExtraList, toggleWithKeyboard = false; 
    22(function($) {
    33
    44setCommentsList = function() {
    5         var totalInput, perPageInput, pageInput, lastConfidentTime = 0, dimAfter, delBefore, updateTotalCount, delAfter;
     5        var totalInput, perPageInput, pageInput, lastConfidentTime = 0, dimBefore, dimAfter, delBefore, updateTotalCount, delAfter, showUndo, getActionFromClass;
    66
    77        totalInput = $('.tablenav input[name="_total"]', '#comments-form');
    88        perPageInput = $('.tablenav input[name="_per_page"]', '#comments-form');
    99        pageInput = $('.tablenav input[name="_page"]', '#comments-form');
    1010
    11         dimAfter = function( r, settings ) {
    12                 var c = $('#' + settings.element);
    13 
    14                 if ( c.is('.unapproved') )
    15                         c.find('div.comment_status').html('0')
    16                 else
    17                         c.find('div.comment_status').html('1')
    18 
    19                 $('span.pending-count').each( function() {
    20                         var a = $(this), n, dif;
    21                         n = a.html().replace(/[^0-9]+/g, '');
    22                         n = parseInt(n,10);
    23                         if ( isNaN(n) ) return;
    24                         dif = $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1;
    25                         n = n + dif;
    26                         if ( n < 0 ) { n = 0; }
    27                         a.closest('#awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0');
    28                         updateCount(a, n);
    29                         dashboardTotals();
    30                 });
     11        getActionFromClass = function(cl) {
     12                var ret;
     13                if ( cl.indexOf(':trash=1') != -1 ) {
     14                        ret = {
     15                                action : 'trash',
     16                                undoAction : 'untrash',
     17                                undoClass : ':untrash=1'
     18                        };
     19                }
     20                else if ( cl.indexOf(':spam=1') != -1 ) {
     21                        ret = {
     22                                action : 'spam',
     23                                undoAction : 'unspam',
     24                                undoClass : ':unspam=1'
     25                        };
     26                }
     27                else if ( cl.indexOf(':action=dim-comment&new=approved') != -1 ) {
     28                        ret = {
     29                                action : 'approve',
     30                                undoAction : 'unapprove',
     31                                undoClass : 'e7e7d3:action=dim-comment&new=unapproved'
     32                        };
     33                }
     34                else if ( cl.indexOf(':action=dim-comment&new=unapproved') != -1 ) {
     35                        ret = {
     36                                action : 'unapprove',
     37                                undoAction : 'approve',
     38                                undoClass : 'e7e7d3:action=dim-comment&new=approved'
     39                        };
     40                } else {
     41                        return false;
     42                }
     43               
     44                return ret;
    3145        };
    3246
    33         // Send current total, page, per_page and url
    34         delBefore = function( settings, list ) {
    35                 var cl = $(settings.target).attr('className'), id, el, n, h, a, author, action = false;
    36 
    37                 settings.data._total = totalInput.val() || 0;
    38                 settings.data._per_page = perPageInput.val() || 0;
    39                 settings.data._page = pageInput.val() || 0;
    40                 settings.data._url = document.location.href;
    41 
    42                 if ( cl.indexOf(':trash=1') != -1 )
    43                         action = 'trash';
    44                 else if ( cl.indexOf(':spam=1') != -1 )
    45                         action = 'spam';
    46 
    47                 if ( action ) {
     47        showUndo = function(settings, list) {
     48                var cl = $(settings.target).attr('className'), params = false, id, el, note, n, author, h, a, undoAction, undoClass;
     49               
     50                params = getActionFromClass(cl);
     51               
     52                if ( params ) {
    4853                        id = cl.replace(/.*?comment-([0-9]+).*/, '$1');
    4954                        el = $('#comment-' + id);
    50                         note = $('#' + action + '-undo-holder').html();
     55                        note = $('#' + params.action + '-undo-holder').html();
    5156
    5257                        el.find('.check-column :checkbox').attr('checked', ''); // Uncheck the row so as not to be affected by Bulk Edits.
    5358
    54                         if ( el.siblings('#replyrow').length && commentReply.cid == id )
     59                        if ( el.siblings('#replyrow').length && commentReply.cid == id ) {
    5560                                commentReply.close();
     61                        }
    5662
    5763                        if ( el.is('tr') ) {
    5864                                n = el.children(':visible').length;
    5965                                author = $('.author strong', el).text();
    60                                 h = $('<tr id="undo-' + id + '" class="undo un' + action + '" style="display:none;"><td colspan="' + n + '">' + note + '</td></tr>');
     66                                h = $('<tr id="undo-' + id + '" class="undo ' + params.undoAction + '" style="display:none;"><td colspan="' + n + '">' + note + '</td></tr>');
    6167                        } else {
    6268                                author = $('.comment-author', el).text();
    63                                 h = $('<div id="undo-' + id + '" style="display:none;" class="undo un' + action + '">' + note + '</div>');
     69                                h = $('<div id="undo-' + id + '" style="display:none;" class="undo ' + params.undoAction + '">' + note + '</div>');
    6470                        }
    6571
    6672                        el.before(h);
    6773
    6874                        $('strong', '#undo-' + id).text(author + ' ');
    6975                        a = $('.undo a', '#undo-' + id);
    70                         a.attr('href', 'comment.php?action=un' + action + 'comment&c=' + id + '&_wpnonce=' + settings.data._ajax_nonce);
    71                         a.attr('className', 'delete:the-comment-list:comment-' + id + '::un' + action + '=1 vim-z vim-destructive');
    72                         $('.avatar', el).clone().prependTo('#undo-' + id + ' .' + action + '-undo-inside');
     76                        a.attr('href', 'comment.php?action=' + params.undoAction + 'comment&c=' + id + '&_wpnonce=' + settings.data._ajax_nonce);
     77                        a.attr('className', 'delete:the-comment-list:comment-' + id + ':' + params.undoClass + ' vim-z vim-destructive');
     78                        $('.avatar', el).clone().prependTo('#undo-' + id + ' .' + params.action + '-undo-inside');
    7379
    7480                        a.click(function(){
    7581                                list.wpList.del(this);
    7682                                $('#undo-' + id).css( {backgroundColor:'#ceb'} ).fadeOut(350, function(){
    7783                                        $(this).remove();
    78                                         $('#comment-' + id).css('backgroundColor', '').fadeIn(300, function(){ $(this).show() });
     84                                        $('#comment-' + id).css('backgroundColor', '').fadeIn(300);
    7985                                });
    8086                                return false;
    8187                        });
    8288                }
     89        };
     90
     91        dimAfter = function( r, settings ) {
     92                var c = $('#' + settings.element);
     93
     94                if ( c.is('.unapproved') )
     95                        c.find('div.comment_status').html('0');
     96                else
     97                        c.find('div.comment_status').html('1');
    8398
     99                $('span.pending-count').each( function() {
     100                        var a = $(this), n, dif;
     101                        n = a.html().replace(/[^0-9]+/g, '');
     102                        n = parseInt(n,10);
     103                        if ( isNaN(n) ) return;
     104                        dif = $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1;
     105                        n = n + dif;
     106                        if ( n < 0 ) { n = 0; }
     107                        a.closest('#awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0');
     108                        updateCount(a, n);
     109                        dashboardTotals();
     110                });
     111        };
     112
     113        // Send current total, page, per_page and url
     114        delBefore = function( settings, list ) {
     115                var cl = $(settings.target).attr('className'), id, el, n, h, a, author, action = false;
     116
     117                settings.data._total = totalInput.val() || 0;
     118                settings.data._per_page = perPageInput.val() || 0;
     119                settings.data._page = pageInput.val() || 0;
     120                settings.data._url = document.location.href;
     121
     122                if (! $(settings.target).parent().hasClass('undo')) {
     123                        showUndo(settings, list);
     124                }
     125               
    84126                return settings;
    85127        };
    86128
    setCommentsList = function() { 
    159201                        spam = -1;
    160202
    161203                $('span.pending-count').each( function() {
    162                         var a = $(this), n = getCount(a), unapproved = $('#' + settings.element).is('.unapproved');
     204                        var a = $(this), n = getCount(a), unapproved = $('#' + settings.element).is('.unapproved') || $(settings.target).parent().is('span.approve');
    163205
    164206                        if ( $(settings.target).parent().is('span.unapprove') || ( ( untrash || unspam ) && unapproved ) ) { // we "deleted" an approved comment from the approved list by clicking "Unapprove"
    165207                                n = n + 1;
    setCommentsList = function() { 
    243285                .bind('wpListDelEnd', function(e, s){
    244286                        var id = s.element.replace(/[^0-9]+/g, '');
    245287
    246                         if ( s.target.className.indexOf(':trash=1') != -1 || s.target.className.indexOf(':spam=1') != -1 )
     288                        if ( getActionFromClass(s.target.className) )
    247289                                $('#undo-' + id).fadeIn(300, function(){ $(this).show() });
    248290                });
    249291        $(listTable).bind('changePage', refillTheExtraList);