### 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.728
diff -u -r1.728 node.module
--- modules/node/node.module	16 Nov 2006 08:32:19 -0000	1.728
+++ modules/node/node.module	16 Nov 2006 18:59:01 -0000
@@ -1491,6 +1491,8 @@
 }
 
 function node_admin_nodes() {
+  drupal_add_js('misc/checkbox.js');
+
   global $form_values;
   $filter = node_build_filter_query();
 
@@ -1527,7 +1529,7 @@
  */
 function theme_node_admin_nodes($form) {
   // Overview table:
-  $header = array(NULL, t('Title'), t('Type'), t('Author'), t('Status'), t('Operations'));
+  $header = array(theme('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.711
diff -u -r1.711 user.module
--- modules/user/user.module	16 Nov 2006 09:01:55 -0000	1.711
+++ modules/user/user.module	16 Nov 2006 18:59:03 -0000
@@ -1958,6 +1958,8 @@
 }
 
 function user_admin_account() {
+  drupal_add_js('misc/checkbox.js');
+
   $filter = user_build_filter_query();
 
   $header = array(
@@ -2029,7 +2031,7 @@
 function theme_user_admin_account($form) {
   // Overview table:
   $header = array(
-    array(),
+    theme('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	16 Nov 2006 18:58:58 -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,
+    theme('checkall'),
     array('data' => t('Subject'), 'field' => 'subject'),
     array('data' => t('Author'), 'field' => 'name'),
     array('data' => t('Time'), 'field' => 'timestamp', 'sort' => 'desc'),
Index: includes/theme.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/theme.inc,v
retrieving revision 1.319
diff -u -r1.319 theme.inc
--- includes/theme.inc	8 Nov 2006 19:24:11 -0000	1.319
+++ includes/theme.inc	16 Nov 2006 18:58:57 -0000
@@ -939,6 +939,19 @@
 }
 
 /**
+ * Return a string for checkbox select/deselect links that are hidden by
+ * default. If JavaScript is enabled, the links will be displayed on page load.
+ */
+function theme_checkall() {
+  $output = '<span class="checkall" style="display: none">';
+  $output .= l(t('Select all'), '', array('class' => 'select'));
+  $output .= ' / ';
+  $output .= l(t('Deselect all'), '', array('class' => 'deselect'));
+  $output .= '</span>';
+  return $output;
+}
+
+/**
  * Execute hook_footer() which is run at the end of the page right before the
  * close of the body tag.
  *
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? To test, uncomment this and comment the next two blocks.
+    $(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);
+}
