2006-03-27 05:37:27 +02:00
|
|
|
<?php
|
2021-06-16 15:29:28 +02:00
|
|
|
/**
|
|
|
|
* Lateral Main Menu.
|
|
|
|
*
|
|
|
|
* @category Main Menu.
|
|
|
|
* @package Pandora FMS.
|
|
|
|
* @subpackage OpenSource.
|
|
|
|
* @version 1.0.0
|
|
|
|
* @license See below
|
|
|
|
*
|
|
|
|
* ______ ___ _______ _______ ________
|
|
|
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
|
|
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
|
|
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
|
|
|
*
|
|
|
|
* ============================================================================
|
|
|
|
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
|
|
|
* Please see http://pandorafms.org for full contribution list
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation for version 2.
|
|
|
|
* 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.
|
|
|
|
* ============================================================================
|
|
|
|
*/
|
|
|
|
|
2022-06-13 16:23:37 +02:00
|
|
|
use function PHPSTORM_META\map;
|
|
|
|
|
2021-06-16 15:29:28 +02:00
|
|
|
// Begin.
|
|
|
|
if (isset($config['id_user']) === false) {
|
2019-01-30 16:18:44 +01:00
|
|
|
include 'general/login_page.php';
|
|
|
|
exit();
|
2006-03-27 05:37:27 +02:00
|
|
|
}
|
2008-12-19 22:45:20 +01:00
|
|
|
|
2019-02-25 11:54:46 +01:00
|
|
|
?>
|
|
|
|
<script type="text/javascript" language="javascript">
|
|
|
|
|
|
|
|
$(document).ready(function(){
|
2022-01-11 12:08:41 +01:00
|
|
|
var menuType_value = "<?php echo ($_SESSION['menu_type'] ?? ''); ?>";
|
2019-03-27 14:39:02 +01:00
|
|
|
|
2021-08-23 10:04:34 +02:00
|
|
|
if (menuType_value === '' || menuType_value === 'classic') {
|
2022-02-10 10:28:43 +01:00
|
|
|
$('ul.submenu').css('left', '214px');
|
2019-02-25 11:54:46 +01:00
|
|
|
}
|
|
|
|
else{
|
2019-03-05 12:54:11 +01:00
|
|
|
$('ul.submenu').css('left', '59px');
|
2019-02-25 11:54:46 +01:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
</script>
|
|
|
|
<?php
|
2014-05-21 12:44:36 +02:00
|
|
|
$autohidden_menu = 0;
|
|
|
|
|
2021-06-16 15:29:28 +02:00
|
|
|
if (isset($config['autohidden_menu']) === true && (bool) $config['autohidden_menu'] === true) {
|
2019-01-30 16:18:44 +01:00
|
|
|
$autohidden_menu = 1;
|
2014-05-21 12:44:36 +02:00
|
|
|
}
|
|
|
|
|
2021-06-16 15:29:28 +02:00
|
|
|
// Start of full lateral menu.
|
|
|
|
echo sprintf('<div id="menu_full" class="menu_full_%s">', $menuTypeClass);
|
2022-07-08 13:40:20 +02:00
|
|
|
$url_logo = ui_get_full_url('index.php');
|
2022-07-11 16:42:20 +02:00
|
|
|
if (is_reporting_console_node() === true) {
|
2022-07-08 13:40:20 +02:00
|
|
|
$url_logo = 'index.php?logged=1&sec=discovery&sec2=godmode/servers/discovery&wiz=tasklist';
|
|
|
|
}
|
2019-02-25 11:54:46 +01:00
|
|
|
|
2022-06-13 16:23:37 +02:00
|
|
|
// Header logo.
|
|
|
|
html_print_div(
|
|
|
|
[
|
|
|
|
'class' => 'logo_green',
|
|
|
|
'content' => html_print_anchor(
|
|
|
|
[
|
2022-07-08 13:40:20 +02:00
|
|
|
'href' => $url_logo,
|
2022-06-13 16:23:37 +02:00
|
|
|
'content' => html_print_header_logo_image(
|
|
|
|
$menuCollapsed,
|
|
|
|
true
|
|
|
|
),
|
|
|
|
],
|
|
|
|
true
|
|
|
|
),
|
|
|
|
]
|
|
|
|
);
|
2019-01-30 16:18:44 +01:00
|
|
|
|
|
|
|
require 'operation/menu.php';
|
|
|
|
require 'godmode/menu.php';
|
2009-02-10 21:29:45 +01:00
|
|
|
|
2022-02-10 10:28:43 +01:00
|
|
|
html_print_div(
|
|
|
|
[
|
|
|
|
'id' => 'button_collapse',
|
|
|
|
'class' => sprintf('button_collapse button_%s', $menuTypeClass),
|
|
|
|
]
|
|
|
|
);
|
2019-02-25 11:54:46 +01:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
echo '</div>';
|
2021-06-16 15:29:28 +02:00
|
|
|
// Menu_container.
|
2019-01-30 16:18:44 +01:00
|
|
|
ui_require_jquery_file('cookie');
|
|
|
|
|
2014-09-16 12:40:05 +02:00
|
|
|
$config_fixed_header = false;
|
2021-06-16 15:29:28 +02:00
|
|
|
if (isset($config['fixed_header']) === true) {
|
2019-01-30 16:18:44 +01:00
|
|
|
$config_fixed_header = $config['fixed_header'];
|
2014-09-16 12:40:05 +02:00
|
|
|
}
|
2009-01-07 11:42:38 +01:00
|
|
|
?>
|
2015-03-26 13:12:48 +01:00
|
|
|
|
2009-02-09 22:00:13 +01:00
|
|
|
<script type="text/javascript" language="javascript">
|
2009-02-13 21:23:44 +01:00
|
|
|
/* <![CDATA[ */
|
2015-04-07 09:50:46 +02:00
|
|
|
|
2022-02-10 10:28:43 +01:00
|
|
|
$('#button_collapse').on('click', function() {
|
2019-02-25 11:54:46 +01:00
|
|
|
|
|
|
|
if($('#menu_full').hasClass('menu_full_classic')){
|
2019-02-26 10:43:59 +01:00
|
|
|
localStorage.setItem("menuType", "collapsed");
|
2019-03-04 08:39:56 +01:00
|
|
|
$('ul.submenu').css('left', '59px');
|
2019-03-25 19:37:45 +01:00
|
|
|
var menuType_val = localStorage.getItem("menuType");
|
|
|
|
$.ajax({
|
|
|
|
type: "POST",
|
|
|
|
url: "ajax.php",
|
|
|
|
data: {
|
|
|
|
menuType: menuType_val,
|
|
|
|
page: "include/functions_menu"
|
|
|
|
},
|
|
|
|
dataType: "json"
|
|
|
|
});
|
2019-02-25 11:54:46 +01:00
|
|
|
}
|
|
|
|
else if($('#menu_full').hasClass('menu_full_collapsed')){
|
2019-02-26 10:43:59 +01:00
|
|
|
localStorage.setItem("menuType", "classic");
|
2019-03-04 08:39:56 +01:00
|
|
|
$('ul.submenu').css('left', '214px');
|
2019-03-25 19:37:45 +01:00
|
|
|
var menuType_val = localStorage.getItem("menuType");
|
|
|
|
$.ajax({
|
|
|
|
type: "POST",
|
|
|
|
url: "ajax.php",
|
|
|
|
data: {
|
|
|
|
menuType: menuType_val,
|
|
|
|
page: "include/functions_menu"
|
|
|
|
},
|
|
|
|
dataType: "json"
|
|
|
|
});
|
2019-02-25 11:54:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$('.logo_full').toggle();
|
|
|
|
$('.logo_icon').toggle();
|
2022-02-10 10:28:43 +01:00
|
|
|
$('#menu_full').toggleClass('menu_full_classic menu_full_collapsed');
|
2019-02-25 11:54:46 +01:00
|
|
|
$('#button_collapse').toggleClass('button_classic button_collapsed');
|
|
|
|
$('div#title_menu').toggleClass('title_menu_classic title_menu_collapsed');
|
|
|
|
$('div#page').toggleClass('page_classic page_collapsed');
|
|
|
|
$('#header_table').toggleClass('header_table_classic header_table_collapsed');
|
|
|
|
$('li.menu_icon').toggleClass("no_hidden_menu menu_icon_collapsed");
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2014-05-21 12:44:36 +02:00
|
|
|
var autohidden_menu = <?php echo $autohidden_menu; ?>;
|
2019-01-30 16:18:44 +01:00
|
|
|
var fixed_header = <?php echo json_encode((bool) $config_fixed_header); ?>;
|
2014-08-05 15:16:54 +02:00
|
|
|
var id_user = "<?php echo $config['id_user']; ?>";
|
|
|
|
var cookie_name = id_user + '-pandora_menu_state';
|
|
|
|
var cookie_name_encoded = btoa(cookie_name);
|
2019-01-30 16:18:44 +01:00
|
|
|
var click_display = "<?php echo $config['click_display']; ?>";
|
2019-02-25 11:54:46 +01:00
|
|
|
|
2014-05-21 12:44:36 +02:00
|
|
|
|
2014-08-05 15:16:54 +02:00
|
|
|
var menuState = $.cookie(cookie_name_encoded);
|
2014-08-04 14:17:13 +02:00
|
|
|
if (!menuState) {
|
2019-01-30 16:18:44 +01:00
|
|
|
menuState = {};
|
2014-08-04 14:17:13 +02:00
|
|
|
}
|
|
|
|
else {
|
2019-01-30 16:18:44 +01:00
|
|
|
menuState = JSON.parse(menuState);
|
|
|
|
open_submenus();
|
2014-08-04 18:50:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function open_submenus () {
|
2019-01-30 16:18:44 +01:00
|
|
|
$.each(menuState, function (index, value) {
|
|
|
|
if (value)
|
|
|
|
$('div.menu>ul>li#' + index + '>ul').show();
|
|
|
|
});
|
2020-03-26 12:29:38 +01:00
|
|
|
//$('div.menu>ul>li.selected>ul').removeClass('invisible');
|
2014-08-04 18:50:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function close_submenus () {
|
2019-01-30 16:18:44 +01:00
|
|
|
$.each(menuState, function (index, value) {
|
|
|
|
if (value)
|
|
|
|
$('div.menu>ul>li#' + index + '>ul').hide();
|
|
|
|
});
|
2020-03-26 12:29:38 +01:00
|
|
|
//$('div.menu>ul>li.selected>ul').addClass('invisible');
|
2014-08-04 14:17:13 +02:00
|
|
|
}
|
|
|
|
|
2019-02-25 11:54:46 +01:00
|
|
|
|
2009-02-13 21:23:44 +01:00
|
|
|
/* ]]> */
|
2013-04-10 09:57:54 +02:00
|
|
|
</script>
|
2015-03-26 13:12:48 +01:00
|
|
|
|
|
|
|
<script type="text/javascript">
|
2019-01-30 16:18:44 +01:00
|
|
|
openTime = 0;
|
|
|
|
openTime2 = 0;
|
|
|
|
handsIn = 0;
|
|
|
|
handsIn2 = 0;
|
|
|
|
|
2019-03-05 12:54:11 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Positionate the submenu elements. Add a negative top.
|
|
|
|
*
|
|
|
|
* @param int index It is the position of li.menu_icon in the ul.
|
|
|
|
* @param string id_submenu It is the id of first level submenu.
|
|
|
|
* @param string id_submenu2 It is the id of second level submenu.
|
|
|
|
* @param int item_height It is the height of a menu item (28 o 35).
|
|
|
|
*
|
|
|
|
* @return (int) The position (in px).
|
|
|
|
*/
|
|
|
|
function menu_calculate_top(index, id_submenu, id_submenu2, item_height){
|
|
|
|
|
|
|
|
var level1 = index;
|
|
|
|
var level2 = $('#'+id_submenu+' ul.submenu > li').length;
|
|
|
|
var level3 = $('#'+id_submenu2+' > li.sub_subMenu').length;
|
|
|
|
var item_height = item_height;
|
|
|
|
|
|
|
|
level2--;
|
|
|
|
if (id_submenu2 !== false) {
|
|
|
|
// If level3 is set, the position is calculated like box is in the center.
|
|
|
|
// wiouth considering level2 box can be moved.
|
|
|
|
level3--;
|
|
|
|
total = (level1 + level3);
|
|
|
|
comp = level3;
|
|
|
|
} else {
|
|
|
|
total = (level1 + level2);
|
|
|
|
comp = level2;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Positionate in the middle
|
|
|
|
if (total > 12 && ((total < 18) || ((level1 - comp) <= 4))) {
|
|
|
|
return - ( Math.floor(comp / 2) * item_height);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Positionate in the bottom
|
|
|
|
if (total >= 18) {
|
|
|
|
return (- comp * item_height);
|
|
|
|
}
|
|
|
|
|
|
|
|
// return 0 by default
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the menu items to be positioned.
|
|
|
|
*
|
|
|
|
* @param string item It is the selector of the current element.
|
|
|
|
*
|
|
|
|
* @return Add the top position in a inline style.
|
|
|
|
*/
|
|
|
|
function get_menu_items(item){
|
|
|
|
var item_height = parseInt(item.css('min-height'));
|
|
|
|
var id_submenu = item.attr('id');
|
|
|
|
var id_submenu2 = false;
|
|
|
|
var index = item.index();
|
|
|
|
|
|
|
|
if(item.parent().hasClass('godmode')){
|
|
|
|
index = index+6; // This is because the menu has divided in two parts.
|
|
|
|
}
|
|
|
|
var top_submenu = menu_calculate_top(index, id_submenu, id_submenu2, item_height);
|
|
|
|
top_submenu = top_submenu+'px';
|
|
|
|
$('#'+id_submenu+' ul.submenu').css('top', top_submenu);
|
|
|
|
|
|
|
|
$('.has_submenu').mouseenter(function() {
|
|
|
|
id_submenu2 = item.attr('id');
|
|
|
|
id_submenu2 = $('#'+id_submenu2+' ul.submenu2').attr('id');
|
|
|
|
var top_submenu2 = menu_calculate_top(index, id_submenu, id_submenu2, item_height);
|
|
|
|
top_submenu2 = top_submenu2+'px';
|
|
|
|
$('#'+id_submenu2).css('top', top_submenu2);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Show and hide submenus
|
|
|
|
*/
|
|
|
|
if(!click_display){
|
|
|
|
$('.menu_icon').mouseenter(function() {
|
|
|
|
table_hover = $(this);
|
|
|
|
handsIn = 1;
|
|
|
|
openTime = new Date().getTime();
|
|
|
|
$("ul#sub"+table_hover[0].id).show();
|
|
|
|
get_menu_items(table_hover);
|
|
|
|
if( typeof(table_noHover) != 'undefined')
|
|
|
|
if ( "ul#sub"+table_hover[0].id != "ul#sub"+table_noHover[0].id )
|
|
|
|
$("ul#sub"+table_noHover[0].id).hide();
|
|
|
|
}).mouseleave(function() {
|
|
|
|
table_noHover = $(this);
|
|
|
|
handsIn = 0;
|
|
|
|
setTimeout(function() {
|
|
|
|
opened = new Date().getTime() - openTime;
|
|
|
|
if(opened > 3000 && handsIn == 0) {
|
|
|
|
openTime = 4000;
|
|
|
|
$("ul#sub"+table_noHover[0].id).hide();
|
|
|
|
}
|
|
|
|
}, 2500);
|
|
|
|
});
|
|
|
|
}else{
|
|
|
|
$(document).ready(function() {
|
|
|
|
if (autohidden_menu) {
|
|
|
|
$('.menu_icon').on("click", function() {
|
|
|
|
if( typeof(table_hover) != 'undefined'){
|
|
|
|
$("ul#sub"+table_hover[0].id).hide();
|
|
|
|
}
|
2019-01-30 16:18:44 +01:00
|
|
|
table_hover = $(this);
|
|
|
|
handsIn = 1;
|
|
|
|
openTime = new Date().getTime();
|
|
|
|
$("ul#sub"+table_hover[0].id).show();
|
2019-03-05 12:54:11 +01:00
|
|
|
get_menu_items(table_hover);
|
2019-01-30 16:18:44 +01:00
|
|
|
}).mouseleave(function() {
|
|
|
|
table_noHover = $(this);
|
|
|
|
handsIn = 0;
|
|
|
|
setTimeout(function() {
|
|
|
|
opened = new Date().getTime() - openTime;
|
2019-03-05 12:54:11 +01:00
|
|
|
if(opened > 5000 && handsIn == 0) {
|
|
|
|
openTime = 6000;
|
|
|
|
$("ul#sub"+table_noHover[0].id).hide();
|
2019-01-30 16:18:44 +01:00
|
|
|
}
|
2019-03-05 12:54:11 +01:00
|
|
|
}, 5500);
|
2019-01-30 16:18:44 +01:00
|
|
|
});
|
2019-03-05 12:54:11 +01:00
|
|
|
} else {
|
|
|
|
$('.menu_icon').on("click", function() {
|
|
|
|
if( typeof(table_hover) != 'undefined'){
|
2019-01-30 16:18:44 +01:00
|
|
|
$("ul#sub"+table_hover[0].id).hide();
|
2019-03-05 12:54:11 +01:00
|
|
|
}
|
|
|
|
table_hover = $(this);
|
|
|
|
handsIn = 1;
|
|
|
|
openTime = new Date().getTime();
|
|
|
|
$("ul#sub"+table_hover[0].id).show();
|
|
|
|
get_menu_items(table_hover);
|
2019-01-30 16:18:44 +01:00
|
|
|
});
|
2019-03-04 08:39:56 +01:00
|
|
|
}
|
2019-03-05 12:54:11 +01:00
|
|
|
});
|
|
|
|
}
|
2019-03-04 08:39:56 +01:00
|
|
|
|
2019-03-05 12:54:11 +01:00
|
|
|
$('.has_submenu').mouseenter(function() {
|
|
|
|
table_hover2 = $(this);
|
|
|
|
handsIn2 = 1;
|
|
|
|
openTime2 = new Date().getTime();
|
|
|
|
$("#sub"+table_hover2[0].id).show();
|
|
|
|
if( typeof(table_noHover2) != 'undefined')
|
|
|
|
if ( "ul#sub"+table_hover2[0].id != "ul#sub"+table_noHover2[0].id )
|
|
|
|
$("ul#sub"+table_noHover2[0].id).hide();
|
|
|
|
}).mouseleave(function() {
|
|
|
|
table_noHover2 = table_hover2;
|
|
|
|
handsIn2 = 0;
|
|
|
|
setTimeout(function() {
|
|
|
|
opened = new Date().getTime() - openTime2;
|
|
|
|
if(opened >= 3000 && handsIn2 == 0) {
|
|
|
|
openTime2 = 4000;
|
|
|
|
$("ul#sub"+table_hover2[0].id).hide();
|
|
|
|
}
|
|
|
|
}, 3500);
|
|
|
|
});
|
|
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
|
|
|
|
if(!click_display){
|
|
|
|
$('#container').click(function() {
|
2019-03-04 08:39:56 +01:00
|
|
|
openTime = 4000;
|
|
|
|
if( typeof(table_hover) != 'undefined')
|
|
|
|
$("ul#sub"+table_hover[0].id).hide();
|
|
|
|
if( typeof(table_hover2) != 'undefined')
|
|
|
|
$("ul#sub"+table_hover2[0].id).hide();
|
2019-03-05 12:54:11 +01:00
|
|
|
});
|
|
|
|
}else{
|
|
|
|
$('#main').click(function() {
|
2019-03-04 08:39:56 +01:00
|
|
|
openTime = 4000;
|
|
|
|
if( typeof(table_hover) != 'undefined')
|
|
|
|
$("ul#sub"+table_hover[0].id).hide();
|
|
|
|
if( typeof(table_hover2) != 'undefined')
|
|
|
|
$("ul#sub"+table_hover2[0].id).hide();
|
|
|
|
});
|
2019-03-05 12:54:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$('div.menu>ul>li>ul>li>a').click(function() {
|
|
|
|
openTime = 4000;
|
|
|
|
if( typeof(table_hover) != 'undefined')
|
|
|
|
$("ul#sub"+table_hover[0].id).hide();
|
|
|
|
if( typeof(table_hover2) != 'undefined')
|
2022-02-10 10:28:43 +01:00
|
|
|
$("ul#sub"+table_hover2[0].id).hide();
|
|
|
|
});
|
|
|
|
|
2019-03-05 12:54:11 +01:00
|
|
|
$('div.menu>ul>li>ul>li>ul>li>a').click(function() {
|
|
|
|
openTime = 4000;
|
|
|
|
if( typeof(table_hover) != 'undefined')
|
|
|
|
$("ul#sub"+table_hover[0].id).hide();
|
|
|
|
if( typeof(table_hover2) != 'undefined')
|
|
|
|
$("ul#sub"+table_hover2[0].id).hide();
|
2019-03-04 08:39:56 +01:00
|
|
|
});
|
2022-02-10 10:28:43 +01:00
|
|
|
|
2019-03-05 12:54:11 +01:00
|
|
|
});
|
2022-02-10 10:28:43 +01:00
|
|
|
|
2015-03-26 13:12:48 +01:00
|
|
|
</script>
|