diff --git includes/menu.inc includes/menu.inc index 0d7a821..a3c8b80 100644 --- includes/menu.inc +++ includes/menu.inc @@ -118,6 +118,11 @@ define('MENU_IS_LOCAL_TASK', 0x0080); define('MENU_IS_LOCAL_ACTION', 0x0100); /** + * Internal menu flag -- menu item is the default settings page. + */ +define('MENU_SETTINGS_DEFAULT', 0x0016); + +/** * @} End of "Menu flags". */ diff --git modules/aggregator/aggregator.module modules/aggregator/aggregator.module index 789283e..47df53f 100644 --- modules/aggregator/aggregator.module +++ modules/aggregator/aggregator.module @@ -92,6 +92,7 @@ function aggregator_menu() { 'page callback' => 'aggregator_admin_overview', 'access arguments' => array('administer news feeds'), 'file' => 'aggregator.admin.inc', + 'type' => MENU_NORMAL_ITEM, ); $items['admin/config/services/aggregator/add/feed'] = array( 'title' => 'Add feed', @@ -144,7 +145,7 @@ function aggregator_menu() { 'page callback' => 'drupal_get_form', 'page arguments' => array('aggregator_admin_form'), 'access arguments' => array('administer news feeds'), - 'type' => MENU_LOCAL_TASK, + 'type' => MENU_LOCAL_TASK | MENU_SETTINGS_DEFAULT, 'file' => 'aggregator.admin.inc', ); $items['aggregator'] = array( diff --git modules/block/block.module modules/block/block.module index ee9d9db..3479db4 100644 --- modules/block/block.module +++ modules/block/block.module @@ -82,6 +82,7 @@ function block_menu() { 'page arguments' => array($default_theme), 'access arguments' => array('administer blocks'), 'file' => 'block.admin.inc', + 'type' => MENU_NORMAL_ITEM | MENU_SETTINGS_DEFAULT, ); $items['admin/structure/block/list'] = array( 'title' => 'List', @@ -800,7 +801,7 @@ function _block_render_blocks($region_blocks) { */ function _block_get_cache_id($block) { global $user; - + // User 1 being out of the regular 'roles define permissions' schema, // it brings too many chances of having unwanted output get in the cache // and later be served to other users. We therefore exclude user 1 from @@ -863,7 +864,7 @@ function template_preprocess_block(&$variables) { /** * Implement hook_user_role_delete(). * - * Remove deleted role from blocks that use it. + * Remove deleted role from blocks that use it. */ function block_user_role_delete($role) { db_delete('block_role') diff --git modules/book/book.module modules/book/book.module index dbd30f3..2ce81f8 100644 --- modules/book/book.module +++ modules/book/book.module @@ -117,7 +117,7 @@ function book_menu() { 'page callback' => 'drupal_get_form', 'page arguments' => array('book_admin_settings'), 'access arguments' => array('administer site configuration'), - 'type' => MENU_LOCAL_TASK, + 'type' => MENU_LOCAL_TASK | MENU_SETTINGS_DEFAULT, 'weight' => 8, 'file' => 'book.admin.inc', ); diff --git modules/filter/filter.module modules/filter/filter.module index 4bf3bb7..4a5ed6f 100644 --- modules/filter/filter.module +++ modules/filter/filter.module @@ -76,6 +76,7 @@ function filter_menu() { 'page arguments' => array('filter_admin_overview'), 'access arguments' => array('administer filters'), 'file' => 'filter.admin.inc', + 'type' => MENU_NORMAL_ITEM | MENU_SETTINGS_DEFAULT, ); $items['admin/config/content/formats/list'] = array( 'title' => 'List', diff --git modules/forum/forum.module modules/forum/forum.module index 41b3a23..cda8ef4 100644 --- modules/forum/forum.module +++ modules/forum/forum.module @@ -606,7 +606,7 @@ function forum_block_view_pre_render($elements) { */ function forum_form($node, $form_state) { $type = node_type_get_type($node); - + if (!empty($node->nid)) { $forum_terms = $node->taxonomy_forums; // If editing, give option to leave shadows diff --git modules/help/help.admin.inc modules/help/help.admin.inc index 455dc19..6939de1 100644 --- modules/help/help.admin.inc +++ modules/help/help.admin.inc @@ -38,7 +38,11 @@ function help_page($name) { $admin_tasks = system_get_module_admin_tasks($name); if (!empty($admin_tasks)) { ksort($admin_tasks); - $output .= theme('item_list', array('items' => $admin_tasks, 'title' => t('@module administration pages', array('@module' => $module['name'])))); + $admin_links = array(); + foreach ($admin_tasks as $task) { + $admin_links[] = l($task['title'], $task['path'], $task['options']); + } + $output .= theme('item_list', array('items' => $admin_links, 'title' => t('@module administration pages', array('@module' => $module['name'])))); } } diff --git modules/image/image.module modules/image/image.module index f2f0815..e24d4c9 100644 --- modules/image/image.module +++ modules/image/image.module @@ -55,6 +55,7 @@ function image_menu() { 'page callback' => 'image_style_list', 'access arguments' => array('administer image styles'), 'file' => 'image.admin.inc', + 'type' => MENU_NORMAL_ITEM | MENU_SETTINGS_DEFAULT, ); $items['admin/config/media/image-styles/list'] = array( 'title' => 'List', diff --git modules/locale/locale.module modules/locale/locale.module index 2d37b0c..020cfe6 100644 --- modules/locale/locale.module +++ modules/locale/locale.module @@ -93,6 +93,12 @@ function locale_help($path, $arg) { * Implement hook_menu(). */ function locale_menu() { + // Define main settings page. + $items['admin/config/regional'] = array( + 'title' => 'Regional and language', + 'description' => 'Regional settings, localization and translation.', + 'type' => MENU_SETTINGS_DEFAULT, + ); // Manage languages $items['admin/config/regional/language'] = array( 'title' => 'Languages', diff --git modules/menu/menu.module modules/menu/menu.module index 5d0fd21..bf9938d 100644 --- modules/menu/menu.module +++ modules/menu/menu.module @@ -80,7 +80,7 @@ function menu_menu() { 'page callback' => 'drupal_get_form', 'page arguments' => array('menu_configure'), 'access arguments' => array('administer menu'), - 'type' => MENU_LOCAL_TASK, + 'type' => MENU_LOCAL_TASK | MENU_SETTINGS_DEFAULT, 'weight' => 5, 'file' => 'menu.admin.inc', ); diff --git modules/path/path.module modules/path/path.module index 9ca4aca..f6d2ee2 100644 --- modules/path/path.module +++ modules/path/path.module @@ -39,6 +39,7 @@ function path_menu() { 'page callback' => 'path_admin_overview', 'access arguments' => array('administer url aliases'), 'file' => 'path.admin.inc', + 'type' => MENU_NORMAL_ITEM | MENU_SETTINGS_DEFAULT, ); $items['admin/config/search/path/edit'] = array( 'title' => 'Edit alias', diff --git modules/profile/profile.module modules/profile/profile.module index ea0a004..ac9eba4 100644 --- modules/profile/profile.module +++ modules/profile/profile.module @@ -90,6 +90,7 @@ function profile_menu() { 'page arguments' => array('profile_admin_overview'), 'access arguments' => array('administer users'), 'file' => 'profile.admin.inc', + 'type' => MENU_NORMAL_ITEM | MENU_SETTINGS_DEFAULT, ); $items['admin/config/people/profile/add'] = array( 'title' => 'Add field', diff --git modules/search/search.module modules/search/search.module index 6160c45..d128304 100644 --- modules/search/search.module +++ modules/search/search.module @@ -195,7 +195,7 @@ function search_menu() { 'page callback' => 'drupal_get_form', 'page arguments' => array('search_admin_settings'), 'access arguments' => array('administer search'), - 'type' => MENU_NORMAL_ITEM, + 'type' => MENU_NORMAL_ITEM | MENU_SETTINGS_DEFAULT, 'file' => 'search.admin.inc', ); $items['admin/config/search/settings/reindex'] = array( diff --git modules/simpletest/simpletest.module modules/simpletest/simpletest.module index f23921e..235e21e 100644 --- modules/simpletest/simpletest.module +++ modules/simpletest/simpletest.module @@ -42,7 +42,7 @@ function simpletest_menu() { 'page callback' => 'drupal_get_form', 'page arguments' => array('simpletest_settings_form'), 'access arguments' => array('administer unit tests'), - 'type' => MENU_LOCAL_TASK, + 'type' => MENU_LOCAL_TASK | MENU_SETTINGS_DEFAULT, 'file' => 'simpletest.pages.inc', ); $items['admin/config/development/testing/results/%'] = array( diff --git modules/statistics/statistics.module modules/statistics/statistics.module index fac5d6a..5be61d3 100644 --- modules/statistics/statistics.module +++ modules/statistics/statistics.module @@ -171,6 +171,7 @@ function statistics_menu() { 'page arguments' => array('statistics_settings_form'), 'access arguments' => array('administer statistics'), 'file' => 'statistics.admin.inc', + 'type' => MENU_NORMAL_ITEM | MENU_SETTINGS_DEFAULT, ); $items['user/%user/track/navigation'] = array( 'title' => 'Track page visits', diff --git modules/system/system.admin.inc modules/system/system.admin.inc index 447d4da..d95e76d 100644 --- modules/system/system.admin.inc +++ modules/system/system.admin.inc @@ -159,16 +159,24 @@ function system_admin_by_module() { // Only display a section if there are any available tasks. if (count($admin_tasks)) { + $admin_links = array(); // Check for help links. if ($help_arg && module_invoke($module, 'help', "admin/help#$module", $help_arg)) { - $admin_tasks[100] = l(t('Get help'), "admin/help/$module"); + $admin_tasks[100] = array( + 'title' => t('Get help'), + 'path' => "admin/help/$module", + 'options' => array('attributes' => array('class' => 'module-help-link')), + ); } // Sort. ksort($admin_tasks); - $menu_items[$info['name']] = array($info['description'], $admin_tasks); + foreach ($admin_tasks as $task) { + $admin_links[] = l($task['title'], $task['path'], $task['options']); + } + $menu_items[$info['name']] = array($info['description'], $admin_links); } } return theme('system_admin_by_module', array('menu_items' => $menu_items)); @@ -694,13 +702,31 @@ function system_modules($form, $form_state = array()) { } } } + $extra['links'] = array(); + $links = array(); + // Only get links to permission and default settings. + $admin_tasks = system_get_module_admin_tasks($module->name, FALSE); + foreach ($admin_tasks as $key => $task) { + // Build a link with no text; only show the icon. + if (!isset($task['options']['attributes']['title'])) { + $task['options']['attributes']['title'] = $task['title']; + } + if (!empty($task['options']['attributes']['class'])) { + $links[] = l(' ', $task['path'], $task['options']); + } + } // Generate link for module's help page, if there is one. if ($help_arg && $module->status && in_array($filename, module_implements('help'))) { if (module_invoke($filename, 'help', "admin/help#$filename", $help_arg)) { // Module has a help page. - $extra['help'] = theme('more_help_link', array('url' => url("admin/help/$filename"))); + $links[] = l('', "admin/help/$filename", array('attributes' => array('class' => 'module-help-link', 'title' => t('More help')))); } } + $links = array_reverse($links, TRUE); + + if (count($links)) { + $extra['links'] = theme('item_list', array('items' => $links)); + } // Mark dependents disabled so the user cannot remove required modules. $dependents = array(); // If this module is required by other modules, list those, and then make it @@ -731,6 +757,7 @@ function system_modules($form, $form_state = array()) { t('Name'), t('Version'), t('Description'), + t('Operations'), ), ); } @@ -761,7 +788,7 @@ function _system_modules_build_row($info, $extra) { 'required_by' => array(), 'disabled' => FALSE, 'enabled' => FALSE, - 'help' => '', + 'extra' => array(), ); $form = array( '#tree' => TRUE, @@ -820,10 +847,10 @@ function _system_modules_build_row($info, $extra) { $form['description']['#markup'] .= theme('system_modules_incompatible', array('message' => $status_long)); } - // Show a "more help" link for modules that have them. - if ($extra['help']) { - $form['help'] = array( - '#markup' => $extra['help'], + // Show a set of useful links for modules that have them. + if (count($extra['links'])) { + $form['links'] = array( + '#markup' => $extra['links'], ); } return $form; @@ -2282,14 +2309,8 @@ function theme_system_modules_fieldset($variables) { } $row[] = $label . '>' . drupal_render($module['name']) . ''; $row[] = drupal_render($module['version']); - $description = ''; - // If we have help, it becomes the first part - // of the description - with CSS, it is float: right'd. - if (isset($module['help'])) { - $description = '
' . drupal_render($module['help']) . '
'; - } // Add the description, along with any modules it requires. - $description .= drupal_render($module['description']); + $description = drupal_render($module['description']); if ($module['#requires']) { $description .= '
' . t('Requires: !module-list', array('!module-list' => implode(', ', $module['#requires']))) . '
'; } @@ -2297,6 +2318,8 @@ function theme_system_modules_fieldset($variables) { $description .= '
' . t('Required by: !module-list', array('!module-list' => implode(', ', $module['#required_by']))) . '
'; } $row[] = array('data' => $description, 'class' => array('description')); + // Display links (such as help or permissions) in its own column. + $row[] = array('data' => drupal_render($module['links']), 'class' => array('operations')); $rows[] = $row; } diff --git modules/system/system.css modules/system/system.css index 6d1281a..64e6436 100644 --- modules/system/system.css +++ modules/system/system.css @@ -159,10 +159,21 @@ tr.merge-up, tr.merge-up td, tr.merge-up th { .more-help-link { text-align: right; /* LTR */ } -.more-help-link a { +.more-help-link a, a.module-help-link { padding: 1px 0 1px 20px; /* LTR */ background: url(../../misc/help.png) 0 50% no-repeat; /* LTR */ } +a.module-help-link, a.module-permissions-link, a.module-settings-link { + padding: 1px 0 1px 26px; /* LTR */ + display: block; + height: 16px; +} +a.module-permissions-link { + background: url(../../misc/permissions.png) 0 50% no-repeat; /* LTR */ +} +a.module-settings-link { + background: url(../../misc/settings.png) 0 50% no-repeat; /* LTR */ +} .more-link { text-align: right; /* LTR */ } @@ -170,6 +181,17 @@ tr.merge-up, tr.merge-up td, tr.merge-up th { margin-left: 1em; /* LTR */ float: right; /* LTR */ } +td.operations { + clear: both; + width: 85px; +} +.operations .item-list ul li { + float: right; + margin: 0 0 0 ; +} +.operations .item-list ul li.last { + margin-left: 0; +} .nowrap { white-space: nowrap; } diff --git modules/system/system.module modules/system/system.module index 9172bb4..56f12a0 100644 --- modules/system/system.module +++ modules/system/system.module @@ -795,6 +795,7 @@ function system_menu() { 'page callback' => 'system_admin_menu_block_page', 'access arguments' => array('access administration pages'), 'file' => 'system.admin.inc', + 'type' => MENU_NORMAL_ITEM, ); $items['admin/config/regional/settings'] = array( 'title' => 'Regional settings', @@ -1746,7 +1747,7 @@ function system_admin_menu_block($item) { $has_subitems = FALSE; $result = db_query(" SELECT m.load_functions, m.to_arg_functions, m.access_callback, m.access_arguments, m.page_callback, m.page_arguments, m.title, m.title_callback, m.title_arguments, m.theme_callback, m.theme_arguments, m.type, m.description, m.path, m.weight as router_weight, ml.* - FROM {menu_router} m + FROM {menu_router} m LEFT JOIN {menu_links} ml ON m.path = ml.router_path WHERE (ml.plid = :plid AND ml.menu_name = :name AND hidden = 0) OR (m.tab_parent = :path AND m.type IN (:local_task, :default_task))", array(':plid' => $item['mlid'], ':name' => $item['menu_name'], ':path' => $item['path'], ':local_task' => MENU_LOCAL_TASK, ':default_task' => MENU_DEFAULT_LOCAL_TASK), array('fetch' => PDO::FETCH_ASSOC)); foreach ($result as $link) { @@ -1780,7 +1781,7 @@ function system_admin_menu_block($item) { } } if ($has_subitems) { - // If we've had at least one non-tab subitem, remove the link for the + // If we've had at least one non-tab subitem, remove the link for the // default task, since that is already broken down to subitems. unset($content[$default_task]); } @@ -2450,13 +2451,20 @@ function system_admin_compact_page($mode = 'off') { * * @param $module * Module name. + * @param $all_tasks + * If TRUE return all task links provided by this module. + * If this is set to FALSE only links to permission and links marked as + * MENU_SETTINGS_DEFAULT are returned. * @return * An array of task links. */ -function system_get_module_admin_tasks($module) { +function system_get_module_admin_tasks($module, $all_tasks = TRUE) { $items = &drupal_static(__FUNCTION__, array()); + $admin_access = user_access('administer permissions'); + $admin_tasks = array(); + $admin_task_count = 0; - if (empty($items)) { + if (!$all_tasks || empty($items)) { $result = db_query(" SELECT m.load_functions, m.to_arg_functions, m.access_callback, m.access_arguments, m.page_callback, m.page_arguments, m.title, m.title_callback, m.title_arguments, m.theme_callback, m.theme_arguments, m.type, ml.* FROM {menu_links} ml INNER JOIN {menu_router} m ON ml.router_path = m.path WHERE ml.link_path LIKE 'admin/%' AND hidden >= 0 AND module = 'system' AND m.number_parts > 2", array(), array('fetch' => PDO::FETCH_ASSOC)); @@ -2468,19 +2476,34 @@ function system_get_module_admin_tasks($module) { } } - $admin_access = user_access('administer permissions'); - $admin_tasks = array(); - $admin_task_count = 0; // Check for permissions. if (in_array($module, module_implements('permission')) && $admin_access) { - $admin_tasks[-1] = l(t('Configure permissions'), 'admin/config/people/permissions', array('fragment' => 'module-' . $module)); + $admin_tasks[-1] = array( + 'title' => t('Configure permissions'), + 'path' => 'admin/config/people/permissions', + 'options' => array('fragment' => 'module-' . $module, 'attributes' => array('class' => 'module-permissions-link')), + ); } // Check for menu items that are admin links. if (in_array($module, module_implements('menu')) && $menu = module_invoke($module, 'menu')) { - foreach (array_keys($menu) as $path) { - if (isset($items[$path])) { - $admin_tasks[$items[$path]['title'] . $admin_task_count ++] = l($items[$path]['title'], $path); + foreach ($menu as $path => $item) { + if ($all_tasks && isset($items[$path])) { + $class = (strpos($path, 'admin/config') !== FALSE) ? 'module-settings-link' : ''; + $admin_tasks[$items[$path]['title'] . $admin_task_count ++] = array( + 'title' => $items[$path]['title'], + 'path' => $path, + 'options' => array('attributes' => array('class' => $class)), + ); + } + elseif ($all_tasks == FALSE) { + if (isset($item['type']) && (($item['type'] & MENU_SETTINGS_DEFAULT) == MENU_SETTINGS_DEFAULT)) { + $admin_tasks[$item['title'] . $admin_task_count ++] = array( + 'title' => isset($item['description']) ? $item['description'] : $item['title'], + 'path' => $path, + 'options' => array('attributes' => array('class' => 'module-settings-link')), + ); + } } } } diff --git modules/update/update.module modules/update/update.module index 43a74a3..a38e6c3 100644 --- modules/update/update.module +++ modules/update/update.module @@ -155,7 +155,7 @@ function update_menu() { 'page arguments' => array('update_settings'), 'access arguments' => array('administer site configuration'), 'file' => 'update.settings.inc', - 'type' => MENU_LOCAL_TASK, + 'type' => MENU_LOCAL_TASK | MENU_SETTINGS_DEFAULT, ); $items['admin/reports/updates/check'] = array( 'title' => 'Manual update check', diff --git modules/upload/upload.module modules/upload/upload.module index 30b92e6..d86f634 100644 --- modules/upload/upload.module +++ modules/upload/upload.module @@ -98,7 +98,7 @@ function upload_menu() { 'page callback' => 'drupal_get_form', 'page arguments' => array('upload_admin_settings'), 'access arguments' => array('administer site configuration'), - 'type' => MENU_NORMAL_ITEM, + 'type' => MENU_NORMAL_ITEM | MENU_SETTINGS_DEFAULT, 'file' => 'upload.admin.inc', ); return $items; diff --git modules/user/user.module modules/user/user.module index 1b8db22..89d0ffa 100644 --- modules/user/user.module +++ modules/user/user.module @@ -1420,6 +1420,7 @@ function user_menu() { 'access arguments' => array('access administration pages'), 'file' => 'system.admin.inc', 'file path' => drupal_get_path('module', 'system'), + 'type' => MENU_NORMAL_ITEM | MENU_SETTINGS_DEFAULT, ); $items['admin/config/people/accounts'] = array( 'title' => 'Account settings', diff --git themes/seven/style.css themes/seven/style.css index e2d25a0..f20be89 100644 --- themes/seven/style.css +++ themes/seven/style.css @@ -430,6 +430,10 @@ table tr.selected td { border-color: #eeb; } +#system-modules table td { + vertical-align: baseline; +} + /** * Forms. */