### Eclipse Workspace Patch 1.0
#P Drupal HEAD (Core)
Index: modules/node/node.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.module,v
retrieving revision 1.727
diff -u -r1.727 node.module
--- modules/node/node.module	12 Nov 2006 19:56:07 -0000	1.727
+++ modules/node/node.module	14 Nov 2006 22:14:24 -0000
@@ -1490,6 +1490,8 @@
 }
 
 function node_admin_nodes() {
+  drupal_add_js('misc/checkbox.js');
+
   global $form_values;
   $filter = node_build_filter_query();
 
@@ -1526,7 +1528,7 @@
  */
 function theme_node_admin_nodes($form) {
   // Overview table:
-  $header = array(NULL, t('Title'), t('Type'), t('Author'), t('Status'), t('Operations'));
+  $header = array(array('data' => l(t('Select all'), NULL, array('class' => 'select')) .' / '. l(t('Deselect all'), NULL, array('class' => 'deselect')), 'style' => 'display: none', 'class' => 'checkall'), 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/user/user.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.module,v
retrieving revision 1.708
diff -u -r1.708 user.module
--- modules/user/user.module	11 Nov 2006 23:52:11 -0000	1.708
+++ modules/user/user.module	14 Nov 2006 22:14:26 -0000
@@ -1960,6 +1960,8 @@
 }
 
 function user_admin_account() {
+  drupal_add_js('misc/checkbox.js');
+
   $filter = user_build_filter_query();
 
   $header = array(
@@ -2031,7 +2033,7 @@
 function theme_user_admin_account($form) {
   // Overview table:
   $header = array(
-    array(),
+    array('data' => l(t('Select all'), NULL, array('class' => 'select')) .' / '. l(t('Deselect all'), NULL, array('class' => 'deselect')), 'style' => 'display: none', 'class' => 'checkall'),
     array('data' => t('Username'), 'field' => 'u.name'),
     array('data' => t('Status'), 'field' => 'u.status'),
     t('Roles'),
Index: modules/comment/comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v
retrieving revision 1.496
diff -u -r1.496 comment.module
--- modules/comment/comment.module	12 Nov 2006 00:11:15 -0000	1.496
+++ modules/comment/comment.module	14 Nov 2006 22:14:22 -0000
@@ -1029,6 +1029,8 @@
 }
 
 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 @@
   // 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 all'), NULL, array('class' => 'select')) .' / '. l(t('Deselect all'), NULL, array('class' => 'deselect')), 'style' => 'display: none', 'class' => 'checkall'),
     array('data' => t('Subject'), 'field' => 'subject'),
     array('data' => t('Author'), 'field' => 'name'),
     array('data' => t('Time'), 'field' => 'timestamp', 'sort' => 'desc'),
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	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,41 @@
+// $Id: $
+
+Drupal.checkAllAttach = function() {
+  // Look for an element with class="checkall" and unhide it. Make any a.select
+  // element show all checkboxes in that form, opposite for a.deselect.
+  $('.checkall').each(function() {
+    $(this).show();
+    /*
+    Why doesn't var state = this.is(".select"); work?
+    $(this).find('a').each(function() {
+      $(this).click(function() {
+        var state = this.is(".select");
+        $(this.form).find("input[@type='checkbox']").each(function() {
+          this.checked = state;
+        });
+        return false;
+      });
+    });*/
+    $(this).find('a.select').each(function() {
+      $(this).click(function() {
+        $(this.form).find("input[@type='checkbox']").each(function() {
+          this.checked = true;
+        });
+        return false;
+      });
+    });
+    $(this).find('a.deselect').each(function() {
+      $(this).click(function() {
+        $(this.form).find("input[@type='checkbox']").each(function() {
+          this.checked = false;
+        });
+        return false;
+      });
+    });
+  });
+}
+
+// Global Killswitch
+if (Drupal.jsEnabled) {
+  $(document).ready(Drupal.checkAllAttach);
+}
