2009-03-02 Esteban Sanchez <estebans@artica.es>
* include/functions_menu.php: Added to repository. Functions for menu.
* operation/menu.php, godmode/menu.php: Added class to menu due to
changes in print_menu().
* general/main_menu.php: temp_print_menu() moved to functions_menu.php
* include/functions_themes.php: Added to repository. Implement
functions relative to themes (only CSS themes list at this moment).
* include/styles/pandora.css, include/styles/pandora_black.css,
include/styles/pandora_minimal.css, include/styles/pandora_red.css:
Added author, name and description comments to adopt to new
get_themes() interface.
* include/styles/pandora_width.css: Improved and make lighter by
simply rewrite some classes.
* include/functions.php: Added is_ajax().
* godmode/agentes/module_manager_editor.php,
godmode/alerts/alert_actions.php, godmode/alerts/alert_commands.php,
godmode/alerts/alert_compounds.php, godmode/alerts/alert_list.php,
godmode/alerts/alert_templates.php, godmode/groups/group_list.php,
godmode/reporting/map_builder.php,
godmode/reporting/reporting_builder.php,
operation/agentes/estado_agente.php, operation/agentes/ver_agente.php,
operation/events/events.php, operation/messages/message.php: Use
is_ajax()
* godmode/setup/setup.php: Use enterprise_include() instead of manual
checking. Use get_css_themes() to show the theme list.
* include/styles/common.css: Added to repository. Minimal styles to
make pandora works and common with all the CSS themes.
* include/functions_ui.php: Added common.css file.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1496 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-03-02 14:43:15 +01:00
|
|
|
<?php
|
|
|
|
|
2009-06-08 20:26:14 +02:00
|
|
|
// Pandora FMS - http://pandorafms.com
|
|
|
|
// ==================================================
|
|
|
|
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
|
|
|
|
// Please see http://pandorafms.org for full contribution list
|
2009-03-02 Esteban Sanchez <estebans@artica.es>
* include/functions_menu.php: Added to repository. Functions for menu.
* operation/menu.php, godmode/menu.php: Added class to menu due to
changes in print_menu().
* general/main_menu.php: temp_print_menu() moved to functions_menu.php
* include/functions_themes.php: Added to repository. Implement
functions relative to themes (only CSS themes list at this moment).
* include/styles/pandora.css, include/styles/pandora_black.css,
include/styles/pandora_minimal.css, include/styles/pandora_red.css:
Added author, name and description comments to adopt to new
get_themes() interface.
* include/styles/pandora_width.css: Improved and make lighter by
simply rewrite some classes.
* include/functions.php: Added is_ajax().
* godmode/agentes/module_manager_editor.php,
godmode/alerts/alert_actions.php, godmode/alerts/alert_commands.php,
godmode/alerts/alert_compounds.php, godmode/alerts/alert_list.php,
godmode/alerts/alert_templates.php, godmode/groups/group_list.php,
godmode/reporting/map_builder.php,
godmode/reporting/reporting_builder.php,
operation/agentes/estado_agente.php, operation/agentes/ver_agente.php,
operation/events/events.php, operation/messages/message.php: Use
is_ajax()
* godmode/setup/setup.php: Use enterprise_include() instead of manual
checking. Use get_css_themes() to show the theme list.
* include/styles/common.css: Added to repository. Minimal styles to
make pandora works and common with all the CSS themes.
* include/functions_ui.php: Added common.css file.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1496 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-03-02 14:43:15 +01:00
|
|
|
|
|
|
|
// This program is free software; you can redistribute it and/or
|
2009-06-08 20:26:14 +02:00
|
|
|
// modify it under the terms of the GNU Lesser General Public License
|
|
|
|
// as published by the Free Software Foundation; version 2
|
|
|
|
|
2009-03-02 Esteban Sanchez <estebans@artica.es>
* include/functions_menu.php: Added to repository. Functions for menu.
* operation/menu.php, godmode/menu.php: Added class to menu due to
changes in print_menu().
* general/main_menu.php: temp_print_menu() moved to functions_menu.php
* include/functions_themes.php: Added to repository. Implement
functions relative to themes (only CSS themes list at this moment).
* include/styles/pandora.css, include/styles/pandora_black.css,
include/styles/pandora_minimal.css, include/styles/pandora_red.css:
Added author, name and description comments to adopt to new
get_themes() interface.
* include/styles/pandora_width.css: Improved and make lighter by
simply rewrite some classes.
* include/functions.php: Added is_ajax().
* godmode/agentes/module_manager_editor.php,
godmode/alerts/alert_actions.php, godmode/alerts/alert_commands.php,
godmode/alerts/alert_compounds.php, godmode/alerts/alert_list.php,
godmode/alerts/alert_templates.php, godmode/groups/group_list.php,
godmode/reporting/map_builder.php,
godmode/reporting/reporting_builder.php,
operation/agentes/estado_agente.php, operation/agentes/ver_agente.php,
operation/events/events.php, operation/messages/message.php: Use
is_ajax()
* godmode/setup/setup.php: Use enterprise_include() instead of manual
checking. Use get_css_themes() to show the theme list.
* include/styles/common.css: Added to repository. Minimal styles to
make pandora works and common with all the CSS themes.
* include/functions_ui.php: Added common.css file.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1496 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-03-02 14:43:15 +01:00
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Prints a complete menu structure.
|
|
|
|
*
|
|
|
|
* @param array Menu structure to print.
|
|
|
|
*/
|
|
|
|
function print_menu (&$menu) {
|
|
|
|
static $idcounter = 0;
|
|
|
|
|
|
|
|
echo '<div class="menu">';
|
|
|
|
|
|
|
|
$sec = (string) get_parameter ('sec');
|
|
|
|
$sec2 = (string) get_parameter ('sec2');
|
|
|
|
|
|
|
|
echo '<ul'.(isset ($menu['class']) ? ' class="'.$menu['class'].'"' : '').'>';
|
|
|
|
|
|
|
|
foreach ($menu as $mainsec => $main) {
|
|
|
|
if ($mainsec == 'class')
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (! isset ($main['id'])) {
|
|
|
|
$id = 'menu_'.++$idcounter;
|
|
|
|
} else {
|
|
|
|
$id = $main['id'];
|
|
|
|
}
|
|
|
|
|
|
|
|
$submenu = false;
|
2009-05-29 11:28:48 +02:00
|
|
|
$classes = array ('menu_icon');
|
2009-03-02 Esteban Sanchez <estebans@artica.es>
* include/functions_menu.php: Added to repository. Functions for menu.
* operation/menu.php, godmode/menu.php: Added class to menu due to
changes in print_menu().
* general/main_menu.php: temp_print_menu() moved to functions_menu.php
* include/functions_themes.php: Added to repository. Implement
functions relative to themes (only CSS themes list at this moment).
* include/styles/pandora.css, include/styles/pandora_black.css,
include/styles/pandora_minimal.css, include/styles/pandora_red.css:
Added author, name and description comments to adopt to new
get_themes() interface.
* include/styles/pandora_width.css: Improved and make lighter by
simply rewrite some classes.
* include/functions.php: Added is_ajax().
* godmode/agentes/module_manager_editor.php,
godmode/alerts/alert_actions.php, godmode/alerts/alert_commands.php,
godmode/alerts/alert_compounds.php, godmode/alerts/alert_list.php,
godmode/alerts/alert_templates.php, godmode/groups/group_list.php,
godmode/reporting/map_builder.php,
godmode/reporting/reporting_builder.php,
operation/agentes/estado_agente.php, operation/agentes/ver_agente.php,
operation/events/events.php, operation/messages/message.php: Use
is_ajax()
* godmode/setup/setup.php: Use enterprise_include() instead of manual
checking. Use get_css_themes() to show the theme list.
* include/styles/common.css: Added to repository. Minimal styles to
make pandora works and common with all the CSS themes.
* include/functions_ui.php: Added common.css file.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1496 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-03-02 14:43:15 +01:00
|
|
|
if (isset ($main["sub"])) {
|
|
|
|
$classes[] = 'has_submenu';
|
|
|
|
$submenu = true;
|
|
|
|
}
|
|
|
|
if (!isset ($main["refr"]))
|
|
|
|
$main["refr"] = 0;
|
|
|
|
|
|
|
|
if ($sec == $mainsec) {
|
|
|
|
$classes[] = 'selected';
|
|
|
|
} else {
|
|
|
|
$classes[] = 'not_selected';
|
|
|
|
}
|
|
|
|
|
|
|
|
$output = '';
|
|
|
|
|
|
|
|
if (! $submenu) {
|
|
|
|
$main["sub"] = array (); //Empty array won't go through foreach
|
|
|
|
}
|
|
|
|
|
|
|
|
$submenu_output = '';
|
|
|
|
$selected = false;
|
|
|
|
$visible = false;
|
|
|
|
|
|
|
|
foreach ($main["sub"] as $subsec2 => $sub) {
|
|
|
|
//Set class
|
|
|
|
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;
|
|
|
|
} else {
|
|
|
|
//Else it's not selected
|
|
|
|
$class = 'submenu_not_selected';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (! isset ($sub["refr"])) {
|
|
|
|
$sub["refr"] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset ($sub["type"]) && $sub["type"] == "direct") {
|
|
|
|
//This is an external link
|
|
|
|
$submenu_output .= '<li class="'.$class.'"><a href="'.$subsec2.'">'.$sub["text"]."</a></li>";
|
|
|
|
} else {
|
|
|
|
//This is an internal link
|
|
|
|
if (isset ($sub[$subsec2]["options"])) {
|
|
|
|
$link_add = "&".$sub[$subsec2]["options"]["name"]."=".$sub[$subsec2]["options"]["value"];
|
|
|
|
} else {
|
|
|
|
$link_add = "";
|
|
|
|
}
|
|
|
|
$submenu_output .= '<li'.($class ? ' class="'.$class.'"' : '').'>';
|
|
|
|
$submenu_output .= '<a href="index.php?sec='.$mainsec.'&sec2='.$subsec2.($main["refr"] ? '&refr='.$main["refr"] : '').$link_add.'">'.$sub["text"].'</a>';
|
|
|
|
$submenu_output .= '</li>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//Print out the first level
|
|
|
|
$output .= '<li class="'.implode (" ", $classes).'" id="icon_'.$id.'">';
|
|
|
|
$output .= '<a href="index.php?sec='.$mainsec.'&sec2='.$main["sec2"].($main["refr"] ? '&refr='.$main["refr"] : '').'">'.$main["text"].'</a><img class="toggle" src="include/styles/images/toggle.png" alt="toggle" />';
|
|
|
|
if ($submenu_output != '') {
|
|
|
|
//WARNING: IN ORDER TO MODIFY THE VISIBILITY OF MENU'S AND SUBMENU'S (eg. with cookies) YOU HAVE TO ADD TO THIS ELSEIF. DON'T MODIFY THE CSS
|
|
|
|
if ($visible || in_array ("selected", $classes)) {
|
|
|
|
$visible = true;
|
|
|
|
}
|
|
|
|
$output .= '<ul class="submenu'.($visible ? '' : ' invisible').'">';
|
|
|
|
$output .= $submenu_output;
|
|
|
|
$output .= '</ul>';
|
|
|
|
}
|
|
|
|
$output .= '</li>';
|
|
|
|
echo $output;
|
|
|
|
}
|
|
|
|
echo '</ul>';
|
|
|
|
//Invisible UL for adding border-top
|
|
|
|
echo '<ul style="height: 0px;"><li> </li></ul></div>';
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|