Commit 0ff789c6 authored by Dries's avatar Dries

- Patch by Kjartan:

   + Fixed CSS to use the same format as the rest of drupal.css.
   + Added fallback routine for menu icons.
   + Fixed anonymous users not seeing the menu.
   + Added proper access checks for admin and help menu items.
parent 36b90c05
......@@ -259,12 +259,40 @@ pre, code {
color: red;
}
#menu { padding: 0 0 0 0.5em; }
#menu ul { list-style: none; margin: 0; padding: 0 0 0.25em 1em; border: none; text-align:left;}
#menu li { margin: 0; padding: 0.2em 0.5em 0 0; }
#menu li a { display: block; width: 100%; text-decoration: none; }
#menu li a.current { color: #000; }
#menu li a:hover { color: #009; }
#menu li.expanded { list-style-image: url(menu-expanded.gif); }
#menu li.collapsed { list-style-image: url(menu-collapsed.gif); }
#menu li.leaf { list-style-image: url(menu-leaf.gif); }
#menu {
padding: 0 0 0 0.5em;
}
#menu ul {
list-style: none;
margin: 0;
padding: 0 0 0.25em 1em;
border: none;
text-align:left;
}
#menu li {
margin: 0;
padding: 0.2em 0.5em 0 0;
}
#menu li a {
display: block;
width: 100%;
text-decoration: none;
}
#menu li a.current {
color: #000;
}
#menu li a:hover {
color: #009;
}
#menu li.expanded {
list-style-type: circle;
list-style-image: url(menu-expanded.gif);
}
#menu li.collapsed {
list-style-type: disc;
list-style-image: url(menu-collapsed.gif);
}
#menu li.leaf {
list-style-type: square;
list-style-image: url(menu-leaf.gif);
}
......@@ -36,7 +36,7 @@ function admin_system($field){
}
function admin_link($type) {
if ($type == "system") {
if ($type == "system" && user_access("access administration pages")) {
menu("admin", t("administer %a", array("%a" => variable_get("site_name", "drupal"))) , NULL, NULL, 9);
menu("admin/overview", "sitemap", "overview_callback", admin_help("admin/overview"), 8);
}
......
......@@ -7,7 +7,7 @@ function help_system($field){
}
function help_link($type) {
if ($type == "system") {
if ($type == "system" && user_access("access administration pages")) {
menu("admin/help/glossary", "glossary", "help_glossary", NULL, 8);
menu("admin/help", "help", "help_admin", NULL, 9);
}
......
......@@ -7,7 +7,7 @@ function help_system($field){
}
function help_link($type) {
if ($type == "system") {
if ($type == "system" && user_access("access administration pages")) {
menu("admin/help/glossary", "glossary", "help_glossary", NULL, 8);
menu("admin/help", "help", "help_admin", NULL, 9);
}
......
......@@ -373,7 +373,10 @@ function user_block($op = "list", $delta = 0) {
else {
switch ($delta) {
case 0:
if (!$user->uid) {
if ($user->uid) {
$block["subject"] = $user->name;
}
else {
/*
** For usability's sake, avoid showing two login forms on one
** page.
......@@ -422,18 +425,11 @@ function user_block($op = "list", $delta = 0) {
$block["subject"] = t("User login");
$block["content"] = "<div class=\"user-login-link\">$output</div>";
return $block;
}
break;
case 1:
if ($user->uid) {
$block["subject"] = $user->name;
menu_build("system");
$block["content"] .= "<div id=\"menu\">". menu_tree()."</div>";
return $block;
}
menu_build("system");
$block["content"] .= "<div id=\"menu\">". menu_tree()."</div>";
return $block;
break;
case 2:
if (user_access("access content")) {
......@@ -469,8 +465,11 @@ function user_link($type) {
}
if ($type == "system") {
menu("user/edit", t("edit account"), NULL, NULL, 8);
menu("user/logout", t("logout"), NULL, NULL, 10);
global $user;
if ($user->uid) {
menu("user/edit", t("edit account"), NULL, NULL, 8);
menu("user/logout", t("logout"), NULL, NULL, 10);
}
if (user_access("administer users")) {
menu("admin/user", "user management", "user_admin", user_help("admin/user"), 2);
menu("admin/user/create", "create new account", "user_admin", user_help("admin/user/create"), 1);
......
......@@ -373,7 +373,10 @@ function user_block($op = "list", $delta = 0) {
else {
switch ($delta) {
case 0:
if (!$user->uid) {
if ($user->uid) {
$block["subject"] = $user->name;
}
else {
/*
** For usability's sake, avoid showing two login forms on one
** page.
......@@ -422,18 +425,11 @@ function user_block($op = "list", $delta = 0) {
$block["subject"] = t("User login");
$block["content"] = "<div class=\"user-login-link\">$output</div>";
return $block;
}
break;
case 1:
if ($user->uid) {
$block["subject"] = $user->name;
menu_build("system");
$block["content"] .= "<div id=\"menu\">". menu_tree()."</div>";
return $block;
}
menu_build("system");
$block["content"] .= "<div id=\"menu\">". menu_tree()."</div>";
return $block;
break;
case 2:
if (user_access("access content")) {
......@@ -469,8 +465,11 @@ function user_link($type) {
}
if ($type == "system") {
menu("user/edit", t("edit account"), NULL, NULL, 8);
menu("user/logout", t("logout"), NULL, NULL, 10);
global $user;
if ($user->uid) {
menu("user/edit", t("edit account"), NULL, NULL, 8);
menu("user/logout", t("logout"), NULL, NULL, 10);
}
if (user_access("administer users")) {
menu("admin/user", "user management", "user_admin", user_help("admin/user"), 2);
menu("admin/user/create", "create new account", "user_admin", user_help("admin/user/create"), 1);
......
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