Added new option to see the menu bar in classic mode. Ticket #234

This commit is contained in:
Arturo Gonzalez 2017-02-07 12:58:29 +01:00
parent 559d7ca217
commit cafda2a116
4 changed files with 148 additions and 59 deletions

View File

@ -75,6 +75,11 @@ var id_user = "<?php echo $config['id_user']; ?>";
var cookie_name = id_user + '-pandora_menu_state';
var cookie_name_encoded = btoa(cookie_name);
var click_display = "<?php echo $config["click_display"]; ?>";
var classic_menu = "<?php echo $config["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();
});
});

View File

@ -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') . '&nbsp;' .
html_print_radio_button ('classic_menu', 1, '',
$config["classic_menu"], true) .
'&nbsp;&nbsp;';
$table_behaviour->data[$row][1] .= __('No') . '&nbsp;' .
html_print_radio_button ('classic_menu', 0, '',
$config["classic_menu"], true);
$row++;
echo "<fieldset>";
echo "<legend>" . __('Behaviour configuration') . "</legend>";
html_print_table ($table_behaviour);

View File

@ -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);
}

View File

@ -685,11 +685,21 @@ if (get_parameter ('login', 0) !== 0) {
// Header
if ($config["pure"] == 0) {
echo '<div id="container"><div id="head">';
require ("general/header.php");
echo '</div><div id="page"><div id="menu">';
require ("general/main_menu.php");
echo '</div>';
if ($config['classic_menu']) {
echo '<div id="container"><div id="head">';
require ("general/header.php");
echo '</div><div id="menu">';
require ("general/main_menu.php");
echo '</div>';
echo '<div style="padding-left:100px;" id="page">';
}
else {
echo '<div id="container"><div id="head">';
require ("general/header.php");
echo '</div><div id="page"><div id="menu">';
require ("general/main_menu.php");
echo '</div>';
}
}
else {
echo '<div id="main_pure">';