summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2003-02-25 19:48:55 +0000
committerDries Buytaert <dries@buytaert.net>2003-02-25 19:48:55 +0000
commitcff898ffdbcbc5f85c10902a40dbbfb9af8ebd70 (patch)
treed4588fba6223936b3826f447b6a92d6e1a575fa3 /includes
parenta8edbf638f83ea81c9ed02e13ae6f8fe56b7f31f (diff)
downloadbrdo-cff898ffdbcbc5f85c10902a40dbbfb9af8ebd70.tar.gz
brdo-cff898ffdbcbc5f85c10902a40dbbfb9af8ebd70.tar.bz2
- Fixed bug when an additional parameter is being passed to the callback.
Patch by Zbynek. - Made the menu_tree() function emit CSS tags to identify which menus are expanded/collapsed/leafs. Patch Zbynek and Al Maw.
Diffstat (limited to 'includes')
-rw-r--r--includes/menu.inc14
1 files changed, 11 insertions, 3 deletions
diff --git a/includes/menu.inc b/includes/menu.inc
index 7b3e685d2..5e234477d 100644
--- a/includes/menu.inc
+++ b/includes/menu.inc
@@ -111,9 +111,11 @@ function menu_tree($parent = "") {
usort($_gmenu[$parent]["children"], "_menu_sort");
foreach ($_gmenu[$parent]["children"] as $item) {
if ($_gmenu[$item]["hidden"] == 0) {
- $output .= "<li>";
+ $trail = menu_trail($item);
+ $style = ($_gmenu[$item]["children"] ? (in_array($item, $trail) ? "expanded" : "collapsed") : "leaf");
+ $output .= "<li class=\"$style\">";
$output .= menu_item($item);
- if (in_array($item, menu_trail($item))) {
+ if (in_array($item, $trail)) {
$output .= menu_tree($item);
}
$output .= "</li>\n";
@@ -149,7 +151,13 @@ function menu_execute_action() {
$selected_menu = array_pop($trail);
if ($_gmenu[$selected_menu]["callback"]) {
- return call_user_func_array($_gmenu[$selected_menu]["callback"], explode("/", substr(query_string(), strlen($selected_menu) + 1)));
+ $arg = substr(query_string(), strlen($selected_menu) + 1);
+ if (empty($arg)) {
+ return call_user_func($_gmenu[$selected_menu]["callback"]);
+ }
+ else {
+ return call_user_func_array($_gmenu[$selected_menu]["callback"], explode("/", $arg));
+ }
}
}