Index: includes/menu.inc =================================================================== RCS file: /usr/local/cvsroot/drupal/includes/menu.inc,v retrieving revision 1.1.1.1.2.1 retrieving revision 1.2 diff -F^f -u -r1.1.1.1.2.1 -r1.2 --- includes/menu.inc 24 Dec 2004 10:49:43 -0000 1.1.1.1.2.1 +++ includes/menu.inc 13 Jan 2005 20:15:54 -0000 1.2 @@ -642,6 +642,67 @@ function theme_menu_local_task($mid, $ac } /** + * Generate the horizontal menu. Often referred to as primary and secondary links. + * + * @param $pid + * The menu ID where to render from. All children of this menu item will be rendered, + * but the item itself will be omitted. + * defaults to NULL, meaning it will use the settings from menu. + * @param $start_level + * provide the number of levels under the pid you want to show your items. + * For example, if you want to show the secondary items somewhere else, you call + * theme_tabs_menu_tree with a $start_level 2. + * @param $end_level + * provide the number of levels under the pid you want to show children of your items. + * For example, if you want to show the secondary and tertiary items somewhere else, you call + * theme_tabs_menu_tree with a $start_level 2 and $end_level 3; Provide 'inf' if you want to show all items + * @param $show_empty + * can be 'TRUE' or 'FALSE' + * used to render an empty secondary link tab, if therre are no secondary items. + * if no empty tab is rendered, it is very difficult to design the page in a consistant + * way. Defaults to 'TRUE' + * + * @ingroup themeable + */ + +function theme_tabs_menu_tree($pid = NULL, $start_level = 1, $end_level = 2, $show_empty = TRUE) { + $menu = menu_get_menu(); + $pid ? NULL : $pid = variable_get('menu_primary_menu', 1); + $active_level ? NULL : $active_level = 1; + $tabs = ''; + + while ($stop == FALSE) { + $stop = TRUE; + + ($start_level <= $active_level) ? $tabs .= "" : NULL; + + $pid = $active_mid; + $active_level ++; + } + + //make a sub-row for the active child. + return $tabs; +} + +/** * @} End of "defgroup menu". */ Index: includes/module.inc =================================================================== RCS file: /usr/local/cvsroot/drupal/includes/module.inc,v retrieving revision 1.1.1.1.2.1 retrieving revision 1.2 diff -F^f -u -r1.1.1.1.2.1 -r1.2 --- includes/module.inc 24 Dec 2004 10:49:43 -0000 1.1.1.1.2.1 +++ includes/module.inc 7 Jan 2005 15:01:32 -0000 1.2 @@ -12,7 +12,7 @@ */ function module_init() { module_load_all(); - module_invoke_all('init'); + } /** @@ -38,7 +38,7 @@ function module_iterate($function, $argu * modules. */ function module_list($refresh = FALSE, $bootstrap = FALSE) { - static $list; + static $list = array(); if ($refresh) { $list = array(); Index: modules/menu.module =================================================================== RCS file: /usr/local/cvsroot/drupal/modules/menu.module,v retrieving revision 1.1.1.1.2.1 retrieving revision 1.2 diff -F^f -u -r1.1.1.1.2.1 -r1.2 --- modules/menu.module 24 Dec 2004 10:49:44 -0000 1.1.1.1.2.1 +++ modules/menu.module 13 Jan 2005 20:15:17 -0000 1.2 @@ -65,6 +65,8 @@ function menu_help($section) { return t('Enter the name for your new menu. Remember to enable the newly created block in the %blocks administration page.', array('%blocks' => l(t('blocks'), 'admin/block'))); case 'admin/menu/item/add': return t('Enter the title, path, position and the weight for your new menu item.'); + case 'admin/help#menu': + return t('Allows administrators to customize the site navigation menu.
A menu can contain menu-items. It can used as a primary-links container. Primary links are used on most sites as horinzontal links on top of your site. On most themes it will be a row of tabs and all sub-links will be sub-tabs.'); } } @@ -263,6 +265,7 @@ function menu_edit_item_form($edit) { $form .= form_hidden('path', ''); $form .= form_hidden('pid', 0); $form .= form_hidden('weight', 0); + $form .= form_checkbox(t('Use as primary links'), 'menu_primary_menu', 1, (($pid = variable_get('menu_primary_menu', 1) == $edit['mid']) ? 1 : 0), t('Use this menu as container for your primary links')); } else { $form .= form_textfield(t('Description'), 'description', $edit['description'], 60, 128, t('The description displayed when hovering over a menu item.')); @@ -325,6 +328,7 @@ function menu_edit_item_save($edit) { $menu = menu_get_menu(); if ($edit['mid']) { + $edit['menu_primary_menu'] ? variable_set('menu_primary_menu', $edit['mid']) : NULL; db_query("UPDATE {menu} SET pid = %d, path = '%s', title = '%s', description = '%s', weight = %d, type = %d WHERE mid = %d", $edit['pid'], $edit['path'], $edit['title'], $edit['description'], $edit['weight'], $edit['type'] | MENU_MODIFIED_BY_ADMIN, $edit['mid']); drupal_set_message(t('Updated menu item %title.', array('%title' => ''. $edit['title'] .''))); } @@ -357,6 +361,7 @@ function menu_overview_tree() { $operations[] = l(t('delete'), 'admin/menu/item/delete/'. $mid); } $table = theme('item_list', $operations); + variable_get('menu_primary_menu', 1) == $mid ? $table .= t('Primary menu') : NULL; $table .= theme('table', $header, menu_overview_tree_rows($mid)); $output .= theme('box', $menu['items'][$mid]['title'], $table); }