Commit 10bdb51c authored by Dries's avatar Dries

- Patch by JonBob/Jonathan: reworked the menu system so that menus are

  configurable!  Menu items can be disabled, repositioned, added and
  so on.

  Upgrading to requires you to run update.php.

  This functionality depricates some of the 'navigation modules' in the
  contributions repository.  Furthermore, modules can now 'suggest'
  menu items and site adminstrators can choose to enable them.  Modules
  in the contributions repository should try to take advantage of this.
parent a083daf8
......@@ -2,7 +2,7 @@ Drupal x.x.x, xxxx-xx-xx
------------------------
- profile module:
* made it possible to administere profile fields.
* made it possible to administer profile fields.
* made it possible to browse the profiles by field.
Drupal 4.4.0, 2004-04-01 (release candidate)
......
......@@ -235,6 +235,21 @@ CREATE TABLE locales (
PRIMARY KEY (lid)
) TYPE=MyISAM;
--
-- Table structure for table 'menu'
--
CREATE TABLE menu (
mid int(10) unsigned NOT NULL default '0',
pid int(10) unsigned NOT NULL default '0',
path varchar(255) NOT NULL default '',
title varchar(255) NOT NULL default '',
weight tinyint(4) NOT NULL default '0',
visibility int(1) unsigned NOT NULL default '0',
status int(1) unsigned NOT NULL default '0',
PRIMARY KEY (mid)
) TYPE=MyISAM;
--
-- Table structure for table 'moderation_filters'
--
......@@ -632,3 +647,4 @@ REPLACE variable SET name='theme_default', value='s:9:"xtemplate";';
REPLACE blocks SET module = 'user', delta = '0', status = '1';
REPLACE blocks SET module = 'user', delta = '1', status = '1';
INSERT INTO sequences (name, id) VALUES ('menu_mid', 1);
......@@ -53,7 +53,8 @@
"2004-02-21" => "update_79",
"2004-03-11: first update since Drupal 4.4.0 release" => "update_80",
"2004-02-20" => "update_81",
"2004-02-27" => "update_82"
"2004-02-27" => "update_82",
"2004-04-15" => "update_83"
);
function update_32() {
......@@ -900,6 +901,27 @@ function update_82() {
return $ret;
}
function update_83() {
$ret = array();
if ($GLOBALS["db_type"] == "mysql") {
$ret[] = update_sql("CREATE TABLE menu (
mid int(10) unsigned NOT NULL default '0',
pid int(10) unsigned NOT NULL default '0',
path varchar(255) NOT NULL default '',
title varchar(255) NOT NULL default '',
weight tinyint(4) NOT NULL default '0',
visibility int(1) unsigned NOT NULL default '0',
status int(1) unsigned NOT NULL default '0',
PRIMARY KEY (mid)
);");
$ret[] = update_sql("INSERT INTO sequences (name, id) VALUES ('menu_mid', 1)");
}
else {
/* Needs PostgreSQL equivalent */
}
return $ret;
}
function update_sql($sql) {
$edit = $_POST["edit"];
$result = db_query($sql);
......
This diff is collapsed.
......@@ -7,8 +7,6 @@
fix_gpc_magic();
menu_build("system");
if (menu_active_handler_exists()) {
menu_execute_active_handler();
}
......
......@@ -313,4 +313,7 @@ td.watchdog-httpd {
td.watchdog-error {
background: #e44;
border: 1px solid #c22;
}
\ No newline at end of file
}
td.menu-disabled {
background: #ccc;
}
......@@ -219,7 +219,7 @@ function blog_link($type, $node = 0, $main) {
if ($type == "system") {
if (user_access("maintain personal blog")) {
menu("node/add/blog", t("blog entry"), "node_page", 0);
menu("blog/". $user->uid, t("my blog"), "blog_page", 1);
menu("blog/". $user->uid, t("my blog"), "blog_page", 1, MENU_SHOW, MENU_LOCKED);
}
if (user_access("access content")) {
menu("blog", t("blogs"), "blog_page", 0, MENU_HIDE);
......
......@@ -219,7 +219,7 @@ function blog_link($type, $node = 0, $main) {
if ($type == "system") {
if (user_access("maintain personal blog")) {
menu("node/add/blog", t("blog entry"), "node_page", 0);
menu("blog/". $user->uid, t("my blog"), "blog_page", 1);
menu("blog/". $user->uid, t("my blog"), "blog_page", 1, MENU_SHOW, MENU_LOCKED);
}
if (user_access("access content")) {
menu("blog", t("blogs"), "blog_page", 0, MENU_HIDE);
......
......@@ -794,8 +794,8 @@ function comment_link($type, $node = 0, $main = 0) {
menu("admin/comment/comments/0", t("new/updated"), "comment_admin", 1);
menu("admin/comment/comments/1", t("approval queue"), "comment_admin", 2);
menu("admin/comment/help", t("help"), "comment_help_page", 9);
menu("admin/comment/edit", t("edit comment"), "comment_admin", 0, MENU_HIDE);
menu("admin/comment/delete", t("delete comment"), "comment_admin", 0, MENU_HIDE);
menu("admin/comment/edit", t("edit comment"), "comment_admin", 0, MENU_HIDE, MENU_LOCKED);
menu("admin/comment/delete", t("delete comment"), "comment_admin", 0, MENU_HIDE, MENU_LOCKED);
if (module_exist('search')) {
menu("admin/comment/search", t("search"), "comment_admin", 8);
}
......@@ -809,7 +809,7 @@ function comment_link($type, $node = 0, $main = 0) {
menu("admin/comment/moderation/roles", t("initial scores"), "comment_admin", 6);
}
}
menu("comment", t("comments"), "comment_page", 0, MENU_HIDE);
menu("comment", t("comments"), "comment_page", 0, MENU_HIDE, MENU_LOCKED);
}
return $links;
......
......@@ -794,8 +794,8 @@ function comment_link($type, $node = 0, $main = 0) {
menu("admin/comment/comments/0", t("new/updated"), "comment_admin", 1);
menu("admin/comment/comments/1", t("approval queue"), "comment_admin", 2);
menu("admin/comment/help", t("help"), "comment_help_page", 9);
menu("admin/comment/edit", t("edit comment"), "comment_admin", 0, MENU_HIDE);
menu("admin/comment/delete", t("delete comment"), "comment_admin", 0, MENU_HIDE);
menu("admin/comment/edit", t("edit comment"), "comment_admin", 0, MENU_HIDE, MENU_LOCKED);
menu("admin/comment/delete", t("delete comment"), "comment_admin", 0, MENU_HIDE, MENU_LOCKED);
if (module_exist('search')) {
menu("admin/comment/search", t("search"), "comment_admin", 8);
}
......@@ -809,7 +809,7 @@ function comment_link($type, $node = 0, $main = 0) {
menu("admin/comment/moderation/roles", t("initial scores"), "comment_admin", 6);
}
}
menu("comment", t("comments"), "comment_page", 0, MENU_HIDE);
menu("comment", t("comments"), "comment_page", 0, MENU_HIDE, MENU_LOCKED);
}
return $links;
......
......@@ -47,7 +47,7 @@ function filter_link($type) {
menu("admin/system/filters", t("filters"), "filter_admin", 5);
menu("admin/system/filters/order", t("ordering"), "filter_admin", 5);
}
menu("filter/tips", t("Compose tips"), "filter_tips_long", 0, MENU_HIDE);
menu("filter/tips", t("compose tips"), "filter_tips_long", 0, MENU_HIDE);
}
}
......
......@@ -47,7 +47,7 @@ function filter_link($type) {
menu("admin/system/filters", t("filters"), "filter_admin", 5);
menu("admin/system/filters/order", t("ordering"), "filter_admin", 5);
}
menu("filter/tips", t("Compose tips"), "filter_tips_long", 0, MENU_HIDE);
menu("filter/tips", t("compose tips"), "filter_tips_long", 0, MENU_HIDE);
}
}
......
......@@ -60,8 +60,8 @@ function locale_link($type) {
menu("admin/locale", t("localization"), "locale_admin", 5);
menu("admin/locale/search", t("search string"), "locale_admin", 8);
menu("admin/locale/help", t("help"), "locale_help_page", 9);
menu("admin/locale/edit", t("edit string"), "locale_admin", 0, MENU_HIDE);
menu("admin/locale/delete", t("delete string"), "locale_admin", 0, MENU_HIDE);
menu("admin/locale/edit", t("edit string"), "locale_admin", 0, MENU_HIDE, MENU_LOCKED);
menu("admin/locale/delete", t("delete string"), "locale_admin", 0, MENU_HIDE, MENU_LOCKED);
foreach ($languages as $key => $value) {
menu("admin/locale/$key", "$value", "locale_admin");
......
......@@ -60,8 +60,8 @@ function locale_link($type) {
menu("admin/locale", t("localization"), "locale_admin", 5);
menu("admin/locale/search", t("search string"), "locale_admin", 8);
menu("admin/locale/help", t("help"), "locale_help_page", 9);
menu("admin/locale/edit", t("edit string"), "locale_admin", 0, MENU_HIDE);
menu("admin/locale/delete", t("delete string"), "locale_admin", 0, MENU_HIDE);
menu("admin/locale/edit", t("edit string"), "locale_admin", 0, MENU_HIDE, MENU_LOCKED);
menu("admin/locale/delete", t("delete string"), "locale_admin", 0, MENU_HIDE, MENU_LOCKED);
foreach ($languages as $key => $value) {
menu("admin/locale/$key", "$value", "locale_admin");
......
This diff is collapsed.
This diff is collapsed.
......@@ -366,7 +366,7 @@ function node_load($conditions, $revision = -1) {
** Return the desired revision
*/
if ($revision != -1 && isset($node->revisions[$revision])) {
$node = $node->revisions[$revision]['node'];
$node = $node->revisions[$revision]['node'];
}
return $node;
......@@ -617,7 +617,7 @@ function node_link($type, $node = 0, $main = 0) {
if (user_access('administer nodes')) {
menu('admin/node', t('content'), 'node_admin');
menu('admin/node/help', t('help'), 'node_help_page', 9);
menu('admin/node/edit', t('edit post'), 'node_admin', 0, MENU_HIDE);
menu('admin/node/edit', t('edit post'), 'node_admin', 0, MENU_HIDE, MENU_LOCKED);
menu('admin/node/settings', t('settings'), 'node_admin', 8);
if (module_exist('search')) {
menu('admin/node/search', t('search'), 'node_admin', 8);
......
......@@ -366,7 +366,7 @@ function node_load($conditions, $revision = -1) {
** Return the desired revision
*/
if ($revision != -1 && isset($node->revisions[$revision])) {
$node = $node->revisions[$revision]['node'];
$node = $node->revisions[$revision]['node'];
}
return $node;
......@@ -617,7 +617,7 @@ function node_link($type, $node = 0, $main = 0) {
if (user_access('administer nodes')) {
menu('admin/node', t('content'), 'node_admin');
menu('admin/node/help', t('help'), 'node_help_page', 9);
menu('admin/node/edit', t('edit post'), 'node_admin', 0, MENU_HIDE);
menu('admin/node/edit', t('edit post'), 'node_admin', 0, MENU_HIDE, MENU_LOCKED);
menu('admin/node/settings', t('settings'), 'node_admin', 8);
if (module_exist('search')) {
menu('admin/node/search', t('search'), 'node_admin', 8);
......
......@@ -20,9 +20,9 @@ function profile_link($type) {
if (user_access('administer users')) {
menu('admin/system/modules/profile', t('profile'), 'profile_admin_overview');
menu('admin/system/modules/profile/add', NULL, 'profile_admin_add', 0, MENU_HIDE);
menu('admin/system/modules/profile/edit', NULL, 'profile_admin_edit', 0, MENU_HIDE);
menu('admin/system/modules/profile/delete', NULL, 'profile_admin_delete', 0, MENU_HIDE);
menu('admin/system/modules/profile/add', NULL, 'profile_admin_add', 0, MENU_HIDE, MENU_LOCKED);
menu('admin/system/modules/profile/edit', NULL, 'profile_admin_edit', 0, MENU_HIDE, MENU_LOCKED);
menu('admin/system/modules/profile/delete', NULL, 'profile_admin_delete', 0, MENU_HIDE, MENU_LOCKED);
}
}
}
......
......@@ -20,9 +20,9 @@ function profile_link($type) {
if (user_access('administer users')) {
menu('admin/system/modules/profile', t('profile'), 'profile_admin_overview');
menu('admin/system/modules/profile/add', NULL, 'profile_admin_add', 0, MENU_HIDE);
menu('admin/system/modules/profile/edit', NULL, 'profile_admin_edit', 0, MENU_HIDE);
menu('admin/system/modules/profile/delete', NULL, 'profile_admin_delete', 0, MENU_HIDE);
menu('admin/system/modules/profile/add', NULL, 'profile_admin_add', 0, MENU_HIDE, MENU_LOCKED);
menu('admin/system/modules/profile/edit', NULL, 'profile_admin_edit', 0, MENU_HIDE, MENU_LOCKED);
menu('admin/system/modules/profile/delete', NULL, 'profile_admin_delete', 0, MENU_HIDE, MENU_LOCKED);
}
}
}
......
......@@ -29,7 +29,7 @@ function taxonomy_link($type, $node = NULL) {
menu("admin/taxonomy/help", t("help"), "taxonomy_admin", 9);
}
if (user_access("access content")) {
menu("taxonomy", t("taxonomy"), "taxonomy_page", 0, MENU_HIDE);
menu("taxonomy", t("taxonomy"), "taxonomy_page", 0, MENU_HIDE, MENU_LOCKED);
}
}
else if ($type == "taxonomy terms" && $node != NULL) {
......
......@@ -29,7 +29,7 @@ function taxonomy_link($type, $node = NULL) {
menu("admin/taxonomy/help", t("help"), "taxonomy_admin", 9);
}
if (user_access("access content")) {
menu("taxonomy", t("taxonomy"), "taxonomy_page", 0, MENU_HIDE);
menu("taxonomy", t("taxonomy"), "taxonomy_page", 0, MENU_HIDE, MENU_LOCKED);
}
}
else if ($type == "taxonomy terms" && $node != NULL) {
......
......@@ -16,7 +16,7 @@ function title_help($section) {
function title_link($type) {
if ($type == "system") {
if (user_access("access content")) {
menu("title", t("search"), "title_page", 0, MENU_HIDE);
menu("title", t("search"), "title_page", 0, MENU_HIDE, MENU_LOCKED);
}
}
}
......
......@@ -539,8 +539,10 @@ function user_link($type) {
menu("logout", t("log out"), "user_logout", 10);
}
else {
menu('user', t("my account"), "user_page", 8, MENU_HIDE);
menu("user/login", t("log in"), "user_page", 0, MENU_HIDE);
}
menu("user/password", t("e-mail new password"), "user_page", 0, MENU_HIDE);
menu("user/register", t("create new account"), "user_page", 0, MENU_HIDE);
if (user_access("administer users")) {
menu("admin/user", t("accounts"), "user_admin", 2);
......@@ -551,7 +553,7 @@ function user_link($type) {
menu("admin/user/role", t("roles"), "user_admin", 4);
menu("admin/user/permission", t("permissions"), "user_admin", 5);
menu("admin/user/help", t("help"), "user_help_page", 9);
menu("admin/user/edit", t("edit user account"), "user_admin", 0, MENU_HIDE);
menu("admin/user/edit", t("edit user account"), "user_admin", 0, MENU_HIDE, MENU_LOCKED);
if (module_exist('search')) {
menu("admin/user/search", t("search"), "user_admin", 8);
}
......@@ -764,7 +766,7 @@ function user_login($edit = array(), $msg = "") {
$output = form_group(t('User login'), $output);
return form($output, "post", url('user'));
return form($output, "post", url('user/login'));
}
function _user_authenticated_id() {
......@@ -851,7 +853,7 @@ function user_pass($edit = array()) {
}
$output .= theme("item_list", $items);
$output = form_group(t('Request new password'), $output);
return form($output, "post", url('user'));
return form($output, "post", url('user/password'));
}
}
......
......@@ -539,8 +539,10 @@ function user_link($type) {
menu("logout", t("log out"), "user_logout", 10);
}
else {
menu('user', t("my account"), "user_page", 8, MENU_HIDE);
menu("user/login", t("log in"), "user_page", 0, MENU_HIDE);
}
menu("user/password", t("e-mail new password"), "user_page", 0, MENU_HIDE);
menu("user/register", t("create new account"), "user_page", 0, MENU_HIDE);
if (user_access("administer users")) {
menu("admin/user", t("accounts"), "user_admin", 2);
......@@ -551,7 +553,7 @@ function user_link($type) {
menu("admin/user/role", t("roles"), "user_admin", 4);
menu("admin/user/permission", t("permissions"), "user_admin", 5);
menu("admin/user/help", t("help"), "user_help_page", 9);
menu("admin/user/edit", t("edit user account"), "user_admin", 0, MENU_HIDE);
menu("admin/user/edit", t("edit user account"), "user_admin", 0, MENU_HIDE, MENU_LOCKED);
if (module_exist('search')) {
menu("admin/user/search", t("search"), "user_admin", 8);
}
......@@ -764,7 +766,7 @@ function user_login($edit = array(), $msg = "") {
$output = form_group(t('User login'), $output);
return form($output, "post", url('user'));
return form($output, "post", url('user/login'));
}
function _user_authenticated_id() {
......@@ -851,7 +853,7 @@ function user_pass($edit = array()) {
}
$output .= theme("item_list", $items);
$output = form_group(t('Request new password'), $output);
return form($output, "post", url('user'));
return form($output, "post", url('user/password'));
}
}
......
......@@ -52,13 +52,11 @@ function watchdog_perm() {
function watchdog_link($type) {
if ($type == "system") {
if (user_access("administer watchdog")) {
if (arg(0) == 'admin') { // avoid SQL queries if possible
menu("admin/watchdog", t("logs"), "watchdog_admin", 7);
menu("admin/watchdog/view", t("view details"), "watchdog_admin", 0, MENU_HIDE);
menu("admin/watchdog", t("logs"), "watchdog_admin", 7);
menu("admin/watchdog/view", t("view details"), "watchdog_admin", 0, MENU_HIDE, MENU_LOCKED);
foreach (_watchdog_get_message_types() as $type) {
menu("admin/watchdog/$type", t($type), "watchdog_admin");
}
foreach (_watchdog_get_message_types() as $type) {
menu("admin/watchdog/$type", t($type), "watchdog_admin");
}
}
}
......
......@@ -52,13 +52,11 @@ function watchdog_perm() {
function watchdog_link($type) {
if ($type == "system") {
if (user_access("administer watchdog")) {
if (arg(0) == 'admin') { // avoid SQL queries if possible
menu("admin/watchdog", t("logs"), "watchdog_admin", 7);
menu("admin/watchdog/view", t("view details"), "watchdog_admin", 0, MENU_HIDE);
menu("admin/watchdog", t("logs"), "watchdog_admin", 7);
menu("admin/watchdog/view", t("view details"), "watchdog_admin", 0, MENU_HIDE, MENU_LOCKED);
foreach (_watchdog_get_message_types() as $type) {
menu("admin/watchdog/$type", t($type), "watchdog_admin");
}
foreach (_watchdog_get_message_types() as $type) {
menu("admin/watchdog/$type", t($type), "watchdog_admin");
}
}
}
......
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