Index: includes/menu.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/menu.inc,v retrieving revision 1.150 diff -u -p -r1.150 menu.inc --- includes/menu.inc 31 Jan 2007 15:49:22 -0000 1.150 +++ includes/menu.inc 31 Jan 2007 19:28:46 -0000 @@ -544,6 +544,16 @@ function menu_rebuild() { $vancode = ''; $link = ''; } + $tab = ($item['type'] & MENU_IS_LOCAL_TASK) ? 1 : 0; + $default_tab = $item['type'] == MENU_DEFAULT_LOCAL_TASK; + if (!isset($item['parent'])) { + if ($tab) { + $item['parent'] = implode('/', array_slice($item['_parts'], 0, $item['_number_parts'] - 1)); + } + else { + $item['parent'] = $path; + } + } $insert_item = $item + array( 'access arguments' => array(), 'access callback' => '', @@ -552,8 +562,18 @@ function menu_rebuild() { 'map arguments' => array(), 'map callback' => '', ); - db_query("INSERT INTO {menu} (mid, pid, path, access_callback, access_arguments, page_callback, page_arguments, map_callback, map_arguments, fit, number_parts, vancode, menu_link, visible, parents, depth, has_children) VALUES (%d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', %d, '%s', %d, %d)", $insert_item['_mid'], $insert_item['_pid'], $path, $insert_item['access callback'], serialize($insert_item['access arguments']), $insert_item['page callback'], serialize($insert_item['page arguments']), $insert_item['map callback'], serialize($insert_item['map arguments']), $insert_item['_fit'], $insert_item['_number_parts'], $vancode .'+', $link, $insert_item['_visible'], $insert_item['_parents'], $insert_item['_depth'], $insert_item['_has_children']); - // $item needs to be unset because of the reference above. + db_query("INSERT INTO {menu} ( + mid, pid, path, + access_callback, access_arguments, page_callback, page_arguments, map_callback, map_arguments, fit, + number_parts, vancode, menu_link, visible, parents, depth, has_children, tab, default_tab, title, parent) + VALUES (%d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', %d, '%s', %d, %d, %d, %d, '%s', '%s')", + $insert_item['_mid'], $insert_item['_pid'], $path, $insert_item['access callback'], + serialize($insert_item['access arguments']), $insert_item['page callback'], + serialize($insert_item['page arguments']), $insert_item['map callback'], + serialize($insert_item['map arguments']), $insert_item['_fit'], + $insert_item['_number_parts'], $vancode .'+', $link, $insert_item['_visible'], + $insert_item['_parents'], $insert_item['_depth'], $insert_item['_has_children'], + $tab, $default_tab, $insert_item['title'], $insert_item['parent']); unset($item); } } @@ -571,6 +591,28 @@ function menu_secondary_links() { } function menu_primary_local_tasks() { + $router_item = menu_get_item(); + $result = db_query("SELECT * FROM {menu} WHERE parent = '%s' AND tab = 1 ORDER BY vancode", $router_item->parent); + $tabs = array(); + while ($item = db_fetch_object($result)) { + $map = explode('/', $item->path); + foreach ($map as $key => $value) { + if ($value == '%') { + $map[$key] = arg($key); + } + } + $path = implode('/', $map); + if (_menu_access($item, $map, TRUE)) { + $link = l($item->title, $path); + if ((!$router_item->tab && $item->default_tab) || ($path == $_GET['q'])) { + $tabs[] = array('class' => 'active', 'data' => $link); + } + else { + $tabs[] = $link; + } + } + } + return theme('item_list', $tabs, NULL, 'ul', array('class' => 'tabs primary')); } function menu_secondary_local_tasks() { Index: modules/aggregator/aggregator.module =================================================================== RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.module,v retrieving revision 1.326 diff -u -p -r1.326 aggregator.module --- modules/aggregator/aggregator.module 31 Jan 2007 15:49:22 -0000 1.326 +++ modules/aggregator/aggregator.module 31 Jan 2007 19:28:47 -0000 @@ -41,6 +41,7 @@ function aggregator_menu() { 'page arguments' => array('aggregator_form_feed'), 'access arguments' => array('administer news feeds'), 'type' => MENU_LOCAL_TASK, + 'parent' => 'admin/content/aggregator', ); $items['admin/content/aggregator/add/category'] = array( 'title' => t('Add category'), @@ -48,6 +49,7 @@ function aggregator_menu() { 'page arguments' => array('aggregator_form_category'), 'access arguments' => array('administer news feeds'), 'type' => MENU_LOCAL_TASK, + 'parent' => 'admin/content/aggregator', ); $items['admin/content/aggregator/remove/%'] = array( 'title' => t('Remove items'), Index: modules/forum/forum.module =================================================================== RCS file: /cvs/drupal/drupal/modules/forum/forum.module,v retrieving revision 1.380 diff -u -p -r1.380 forum.module --- modules/forum/forum.module 31 Jan 2007 16:01:17 -0000 1.380 +++ modules/forum/forum.module 31 Jan 2007 19:28:47 -0000 @@ -58,12 +58,14 @@ function forum_menu() { 'page callback' => 'forum_form_main', 'page arguments' => array('container'), 'type' => MENU_LOCAL_TASK, + 'parent' => 'admin/content/forum', ); $items['admin/content/forum/add/forum'] = array( 'title' => t('Add forum'), 'page callback' => 'forum_form_main', 'page arguments' => array('forum'), 'type' => MENU_LOCAL_TASK, + 'parent' => 'admin/content/forum', ); $items['admin/content/forum/settings'] = array( 'title' => t('Settings'), @@ -71,6 +73,7 @@ function forum_menu() { 'page arguments' => array('forum_admin_settings'), 'weight' => 5, 'type' => MENU_LOCAL_TASK, + 'parent' => 'admin/content/forum', ); $items['admin/content/forum/edit'] = array( 'page callback' => 'forum_form_main', Index: modules/locale/locale.module =================================================================== RCS file: /cvs/drupal/drupal/modules/locale/locale.module,v retrieving revision 1.157 diff -u -p -r1.157 locale.module --- modules/locale/locale.module 31 Jan 2007 15:49:25 -0000 1.157 +++ modules/locale/locale.module 31 Jan 2007 19:28:48 -0000 @@ -61,6 +61,7 @@ function locale_menu() { 'page callback' => 'locale_string_search', 'weight' => 10, 'type' => MENU_LOCAL_TASK, + 'parent' => 'admin/settings/locale', ); // Manage languages subtabs Index: modules/search/search.module =================================================================== RCS file: /cvs/drupal/drupal/modules/search/search.module,v retrieving revision 1.210 diff -u -p -r1.210 search.module --- modules/search/search.module 24 Jan 2007 14:48:36 -0000 1.210 +++ modules/search/search.module 31 Jan 2007 19:28:49 -0000 @@ -168,30 +168,19 @@ function search_menu() { foreach (module_implements('search') as $name) { $items['search/'. $name] = array( + 'title' => module_invoke($name, 'search', 'name', TRUE), 'page callback' => 'search_view', 'page arguments' => array($name), - 'access callback' => FALSE, - 'type' => MENU_LOCAL_TASK, + 'access callback' => '_search_menu', + 'access arguments' => array($name), + 'type' => $name == 'node' ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK, ); } return $items; } -function search_init() { - // To remember the user's search keywords when switching across tabs, - // we dynamically add the keywords to the search tabs' paths. - if (arg(0) == 'search') { - $keys = search_get_keys(); - $keys = strlen($keys) ? '/'. $keys : ''; - foreach (module_implements('search') as $name) { - $title = module_invoke($name, 'search', 'name'); - $item = menu_get_item('search/'. $name); - $item->title = $title; - $item->access = user_access('search content') && $title; - menu_set_item('search/'. $name, $item); - menu_set_item('search/'. $name . $keys, $item); - } - } +function _search_menu($name) { + return user_access('search content') && module_invoke($name, 'search', 'name'); } /** Index: modules/system/system.install =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.install,v retrieving revision 1.75 diff -u -p -r1.75 system.install --- modules/system/system.install 31 Jan 2007 15:49:25 -0000 1.75 +++ modules/system/system.install 31 Jan 2007 19:28:51 -0000 @@ -344,6 +344,10 @@ function system_install() { parents varchar(255) NOT NULL default '', depth int NOT NULL default '0', has_children int NOT NULL default '0', + tab int NOT NULL default 0, + title varchar(255) NOT NULL default '', + default_tab int NOT NULL default '0', + parent varchar(255) NOT NULL default '', PRIMARY KEY (path), KEY vancode (vancode), KEY fit (fit), @@ -812,6 +816,10 @@ function system_install() { parents varchar(255) NOT NULL default '', depth int NOT NULL default '0', has_children int NOT NULL default '0', + tab int NOT NULL default '0', + title varchar(255) NOT NULL default '', + default_tab int NOT NULL default '0', + parent varchar(255) NOT NULL default '', PRIMARY KEY (path) )"); Index: modules/taxonomy/taxonomy.module =================================================================== RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.module,v retrieving revision 1.336 diff -u -p -r1.336 taxonomy.module --- modules/taxonomy/taxonomy.module 31 Jan 2007 15:49:26 -0000 1.336 +++ modules/taxonomy/taxonomy.module 31 Jan 2007 19:28:52 -0000 @@ -88,6 +88,7 @@ function taxonomy_menu() { 'page callback' => 'drupal_get_form', 'page arguments' => array('taxonomy_form_vocabulary'), 'type' => MENU_LOCAL_TASK, + 'parent' => 'admin/content/taxonomy', ); $items['admin/content/taxonomy/edit/vocabulary/%'] = array( @@ -136,6 +137,7 @@ function taxonomy_menu() { 'page callback' => 'drupal_get_form', 'page arguments' => array('taxonomy_form_term', 3), 'type' => MENU_LOCAL_TASK, + 'parent' => 'admin/content/taxonomy/%', ); return $items; Index: modules/user/user.module =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.module,v retrieving revision 1.751 diff -u -p -r1.751 user.module --- modules/user/user.module 31 Jan 2007 15:49:26 -0000 1.751 +++ modules/user/user.module 31 Jan 2007 19:28:54 -0000 @@ -427,10 +427,10 @@ function user_file_download($file) { /** * Implementation of hook_search(). */ -function user_search($op = 'search', $keys = NULL) { +function user_search($op = 'search', $keys = NULL, $skip_access_check = FALSE) { switch ($op) { case 'name': - if (user_access('access user profiles')) { + if ($skip_access_check || user_access('access user profiles')) { return t('Users'); } case 'search':