summaryrefslogtreecommitdiff
path: root/modules/menu/menu.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2006-07-31 11:25:55 +0000
committerDries Buytaert <dries@buytaert.net>2006-07-31 11:25:55 +0000
commitb138793b6890a16ec87107779392e4fb0c4cfc8f (patch)
tree50cb488c27cabba23a3116e72aa3e970617a8048 /modules/menu/menu.module
parent3a7b64ae03242d09685ad2a2e82c9657f7fa85e6 (diff)
downloadbrdo-b138793b6890a16ec87107779392e4fb0c4cfc8f.tar.gz
brdo-b138793b6890a16ec87107779392e4fb0c4cfc8f.tar.bz2
- Patch #72079 by Earl et al: give Drupal an overall administration page ... :-)
Diffstat (limited to 'modules/menu/menu.module')
-rw-r--r--modules/menu/menu.module92
1 files changed, 50 insertions, 42 deletions
diff --git a/modules/menu/menu.module b/modules/menu/menu.module
index 14086951b..f738dfa81 100644
--- a/modules/menu/menu.module
+++ b/modules/menu/menu.module
@@ -19,7 +19,7 @@ Menu administration tabs:
<li>On the administer menu page, administrators can "edit" to change the title, description, parent or weight of a menu item. Under the "operations" column, click on "enable/disable" to toggle a menu item on or off. Only menu items which are enabled are displayed in the corresponding menu block. Note that the default menu items generated by the menu module cannot be deleted, only disabled.</li>
<li>Use the "add menu" tab to submit a title for a new custom menu. Once submitted, the menu will appear in a list toward the bottom of the administer menu page underneath the main navigation menu. Under the menu name there will be links to edit or delete the menu, and a link to add new items to the menu.</li>
<li>Use the "add menu item" tab to create new links in either the navigation or a custom menu (such as a primary/secondary links menu). Select the parent item to place the new link within an existing menu structure. For top level menu items, choose the name of the menu in which the link is to be added.</li>
-</ul>', array('%navigation' => theme('placeholder', 'Navigation'), '%primary-links' => theme('placeholder', 'primary links'), '%secondary-links' => theme('placeholder', 'secondary links'), '%admin-block' => url('admin/block'), '%menu-settings' => url('admin/settings/menu')));
+</ul>', array('%navigation' => theme('placeholder', 'Navigation'), '%primary-links' => theme('placeholder', 'primary links'), '%secondary-links' => theme('placeholder', 'secondary links'), '%admin-block' => url('admin/build/block'), '%menu-settings' => url('admin/build/menu/settings')));
$output .= t('<p>You can</p>
<ul>
<li>administer menus at <a href="%admin-menu">administer &gt;&gt; menus</a>.</li>
@@ -28,16 +28,16 @@ Menu administration tabs:
<li>modify menu settings (in particular, to specify a menu to use for primary or secondary links) at <a href="%admin-settings-menus">administer &gt;&gt; settings &gt;&gt; menus</a>.</li>
<li>manage menu blocks at <a href="%admin-block">administer &gt;&gt; blocks</a>.</li>
</ul>
-', array('%admin-menu' => url('admin/menu'), '%admin-block' => url('admin/block'), '%admin-menu-menu-add' => url('admin/menu/menu/add'), '%admin-menu-item-add' => url('admin/menu/item/add'), '%admin-settings-menus' => url('admin/settings/menu')));
+', array('%admin-menu' => url('admin/build/menu'), '%admin-block' => url('admin/build/block'), '%admin-menu-menu-add' => url('admin/build/menu/menu/add'), '%admin-menu-item-add' => url('admin/build/menu/item/add'), '%admin-settings-menus' => url('admin/build/menu/settings')));
$output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="%menu">Menu page</a>.', array('%menu' => 'http://drupal.org/handbook/modules/menu/')) .'</p>';
return $output;
- case 'admin/modules#description':
+ case 'admin/settings/modules#description':
return t('Allows administrators to customize the site navigation menu.');
- case 'admin/menu':
- return '<p>'. t('Menus are a collection of links (menu items) used to navigate a website. The list(s) below display the currently available menus along with their menu items. Select an operation from the list to manage each menu or menu item.', array('%admin-settings-menus' => url('admin/settings/menu'), '%admin-block'=>url('admin/block'))) .'</p>';
- case 'admin/menu/menu/add':
- return '<p>'. t('Enter the name for your new menu. Remember to enable the newly created block in the <a href="%blocks">blocks administration page</a>.', array('%blocks' => url('admin/block'))) .'</p>';
- case 'admin/menu/item/add':
+ case 'admin/build/menu':
+ return '<p>'. t('Menus are a collection of links (menu items) used to navigate a website. The list(s) below display the currently available menus along with their menu items. Select an operation from the list to manage each menu or menu item.', array('%admin-settings-menus' => url('admin/build/menu/settings'), '%admin-block'=>url('admin/build/block'))) .'</p>';
+ case 'admin/build/menu/menu/add':
+ return '<p>'. t('Enter the name for your new menu. Remember to enable the newly created block in the <a href="%blocks">blocks administration page</a>.', array('%blocks' => url('admin/build/block'))) .'</p>';
+ case 'admin/build/menu/item/add':
return '<p>'. t('Enter the title, path, position and the weight for your new menu item.') .'</p>';
}
}
@@ -49,60 +49,68 @@ function menu_menu($may_cache) {
$items = array();
if ($may_cache) {
- $items[] = array('path' => 'admin/menu',
+ $items[] = array('path' => 'admin/build/menu',
'title' => t('menus'),
+ 'description' => t('Control your site\'s navigation menu, create menu blocks, as well as rename and reorganize menu items.'),
'callback' => 'menu_overview',
'access' => user_access('administer menu'));
- $items[] = array('path' => 'admin/menu/list',
+ $items[] = array('path' => 'admin/build/menu/list',
'title' => t('list'),
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10);
- $items[] = array('path' => 'admin/menu/item/add',
+ $items[] = array('path' => 'admin/build/menu/item/add',
'title' => t('add menu item'),
'callback' => 'menu_edit_item_form',
+ 'callback arguments' => array('add'),
'access' => user_access('administer menu'),
'type' => MENU_LOCAL_TASK);
- $items[] = array('path' => 'admin/menu/item/edit',
+ $items[] = array('path' => 'admin/build/menu/item/edit',
'title' => t('edit menu item'),
'callback' => 'menu_edit_item_form',
+ 'callback arguments' => array('edit'),
'access' => user_access('administer menu'),
'type' => MENU_CALLBACK);
- $items[] = array('path' => 'admin/menu/item/reset',
+ $items[] = array('path' => 'admin/build/menu/item/reset',
'title' => t('reset menu item'),
'callback' => 'menu_reset_item',
'access' => user_access('administer menu'),
'type' => MENU_CALLBACK);
- $items[] = array('path' => 'admin/menu/item/disable',
+ $items[] = array('path' => 'admin/build/menu/item/disable',
'title' => t('disable menu item'),
'callback' => 'menu_disable_item',
'access' => user_access('administer menu'),
'type' => MENU_CALLBACK);
- $items[] = array('path' => 'admin/menu/item/delete',
+ $items[] = array('path' => 'admin/build/menu/item/delete',
'title' => t('delete menu item'),
'callback' => 'menu_item_delete_form',
'access' => user_access('administer menu'),
'type' => MENU_CALLBACK);
- $items[] = array('path' => 'admin/menu/menu/add',
+ $items[] = array('path' => 'admin/build/menu/menu/add',
'title' => t('add menu'),
'callback' => 'menu_edit_menu_form',
+ 'callback arguments' => array('add'),
'access' => user_access('administer menu'),
'type' => MENU_LOCAL_TASK);
- $items[] = array('path' => 'admin/menu/menu/edit',
+ $items[] = array('path' => 'admin/build/menu/menu/edit',
'title' => t('edit menu'),
'callback' => 'menu_edit_menu_form',
+ 'callback arguments' => array('edit'),
'access' => user_access('administer menu'),
'type' => MENU_CALLBACK);
- $items[] = array('path' => 'admin/menu/menu/delete',
+ $items[] = array('path' => 'admin/build/menu/menu/delete',
'title' => t('delete menu'),
'callback' => 'menu_item_delete_form',
'access' => user_access('administer menu'),
'type' => MENU_CALLBACK);
- $items[] = array('path' => 'admin/settings/menu',
- 'title' => t('menus'),
- 'callback' => 'menu_configure');
+ $items[] = array('path' => 'admin/build/menu/settings',
+ 'title' => t('settings'),
+ 'callback' => 'menu_configure',
+ 'type' => MENU_LOCAL_TASK,
+ 'weight' => 5,
+ );
}
return $items;
@@ -238,7 +246,7 @@ function menu_form_alter($form_id, &$form) {
);
$form['menu']['advanced'] = array('#type' => 'item',
- '#value' => t('You may also <a href="%edit">edit the advanced settings</a> for this menu item.', array('%edit' => url("admin/menu/item/edit/{$item['mid']}"))),
+ '#value' => t('You may also <a href="%edit">edit the advanced settings</a> for this menu item.', array('%edit' => url("admin/build/menu/item/edit/{$item['mid']}"))),
);
}
}
@@ -258,7 +266,7 @@ function menu_configure() {
);
$form['settings_links']['intro'] = array('#type' => 'item',
- '#value' => t('Primary and secondary links provide a navigational menu system which usually (depending on your theme) appears at the top-right of the browser window. The links displayed can be generated either from a custom list created via the <a href="%menu">menu administration</a> page or from a built-in list of menu items such as the navigation menu links.', array('%menu' => url('admin/menu'))),
+ '#value' => t('Primary and secondary links provide a navigational menu system which usually (depending on your theme) appears at the top-right of the browser window. The links displayed can be generated either from a custom list created via the <a href="%menu">menu administration</a> page or from a built-in list of menu items such as the navigation menu links.', array('%menu' => url('admin/build/menu'))),
);
$form['settings_links']['menu_primary_menu'] = array('#type' => 'select',
@@ -301,8 +309,8 @@ function menu_configure() {
/**
* Menu callback; handle the adding/editing of a new menu.
*/
-function menu_edit_menu_form($mid = 0) {
- if (arg(3) == 'edit') {
+function menu_edit_menu_form($type, $mid = 0) {
+ if ($type == 'edit') {
if (!($item = db_fetch_array(db_query('SELECT * FROM {menu} WHERE mid = %d', $mid)))) {
drupal_not_found();
return;
@@ -331,8 +339,8 @@ function menu_edit_menu_form($mid = 0) {
/**
* Present the menu item editing form.
*/
-function menu_edit_item_form($mid = 0) {
- if (arg(3) == 'edit') {
+function menu_edit_item_form($type, $mid = 0) {
+ if ($type == 'edit') {
if (!($item = db_fetch_array(db_query('SELECT * FROM {menu} WHERE mid = %d', $mid)))) {
drupal_not_found();
return;
@@ -411,7 +419,7 @@ function menu_edit_item_form($mid = 0) {
*/
function menu_edit_item_form_submit($form_id, $form_values) {
menu_edit_item_save($form_values);
- return 'admin/menu';
+ return 'admin/build/menu';
}
/**
@@ -434,7 +442,7 @@ function menu_item_delete_form($mid) {
$message = t('Are you sure you want to delete the custom menu item %item?', array('%item' => theme('placeholder', $menu->title)));
}
- return confirm_form('menu_confirm_delete_form', $form, $message, 'admin/menu', t('This action cannot be undone.'), t('Delete'));
+ return confirm_form('menu_confirm_delete_form', $form, $message, 'admin/build/menu', t('This action cannot be undone.'), t('Delete'));
}
/**
@@ -453,7 +461,7 @@ function menu_confirm_delete_form_submit($form_id, $form_values) {
watchdog('menu', t('Deleted menu item %title.', $t_args), WATCHDOG_NOTICE);
}
- return 'admin/menu';
+ return 'admin/build/menu';
}
/**
@@ -462,7 +470,7 @@ function menu_confirm_delete_form_submit($form_id, $form_values) {
function menu_reset_item($mid) {
if (isset($mid) && $title = db_result(db_query('SELECT title FROM {menu} WHERE mid = %d', $mid))) {
$form['mid'] = array('#type' => 'value', '#value' => $mid);
- return confirm_form('menu_reset_item_form', $form, t('Are you sure you want to reset the item %item to its default values?', array('%item' => theme('placeholder', $title))), 'admin/menu', t('Any customizations will be lost. This action cannot be undone.'), t('Reset'));
+ return confirm_form('menu_reset_item_form', $form, t('Are you sure you want to reset the item %item to its default values?', array('%item' => theme('placeholder', $title))), 'admin/build/menu', t('Any customizations will be lost. This action cannot be undone.'), t('Reset'));
}
else {
drupal_not_found();
@@ -476,7 +484,7 @@ function menu_reset_item_form_submit($form_id, $form_values) {
menu_delete_item($form_values['mid']);
drupal_set_message(t('The menu item was reset to its default settings.'));
- return 'admin/menu';
+ return 'admin/build/menu';
}
/**
@@ -490,7 +498,7 @@ function menu_disable_item($mid) {
$type |= MENU_MODIFIED_BY_ADMIN;
db_query('UPDATE {menu} SET type = %d WHERE mid = %d', $type, $mid);
drupal_set_message(t('The menu item has been disabled.'));
- drupal_goto('admin/menu');
+ drupal_goto('admin/build/menu');
}
/**
@@ -525,7 +533,7 @@ function menu_edit_item_save($edit) {
}
elseif ($status == SAVED_NEW) {
drupal_set_message(t('The menu item %title has been added.', $t_args));
- watchdog('menu', t('Added menu item %title.', $t_args), WATCHDOG_NOTICE, l(t('view'), 'admin/menu'));
+ watchdog('menu', t('Added menu item %title.', $t_args), WATCHDOG_NOTICE, l(t('view'), 'admin/build/menu'));
}
return $edit['mid'];
}
@@ -600,12 +608,12 @@ function menu_overview_tree() {
foreach ($root_menus as $mid => $title) {
$operations = array();
if ($menu['items'][$mid]['type'] & MENU_MODIFIABLE_BY_ADMIN) {
- $operations[] = l(t('edit'), 'admin/menu/menu/edit/'. $mid);
+ $operations[] = l(t('edit'), 'admin/build/menu/menu/edit/'. $mid);
}
if ($menu['items'][$mid]['type'] & MENU_CREATED_BY_ADMIN) {
- $operations[] = l(t('delete'), 'admin/menu/menu/delete/'. $mid);
+ $operations[] = l(t('delete'), 'admin/build/menu/menu/delete/'. $mid);
}
- $operations[] = l(t('add item'), 'admin/menu/item/add/'. $mid);
+ $operations[] = l(t('add item'), 'admin/build/menu/item/add/'. $mid);
$table = theme('item_list', $operations);
$table .= theme('table', $header, menu_overview_tree_rows($mid));
$output .= theme('box', check_plain($title), $table);
@@ -645,7 +653,7 @@ function menu_overview_tree_rows($pid = 0, $depth = 0) {
else {
// Set the edit column.
if ($item['type'] & (MENU_VISIBLE_IN_TREE | MENU_VISIBLE_IF_HAS_CHILDREN)) {
- $operations[] = array('data' => l(t('edit'), 'admin/menu/item/edit/'. $mid));
+ $operations[] = array('data' => l(t('edit'), 'admin/build/menu/item/edit/'. $mid));
}
else {
$operations[] = array('data' => '');
@@ -658,18 +666,18 @@ function menu_overview_tree_rows($pid = 0, $depth = 0) {
$operations[] = array('data' => '');
}
else if ($item['type'] & MENU_VISIBLE_IN_TREE) {
- $operations[] = array('data' => l(t('disable'), 'admin/menu/item/disable/'. $mid));
+ $operations[] = array('data' => l(t('disable'), 'admin/build/menu/item/disable/'. $mid));
}
else {
- $operations[] = array('data' => l(t('enable'), 'admin/menu/item/edit/'. $mid));
+ $operations[] = array('data' => l(t('enable'), 'admin/build/menu/item/edit/'. $mid));
}
// Set the reset column.
if ($item['type'] & MENU_CREATED_BY_ADMIN) {
- $operations[] = array('data' => l(t('delete'), 'admin/menu/item/delete/'. $mid));
+ $operations[] = array('data' => l(t('delete'), 'admin/build/menu/item/delete/'. $mid));
}
else if ($item['type'] & MENU_MODIFIED_BY_ADMIN) {
- $operations[] = array('data' => l(t('reset'), 'admin/menu/item/reset/'. $mid));
+ $operations[] = array('data' => l(t('reset'), 'admin/build/menu/item/reset/'. $mid));
}
else {
$operations[] = array('data' => '');