Commit 56790748 authored by Dries's avatar Dries

- Patch #550718 by alexanderpas, Gábor Hojtsy | Dries, webchick, ugerhard:...

- Patch #550718 by alexanderpas, Gábor Hojtsy | Dries, webchick, ugerhard: tabs on admin pages are not accessible from overviews and menus.
parent 29addd06
......@@ -102,6 +102,7 @@ function book_node_view_link($node, $build_mode) {
function book_menu() {
$items['admin/content/book'] = array(
'title' => 'Books',
'description' => "Manage your site's book outlines.",
'page callback' => 'book_admin_overview',
'access arguments' => array('administer book outlines'),
'type' => MENU_LOCAL_TASK,
......
......@@ -1573,7 +1573,7 @@ function _node_add_access() {
function node_menu() {
$items['admin/content'] = array(
'title' => 'Content',
'description' => 'Find and manage content and comments.',
'description' => 'Find and manage content.',
'page callback' => 'drupal_get_form',
'page arguments' => array('node_admin_content'),
'access arguments' => array('administer nodes'),
......@@ -1582,6 +1582,7 @@ function node_menu() {
);
$items['admin/content/node'] = array(
'title' => 'Content',
'description' => "View, edit, and delete your site's content.",
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10,
);
......
......@@ -564,6 +564,7 @@ function system_menu() {
);
$items['admin/appearance/settings'] = array(
'title' => 'Configure',
'description' => 'Configure default and theme specific settings.',
'page arguments' => array('system_theme_settings'),
'access arguments' => array('administer site configuration'),
'type' => MENU_LOCAL_TASK,
......@@ -1661,12 +1662,26 @@ function system_admin_menu_block($item) {
}
$content = array();
$default_task = NULL;
$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.type, m.description, ml.*
FROM {menu_links} ml
LEFT JOIN {menu_router} m ON ml.router_path = m.path
WHERE ml.plid = :plid AND ml.menu_name = :name AND hidden = 0", array(':plid' => $item['mlid'], ':name' => $item['menu_name']), array('fetch' => PDO::FETCH_ASSOC));
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.type, m.description, m.path, m.weight as router_weight, ml.*
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) {
if (!isset($link['link_path'])) {
// If this was not an actual link, fake the tab as a menu link, so we
// don't need to special case it beyond this point.
$link['link_title'] = $link['title'];
$link['link_path'] = $link['path'];
$link['options'] = 'a:0:{}';
$link['weight'] = $link['router_weight'];
}
else {
// We found a non-tab subitem, remember that.
$has_subitems = TRUE;
}
_menu_link_translate($link);
if (!$link['access']) {
continue;
......@@ -1678,7 +1693,16 @@ function system_admin_menu_block($item) {
}
// Prepare for sorting as in function _menu_tree_check_access().
// The weight is offset so it is always positive, with a uniform 5-digits.
$content[(50000 + $link['weight']) . ' ' . drupal_strtolower($link['title']) . ' ' . $link['mlid']] = $link;
$key = (50000 + $link['weight']) . ' ' . drupal_strtolower($link['title']) . ' ' . $link['mlid'];
$content[$key] = $link;
if ($link['type'] == MENU_DEFAULT_LOCAL_TASK) {
$default_task = $key;
}
}
if ($has_subitems) {
// 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]);
}
ksort($content);
$cache[$item['mlid']] = $content;
......
......@@ -1277,11 +1277,6 @@ function user_menu() {
'weight' => -4,
'file' => 'user.admin.inc',
);
$items['admin/people/list'] = array(
'title' => 'List',
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10,
);
$items['admin/people/create'] = array(
'title' => 'Add user',
'page arguments' => array('create'),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment