WordPress.org

Make WordPress Core

Changeset 3652


Ignore:
Timestamp:
03/21/2006 12:33:36 AM (16 years ago)
Author:
ryan
Message:

Show number of comments selected for deletion. Props robmiller. fixes #2508

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit-comments.php

    r3563 r3652  
    2323        }
    2424    }
     25}
     26
     27function getNumChecked(form)
     28{
     29    var num = 0;
     30    for (i = 0, n = form.elements.length; i < n; i++) {
     31        if(form.elements[i].type == "checkbox") {
     32            if(form.elements[i].checked == true)
     33                num++;
     34        }
     35    }
     36    return num;
    2537}
    2638//-->
     
    169181    ?></table>
    170182    <p><a href="javascript:;" onclick="checkAll(document.getElementById('deletecomments')); return false; "><?php _e('Invert Checkbox Selection') ?></a></p>
    171             <p class="submit"><input type="submit" name="delete_button" value="<?php _e('Delete Checked Comments &raquo;') ?>" onclick="return confirm('<?php _e("You are about to delete these comments permanently \\n  \'Cancel\' to stop, \'OK\' to delete.") ?>')" />
     183            <p class="submit"><input type="submit" name="delete_button" value="<?php _e('Delete Checked Comments &raquo;') ?>" onclick="var numchecked = getNumChecked(document.getElementById('deletecomments')); if(numchecked < 1) { alert('<?php _e("Please select some comments to delete"); ?>'); return false } return confirm('<?php printf(__("You are about to delete %s comments permanently \\n  \'Cancel\' to stop, \'OK\' to delete."), "' + numchecked + '"); ?>')" />
    172184            <input type="submit" name="spam_button" value="<?php _e('Mark Checked Comments as Spam &raquo;') ?>" onclick="return confirm('<?php _e("You are about to mark these comments as spam \\n  \'Cancel\' to stop, \'OK\' to mark as spam.") ?>')" /></p>
    173185  </form>
Note: See TracChangeset for help on using the changeset viewer.