2006-03-27 05:37:27 +02:00
|
|
|
<?php
|
2023-03-30 13:02:36 +02:00
|
|
|
|
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
|
|
|
|
*
|
|
|
|
* ______ ___ _______ _______ ________
|
2023-06-08 12:42:10 +02:00
|
|
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
|
|
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
2021-06-16 15:29:28 +02:00
|
|
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
|
|
|
*
|
|
|
|
* ============================================================================
|
2023-06-08 11:53:13 +02:00
|
|
|
* Copyright (c) 2005-2023 Pandora FMS
|
2023-06-08 13:19:01 +02:00
|
|
|
* Please see https://pandorafms.com/community/ for full contribution list
|
2021-06-16 15:29:28 +02:00
|
|
|
* 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.
|
|
|
|
* ============================================================================
|
|
|
|
*/
|
|
|
|
|
|
|
|
// 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
|
|
|
|
2023-02-13 09:31:33 +01:00
|
|
|
require_once 'include/functions_menu.php';
|
2019-03-27 14:39:02 +01:00
|
|
|
|
2023-02-13 09:31:33 +01:00
|
|
|
// Global variable. Do not delete.
|
|
|
|
$tab_active = '';
|
2019-02-25 11:54:46 +01:00
|
|
|
|
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);
|
2023-02-13 09:31:33 +01:00
|
|
|
|
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
|
2023-02-13 09:31:33 +01:00
|
|
|
).'<div id="button_collapse" class="button_'.$menuTypeClass.'" style="cursor: pointer"></div>',
|
2022-06-13 16:23:37 +02:00
|
|
|
]
|
|
|
|
);
|
2019-01-30 16:18:44 +01:00
|
|
|
|
2023-02-13 09:31:33 +01:00
|
|
|
$display_classic = '';
|
|
|
|
$display_collapsed = 'display: none;';
|
|
|
|
if ($menuTypeClass === 'collapsed') {
|
|
|
|
$display_classic = 'display: none;';
|
|
|
|
$display_collapsed = '';
|
|
|
|
}
|
2009-02-10 21:29:45 +01:00
|
|
|
|
2023-02-13 09:31:33 +01:00
|
|
|
|
|
|
|
// Tabs.
|
|
|
|
echo '<div id="menu_tabs">';
|
|
|
|
// Tabs classic.
|
|
|
|
echo '<ul class="tabs_ul" style="'.$display_classic.'">';
|
2023-02-13 13:16:51 +01:00
|
|
|
echo '<li id="tab_display" class="tabs_li"><span>'.__('Operation').'</span></a></li>';
|
2023-02-13 09:31:33 +01:00
|
|
|
echo '<li id="tab_management" class="tabs_li"><span>'.__('Management').'</span></a></li>';
|
|
|
|
echo '</ul>';
|
|
|
|
echo '<div class="div_border_line" style="'.$display_classic.'"><div id="tab_line_1" class="border_line"></div><div id="tab_line_2" class="border_line"></div></div>';
|
|
|
|
// Tabs collapse.
|
|
|
|
echo '<div class="tabs_collapsed" style="'.$display_collapsed.'">';
|
|
|
|
echo '<div class="tabs_collapsed_container">';
|
2023-02-13 13:16:51 +01:00
|
|
|
echo '<div id="tab_collapsed_display" class="tabs_collapsed_div" title="'.__('Operation').'"><div class="tabs_collapsed_display"></div></div>';
|
|
|
|
echo '<div id="tab_collapsed_management" class="tabs_collapsed_div" title="'.__('Management').'"><div class="tabs_collapsed_management"></div></div>';
|
2023-02-13 09:31:33 +01:00
|
|
|
echo '</div></div>';
|
2019-02-25 11:54:46 +01:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
echo '</div>';
|
|
|
|
|
2023-02-13 09:31:33 +01:00
|
|
|
echo '<div id="div_display">';
|
|
|
|
require 'operation/menu.php';
|
|
|
|
echo '</div>';
|
|
|
|
echo '<div id="div_management">';
|
|
|
|
require 'godmode/menu.php';
|
|
|
|
echo '</div>';
|
|
|
|
echo '</div>';
|
2009-01-07 11:42:38 +01:00
|
|
|
?>
|
2023-02-13 09:31:33 +01:00
|
|
|
<script type="text/javascript">
|
|
|
|
$(document).ready(function() {
|
2023-03-09 11:25:43 +01:00
|
|
|
menuActionButtonResizing();
|
2023-02-27 09:39:34 +01:00
|
|
|
const menuTypeClass = '<?php echo $menuTypeClass; ?>';
|
|
|
|
if (menuTypeClass === 'classic' && menuTypeClass !== localStorage.getItem('menuType')) {
|
|
|
|
localStorage.setItem('menuType', 'classic');
|
|
|
|
}
|
2023-02-13 09:31:33 +01:00
|
|
|
const tab = '<?php echo $tab_active; ?>';
|
|
|
|
|
|
|
|
if (tab === 'management') {
|
|
|
|
$('#tab_line_2').addClass('tabs_selected');
|
|
|
|
$('#div_display').css('display', 'none');
|
|
|
|
$('#div_management').css('display', 'block');
|
2023-02-16 14:37:30 +01:00
|
|
|
$('#tab_display').addClass('head_tab_unselected').removeClass('head_tab_selected');
|
|
|
|
$('#tab_management').addClass('head_tab_selected').removeClass('head_tab_unselected');
|
2023-02-13 09:31:33 +01:00
|
|
|
$('#tab_collapsed_display').children().first().removeClass('tabs_collapsed_display');
|
|
|
|
$('#tab_collapsed_display').children().first().addClass('tabs_collapsed_oval');
|
|
|
|
} else {
|
|
|
|
$('#tab_line_1').addClass('tabs_selected');
|
2023-02-16 14:37:30 +01:00
|
|
|
$('#tab_management').addClass('head_tab_unselected').removeClass('head_tab_selected');
|
|
|
|
$('#tab_display').addClass('head_tab_selected').removeClass('head_tab_unselected');
|
2023-02-13 09:31:33 +01:00
|
|
|
$('#tab_collapsed_management').children().first().removeClass('tabs_collapsed_management');
|
|
|
|
$('#tab_collapsed_management').children().first().addClass('tabs_collapsed_oval');
|
|
|
|
}
|
2015-03-26 13:12:48 +01:00
|
|
|
|
2023-02-13 09:31:33 +01:00
|
|
|
$('#tab_display,#tab_collapsed_display').click(function() {
|
|
|
|
$('#tab_line_1').addClass('tabs_selected');
|
|
|
|
$('#tab_line_2').removeClass('tabs_selected');
|
|
|
|
$('#div_management').css('display', 'none');
|
|
|
|
$('#div_display').css('display', 'block');
|
2023-02-16 14:37:30 +01:00
|
|
|
$('#tab_management').addClass('head_tab_unselected').removeClass('head_tab_selected');
|
|
|
|
$('#tab_display').addClass('head_tab_selected').removeClass('head_tab_unselected');
|
2023-02-13 09:31:33 +01:00
|
|
|
$('#tab_collapsed_management').children().first().removeClass('tabs_collapsed_management');
|
|
|
|
$('#tab_collapsed_management').children().first().addClass('tabs_collapsed_oval');
|
|
|
|
$('#tab_collapsed_display').children().first().removeClass('tabs_collapsed_oval');
|
|
|
|
$('#tab_collapsed_display').children().first().addClass('tabs_collapsed_display');
|
2019-03-25 19:37:45 +01:00
|
|
|
});
|
2014-08-04 14:17:13 +02:00
|
|
|
|
2023-02-13 09:31:33 +01:00
|
|
|
$('#tab_management,#tab_collapsed_management').click(function() {
|
|
|
|
$('#tab_line_2').addClass('tabs_selected');
|
|
|
|
$('#tab_line_1').removeClass('tabs_selected');
|
|
|
|
$('#div_display').css('display', 'none');
|
|
|
|
$('#div_management').css('display', 'block');
|
2023-02-16 14:37:30 +01:00
|
|
|
$('#tab_display').addClass('head_tab_unselected').removeClass('head_tab_selected');
|
|
|
|
$('#tab_management').addClass('head_tab_selected').removeClass('head_tab_unselected');
|
2023-02-13 09:31:33 +01:00
|
|
|
$('#tab_collapsed_display').children().first().removeClass('tabs_collapsed_display');
|
|
|
|
$('#tab_collapsed_display').children().first().addClass('tabs_collapsed_oval');
|
|
|
|
$('#tab_collapsed_management').children().first().removeClass('tabs_collapsed_oval');
|
|
|
|
$('#tab_collapsed_management').children().first().addClass('tabs_collapsed_management');
|
|
|
|
});
|
2019-02-25 11:54:46 +01:00
|
|
|
|
2023-02-13 09:31:33 +01:00
|
|
|
$('#button_collapse').click(function() {
|
|
|
|
if ($('#menu_full').hasClass('menu_full_classic')) {
|
|
|
|
localStorage.setItem("menuType", "collapsed");
|
|
|
|
$('ul.submenu').css('left', '80px');
|
|
|
|
var menuType_val = localStorage.getItem("menuType");
|
|
|
|
$.ajax({
|
|
|
|
type: "POST",
|
|
|
|
url: "ajax.php",
|
|
|
|
data: {
|
|
|
|
menuType: menuType_val,
|
|
|
|
page: "include/functions_menu"
|
|
|
|
},
|
|
|
|
dataType: "json"
|
|
|
|
});
|
|
|
|
$('.tabs_ul').hide();
|
|
|
|
$('.div_border_line').hide();
|
|
|
|
$('.tabs_collapsed').show();
|
|
|
|
|
|
|
|
$(".title_menu_classic").children('div[class*=icon_]').each(function() {
|
|
|
|
$(this).removeClass('w15p').addClass('w100p');
|
|
|
|
});
|
|
|
|
|
|
|
|
$(".title_menu_classic").children('div[class*=arrow_]').each(function() {
|
|
|
|
$(this).hide();
|
|
|
|
});
|
|
|
|
|
|
|
|
$(".title_menu_classic").children('span').each(function() {
|
|
|
|
$(this).hide();
|
|
|
|
});
|
|
|
|
|
|
|
|
$('ul.submenu').css('position', 'fixed');
|
|
|
|
$('ul.submenu').css('left', '60px');
|
|
|
|
|
|
|
|
$('li.selected').each(function() {
|
|
|
|
$(`#sub${this.id}`).hide();
|
|
|
|
})
|
|
|
|
} else if ($('#menu_full').hasClass('menu_full_collapsed')) {
|
|
|
|
localStorage.setItem("menuType", "classic");
|
|
|
|
$('ul.submenu').css('left', '280px');
|
|
|
|
var menuType_val = localStorage.getItem("menuType");
|
|
|
|
$.ajax({
|
|
|
|
type: "POST",
|
|
|
|
url: "ajax.php",
|
|
|
|
data: {
|
|
|
|
menuType: menuType_val,
|
|
|
|
page: "include/functions_menu"
|
|
|
|
},
|
|
|
|
dataType: "json"
|
|
|
|
});
|
|
|
|
$('.tabs_ul').show();
|
|
|
|
$('.div_border_line').show();
|
|
|
|
$('.tabs_collapsed').hide();
|
|
|
|
|
|
|
|
$(".title_menu_classic").children('div[class*=icon_]').each(function() {
|
|
|
|
$(this).removeClass('w100p').addClass('w15p');
|
|
|
|
});
|
|
|
|
|
|
|
|
$(".title_menu_classic").children('div[class*=arrow_]').each(function() {
|
|
|
|
$(this).show();
|
|
|
|
});
|
|
|
|
|
|
|
|
$(".title_menu_classic").children('span').each(function() {
|
|
|
|
$(this).show();
|
|
|
|
});
|
|
|
|
|
|
|
|
$('ul.submenu').css('position', '');
|
|
|
|
$('ul.submenu').css('left', '80px');
|
|
|
|
|
|
|
|
$('li.selected').each(function() {
|
|
|
|
$(`#sub${this.id}`).show();
|
|
|
|
})
|
|
|
|
}
|
2015-03-26 13:12:48 +01:00
|
|
|
|
2023-02-13 09:31:33 +01:00
|
|
|
$('.logo_full').toggle();
|
|
|
|
$('.logo_icon').toggle();
|
|
|
|
$('#menu_full').toggleClass('menu_full_classic menu_full_collapsed');
|
|
|
|
$('#button_collapse').toggleClass('button_classic button_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");
|
2023-02-15 13:43:42 +01:00
|
|
|
menuActionButtonResizing();
|
2023-02-13 09:31:33 +01:00
|
|
|
});
|
2019-01-30 16:18:44 +01:00
|
|
|
|
2023-02-13 09:31:33 +01:00
|
|
|
const id_selected = '<?php echo $menu1_selected; ?>';
|
|
|
|
if (id_selected != '') {
|
|
|
|
var menuType_val = localStorage.getItem("menuType");
|
2023-03-30 13:02:36 +02:00
|
|
|
const closedMenuId = localStorage.getItem("closedMenuId");
|
|
|
|
if (menuType_val === 'classic' &&
|
|
|
|
(closedMenuId === '' || `icon_${id_selected}` !== closedMenuId)
|
|
|
|
) {
|
2023-02-13 09:31:33 +01:00
|
|
|
$(`ul#subicon_${id_selected}`).show();
|
2023-03-30 13:02:36 +02:00
|
|
|
// Arrow.
|
|
|
|
$(`#icon_${id_selected}`).children().first().children().last().removeClass('arrow_menu_down');
|
|
|
|
$(`#icon_${id_selected}`).children().first().children().last().addClass('arrow_menu_up');
|
2023-02-13 09:31:33 +01:00
|
|
|
}
|
2019-03-05 12:54:11 +01:00
|
|
|
|
2023-02-13 09:31:33 +01:00
|
|
|
// Span.
|
|
|
|
$(`#icon_${id_selected}`).children().first().children().eq(1).addClass('span_selected');
|
|
|
|
|
|
|
|
const id_selected2 = '<?php echo $menu2_selected; ?>';
|
|
|
|
if (id_selected2 != '') {
|
|
|
|
if ($(`#sub${id_selected2}`).length > 0) {
|
|
|
|
$(`#sub${id_selected2}`).show();
|
|
|
|
// Arrow.
|
|
|
|
$(`#${id_selected2}`).children().first().children().last().removeClass('arrow_menu_down');
|
|
|
|
$(`#${id_selected2}`).children().first().children().last().addClass('arrow_menu_up');
|
|
|
|
// Span.
|
|
|
|
$(`#${id_selected2}`).children().first().children().first().addClass('span_selected');
|
|
|
|
// Vertical line.
|
|
|
|
$(`.sub_subMenu.selected`).prepend(`<div class="element_submenu_selected left_3"></div>`);
|
|
|
|
} else {
|
|
|
|
$(`#${id_selected2}`).addClass('submenu_selected_no_submenu');
|
|
|
|
$(`#${id_selected2}`).children().first().children().first().css('color', '#fff');
|
|
|
|
// Vertical line.
|
|
|
|
$(`#${id_selected2}`).prepend(`<div class="element_submenu_selected"></div>`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-03-05 12:54:11 +01:00
|
|
|
|
|
|
|
|
2023-02-13 09:31:33 +01:00
|
|
|
var click_display = "<?php echo $config['click_display']; ?>";
|
2019-03-05 12:54:11 +01:00
|
|
|
|
2023-02-13 09:31:33 +01:00
|
|
|
$('.menu_icon').mouseenter(function() {
|
|
|
|
var menuType_val = localStorage.getItem("menuType");
|
|
|
|
if (!click_display && menuType_val === 'collapsed') {
|
2019-01-30 16:18:44 +01:00
|
|
|
table_hover = $(this);
|
|
|
|
handsIn = 1;
|
|
|
|
openTime = new Date().getTime();
|
2023-03-30 13:02:36 +02:00
|
|
|
$("ul#sub" + table_hover[0].id).show();
|
2019-03-05 12:54:11 +01:00
|
|
|
get_menu_items(table_hover);
|
2023-02-13 09:31:33 +01:00
|
|
|
if (typeof(table_noHover) != 'undefined') {
|
2023-03-30 13:02:36 +02:00
|
|
|
if ("ul#sub" + table_hover[0].id != "ul#sub" + table_noHover[0].id) {
|
|
|
|
$("ul#sub" + table_noHover[0].id).hide();
|
2023-02-13 09:31:33 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}).mouseleave(function() {
|
|
|
|
var menuType_val = localStorage.getItem("menuType");
|
|
|
|
if (!click_display && menuType_val === 'collapsed') {
|
2019-01-30 16:18:44 +01:00
|
|
|
table_noHover = $(this);
|
|
|
|
handsIn = 0;
|
|
|
|
setTimeout(function() {
|
|
|
|
opened = new Date().getTime() - openTime;
|
2023-03-30 13:02:36 +02:00
|
|
|
if (opened > 2500 && handsIn == 0) {
|
2023-02-13 09:31:33 +01:00
|
|
|
openTime = 4000;
|
2023-03-30 13:02:36 +02:00
|
|
|
$("ul#sub" + table_noHover[0].id).hide();
|
2019-01-30 16:18:44 +01:00
|
|
|
}
|
2023-02-13 09:31:33 +01:00
|
|
|
}, 2500);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
$('.has_submenu').mouseenter(function() {
|
|
|
|
var menuType_val = localStorage.getItem("menuType");
|
|
|
|
if (!click_display && menuType_val === 'collapsed') {
|
|
|
|
table_hover2 = $(this);
|
|
|
|
handsIn2 = 1;
|
|
|
|
openTime2 = new Date().getTime();
|
2023-03-30 13:02:36 +02:00
|
|
|
$("#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();
|
2023-02-13 09:31:33 +01:00
|
|
|
}
|
2019-03-05 12:54:11 +01:00
|
|
|
}
|
2023-02-13 09:31:33 +01:00
|
|
|
}
|
|
|
|
}).mouseleave(function() {
|
|
|
|
var menuType_val = localStorage.getItem("menuType");
|
|
|
|
if (!click_display && menuType_val === 'collapsed') {
|
|
|
|
table_noHover2 = table_hover2;
|
|
|
|
handsIn2 = 0;
|
|
|
|
setTimeout(function() {
|
2023-03-30 13:02:36 +02:00
|
|
|
opened = new Date().getTime() - openTime2;
|
|
|
|
if (opened >= 3000 && handsIn2 == 0) {
|
2023-02-13 09:31:33 +01:00
|
|
|
openTime2 = 4000;
|
2023-03-30 13:02:36 +02:00
|
|
|
$("ul#sub" + table_hover2[0].id).hide();
|
2023-02-13 09:31:33 +01:00
|
|
|
}
|
|
|
|
}, 3500);
|
|
|
|
}
|
|
|
|
});
|
2019-03-04 08:39:56 +01:00
|
|
|
|
2023-02-13 09:31:33 +01:00
|
|
|
$('#container').click(function() {
|
|
|
|
var menuType_val = localStorage.getItem("menuType");
|
|
|
|
if (!click_display && menuType_val === 'collapsed') {
|
2019-03-05 12:54:11 +01:00
|
|
|
|
2023-02-13 09:31:33 +01:00
|
|
|
openTime = 4000;
|
2023-03-30 13:02:36 +02:00
|
|
|
if (typeof(table_hover) != 'undefined') {
|
|
|
|
$("ul#sub" + table_hover[0].id).hide();
|
2023-02-13 09:31:33 +01:00
|
|
|
}
|
2019-03-05 12:54:11 +01:00
|
|
|
|
2023-03-30 13:02:36 +02:00
|
|
|
if (typeof(table_hover2) != 'undefined') {
|
|
|
|
$("ul#sub" + table_hover2[0].id).hide();
|
2023-02-13 09:31:33 +01:00
|
|
|
}
|
|
|
|
}
|
2019-03-05 12:54:11 +01:00
|
|
|
});
|
2023-02-13 09:31:33 +01:00
|
|
|
|
|
|
|
$('.title_menu_classic').click(function() {
|
|
|
|
var menuType_val = localStorage.getItem("menuType");
|
|
|
|
if (click_display || (!click_display && menuType_val === 'classic')) {
|
|
|
|
const table_hover = $(this).parent();
|
|
|
|
const id = table_hover[0].id;
|
|
|
|
const classes = $(`#${id}`).attr('class');
|
|
|
|
|
2023-06-19 15:09:30 +02:00
|
|
|
if (id === 'icon_about' || id === 'icon_about_operation') {
|
2023-02-13 09:31:33 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
var menuType_val = localStorage.getItem("menuType");
|
2023-03-30 13:02:36 +02:00
|
|
|
const closedMenuId = localStorage.getItem("closedMenuId");
|
2023-02-13 09:31:33 +01:00
|
|
|
|
2023-03-30 13:02:36 +02:00
|
|
|
if (classes.includes('selected') === true
|
|
|
|
&& (closedMenuId === '' || closedMenuId !== id)
|
|
|
|
) {
|
2023-02-13 09:31:33 +01:00
|
|
|
if (menuType_val === 'collapsed' && $(`ul#sub${id}`).is(':hidden')) {
|
|
|
|
$(`ul#sub${id}`).show();
|
|
|
|
get_menu_items(table_hover);
|
|
|
|
} else {
|
|
|
|
$(`#${id}`).removeClass('selected');
|
|
|
|
$(`ul#sub${id}`).hide();
|
2023-03-30 13:02:36 +02:00
|
|
|
|
|
|
|
const liSelected = $(`ul#sub${id}`).find('.selected');
|
|
|
|
if (liSelected.length > 0) {
|
|
|
|
localStorage.setItem("closedMenuId", id);
|
|
|
|
}
|
2023-02-13 09:31:33 +01:00
|
|
|
// Arrow.
|
|
|
|
table_hover.children().first().children().last().removeClass('arrow_menu_up');
|
|
|
|
table_hover.children().first().children().last().addClass('arrow_menu_down');
|
|
|
|
// Span.
|
|
|
|
table_hover.children().first().children().eq(1).removeClass('span_selected');
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (menuType_val === 'collapsed') {
|
|
|
|
// hide all submenus.
|
|
|
|
$('ul[id^=sub]').hide();
|
|
|
|
$(`ul#sub${id}`).show();
|
|
|
|
// Unselect all.
|
|
|
|
$(`li[id^=icon_]`).removeClass('selected');
|
|
|
|
$(`#${id}`).addClass('selected');
|
|
|
|
get_menu_items(table_hover);
|
|
|
|
} else {
|
|
|
|
$(`ul#sub${id}`).show();
|
|
|
|
$(`#${id}`).addClass('selected');
|
2023-03-30 13:02:36 +02:00
|
|
|
|
|
|
|
const liSelected = $(`ul#sub${id}`).find('.selected');
|
|
|
|
if (liSelected.length > 0) {
|
|
|
|
localStorage.setItem("closedMenuId", '');
|
|
|
|
}
|
|
|
|
|
2023-02-13 09:31:33 +01:00
|
|
|
// Arrow.
|
|
|
|
$(this).children().last().removeClass('arrow_menu_down');
|
|
|
|
$(this).children().last().addClass('arrow_menu_up');
|
|
|
|
// Span.
|
|
|
|
$(this).children().eq(1).addClass('span_selected');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-03-04 08:39:56 +01:00
|
|
|
});
|
2019-03-05 12:54:11 +01:00
|
|
|
|
2023-02-13 09:31:33 +01:00
|
|
|
$('.has_submenu').click(function() {
|
|
|
|
var menuType_val = localStorage.getItem("menuType");
|
|
|
|
if (click_display || (!click_display && menuType_val === 'classic')) {
|
|
|
|
const table_hover2 = $(this);
|
|
|
|
const id = table_hover2[0].id;
|
|
|
|
const classes = $(`#${id}`).attr('class');
|
|
|
|
|
|
|
|
if (classes.includes('submenu_selected') === true) {
|
|
|
|
$(`#${id}`).removeClass('submenu_selected');
|
|
|
|
$(`#${id}`).addClass('submenu_not_selected');
|
|
|
|
$(`#sub${id}`).hide();
|
|
|
|
// Arrow.
|
|
|
|
table_hover2.children().first().children().last().removeClass('arrow_menu_up');
|
|
|
|
table_hover2.children().first().children().last().addClass('arrow_menu_down');
|
|
|
|
// Span.
|
|
|
|
table_hover2.children().first().children().first().removeClass('span_selected');
|
|
|
|
} else {
|
|
|
|
$(`#${id}`).removeClass('submenu_not_selected');
|
|
|
|
$(`#${id}`).addClass('submenu_selected');
|
|
|
|
$(`#sub${id}`).show();
|
|
|
|
// Arrow.
|
|
|
|
table_hover2.children().first().children().last().removeClass('arrow_menu_down');
|
|
|
|
table_hover2.children().first().children().last().addClass('arrow_menu_up');
|
|
|
|
// Span.
|
|
|
|
table_hover2.children().first().children().first().addClass('span_selected');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2019-03-05 12:54:11 +01:00
|
|
|
|
2023-03-30 13:02:36 +02:00
|
|
|
$('.sub_subMenu').click(function(event) {
|
2023-02-13 09:31:33 +01:00
|
|
|
event.stopPropagation();
|
|
|
|
});
|
2022-02-10 10:28:43 +01:00
|
|
|
|
2023-02-13 09:31:33 +01:00
|
|
|
/**
|
|
|
|
* 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 index = item.index();
|
|
|
|
|
|
|
|
var top_submenu = menu_calculate_top(index, item_height);
|
2023-03-30 13:02:36 +02:00
|
|
|
top_submenu = top_submenu + 'px';
|
|
|
|
$('#' + id_submenu + ' ul.submenu').css('position', 'fixed');
|
|
|
|
$('#' + id_submenu + ' ul.submenu').css('top', top_submenu);
|
|
|
|
$('#' + id_submenu + ' ul.submenu').css('left', '60px');
|
2023-02-13 09:31:33 +01:00
|
|
|
}
|
2022-02-10 10:28:43 +01:00
|
|
|
|
|
|
|
|
2023-02-13 09:31:33 +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 int item_height It is the height of a menu item (35).
|
|
|
|
*
|
|
|
|
* @return (int) The position (in px).
|
|
|
|
*/
|
|
|
|
function menu_calculate_top(index, item_height) {
|
2023-02-27 09:39:34 +01:00
|
|
|
const height_position = index * item_height;
|
|
|
|
const height_logo = $('.logo_green').outerHeight(true);
|
|
|
|
const height_tabs = $('#menu_tabs').outerHeight(true);
|
|
|
|
const padding_menu = parseInt($('.godmode').css('padding-top'));
|
|
|
|
|
|
|
|
return height_logo + height_tabs + padding_menu + height_position;
|
2023-02-13 09:31:33 +01:00
|
|
|
}
|
|
|
|
});
|
2023-03-30 13:02:36 +02:00
|
|
|
</script>
|