Index: system.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.admin.inc,v retrieving revision 1.30 diff -u -r1.30 system.admin.inc --- system.admin.inc 27 Nov 2007 21:06:28 -0000 1.30 +++ system.admin.inc 2 Dec 2007 05:14:06 -0000 @@ -566,6 +566,7 @@ * The form array. */ function system_modules($form_state = array()) { + include_once './includes/install.inc'; // for uninstallation checks drupal_rebuild_theme_registry(); node_types_rebuild(); menu_rebuild(); @@ -585,6 +586,21 @@ // Create storage for disabled modules as browser will disable checkboxes. $form['disabled_modules'] = array('#type' => 'value', '#value' => array()); + + // Create links for module dashboard + $forms['module_menu'] = array('#type' => 'value', '#value' => array()); + + // Retrieve help links that 'help' knows about + $help_menu = module_invoke('help', 'menu'); + $help_links = array(); + if (is_array($help_menu)) { + foreach ($help_menu as $path => $info) { + if (!isset($info['title'])) continue; + $help_links[$info['title']] = $path; + } + } + + // Traverse the files, checking for compatibility $incompatible_core = array(); @@ -605,6 +621,7 @@ $throttle = array(); // Traverse the files retrieved and build the form. foreach ($files as $filename => $file) { + module_load_install($filename); // so that we can inspect hooks, SECURITY RISK! $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'])); @@ -621,6 +638,14 @@ if ($file->throttle) { $throttle[] = $file->name; } + + $menu = system_get_module_admin_tasks($filename); + if (isset($help_links[$filename])) { + $form['module_menu']['#value'][$filename][] = '' . t('Help') . ''; + } + foreach ($menu as $link) { + $form['module_menu']['#value'][$filename][] = $link; + } $dependencies = array(); // Check for missing dependencies. @@ -680,6 +705,13 @@ $disabled[] = $required; $form['disabled_modules']['#value'][$required] = TRUE; } + + // Determine which modules can be uninstalled + $uninstallable_modules = _system_modules_get_uninstallable_modules(); + while ($module = db_fetch_object($uninstallable_modules)) { + if (!module_hook($module->name, 'uninstall')) continue; + $form['module_menu']['#value'][$module->name][] = '' . t('Uninstall') . ''; + } // Handle status checkboxes, including overriding // the generated checkboxes for required modules. @@ -716,7 +748,6 @@ '#value' => t('Save configuration'), ); $form['#action'] = url('admin/build/modules/list/confirm'); - return $form; } @@ -936,7 +967,7 @@ $form = array(); // Pull all disabled modules from the system table. - $disabled_modules = db_query("SELECT name, filename, info FROM {system} WHERE type = 'module' AND status = 0 AND schema_version > %d ORDER BY name", SCHEMA_UNINSTALLED); + $disabled_modules = _system_modules_get_uninstallable_modules(); while ($module = db_fetch_object($disabled_modules)) { // Grab the module info @@ -951,6 +982,17 @@ $options[$module->name] = ''; } } + + if (arg(4) == 'confirm' && $module = arg(5)) { + if (isset($form['modules'][$module])) { + $storage['uninstall'][$module] = $module; + if ($confirm_form = system_modules_uninstall_confirm_form($storage)) { + return $confirm_form; + } + } else { + form_set_error('system_modules_uninstall', 'Cannot uninstall ' . $module . '; module either does not exist or is active.'); + } + } // Only build the rest of the form if there are any modules available to uninstall. if (!empty($options)) { @@ -1054,6 +1096,10 @@ } } +function _system_modules_get_uninstallable_modules() { + return db_query("SELECT name, filename, info FROM {system} WHERE type = 'module' AND status = 0 AND schema_version > %d ORDER BY name", SCHEMA_UNINSTALLED); +} + /** * Form builder; The general site information form. * @@ -1931,6 +1977,10 @@ foreach ($modules as $key => $module) { $row = array(); $description = drupal_render($form['description'][$key]); + if (isset($form['module_menu']['#value'][$key])) { + // add module links + $description .= '
'; + } if (isset($form['status']['#incompatible_modules_core'][$key])) { unset($form['status'][$key]); $status = theme('image', 'misc/watchdog-error.png', t('incompatible'), t('Incompatible with this version of Drupal core')); @@ -1963,7 +2013,11 @@ $row[] = drupal_render($form['version'][$key]); $row[] = array('data' => $description, 'class' => 'description'); - $rows[] = $row; + + $extended_row = array('data' => $row); + if ($form['status'][$key]['#value']) $extended_row['class'] = 'enabled'; + + $rows[] = $extended_row; } $fieldset = array( '#title' => t($package), Index: system.css =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.css,v retrieving revision 1.41 diff -u -r1.41 system.css --- system.css 20 Nov 2007 10:18:43 -0000 1.41 +++ system.css 1 Dec 2007 22:54:17 -0000 @@ -495,6 +495,16 @@ font-weight: bold; } +#system-modules div.menu { + color: #444; + font-size: 0.9em; +} + +#system-modules tr.enabled { + background:#B6EFA4; + border-color:#80CF67; +} + /* ** Styles for the system themes page (admin/build/themes) */