Commit ac5b5616 authored by Dries's avatar Dries

- More tab-improvements by JonBob: improved support for the default tabs!
parent e21f238a
......@@ -7,6 +7,8 @@
*/
/**
* @name Menu Flags
* @{
* Flags for use in the "type" attribute of menu items.
*/
define('MENU_IS_ROOT', 0x0001);
......@@ -18,6 +20,17 @@
define('MENU_CREATED_BY_ADMIN', 0x0040);
define('MENU_IS_LOCAL_TASK', 0x0080);
define('MENU_IS_LOCAL_SUBTASK', 0x0100);
define('MENU_LINKS_TO_PARENT', 0x0200);
/**
* @}
*/
/**
* @name Menu Item Types
* @{
* Menu item definitions provide one of these constants, which are shortcuts for
* combinations of the above flags.
*/
/**
* Normal menu items show up in the menu tree and can be moved/hidden by
......@@ -58,6 +71,12 @@
*/
define('MENU_LOCAL_SUBTASK', MENU_IS_LOCAL_SUBTASK);
/**
* Every set of local tasks should provide one "default" task, that links to the
* same path as its parent when clicked.
*/
define('MENU_DEFAULT_LOCAL_TASK', MENU_IS_LOCAL_TASK | MENU_LINKS_TO_PARENT);
/**
* Custom items are those defined by the administrator.
*/
......@@ -69,11 +88,20 @@
define('MENU_CUSTOM_MENU', MENU_IS_ROOT | MENU_VISIBLE_IN_TREE | MENU_CREATED_BY_ADMIN | MENU_MODIFIABLE_BY_ADMIN);
/**
* @}
*/
/**
* @name Menu status codes
* @{
* Status codes for menu callbacks.
*/
define('MENU_FOUND', 1);
define('MENU_NOT_FOUND', 2);
define('MENU_ACCESS_DENIED', 3);
/**
* @}
*/
/**
* Return the menu data structure.
......@@ -127,7 +155,11 @@ function menu_get_local_tasks() {
// _menu_build_local_tasks() may indirectly call this function, so prevent
// infinite loops.
$_menu['local tasks'] = array();
_menu_build_local_tasks();
$pid = menu_get_active_nontask_item();
if (!_menu_build_local_tasks($pid)) {
// If the build returned FALSE, the tasks need not be displayed.
$_menu['local tasks'][$pid]['children'] = array();
}
}
return $_menu['local tasks'];
......@@ -265,6 +297,20 @@ function menu_set_active_item($path = NULL) {
$path = substr($path, 0, strrpos($path, '/'));
}
$stored_mid = array_key_exists($path, $menu['path index']) ? $menu['path index'][$path] : 0;
// Search for default local tasks to activate instead of this item.
$continue = TRUE;
while ($continue) {
$continue = FALSE;
if (array_key_exists('children', $menu['items'][$stored_mid])) {
foreach ($menu['items'][$stored_mid]['children'] as $cid) {
if ($menu['items'][$cid]['type'] & MENU_LINKS_TO_PARENT) {
$stored_mid = $cid;
$continue = TRUE;
}
}
}
}
}
return $stored_mid;
......@@ -288,24 +334,6 @@ function menu_get_active_nontask_item() {
}
}
/**
* Returns the ID of the current menu item or, if the current item is a
* local task or subtask, the ID of the current local task (not subtask).
*/
function menu_get_active_local_task() {
$menu = menu_get_menu();
$mid = menu_get_active_item();
// Find the first non-task item:
while ($mid && ($menu['items'][$mid]['type'] & MENU_LOCAL_SUBTASK)) {
$mid = $menu['items'][$mid]['pid'];
}
if ($mid) {
return $mid;
}
}
/**
* Returns the title of the active menu item.
*/
......@@ -346,7 +374,7 @@ function menu_get_active_breadcrumb() {
$links[] = l(t('Home'), '');
$trail = _menu_get_trail($_GET['q']);
$trail = _menu_get_active_trail();
foreach ($trail as $mid) {
if ($menu['items'][$mid]['type'] & MENU_VISIBLE_IN_BREADCRUMB) {
$links[] = theme('menu_item', $mid);
......@@ -363,11 +391,7 @@ function menu_get_active_breadcrumb() {
* Returns true when the menu item is in the active trail.
*/
function menu_in_active_trail($mid) {
static $trail;
if (empty($trail)) {
$trail = _menu_get_trail($_GET['q']);
}
$trail = _menu_get_active_trail();
return in_array($mid, $trail);
}
......@@ -457,7 +481,12 @@ function theme_menu_tree($pid = 1, $all = FALSE) {
function theme_menu_item($mid) {
$menu = menu_get_menu();
return l($menu['items'][$mid]['title'], $menu['items'][$mid]['path']);
$link_mid = $mid;
while ($menu['items'][$link_mid]['type'] & MENU_LINKS_TO_PARENT) {
$link_mid = $menu['items'][$link_mid]['pid'];
}
return l($menu['items'][$mid]['title'], $menu['items'][$link_mid]['path']);
}
/**
......@@ -466,17 +495,18 @@ function theme_menu_item($mid) {
*/
function theme_menu_local_tasks() {
$local_tasks = menu_get_local_tasks();
$pid = menu_get_active_nontask_item();
$output = '';
if (count($local_tasks[0]['children'])) {
if (count($local_tasks[$pid]['children'])) {
$output .= "<ul class=\"tabs primary\">\n";
foreach ($local_tasks[0]['children'] as $mid) {
$output .= theme('menu_local_task', $mid, $mid == menu_get_active_local_task());
foreach ($local_tasks[$pid]['children'] as $mid) {
$output .= theme('menu_local_task', $mid, menu_in_active_trail($mid));
}
$output .= "</ul>\n";
foreach ($local_tasks[0]['children'] as $mid) {
if ($mid == menu_get_active_local_task() && count($local_tasks[$mid]['children'])) {
foreach ($local_tasks[$pid]['children'] as $mid) {
if (menu_in_active_trail($mid) && count($local_tasks[$mid]['children'])) {
$output .= "<ul class=\"tabs secondary\">\n";
foreach ($local_tasks[$mid]['children'] as $cid) {
$output .= theme('menu_local_task', $cid, menu_in_active_trail($cid));
......@@ -509,28 +539,24 @@ function theme_menu_local_task($mid, $active) {
/** @} End of addtogroup themeable */
/**
* Returns an array with the menu items that lead to the specified path.
* Returns an array with the menu items that lead to the current menu item.
*/
function _menu_get_trail($path) {
$menu = menu_get_menu();
function _menu_get_active_trail() {
static $trail;
$trail = array();
if (!isset($trail)) {
$menu = menu_get_menu();
// Find the ID of the given path.
while ($path && !array_key_exists($path, $menu['path index'])) {
$path = substr($path, 0, strrpos($path, '/'));
}
if (!array_key_exists($path, $menu['path index'])) {
return array();
}
$mid = $menu['path index'][$path];
$trail = array();
// Follow the parents up the chain to get the trail.
while ($mid && $menu['items'][$mid]) {
array_unshift($trail, $mid);
$mid = $menu['items'][$mid]['pid'];
}
$mid = menu_get_active_item();
// Follow the parents up the chain to get the trail.
while ($mid && $menu['items'][$mid]) {
array_unshift($trail, $mid);
$mid = $menu['items'][$mid]['pid'];
}
}
return $trail;
}
......@@ -721,50 +747,42 @@ function _menu_build_visible_tree($pid = 0) {
*
* Since this is only for display, we only need title, path, and children
* for each item.
*
* At the close of this function, $_menu['local tasks'] is populated with the
* menu items in the local task tree.
*
* @return
* TRUE if the local task tree is forked. It does not need to be displayed
* otherwise.
*/
function _menu_build_local_tasks() {
function _menu_build_local_tasks($pid) {
global $_menu;
$tasks = array();
$tasks[0] = array('children' => array());
$forked = FALSE;
$mid = menu_get_active_nontask_item();
if ($mid) {
// Find top-level tasks
if ($children = $_menu['items'][$mid]['children']) {
foreach ($children as $cid) {
if (($_menu['items'][$cid]['type'] & MENU_IS_LOCAL_TASK) && _menu_item_is_accessible($cid)) {
$tasks[$cid] = array('title' => $_menu['items'][$cid]['title'], 'path' => $_menu['items'][$cid]['path'], 'children' => array());
$tasks[0]['children'][] = $cid;
if (isset($_menu['items'][$pid])) {
$parent = $_menu['items'][$pid];
$children = array();
if (array_key_exists('children', $parent)) {
foreach ($parent['children'] as $mid) {
if (($_menu['items'][$mid]['type'] & MENU_IS_LOCAL_TASK) && _menu_item_is_accessible($mid)) {
$children[] = $mid;
// Beware short-circuiting || operator!
$forked = _menu_build_local_tasks($mid) || $forked;
}
}
}
usort($tasks[0]['children'], '_menu_sort');
$tasks[$mid] = array('title' => $_menu['items'][$mid]['title'], 'path' => $_menu['items'][$mid]['path'], 'children' => array());
array_unshift($tasks[0]['children'], $mid);
// Find subtasks
foreach ($tasks[0]['children'] as $mid) {
if ($children = $_menu['items'][$mid]['children']) {
foreach ($children as $cid) {
if (($_menu['items'][$cid]['type'] & MENU_IS_LOCAL_SUBTASK) && _menu_item_is_accessible($cid)) {
$tasks[$cid] = array('title' => $_menu['items'][$cid]['title'], 'path' => $_menu['items'][$cid]['path'], 'children' => array());
$tasks[$mid]['children'][] = $cid;
}
}
}
usort($tasks[$mid]['children'], '_menu_sort');
usort($children, '_menu_sort');
$forked = $forked || count($children) > 1;
$_menu['local tasks'][$pid] = array('title' => $parent['title'], 'path' => $parent['path'], 'children' => $children);
foreach ($children as $mid) {
$_menu['local tasks'][$mid]['pid'] = $pid;
}
}
if (count($tasks) > 2) {
$_menu['local tasks'] = $tasks;
}
else {
$_menu['local tasks'] = array();
$_menu['local tasks'][0] = array('children' => array());
}
return $forked;
}
?>
......@@ -129,7 +129,8 @@ function aggregator_menu() {
'callback' => 'aggregator_admin_refresh_feed', 'access' => $edit,
'type' => MENU_CALLBACK);
// Tabs:
$items[] = array('path' => 'admin/aggregator/list', 'title' => t('list'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array('path' => 'admin/aggregator/add/feed', 'title' => t('add feed'),
'callback' => 'aggregator_admin_edit_feed', 'access' => $edit,
'type' => MENU_LOCAL_TASK);
......@@ -159,6 +160,8 @@ function aggregator_menu() {
while ($feed = db_fetch_object($result)) {
$items[] = array('path' => 'aggregator/sources/'. $feed->fid, 'title' => $feed->title,
'callback' => 'aggregator_page_source', 'access' => $view);
$items[] = array('path' => 'aggregator/sources/'. $feed->fid .'/view', 'title' => t('view'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array('path' => 'aggregator/sources/'. $feed->fid .'/categorize', 'title' => t('categorize'),
'callback' => 'aggregator_page_source', 'access' => $edit,
'type' => MENU_LOCAL_TASK);
......@@ -173,6 +176,8 @@ function aggregator_menu() {
while ($category = db_fetch_object($result)) {
$items[] = array('path' => 'aggregator/categories/'. $category->cid, 'title' => $category->title,
'callback' => 'aggregator_page_category', 'access' => $view);
$items[] = array('path' => 'aggregator/categories/'. $category->cid .'/view', 'title' => t('view'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array('path' => 'aggregator/categories/'. $category->cid .'/categorize', 'title' => t('categorize'),
'callback' => 'aggregator_page_category', 'access' => $edit,
'type' => MENU_LOCAL_TASK);
......
......@@ -129,7 +129,8 @@ function aggregator_menu() {
'callback' => 'aggregator_admin_refresh_feed', 'access' => $edit,
'type' => MENU_CALLBACK);
// Tabs:
$items[] = array('path' => 'admin/aggregator/list', 'title' => t('list'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array('path' => 'admin/aggregator/add/feed', 'title' => t('add feed'),
'callback' => 'aggregator_admin_edit_feed', 'access' => $edit,
'type' => MENU_LOCAL_TASK);
......@@ -159,6 +160,8 @@ function aggregator_menu() {
while ($feed = db_fetch_object($result)) {
$items[] = array('path' => 'aggregator/sources/'. $feed->fid, 'title' => $feed->title,
'callback' => 'aggregator_page_source', 'access' => $view);
$items[] = array('path' => 'aggregator/sources/'. $feed->fid .'/view', 'title' => t('view'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array('path' => 'aggregator/sources/'. $feed->fid .'/categorize', 'title' => t('categorize'),
'callback' => 'aggregator_page_source', 'access' => $edit,
'type' => MENU_LOCAL_TASK);
......@@ -173,6 +176,8 @@ function aggregator_menu() {
while ($category = db_fetch_object($result)) {
$items[] = array('path' => 'aggregator/categories/'. $category->cid, 'title' => $category->title,
'callback' => 'aggregator_page_category', 'access' => $view);
$items[] = array('path' => 'aggregator/categories/'. $category->cid .'/view', 'title' => t('view'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array('path' => 'aggregator/categories/'. $category->cid .'/categorize', 'title' => t('categorize'),
'callback' => 'aggregator_page_category', 'access' => $edit,
'type' => MENU_LOCAL_TASK);
......
......@@ -208,6 +208,8 @@ function archive_menu() {
'access' => user_access('access content'),
'callback' => 'archive_page',
'type' => MENU_SUGGESTED_ITEM);
$items[] = array('path' => 'archive/browse', 'title' => t('browse'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array('path' => 'archive/configure', 'title' => t('configure'),
'access' => user_access('administer site configuration'),
'callback' => 'archive_configure',
......
......@@ -208,6 +208,8 @@ function archive_menu() {
'access' => user_access('access content'),
'callback' => 'archive_page',
'type' => MENU_SUGGESTED_ITEM);
$items[] = array('path' => 'archive/browse', 'title' => t('browse'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array('path' => 'archive/configure', 'title' => t('configure'),
'access' => user_access('administer site configuration'),
'callback' => 'archive_configure',
......
......@@ -67,6 +67,8 @@ function block_menu() {
$items[] = array('path' => 'admin/block', 'title' => t('blocks'),
'access' => user_access('administer blocks'),
'callback' => 'block_admin');
$items[] = array('path' => 'admin/block/list', 'title' => t('list'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array('path' => 'admin/block/edit', 'title' => t('edit block'),
'access' => user_access('administer blocks'),
'callback' => 'block_box_edit',
......
......@@ -67,6 +67,8 @@ function block_menu() {
$items[] = array('path' => 'admin/block', 'title' => t('blocks'),
'access' => user_access('administer blocks'),
'callback' => 'block_admin');
$items[] = array('path' => 'admin/block/list', 'title' => t('list'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array('path' => 'admin/block/edit', 'title' => t('edit block'),
'access' => user_access('administer blocks'),
'callback' => 'block_box_edit',
......
......@@ -52,7 +52,9 @@ function filter_menu() {
$items[] = array('path' => 'admin/filters', 'title' => t('filters'),
'callback' => 'filter_admin_settings',
'access' => user_access('administer site configuration'));
$items[] = array('path' => 'admin/filters/order', 'title' => t('rearrange filters'),
$items[] = array('path' => 'admin/filters/configure', 'title' => t('configure'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array('path' => 'admin/filters/order', 'title' => t('rearrange'),
'callback' => 'filter_admin_order',
'access' => user_access('administer site configuration'),
'type' => MENU_LOCAL_TASK);
......
......@@ -52,7 +52,9 @@ function filter_menu() {
$items[] = array('path' => 'admin/filters', 'title' => t('filters'),
'callback' => 'filter_admin_settings',
'access' => user_access('administer site configuration'));
$items[] = array('path' => 'admin/filters/order', 'title' => t('rearrange filters'),
$items[] = array('path' => 'admin/filters/configure', 'title' => t('configure'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array('path' => 'admin/filters/order', 'title' => t('rearrange'),
'callback' => 'filter_admin_order',
'access' => user_access('administer site configuration'),
'type' => MENU_LOCAL_TASK);
......
......@@ -26,7 +26,8 @@ function menu_menu() {
'access' => user_access('administer menu'),
'type' => MENU_CALLBACK);
// Tabs:
$items[] = array('path' => 'admin/menu/list', 'title' => t('list'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array('path' => 'admin/menu/menu/add', 'title' => t('add menu'),
'callback' => 'menu_add_menu',
'access' => user_access('administer menu'),
......
......@@ -26,7 +26,8 @@ function menu_menu() {
'access' => user_access('administer menu'),
'type' => MENU_CALLBACK);
// Tabs:
$items[] = array('path' => 'admin/menu/list', 'title' => t('list'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array('path' => 'admin/menu/menu/add', 'title' => t('add menu'),
'callback' => 'menu_add_menu',
'access' => user_access('administer menu'),
......
......@@ -641,12 +641,18 @@ function node_menu() {
$items[] = array('path' => 'admin/node', 'title' => t('content'),
'callback' => 'node_admin',
'access' => user_access('administer nodes'));
// Tabs:
$items[] = array('path' => 'admin/node/overview', 'title' => t('list'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array('path' => 'admin/node/configure', 'title' => t('configure'),
'callback' => 'node_configure',
'access' => user_access('administer nodes'),
'type' => MENU_LOCAL_TASK);
$items[] = array('path' => 'admin/node/configure/settings', 'title' => t('settings'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array('path' => 'admin/node/configure/defaults', 'title' => t('default workflow'),
'callback' => 'node_default_settings',
'access' => user_access('administer nodes'),
'type' => MENU_LOCAL_TASK);
if (module_exist('search')) {
$items[] = array('path' => 'admin/node/search', 'title' => t('search'),
'callback' => 'node_admin',
......@@ -654,16 +660,6 @@ function node_menu() {
'type' => MENU_LOCAL_TASK);
}
// Subtabs:
$items[] = array('path' => 'admin/node/configure/settings', 'title' => t('settings'),
'callback' => 'node_configure',
'access' => user_access('administer nodes'),
'type' => MENU_LOCAL_SUBTASK);
$items[] = array('path' => 'admin/node/configure/defaults', 'title' => t('default workflow'),
'callback' => 'node_default_settings',
'access' => user_access('administer nodes'),
'type' => MENU_LOCAL_SUBTASK);
$items[] = array('path' => 'node', 'title' => t('content'),
'callback' => 'node_page',
'access' => user_access('access content'),
......@@ -681,6 +677,8 @@ function node_menu() {
'callback' => 'node_page',
'access' => user_access('access content'),
'type' => MENU_CALLBACK);
$items[] = array('path' => 'node/'. arg(1) .'/view', 'title' => t('view'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array('path' => 'node/'. arg(1) .'/edit', 'title' => t('edit'),
'callback' => 'node_page',
'access' => node_access('update', $node),
......
......@@ -641,12 +641,18 @@ function node_menu() {
$items[] = array('path' => 'admin/node', 'title' => t('content'),
'callback' => 'node_admin',
'access' => user_access('administer nodes'));
// Tabs:
$items[] = array('path' => 'admin/node/overview', 'title' => t('list'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array('path' => 'admin/node/configure', 'title' => t('configure'),
'callback' => 'node_configure',
'access' => user_access('administer nodes'),
'type' => MENU_LOCAL_TASK);
$items[] = array('path' => 'admin/node/configure/settings', 'title' => t('settings'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array('path' => 'admin/node/configure/defaults', 'title' => t('default workflow'),
'callback' => 'node_default_settings',
'access' => user_access('administer nodes'),
'type' => MENU_LOCAL_TASK);
if (module_exist('search')) {
$items[] = array('path' => 'admin/node/search', 'title' => t('search'),
'callback' => 'node_admin',
......@@ -654,16 +660,6 @@ function node_menu() {
'type' => MENU_LOCAL_TASK);
}
// Subtabs:
$items[] = array('path' => 'admin/node/configure/settings', 'title' => t('settings'),
'callback' => 'node_configure',
'access' => user_access('administer nodes'),
'type' => MENU_LOCAL_SUBTASK);
$items[] = array('path' => 'admin/node/configure/defaults', 'title' => t('default workflow'),
'callback' => 'node_default_settings',
'access' => user_access('administer nodes'),
'type' => MENU_LOCAL_SUBTASK);
$items[] = array('path' => 'node', 'title' => t('content'),
'callback' => 'node_page',
'access' => user_access('access content'),
......@@ -681,6 +677,8 @@ function node_menu() {
'callback' => 'node_page',
'access' => user_access('access content'),
'type' => MENU_CALLBACK);
$items[] = array('path' => 'node/'. arg(1) .'/view', 'title' => t('view'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array('path' => 'node/'. arg(1) .'/edit', 'title' => t('edit'),
'callback' => 'node_page',
'access' => node_access('update', $node),
......
......@@ -66,8 +66,9 @@ function path_menu() {
'callback' => 'path_admin_delete',
'access' => user_access('administer url aliases'),
'type' => MENU_CALLBACK);
// Tabs:
$items[] = array('path' => 'admin/path/add', 'title' => t('add alias'),
$items[] = array('path' => 'admin/path/list', 'title' => t('list'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array('path' => 'admin/path/add', 'title' => t('add'),
'callback' => 'path_admin_edit',
'access' => user_access('administer url aliases'),
'type' => MENU_LOCAL_TASK);
......
......@@ -66,8 +66,9 @@ function path_menu() {
'callback' => 'path_admin_delete',
'access' => user_access('administer url aliases'),
'type' => MENU_CALLBACK);
// Tabs:
$items[] = array('path' => 'admin/path/add', 'title' => t('add alias'),
$items[] = array('path' => 'admin/path/list', 'title' => t('list'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array('path' => 'admin/path/add', 'title' => t('add'),
'callback' => 'path_admin_edit',
'access' => user_access('administer url aliases'),
'type' => MENU_LOCAL_TASK);
......
......@@ -34,7 +34,7 @@ function profile_menu() {
$items[] = array('path' => 'admin/user/configure/profile', 'title' => t('profiles'),
'callback' => 'profile_admin_overview',
'access' => user_access('administer users'),
'type' => MENU_LOCAL_SUBTASK);
'type' => MENU_LOCAL_TASK);
$items[] = array('path' => 'admin/user/configure/profile/add', 'title' => t('add field'),
'callback' => 'profile_admin_add',
'access' => user_access('administer users'),
......
......@@ -34,7 +34,7 @@ function profile_menu() {
$items[] = array('path' => 'admin/user/configure/profile', 'title' => t('profiles'),
'callback' => 'profile_admin_overview',
'access' => user_access('administer users'),
'type' => MENU_LOCAL_SUBTASK);
'type' => MENU_LOCAL_TASK);
$items[] = array('path' => 'admin/user/configure/profile/add', 'title' => t('add field'),
'callback' => 'profile_admin_add',
'access' => user_access('administer users'),
......
......@@ -52,6 +52,8 @@ function search_menu() {
'callback' => 'search_help_page',
'access' => user_access('search content'),
'type' => MENU_SUGGESTED_ITEM);
$items[] = array('path' => 'search/search', 'title' => t('search'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array('path' => 'search/configure', 'title' => t('configure'),
'callback' => 'search_configure',
'access' => user_access('administer site configuration'),
......
......@@ -52,6 +52,8 @@ function search_menu() {
'callback' => 'search_help_page',
'access' => user_access('search content'),
'type' => MENU_SUGGESTED_ITEM);
$items[] = array('path' => 'search/search', 'title' => t('search'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array('path' => 'search/configure', 'title' => t('configure'),
'callback' => 'search_configure',
'access' => user_access('administer site configuration'),
......
......@@ -63,6 +63,8 @@ function taxonomy_menu() {
$items[] = array('path' => 'admin/taxonomy', 'title' => t('categories'),
'callback' => 'taxonomy_admin',
'access' => user_access('administer taxonomy'));
$items[] = array('path' => 'admin/taxonomy/list', 'title' => t('list'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array('path' => 'admin/taxonomy/add/vocabulary', 'title' => t('add vocabulary'),
'callback' => 'taxonomy_admin',
'access' => user_access('administer taxonomy'),
......
......@@ -63,6 +63,8 @@ function taxonomy_menu() {
$items[] = array('path' => 'admin/taxonomy', 'title' => t('categories'),
'callback' => 'taxonomy_admin',
'access' => user_access('administer taxonomy'));
$items[] = array('path' => 'admin/taxonomy/list', 'title' => t('list'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array('path' => 'admin/taxonomy/add/vocabulary', 'title' => t('add vocabulary'),
'callback' => 'taxonomy_admin',
'access' => user_access('administer taxonomy'),
......
......@@ -605,6 +605,8 @@ function user_menu() {
if (arg(0) == 'user' && is_numeric(arg(1))) {
$items[] = array('path' => 'user/'. arg(1), 'title' => t('user'),
'callback' => 'user_page', 'access' => TRUE);
$items[] = array('path' => 'user/'. arg(1) .'/view', 'title' => t('view'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array('path' => 'user/'. arg(1) .'/edit', 'title' => t('edit'),
'callback' => 'user_edit', 'access' => $access || $user->uid == arg(1),