? .DS_Store
? system_modules_cleanup.patch
? misc/drupal.js alias
? modules/.DS_Store
? profiles/.DS_Store
? profiles/my_new_profiaal
? sites/all/modules
? sites/default/files
? sites/default/settings.php
Index: modules/system/system.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.admin.inc,v
retrieving revision 1.64
diff -u -p -r1.64 system.admin.inc
--- modules/system/system.admin.inc	20 Feb 2008 13:46:41 -0000	1.64
+++ modules/system/system.admin.inc	2 Mar 2008 18:59:57 -0000
@@ -619,139 +619,53 @@ function system_modules($form_state = ar
     return system_modules_confirm_form($files, $form_state['storage']);
   }
   $dependencies = array();
+  $modules = array();
 
-  // Store module list for validation callback.
-  $form['validation_modules'] = array('#type' => 'value', '#value' => $files);
-
-  // Create storage for disabled modules as browser will disable checkboxes.
-  $form['disabled_modules'] = array('#type' => 'value', '#value' => array());
-
-  // Traverse the files, checking for compatibility
-  $incompatible_core = array();
-  $incompatible_php = array();
-  foreach ($files as $filename => $file) {
-    // Ensure this module is compatible with this version of core.
-    if (!isset($file->info['core']) || $file->info['core'] != DRUPAL_CORE_COMPATIBILITY) {
-      $incompatible_core[$file->name] = $file->name;
-    }
-    // Ensure this module is compatible with the currently installed version of PHP.
-    if (version_compare(phpversion(), $file->info['php']) < 0) {
-      $incompatible_php[$file->name] = $file->info['php'];
-    }
-  }
-
-  // Array for disabling checkboxes in callback system_module_disable.
-  $disabled = array();
-  $throttle = array();
-  // Traverse the files retrieved and build the form.
-  foreach ($files as $filename => $file) {
-    $form['name'][$filename] = array('#value' => $file->info['name']);
-    $form['version'][$filename] = array('#value' => $file->info['version']);
-    $form['description'][$filename] = array('#value' => t($file->info['description']));
-    $options[$filename] = '';
-    // Ensure this module is compatible with this version of core and php.
-    if (_system_is_incompatible($incompatible_core, $files, $file) || _system_is_incompatible($incompatible_php, $files, $file)) {
-      $disabled[] = $file->name;
-      // Nothing else in this loop matters, so move to the next module.
-      continue;
-    }
-    if ($file->status) {
-      $status[] = $file->name;
-    }
-    if ($file->throttle) {
-      $throttle[] = $file->name;
-    }
-
-    $dependencies = array();
-    // Check for missing dependencies.
-    if (is_array($file->info['dependencies'])) {
-      foreach ($file->info['dependencies'] as $dependency) {
-        if (!isset($files[$dependency]) || !$files[$dependency]->status) {
-          if (isset($files[$dependency])) {
-            $dependencies[] = $files[$dependency]->info['name'] . t(' (<span class="admin-disabled">disabled</span>)');
-          }
-          else {
-            $dependencies[] = drupal_ucfirst($dependency) . t(' (<span class="admin-missing">missing</span>)');
-            $disabled[] = $filename;
-            $form['disabled_modules']['#value'][$filename] = FALSE;
-          }
+  $modules_required = drupal_required_modules();
+  foreach ($files as $filename => $module) {
+    $extra = array();
+    if (in_array($filename, $modules_required)) {
+      $extra['required'] = TRUE;
+    }
+    $extra['enabled'] = (bool) $module->status;
+    if (is_array($module->info['dependencies'])) {
+      foreach ($module->info['dependencies'] as $dependency) {
+        if (!isset($files[$dependency])) {
+          $extra['dependencies'][] = $files[$dependency]->info['name'] . t(' (<span class="admin-disabled">disabled</span>)');
+        }
+        elseif (!$files[$dependency]->status) {
+          $extra['dependencies'][] = drupal_ucfirst($dependency) . t(' (<span class="admin-missing">missing</span>)');
+          $extra['disabled'] = TRUE;
         }
         else {
-          $dependencies[] = $files[$dependency]->info['name'] . t(' (<span class="admin-enabled">enabled</span>)');
+          $extra['dependencies'][] = $files[$dependency]->info['name'] . t(' (<span class="admin-enabled">enabled</span>)');
         }
       }
-
-      // Add text for dependencies.
-      if (!empty($dependencies)) {
-        $form['description'][$filename]['dependencies'] = array(
-          '#value' => t('Depends on: !dependencies', array('!dependencies' => implode(', ', $dependencies))),
-          '#prefix' => '<div class="admin-dependencies">',
-          '#suffix' => '</div>',
-        );
-      }
     }
-
     // Mark dependents disabled so user can not remove modules being depended on.
     $dependents = array();
-    foreach ($file->info['dependents'] as $dependent) {
+    foreach ($module->info['dependents'] as $dependent) {
       if ($files[$dependent]->status == 1) {
-        $dependents[] = $files[$dependent]->info['name'] . t(' (<span class="admin-enabled">enabled</span>)');
-        $disabled[] = $filename;
-        $form['disabled_modules']['#value'][$filename] = TRUE;
+        $extra['dependents'][] = $files[$dependent]->info['name'] . t(' (<span class="admin-enabled">enabled</span>)');
+        $extra['disabled'] = TRUE;
       }
       else {
-        $dependents[] = $files[$dependent]->info['name'] . t(' (<span class="admin-disabled">disabled</span>)');
+        $extra['dependents'][] = $files[$dependent]->info['name'] . t(' (<span class="admin-disabled">disabled</span>)');
       }
     }
-
-    // Add text for enabled dependents.
-    if (!empty($dependents)) {
-      $form['description'][$filename]['required'] = array(
-        '#value' => t('Required by: !required', array('!required' => implode(', ', $dependents))),
-        '#prefix' => '<div class="admin-required">',
-        '#suffix' => '</div>',
-      );
-    }
+    $form[$module->info['package']][$filename] = _system_modules_build_module($module->info, $extra);
   }
-
-  $modules_required = drupal_required_modules();
-  // Merge in required modules.
-  foreach ($modules_required as $required) {
-    $disabled[] = $required;
-    $form['disabled_modules']['#value'][$required] = TRUE;
-  }
-
-  // Handle status checkboxes, including overriding
-  // the generated checkboxes for required modules.
-  $form['status'] = array(
-    '#type' => 'checkboxes',
-    '#default_value' => $status,
-    '#options' => $options,
-    '#process' => array(
-      'expand_checkboxes',
-      'system_modules_disable',
-    ),
-    '#disabled_modules' => $disabled,
-    '#incompatible_modules_core' => $incompatible_core,
-    '#incompatible_modules_php' => $incompatible_php,
-  );
-
-  // Handle throttle checkboxes, including overriding the
-  // generated checkboxes for required modules.
-  if (module_exists('throttle')) {
-    $form['throttle'] = array(
-      '#type' => 'checkboxes',
-      '#default_value' => $throttle,
-      '#options' => $options,
-      '#process' => array(
-        'expand_checkboxes',
-        'system_modules_disable',
-      ),
-      '#disabled_modules' => array_merge($modules_required, array('throttle')),
+  foreach (element_children($form) as $package) {
+    $form[$package] += array(
+      '#type' => 'fieldset',
+      '#title' => t($package),
+      '#collapsible' => TRUE,
+      '#collapsed' => ($package == 'Core - required'),
+      '#theme' => 'system_modules_fieldset',
     );
   }
-
-  $form['buttons']['submit'] = array(
+  
+  $form['submit'] = array(
     '#type' => 'submit',
     '#value' => t('Save configuration'),
   );
@@ -767,20 +681,63 @@ function system_sort_modules_by_info_nam
   return strcasecmp($a->info['name'], $b->info['name']);
 }
 
-/**
- * Form process callback function to disable check boxes.
- *
- * @param $form
- *   The form structure.
- * @param $edit
- *   Not used.
- * @ingroup forms
- * @return
- *   The form structure.
- */
-function system_modules_disable($form, $edit) {
-  foreach ($form['#disabled_modules'] as $key) {
-    $form[$key]['#attributes']['disabled'] = 'disabled';
+function _system_modules_build_module($info, $extra) {
+  $extra += array(
+    'required' => FALSE,
+    'dependencies' => array(),
+    'dependents' => array(),
+    'disabled' => FALSE,
+    'enabled' => FALSE,
+  );
+  $form = array(
+    '#tree' => TRUE,
+  );
+  $form['name'] = array(
+    '#value' => t($info['name']),
+  );
+  $form['description'] = array(
+    '#value' => t($info['description']),
+  );
+  $form['version'] = array(
+    '#value' => $info['version'],
+  );
+
+  $compatible = TRUE;
+  $status_short = '';
+  $status_long = '';
+
+  if (!isset($info['core']) || $info['core'] != DRUPAL_CORE_COMPATIBILITY) {
+    $compatible = FALSE;
+    $status_short .= t('Incompatible with this version of Drupal core. ');
+    $status_long .= t('This version is incompatible with the !core_version version of Drupal core. ', array('!core_version' => VERSION));
+  }
+
+  // Ensure this module is compatible with the currently installed version of PHP.
+  if (version_compare(phpversion(), $info['php']) < 0) {
+    $compatible = FALSE;
+    $status_short .= t('Incompatible with this version of PHP');
+    if (substr_count($info['php'], '.') < 2) {
+      $php_required .= '.*';
+    }
+    $status_long .= t('This module requires PHP version @php_required and is incompatible with PHP version !php_version.', array('@php_required' => $php_required, '!php_version' => phpversion()));
+  }
+
+  if ($compatible) {
+    $form['enable'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Enable'),
+      '#required' => $extra['required'],
+      '#default_value' => $extra['enabled'],
+    );
+    if ($extra['disabled']) {
+      $form['enable']['#disabled'] = TRUE;
+    }
+  }
+  else {
+    $form['enable'] = array(
+      '#value' =>  theme('image', 'misc/watchdog-error.png', t('incompatible'), $status_short),
+    );
+    $form['description']['#value'] .= theme('system_modules_incompatible', $status_long);
   }
   return $form;
 }
@@ -2069,6 +2026,19 @@ function theme_system_modules($form) {
 }
 
 /**
+ * Themes an incompatible message.
+ *
+ * @ingroup themeable
+ * @param $message
+ *   The form array representing the currently disabled modules.
+ * @return
+ *   An HTML string for the message.
+ */
+function theme_system_modules_incompatible($message) {
+  return '<div class="incompatible">'. $message .'</div>';
+}
+
+/**
  * Themes a table of currently disabled modules.
  *
  * @ingroup themeable
Index: modules/system/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.module,v
retrieving revision 1.592
diff -u -p -r1.592 system.module
--- modules/system/system.module	20 Feb 2008 13:46:41 -0000	1.592
+++ modules/system/system.module	2 Mar 2008 18:59:57 -0000
@@ -117,8 +117,8 @@ function system_theme() {
       'arguments' => array('form' => NULL),
       'file' => 'system.admin.inc',
     ),
-    'system_modules' => array(
-      'arguments' => array('form' => NULL),
+    'system_modules_incompatible' => array(
+      'arguments' => array('message' => NULL),
       'file' => 'system.admin.inc',
     ),
     'system_modules_uninstall' => array(
