From cafda2a1162fda91eb89efd9698eead3bfb6ae61 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Tue, 7 Feb 2017 12:58:29 +0100 Subject: [PATCH] Added new option to see the menu bar in classic mode. Ticket #234 --- pandora_console/general/main_menu.php | 170 ++++++++++++------ .../godmode/setup/setup_visuals.php | 11 ++ pandora_console/include/functions_config.php | 6 + pandora_console/index.php | 20 ++- 4 files changed, 148 insertions(+), 59 deletions(-) diff --git a/pandora_console/general/main_menu.php b/pandora_console/general/main_menu.php index d10ed9c341..0cfd1387b3 100644 --- a/pandora_console/general/main_menu.php +++ b/pandora_console/general/main_menu.php @@ -75,6 +75,11 @@ var id_user = ""; var cookie_name = id_user + '-pandora_menu_state'; var cookie_name_encoded = btoa(cookie_name); var click_display = ""; +var classic_menu = ""; + +if (classic_menu) { + autohidden_menu = true; +} var menuState = $.cookie(cookie_name_encoded); if (!menuState) { @@ -226,29 +231,18 @@ $(document).ready( function() { */ handsInMenu = 0; openTimeMenu = 0; - if(!click_display){ - $('#menu').mouseenter(function() { - $('div#title_menu').show(); - handsInMenu = 1; - openTimeMenu = new Date().getTime(); - $('#menu').css('width', '145px'); - $('li.menu_icon').addClass( " no_hidden_menu" ); - $('ul.submenu').css('left', '144px'); - }).mouseleave(function() { - handsInMenu = 0; - setTimeout(function() { - openedMenu = new Date().getTime() - openTimeMenu; - if(openedMenu > 1000 && handsInMenu == 0) { - $('#menu').css('width', '45px'); - $('li.menu_icon').removeClass( " no_hidden_menu"); - $('ul.submenu').css('left', '44px'); - $('div#title_menu').hide(); - } - }, 2500); - }); - }else{ - $(document).ready(function() { - $('#menu').on("click", function() { + if (classic_menu) { + $('div#title_menu').show(); + handsInMenu = 1; + openTimeMenu = new Date().getTime(); + $('#menu').css('width', '145px'); + $('#menu').css('position', 'block'); + $('li.menu_icon').addClass( " no_hidden_menu" ); + $('ul.submenu').css('left', '144px'); + } + else { + if(!click_display){ + $('#menu').mouseenter(function() { $('div#title_menu').show(); handsInMenu = 1; openTimeMenu = new Date().getTime(); @@ -267,10 +261,35 @@ $(document).ready( function() { $('ul.submenu').css('left', '44px'); $('div#title_menu').hide(); } - }, 5500); + }, 2500); }); - }); + }else{ + $(document).ready(function() { + $('#menu').on("click", function() { + $('div#title_menu').show(); + handsInMenu = 1; + openTimeMenu = new Date().getTime(); + $('#menu').css('width', '145px'); + $('li.menu_icon').addClass( " no_hidden_menu" ); + $('li.menu_icon').find('li').addClass( " no_hidden_menu" ); + $('ul.submenu').css('left', '144px'); + }).mouseleave(function() { + handsInMenu = 0; + setTimeout(function() { + openedMenu = new Date().getTime() - openTimeMenu; + if(openedMenu > 1000 && handsInMenu == 0) { + $('#menu').css('width', '45px'); + $('li.menu_icon').removeClass( " no_hidden_menu"); + $('li.menu_icon').find('li').removeClass( " no_hidden_menu" ); + $('ul.submenu').css('left', '44px'); + $('div#title_menu').hide(); + } + }, 5500); + }); + }); + } } + /*$('#menu').mouseenter(function() { $('div#title_menu').show(); handsInMenu = 1; @@ -416,9 +435,76 @@ $(document).ready( function() { }); $(document).ready(function() { - //Daniel maya 02/06/2016 Display menu with click --INI - if(!click_display){ + if (!classic_menu) { + //Daniel maya 02/06/2016 Display menu with click --INI + if(!click_display){ + $('#container').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(); + $('#menu').css('width', '45px'); + $('li.menu_icon').removeClass( " no_hidden_menu"); + $('ul.submenu').css('left', '44px'); + $('div#title_menu').hide(); + }); + }else{ + $('#main').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(); + $('#menu').css('width', '45px'); + $('li.menu_icon').removeClass( " no_hidden_menu"); + $('ul.submenu').css('left', '44px'); + $('div#title_menu').hide(); + }); + } + //Daniel maya 02/06/2016 Display menu with click --END + } + else { $('#container').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(); + $('ul.submenu').css('left', '144px'); + }); + + $('#main').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(); + $('ul.submenu').css('left', '144px'); + }); + } + + if (classic_menu) { + $('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') + $("ul#sub"+table_hover2[0].id).hide(); + $('ul.submenu').css('left', '144px'); + }); + + $('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(); + $('ul.submenu').css('left', '144px'); + }); + } + else { + $('div.menu>ul>li>ul>li>a').click(function() { openTime = 4000; if( typeof(table_hover) != 'undefined') $("ul#sub"+table_hover[0].id).hide(); @@ -428,9 +514,9 @@ $(document).ready( function() { $('li.menu_icon').removeClass( " no_hidden_menu"); $('ul.submenu').css('left', '44px'); $('div#title_menu').hide(); - }); - }else{ - $('#main').click(function() { + }); + + $('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(); @@ -442,30 +528,6 @@ $(document).ready( function() { $('div#title_menu').hide(); }); } - //Daniel maya 02/06/2016 Display menu with click --END - - $('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') - $("ul#sub"+table_hover2[0].id).hide(); - $('#menu').css('width', '45px'); - $('li.menu_icon').removeClass( " no_hidden_menu"); - $('ul.submenu').css('left', '44px'); - $('div#title_menu').hide(); - }); - $('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(); - $('#menu').css('width', '45px'); - $('li.menu_icon').removeClass( " no_hidden_menu"); - $('ul.submenu').css('left', '44px'); - $('div#title_menu').hide(); - }); }); diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php index f518622353..9c34f9b501 100755 --- a/pandora_console/godmode/setup/setup_visuals.php +++ b/pandora_console/godmode/setup/setup_visuals.php @@ -122,6 +122,17 @@ if (enterprise_installed()) { $row++; } +$table_behaviour->data[$row][0] = __('Classic menu mode'). + ui_print_help_tip(__('Text menu options always visible, don\'t hide'), true); +$table_behaviour->data[$row][1] = __('Yes') . ' ' . + html_print_radio_button ('classic_menu', 1, '', + $config["classic_menu"], true) . + '  '; +$table_behaviour->data[$row][1] .= __('No') . ' ' . + html_print_radio_button ('classic_menu', 0, '', + $config["classic_menu"], true); +$row++; + echo "
"; echo "" . __('Behaviour configuration') . ""; html_print_table ($table_behaviour); diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 58ae2f2fa0..283f16801e 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -544,6 +544,8 @@ function config_update_config () { } if (!config_update_value ('percentil', (int) get_parameter('percentil', 0))) $error_update[] = __('Default percentil'); + if (!config_update_value ('classic_menu', (bool) get_parameter('classic_menu', false))) + $error_update[] = __('Classic menu mode'); //-------------------------------------------------- @@ -1561,6 +1563,10 @@ function config_process_config () { config_update_value ('service_item_padding_size', 80); } } + if (!isset($config["classic_menu"])) { + config_update_value ('classic_menu', 0); + } + if (!isset($config['command_snapshot'])) { config_update_value ('command_snapshot', 1); } diff --git a/pandora_console/index.php b/pandora_console/index.php index 0ce25349bc..9dff0107e6 100755 --- a/pandora_console/index.php +++ b/pandora_console/index.php @@ -685,11 +685,21 @@ if (get_parameter ('login', 0) !== 0) { // Header if ($config["pure"] == 0) { - echo '
'; + if ($config['classic_menu']) { + echo '
'; + echo '
'; + } + else { + echo '
'; + } } else { echo '
';