From 9780a9a5f0dd5fb67578a301d16d213ad08e33f1 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Tue, 1 Sep 2009 11:55:24 +0000 Subject: [PATCH] 2009-08-01 Miguel de Dios * include/functions_menu.php: add lines of code that I forget in the previus commits. Now the menu show correctly the extensions. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1897 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 5 ++ pandora_console/include/functions_menu.php | 57 ++++++++++++++++++++-- 2 files changed, 57 insertions(+), 5 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 61c697631d..51d6d42c8f 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,8 @@ +2009-08-01 Miguel de Dios + + * include/functions_menu.php: add lines of code that I forget in the + previus commits. Now the menu show correctly the extensions. + 2009-08-01 Miguel de Dios * include/functions_db.php: add external Module group "Not assigned" diff --git a/pandora_console/include/functions_menu.php b/pandora_console/include/functions_menu.php index 59079075d8..db38cb6e6c 100644 --- a/pandora_console/include/functions_menu.php +++ b/pandora_console/include/functions_menu.php @@ -35,6 +35,16 @@ function print_menu (&$menu) { echo ''; foreach ($menu as $mainsec => $main) { + $extensionInMenuParameter = (string) get_parameter ('extension_in_menu',''); + + $showSubsection = true; + if ($extensionInMenuParameter != '') { + if ($extensionInMenuParameter == $mainsec) + $showSubsection = true; + else + $showSubsection = false; + } + if ($mainsec == 'class') continue; @@ -53,10 +63,12 @@ function print_menu (&$menu) { if (!isset ($main["refr"])) $main["refr"] = 0; - if ($sec == $mainsec) { + if (($sec == $mainsec) && ($showSubsection)) { $classes[] = 'selected'; } else { $classes[] = 'not_selected'; + if ($extensionInMenuParameter == $mainsec) + $classes[] = 'selected'; } $output = ''; @@ -71,17 +83,21 @@ function print_menu (&$menu) { foreach ($main["sub"] as $subsec2 => $sub) { //Set class - if ($sec2 == $subsec2 && isset ($sub[$subsec2]["options"]) + if (($sec2 == $subsec2 && isset ($sub[$subsec2]["options"])) && (get_parameter_get ($sub[$subsec2]["options"]["name"]) == $sub[$subsec2]["options"]["value"])) { //If the subclass is selected and there are options and that options value is true $class = 'submenu_selected'; $selected = true; $visible = true; } elseif ($sec2 == $subsec2 && !isset ($sub[$subsec2]["options"])) { - //If the subclass is selected and there are no options $class = 'submenu_selected'; $selected = true; - $visible = true; + + $hasExtensions = (array_key_exists('hasExtensions',$main)) ? $main['hasExtensions'] : false; + if (($extensionInMenuParameter != '') && ($hasExtensions)) + $visible = true; + else + $visible = false; } else { //Else it's not selected $class = 'submenu_not_selected'; @@ -101,8 +117,35 @@ function print_menu (&$menu) { } else { $link_add = ""; } + $submenu_output .= ''; - $submenu_output .= ''.$sub["text"].''; + + //Ini Add icon extension + $secExtension = null; + if (array_key_exists('extension',$sub)) $secExtensionBool = $sub["extension"]; + else $secExtensionBool = false; + + if ($secExtensionBool) { + $imageIcon = 'images/extensions.png'; + if (strlen($sub["icon"]) > 0) + $imageIcon ='extensions/'.$sub["icon"]; + + $submenu_output .= '
 
'; + } + + + $secExtension = null; + if (array_key_exists('sec',$sub)) $secExtension = $sub["sec"]; + if (strlen($secExtension) > 0) { + $secUrl = $secExtension; + $extensionInMenu = 'extension_in_menu='.$mainsec.'&'; + } + else { + $secUrl = $mainsec; + $extensionInMenu = ''; + } + + $submenu_output .= ''.$sub["text"].''; $submenu_output .= ''; } } @@ -115,6 +158,10 @@ function print_menu (&$menu) { if ($visible || in_array ("selected", $classes)) { $visible = true; } + if (!$showSubsection) { + $visible = false; + } + $output .= '';