Commit d2687836 authored by Dries's avatar Dries

- Small improvement to the admin menu based on feedback from Michael.
parent 20e8f9eb
......@@ -229,8 +229,7 @@ CREATE TABLE menu (
help TEXT default '',
title varchar(255) NOT NULL default '',
parent varchar(255) NOT NULL default '',
weight tinyint(4) DEFAULT '0' NOT NULL,
overview tinyint(1) DEFAULT '0' NOT NULL
weight tinyint(4) DEFAULT '0' NOT NULL
) TYPE=MyISAM;
--
......
......@@ -226,8 +226,7 @@ CREATE TABLE menu (
help TEXT default '',
title varchar(255) NOT NULL default '',
parent varchar(255) NOT NULL default '',
weight tinyint(4) DEFAULT '0' NOT NULL,
overview tinyint(1) DEFAULT '0' NOT NULL
weight tinyint(4) DEFAULT '0' NOT NULL
);
--
......
......@@ -36,6 +36,17 @@ function menu_trail() {
return $trail;
}
function menu_in_trail($item) {
$trail = menu_trail();
foreach ($trail as $menu) {
if ($menu->link == $item->link) {
return 1;
}
}
return 0;
}
function menu_item($item) {
/*
......@@ -99,15 +110,18 @@ function menu_help() {
return $output;
}
function menu_tree($parent = "", $overview = 0) {
function menu_tree($parent = "", $all = 1) {
$result = db_query("SELECT * FROM menu WHERE parent = '%s' AND overview = '%d' ORDER BY weight, name", $parent, $overview);
if ($all) {
$result = db_query("SELECT * FROM menu WHERE parent = '%s' ORDER BY weight, name", $parent);
}
if (db_num_rows($result)) {
$output = "<ul>";
while ($item = db_fetch_object($result)) {
$all = (stristr(request_uri(), $item->link) == $item->link) ? 1 : 0;
$output .= "<li>". menu_item($item) ."</li>";
$output .= menu_tree($item->name, 1);
$output .= menu_tree($item->name, menu_in_trail($item));
}
$output .= "</ul>";
}
......@@ -115,10 +129,10 @@ function menu_tree($parent = "", $overview = 0) {
return $output;
}
function menu_add($name, $link, $title = NULL, $help = NULL, $parent = NULL, $weight = 1, $overview = 0) {
function menu_add($name, $link, $title = NULL, $help = NULL, $parent = NULL, $weight = 1) {
if (!db_result(db_query("SELECT name FROM menu WHERE link = '%s'", $link))) {
db_query("INSERT INTO menu (name, link, title, help, parent, weight, overview) VALUES ('%s', '%s', '%s', '%s', '%s', '%d', '%d')", $name, $link, $title, $help, $parent, $weight, $overview);
db_query("INSERT INTO menu (name, link, title, help, parent, weight) VALUES ('%s', '%s', '%s', '%s', '%s', '%d')", $name, $link, $title, $help, $parent, $weight);
}
}
?>
\ No newline at end of file
?>
......@@ -660,7 +660,7 @@ function comment_link($type, $node = 0, $main = 0) {
if ($type == "admin" && user_access("administer comments")) {
$settings = "If you really have a lot of comments, you can enable moderation. You assign moderation permissions to role(s), then setup some 'moderation votes'; these votes will appear to moderators in a dropdown menu near the comment. You also have to assign, for every role and every vote, a value, which can be either positive or negative; use the moderation matrix to do this. This allows for some roles having greater 'weight' in their moderation, if you wish. If you set a value to 0, that vote won't be available to that role. When a user moderates, the value of their vote is added or subtracted to the score of that comment. Finally, you may want to setup the comment thresholds: these are floor/ceiling values which users see in the comment control panel. Threshholds are useful for hiding poorly rated comments while reading your site.";
menu_add("comment management", url("admin/comment"), "Administer comments.", $help["comment"], "content management", 1, 1);
menu_add("comment management", url("admin/comment"), "Administer comments.", $help["comment"], "content management", 1);
menu_add("new or updated comments", url("admin/comment&status=0"), "Display new or updated comments.", NULL, "comment management");
menu_add("comments that await approval", url("admin/comment&status=1"), "Display comments that await approval.", NULL, "comment management");
menu_add("search comment", url("admin/comment/search"), "Search a comment.", NULL, "comment management", 8);
......
......@@ -660,7 +660,7 @@ function comment_link($type, $node = 0, $main = 0) {
if ($type == "admin" && user_access("administer comments")) {
$settings = "If you really have a lot of comments, you can enable moderation. You assign moderation permissions to role(s), then setup some 'moderation votes'; these votes will appear to moderators in a dropdown menu near the comment. You also have to assign, for every role and every vote, a value, which can be either positive or negative; use the moderation matrix to do this. This allows for some roles having greater 'weight' in their moderation, if you wish. If you set a value to 0, that vote won't be available to that role. When a user moderates, the value of their vote is added or subtracted to the score of that comment. Finally, you may want to setup the comment thresholds: these are floor/ceiling values which users see in the comment control panel. Threshholds are useful for hiding poorly rated comments while reading your site.";
menu_add("comment management", url("admin/comment"), "Administer comments.", $help["comment"], "content management", 1, 1);
menu_add("comment management", url("admin/comment"), "Administer comments.", $help["comment"], "content management", 1);
menu_add("new or updated comments", url("admin/comment&status=0"), "Display new or updated comments.", NULL, "comment management");
menu_add("comments that await approval", url("admin/comment&status=1"), "Display comments that await approval.", NULL, "comment management");
menu_add("search comment", url("admin/comment/search"), "Search a comment.", NULL, "comment management", 8);
......
......@@ -454,9 +454,9 @@ function node_link($type, $node = 0, $main = 0) {
$search = "On this page you can search for a post. For example, one may search for 'br' and Drupal might return 'bread brakers', 'our daily bread' and 'brenda'.";
menu_add("content management", url("admin/node"), "Content management.", NULL, NULL);
menu_add("submit new content", url("node/add"), "Submit new content.", NULL, "content management", -1, 1);
menu_add("new or updated posts", url("admin/node/nodes/0"), "Display all new or updated posts.", NULL, "content management", 0, 1);
menu_add("posts that await approval", url("admin/node/nodes/1"), "Display posts that await approval.", NULL, "content management", 0, 1);
menu_add("submit new content", url("node/add"), "Submit new content.", NULL, "content management", -1);
menu_add("new or updated posts", url("admin/node/nodes/0"), "Display all new or updated posts.", NULL, "content management", 0);
menu_add("posts that await approval", url("admin/node/nodes/1"), "Display posts that await approval.", NULL, "content management", 0);
menu_add("search content", url("admin/node/search"), "Search a post.", $search, "content management", 5);
menu_add("help", url("admin/node/help"), "More information about content management.", NULL, "content management", 7);
}
......
......@@ -454,9 +454,9 @@ function node_link($type, $node = 0, $main = 0) {
$search = "On this page you can search for a post. For example, one may search for 'br' and Drupal might return 'bread brakers', 'our daily bread' and 'brenda'.";
menu_add("content management", url("admin/node"), "Content management.", NULL, NULL);
menu_add("submit new content", url("node/add"), "Submit new content.", NULL, "content management", -1, 1);
menu_add("new or updated posts", url("admin/node/nodes/0"), "Display all new or updated posts.", NULL, "content management", 0, 1);
menu_add("posts that await approval", url("admin/node/nodes/1"), "Display posts that await approval.", NULL, "content management", 0, 1);
menu_add("submit new content", url("node/add"), "Submit new content.", NULL, "content management", -1);
menu_add("new or updated posts", url("admin/node/nodes/0"), "Display all new or updated posts.", NULL, "content management", 0);
menu_add("posts that await approval", url("admin/node/nodes/1"), "Display posts that await approval.", NULL, "content management", 0);
menu_add("search content", url("admin/node/search"), "Search a post.", $search, "content management", 5);
menu_add("help", url("admin/node/help"), "More information about content management.", NULL, "content management", 7);
}
......
......@@ -48,7 +48,7 @@ function taxonomy_link($type) {
$help["taxonomy"] = "The taxonomy module allows you to classify post into categories and subcategories; it allows multiple lists of categories for classification (controlled vocabularies) and offers the possibility of creating thesauri (controlled vocabularies that indicate the relationship of terms) and taxonomies (controlled vocabularies where relationships are indicated hierarchically).";
$help["vocabulary"] = "When you create a controlled vocabulary you are creating a set of terms to use for describing content (known as descriptors in indexing lingo). Drupal allows you to describe each node of content (blog, story, etc.) using one or many of these terms. For simple implementations, you might create a set of categories without subcategories, similar to Slashdot.org's or Kuro5hin.org's sections. For more complex implementations, you might create a hierarchical list of categories.";
menu_add("taxonomy", url("admin/taxonomy"), "Administer taxonomies.", $help["taxonomy"], "content management", 1, 1);
menu_add("taxonomy", url("admin/taxonomy"), "Administer taxonomies.", $help["taxonomy"], "content management", 1);
menu_add("add new vocabulary", url("admin/taxonomy/add/vocabulary"), "Add a new vocabulary.", $help["vocabulary"], "taxonomy");
menu_add("help", url("admin/taxonomy/help"), "More information about taxonomies.", NULL, "taxonomy", 9);
}
......@@ -785,4 +785,4 @@ function taxonomy_help() {
<p>Every term, or collection of terms, provides an <a href="http://backend.userland.com/stories/rss091">RSS</a> feed to which interested users may subscribe. The URL format for an sample RSS feed is <a href="<?php print path_uri() . url("node/feed", "or=1,2"); ?>"><?php print path_uri() . url("node/feed", "or=1,2"); ?></a>.</p>
<?php
}
?>
\ No newline at end of file
?>
......@@ -48,7 +48,7 @@ function taxonomy_link($type) {
$help["taxonomy"] = "The taxonomy module allows you to classify post into categories and subcategories; it allows multiple lists of categories for classification (controlled vocabularies) and offers the possibility of creating thesauri (controlled vocabularies that indicate the relationship of terms) and taxonomies (controlled vocabularies where relationships are indicated hierarchically).";
$help["vocabulary"] = "When you create a controlled vocabulary you are creating a set of terms to use for describing content (known as descriptors in indexing lingo). Drupal allows you to describe each node of content (blog, story, etc.) using one or many of these terms. For simple implementations, you might create a set of categories without subcategories, similar to Slashdot.org's or Kuro5hin.org's sections. For more complex implementations, you might create a hierarchical list of categories.";
menu_add("taxonomy", url("admin/taxonomy"), "Administer taxonomies.", $help["taxonomy"], "content management", 1, 1);
menu_add("taxonomy", url("admin/taxonomy"), "Administer taxonomies.", $help["taxonomy"], "content management", 1);
menu_add("add new vocabulary", url("admin/taxonomy/add/vocabulary"), "Add a new vocabulary.", $help["vocabulary"], "taxonomy");
menu_add("help", url("admin/taxonomy/help"), "More information about taxonomies.", NULL, "taxonomy", 9);
}
......@@ -785,4 +785,4 @@ function taxonomy_help() {
<p>Every term, or collection of terms, provides an <a href="http://backend.userland.com/stories/rss091">RSS</a> feed to which interested users may subscribe. The URL format for an sample RSS feed is <a href="<?php print path_uri() . url("node/feed", "or=1,2"); ?>"><?php print path_uri() . url("node/feed", "or=1,2"); ?></a>.</p>
<?php
}
?>
\ No newline at end of file
?>
......@@ -404,7 +404,7 @@ function user_link($type) {
menu_add("user management", url("admin/user"), "User management", $help["user"]);
menu_add("create new account", url("admin/user/create"), "Create a new user account.", $help["create"], "user management", 1);
menu_add("view user accounts", url("admin/user/account"), "Display user account listings.", $help["view"], "user management", 2, 1);
menu_add("view user accounts", url("admin/user/account"), "Display user account listings.", $help["view"], "user management", 2);
menu_add("access rules", url("admin/user/access"), "Configure access rules.", $help["access"], "user management", 3);
menu_add("e-mail rules", url("admin/user/access/mail"), "Allow or deny certain e-mail addresses.", $help["access"], "access rules");
menu_add("username rules", url("admin/user/access/user"), "Allow or deny certain usernames.", $help["access"], "access rules");
......
......@@ -404,7 +404,7 @@ function user_link($type) {
menu_add("user management", url("admin/user"), "User management", $help["user"]);
menu_add("create new account", url("admin/user/create"), "Create a new user account.", $help["create"], "user management", 1);
menu_add("view user accounts", url("admin/user/account"), "Display user account listings.", $help["view"], "user management", 2, 1);
menu_add("view user accounts", url("admin/user/account"), "Display user account listings.", $help["view"], "user management", 2);
menu_add("access rules", url("admin/user/access"), "Configure access rules.", $help["access"], "user management", 3);
menu_add("e-mail rules", url("admin/user/access/mail"), "Allow or deny certain e-mail addresses.", $help["access"], "access rules");
menu_add("username rules", url("admin/user/access/user"), "Allow or deny certain usernames.", $help["access"], "access rules");
......
......@@ -22,7 +22,7 @@ function watchdog_link($type) {
$help = "The watchdog module monitors your website, captures system events in a log and records them to be reviewed by an authorized individual at a later time. The watchdog log is simply a list of events recorded during operation and contains usage data, performance data, errors, warnings and operational information. It is vital to check the watchdog report on a regular basis as it is often the only way to tell what is going on.";
menu_add("site monitoring", url("admin/watchdog"), "Monitor your site.", NULL, NULL, 2);
menu_add("watchdog", url("admin/watchdog/list/all"), "Display system events.", $help, "site monitoring", 1, 1);
menu_add("watchdog", url("admin/watchdog/list/all"), "Display system events.", $help, "site monitoring", 1);
menu_add("user messages", url("admin/watchdog/list/user"), "Display system events", $help, "watchdog");
menu_add("regular messages", url("admin/watchdog/list/regular"), "Display system events", $help, "watchdog");
menu_add("special messages", url("admin/watchdog/list/special"), "Display system events", $help, "watchdog");
......
......@@ -22,7 +22,7 @@ function watchdog_link($type) {
$help = "The watchdog module monitors your website, captures system events in a log and records them to be reviewed by an authorized individual at a later time. The watchdog log is simply a list of events recorded during operation and contains usage data, performance data, errors, warnings and operational information. It is vital to check the watchdog report on a regular basis as it is often the only way to tell what is going on.";
menu_add("site monitoring", url("admin/watchdog"), "Monitor your site.", NULL, NULL, 2);
menu_add("watchdog", url("admin/watchdog/list/all"), "Display system events.", $help, "site monitoring", 1, 1);
menu_add("watchdog", url("admin/watchdog/list/all"), "Display system events.", $help, "site monitoring", 1);
menu_add("user messages", url("admin/watchdog/list/user"), "Display system events", $help, "watchdog");
menu_add("regular messages", url("admin/watchdog/list/regular"), "Display system events", $help, "watchdog");
menu_add("special messages", url("admin/watchdog/list/special"), "Display system events", $help, "watchdog");
......
......@@ -653,8 +653,7 @@ function update_47() {
help TEXT default '',
title varchar(255) NOT NULL default '',
parent varchar(255) NOT NULL default '',
weight tinyint(4) DEFAULT '0' NOT NULL,
overview tinyint(1) DEFAULT '0' NOT NULL
weight tinyint(4) DEFAULT '0' NOT NULL
);");
}
......@@ -856,4 +855,4 @@ function update_info() {
else {
update_info();
}
?>
\ No newline at end of file
?>
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