Index: misc/checkbox.js
===================================================================
RCS file: misc/checkbox.js
diff -N misc/checkbox.js
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ misc/checkbox.js	17 Nov 2006 01:13:49 -0000
@@ -0,0 +1,77 @@
+// $Id: $
+
+Drupal.checkAllAttach = function() {
+  // keep track of which checkbox is checked for selecting ranges
+  var checked;
+  
+  // find all <a> with class check-all, and attach a toggle event to them
+  // so that when the link is clicked, checkboxes within the form are checked
+  // and when the link is clicked again, checkboxes are unchecked
+  // also highlight and unhighlight each row the checkbox lives in
+  $('a.select-all').show().toggle(function() {
+    $('input:checkbox', this.form).each(function() {
+      this.checked = true;
+      $(this).parents('tr').addClass('selected');
+    });
+    $(this).html('Select&nbsp;none');
+    return false;
+  }, function() {
+    $('input:checkbox', this.form).each(function() {
+      this.checked = false;
+      $(this).parents('tr').removeClass('selected');
+    });
+    $(this).html('Select&nbsp;all');
+    return false;
+  });
+
+  // for each of the checkboxes within the form that this <a> exists
+  $('form[a.select-all] input:checkbox').click(function(e) {
+    // highlight this row
+    $(this).parents('tr').addClass('selected');
+
+    // if this is a shift click, we need to highlight everything in the range
+    if (e.shiftKey) {
+      // we use the checkboxes parent TR to do our range searching
+      from = $(checked).parents('tr')[0];
+      to = $(e.target).parents('tr')[0];
+      
+      // we swap from and to around to support forward and reverse clicking
+      if (from.rowIndex > to.rowIndex) {
+         temp = to;
+         to = from;
+         from = temp;
+      }
+
+      selectRange(from, to);
+    }
+    
+    // keep track of what has been checked so far
+    checked = e.target;
+  });
+  
+  // select all checkboxes within a range
+  function selectRange(from, to) {
+    // traverse through the sibling nodes
+    for (var i = from.nextSibling; i; i = i.nextSibling) {
+      // make sure that we're only dealing with elements
+      if (i.nodeType != 1) continue;
+
+      if (to.nodeType) {
+      // if we are at the end stop
+        if (i == to) break;
+      } 
+      // a faster alternative to doing $(i).filter(to).length
+      else if (jQuery.filter(to, [i]).r.length) break;
+      
+      $(i).addClass('selected');
+      $('input:checkbox', i).each(function() {
+        this.checked = true;
+      });
+    }
+  }
+}
+
+// Global Killswitch
+if (Drupal.jsEnabled) {
+  $(document).ready(Drupal.checkAllAttach);
+}
Index: modules/comment/comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v
retrieving revision 1.496
diff -u -F^f -r1.496 comment.module
--- modules/comment/comment.module	12 Nov 2006 00:11:15 -0000	1.496
+++ modules/comment/comment.module	17 Nov 2006 01:13:51 -0000
@@ -1029,6 +1029,8 @@ function comment_admin($type = 'new') {
 }
 
 function comment_admin_overview($type = 'new', $arg) {
+  drupal_add_js('misc/checkbox.js');
+
   // build an 'Update options' form
   $form['options'] = array(
     '#type' => 'fieldset', '#title' => t('Update options'),
@@ -1044,7 +1046,7 @@ function comment_admin_overview($type = 
   // load the comments that we want to display
   $status = ($type == 'approval') ? COMMENT_NOT_PUBLISHED : COMMENT_PUBLISHED;
   $form['header'] = array('#type' => 'value', '#value' => array(
-    NULL,
+    array('data' => l(t('Select&nbsp;all'), NULL, array('class' => 'select-all'), NULL, NULL, FALSE, TRUE)),
     array('data' => t('Subject'), 'field' => 'subject'),
     array('data' => t('Author'), 'field' => 'name'),
     array('data' => t('Time'), 'field' => 'timestamp', 'sort' => 'desc'),
Index: modules/node/node.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.module,v
retrieving revision 1.728
diff -u -F^f -r1.728 node.module
--- modules/node/node.module	16 Nov 2006 08:32:19 -0000	1.728
+++ modules/node/node.module	17 Nov 2006 01:13:53 -0000
@@ -1491,6 +1491,8 @@ function node_admin_content() {
 }
 
 function node_admin_nodes() {
+  drupal_add_js('misc/checkbox.js');
+
   global $form_values;
   $filter = node_build_filter_query();
 
@@ -1527,7 +1529,7 @@ function node_admin_nodes() {
  */
 function theme_node_admin_nodes($form) {
   // Overview table:
-  $header = array(NULL, t('Title'), t('Type'), t('Author'), t('Status'), t('Operations'));
+  $header = array(l(t('Select&nbsp;all'), NULL, array('class' => 'select-all'), NULL, NULL, FALSE, TRUE), t('Title'), t('Type'), t('Author'), t('Status'), t('Operations'));
 
   $output .= drupal_render($form['options']);
   if (isset($form['title']) && is_array($form['title'])) {
Index: modules/system/system.css
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.css,v
retrieving revision 1.14
diff -u -F^f -r1.14 system.css
--- modules/system/system.css	24 Oct 2006 19:36:52 -0000	1.14
+++ modules/system/system.css	17 Nov 2006 01:13:53 -0000
@@ -325,3 +325,11 @@
   display: block;
   padding: 1.5em 0 .5em;
 }
+
+a.select-all {
+  display: none;
+  width: 6em;
+}
+tr.selected td {
+  background: #ffc;
+}
\ No newline at end of file
Index: modules/user/user.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.module,v
retrieving revision 1.711
diff -u -F^f -r1.711 user.module
--- modules/user/user.module	16 Nov 2006 09:01:55 -0000	1.711
+++ modules/user/user.module	17 Nov 2006 01:13:56 -0000
@@ -1958,6 +1958,8 @@ function theme_user_admin_new_role($form
 }
 
 function user_admin_account() {
+  drupal_add_js('misc/checkbox.js');
+
   $filter = user_build_filter_query();
 
   $header = array(
@@ -2029,7 +2031,7 @@ function user_admin_account() {
 function theme_user_admin_account($form) {
   // Overview table:
   $header = array(
-    array(),
+    array('data' => l(t('Select&nbsp;all'), NULL, array('class' => 'select-all'), NULL, NULL, FALSE, TRUE)),
     array('data' => t('Username'), 'field' => 'u.name'),
     array('data' => t('Status'), 'field' => 'u.status'),
     t('Roles'),
