Index: admin_menu.module
===================================================================
--- admin_menu.module	(Revision 267)
+++ admin_menu.module	(Arbeitskopie)
@@ -396,6 +396,9 @@ function admin_menu_form_alter($form_id,
       '#description' => t('Enable this option to disable user access checks for menu items, i.e. every menu item in the visible menu tree will be displayed to every user regardless of access permissions.'),
     );
   }
+  else if ($form_id == 'system_modules') {
+    drupal_add_js(drupal_get_path('module', 'admin_menu') .'/admin_menu.modules.js');
+  }
 }
 
 /**
Index: admin_menu.modules.js
===================================================================
--- admin_menu.modules.js	(Revision 0)
+++ admin_menu.modules.js	(Revision 0)
@@ -0,0 +1,63 @@
+// $Id: qamodules.js,v 1.1 2008/02/22 01:25:13 starbow Exp $
+
+/**
+ * We are activating the module, so activate all the parents it depends on.
+ */
+Drupal.qamodulesActivate = function (title, modules) {
+  modules[title].self.attr('checked', true);
+  jQuery.each(modules[title].dependencies, function(i, val) {
+    Drupal.qamodulesActivate(val, modules);
+  });
+}
+
+/**
+ * We are deactivating the module, so deactivate all the modules that depend on it.
+ */
+Drupal.qamodulesDeactivate = function (title, modules) {
+  modules[title].self.attr('checked', false);
+  jQuery.each(modules[title].requirements, function(i, val) {
+    Drupal.qamodulesDeactivate(val, modules);
+  });
+}
+
+/**
+ * Parse a module's Required by, or Depends on string.
+ *
+ * @param: str - ex: 'Required by: Event Views (disabled), Views UI (disabled)'
+ * @return: array - ex: ['Event Views', 'Views UI']
+ */
+Drupal.qamodulesParse = function(str) {
+  var result = [];
+  if (str) {
+    str = str.substr(str.indexOf(':')+1); // Remove 'Required by:'
+    str = str.replace( /\([^)]*\)/g, ''); // Remove (stuff).
+    result = jQuery.map(str.split(','), function(n,i) {
+      return jQuery.trim(n);
+    });
+  }
+  return result;
+}
+
+if( Drupal.jsEnabled ) {
+  $(document).ready(function(){ 
+	  var modules = [];
+	  $('#system-modules input:checkbox, #system-modules-1 input:checkbox').each( function() {
+	    var $row = $(this).parents('tr:first');
+	    var $title = $row.children('td').eq(1).text();
+	    var $depend = Drupal.qamodulesParse($row.find('.admin-dependencies').text());
+	    var $required = Drupal.qamodulesParse($row.find('.admin-required').text());
+	    modules[$title] = { self: $(this), dependencies : $depend, requirements : $required }
+	  });
+	  $('#system-modules input:checkbox, #system-modules-1 input:checkbox').click( function() {
+	    var title = $(this).parents('tr:first').children('td').eq(1).text();
+	    var checked = $(this).attr('checked');
+	    if (checked) { 
+	      Drupal.qamodulesActivate(title, modules);
+	    }
+	    else {
+	      Drupal.qamodulesDeactivate(title, modules);    
+	    }
+	  });
+	  $(':checkbox:disabled').attr('disabled', false); // Allow parents to be turned off.
+  });
+}
