diff --git a/pandora_console/general/main_menu.php b/pandora_console/general/main_menu.php
index 27aa2f69bd..cb5126b621 100644
--- a/pandora_console/general/main_menu.php
+++ b/pandora_console/general/main_menu.php
@@ -16,16 +16,80 @@ if (! isset($config['id_user'])) {
exit();
}
+?>
+
+';
+echo '';
// menu_container
ui_require_jquery_file('cookie');
-$config_fixed_menu = false;
-if (isset($config['fixed_menu'])) {
- $config_fixed_menu = $config['fixed_menu'];
-}
-
$config_fixed_header = false;
if (isset($config['fixed_header'])) {
$config_fixed_header = $config['fixed_header'];
@@ -64,25 +126,35 @@ if (isset($config['fixed_header'])) {
@@ -348,182 +191,199 @@ $(document).ready( function() {
handsIn = 0;
handsIn2 = 0;
- if(!click_display){
- $('.menu_icon').mouseenter(function() {
+
+/**
+ * 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();
+ }
table_hover = $(this);
handsIn = 1;
openTime = new Date().getTime();
$("ul#sub"+table_hover[0].id).show();
- 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();
+ get_menu_items(table_hover);
}).mouseleave(function() {
table_noHover = $(this);
handsIn = 0;
setTimeout(function() {
opened = new Date().getTime() - openTime;
- if(opened > 3000 && handsIn == 0) {
- openTime = 4000;
- $("ul#sub"+table_hover[0].id).hide();
+ if(opened > 5000 && handsIn == 0) {
+ openTime = 6000;
+ $("ul#sub"+table_noHover[0].id).hide();
}
- }, 2500);
+ }, 5500);
});
+ } else {
+ $('.menu_icon').on("click", function() {
+ if( typeof(table_hover) != 'undefined'){
+ $("ul#sub"+table_hover[0].id).hide();
+ }
+ table_hover = $(this);
+ handsIn = 1;
+ openTime = new Date().getTime();
+ $("ul#sub"+table_hover[0].id).show();
+ get_menu_items(table_hover);
+ });
+ }
+ });
+}
+
+$('.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() {
+ 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();
+ });
}else{
- $(document).ready(function() {
- if (autohidden_menu) {
- $('.menu_icon').on("click", function() {
- if( typeof(table_hover) != 'undefined'){
- $("ul#sub"+table_hover[0].id).hide();
- }
- table_hover = $(this);
- handsIn = 1;
- openTime = new Date().getTime();
- $("ul#sub"+table_hover[0].id).show();
- }).mouseleave(function() {
- table_noHover = $(this);
- handsIn = 0;
- setTimeout(function() {
- opened = new Date().getTime() - openTime;
- if(opened > 5000 && handsIn == 0) {
- openTime = 6000;
- $("ul#sub"+table_hover[0].id).hide();
- }
- }, 5500);
- });
- } else {
- $('.menu_icon').on("click", function() {
- if( typeof(table_hover) != 'undefined'){
- $("ul#sub"+table_hover[0].id).hide();
- }
- table_hover = $(this);
- handsIn = 1;
- openTime = new Date().getTime();
- $("ul#sub"+table_hover[0].id).show();
- });
- }
+ $('#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();
});
}
-- $('.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 (!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 {
- 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', '145px');
- $('ul.submenu').css('left', '144px');
- });
- }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', '145px');
- $('ul.submenu').css('left', '144px');
- });
- }
- }
+
+ $('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();
+ });
- 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();
- 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();
- });
- }
+ $('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();
});
+});
-
diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php
index 85047cd488..f2042193fb 100755
--- a/pandora_console/godmode/setup/setup_visuals.php
+++ b/pandora_console/godmode/setup/setup_visuals.php
@@ -120,15 +120,6 @@ 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] = html_print_checkbox_switch(
- 'classic_menu',
- 1,
- $config['classic_menu'],
- true
-);
-$row++;
-
echo ' |