cvs diff: Diffing modules/update
Index: modules/update/update.manager.inc
===================================================================
RCS file: /Users/wright/drupal/local_repo/drupal/modules/update/update.manager.inc,v
retrieving revision 1.3
diff -u -p -r1.3 update.manager.inc
--- modules/update/update.manager.inc	24 Oct 2009 03:03:44 -0000	1.3
+++ modules/update/update.manager.inc	24 Oct 2009 03:28:50 -0000
@@ -80,6 +80,11 @@ function update_manager_update_form($for
   // array of data for cells in that project's row in the appropriate table.
   $projects = array();
 
+  // Remember all the project types that need updates (e.g. module,
+  // theme-disabled, etc) so that we can generate the right labels for the
+  // tables we create.
+  $project_types = array();
+
   // This stores the actual download link we're going to update from for each
   // project in the form, regardless of if it's enabled or disabled.
   $form['project_downloads'] = array('#tree' => TRUE);
@@ -157,8 +162,10 @@ function update_manager_update_form($for
 
     $entry['#attributes'] = array('class' => array('update-' . $type));
 
+    $project_type = $project['project_type'];
+
     // Drupal core needs to be upgraded manually.
-    $needs_manual = $project['project_type'] == 'core';
+    $needs_manual = $project_type == 'core';
 
     if ($needs_manual) {
       // Since it won't be tableselect, #weight will add an extra column to the
@@ -175,7 +182,7 @@ function update_manager_update_form($for
 
     // Based on what kind of project this is, save the entry into the
     // appropriate subarray.
-    switch ($project['project_type']) {
+    switch ($project_type) {
       case 'core':
         // Core needs manual updates at this time.
         $projects['manual'][$name] = $entry;
@@ -191,6 +198,9 @@ function update_manager_update_form($for
         $projects['disabled'][$name] = $entry;
         break;
     }
+
+    // Remember that we just processed a project of this type.
+    $project_types[$project_type] = TRUE;
   }
 
   if (empty($projects)) {
@@ -215,8 +225,19 @@ function update_manager_update_form($for
       '#header' => $headers,
       '#options' => $projects['enabled'],
     );
-    if (count($projects) > 1) {
-      $form['projects']['#prefix'] = '<h2>' . t('Enabled add-ons') . '</h2>';
+    if (!empty($projects['disabled'])) {
+      if (isset($project_types['module'])) {
+        if (isset($project_types['theme'])) {
+          $header_text = t('Enabled modules and themes');
+        }
+        else {
+          $header_text = t('Enabled modules');
+        }
+      }
+      elseif (isset($project_types['theme'])) {
+        $header_text = t('Enabled themes');
+      }
+      $form['projects']['#prefix'] = '<h2>' . $header_text . '</h2>';
     }
   }
 
@@ -227,9 +248,18 @@ function update_manager_update_form($for
       '#options' => $projects['disabled'],
       '#weight' => 1,
     );
-    if (count($projects) > 1) {
-      $form['disabled_projects']['#prefix'] = '<h2>' . t('Disabled add-ons') . '</h2>';
+    if (isset($project_types['module-disabled'])) {
+      if (isset($project_types['theme-disabled'])) {
+        $header_text = t('Disabled modules and themes');
+      }
+      else {
+        $header_text = t('Disabled modules');
+      }
+    }
+    elseif (isset($project_types['theme-disabled'])) {
+      $header_text = t('Disabled themes');
     }
+    $form['disabled_projects']['#prefix'] = '<h2>' . $header_text . '</h2>';
   }
 
   // If either table has been printed yet, we need a submit button and to
cvs diff: Diffing modules/update/tests
