Merge branch 'ent-3754-Ajustes-menú-lateral' into 'develop'

Ent 3754 ajustes menú lateral

See merge request artica/pandorafms!2291

Former-commit-id: 2cfa456d9e49aa262f08c690426bcbabb180392b
This commit is contained in:
Daniel Rodriguez 2019-03-26 09:42:29 +01:00
commit 5b0555e7cb
4 changed files with 67 additions and 30 deletions

View File

@ -18,10 +18,13 @@ require_once 'include/functions_notifications.php';
// Global errors/warnings checking.
config_check();
?>
<div id="header_table">
<div id="header_table_inner">
if ($_SESSION['menu_type']=='classic')
echo '<div id="header_table" class="header_table_classic">';
else
echo '<div id="header_table" class="header_table_collapsed">';
?>
<div id="header_table_inner">
<?php
// ======= Notifications Discovery ===============================================
$notifications_numbers = notifications_get_counters();

View File

@ -20,31 +20,15 @@ if (! isset($config['id_user'])) {
<script type="text/javascript" language="javascript">
$(document).ready(function(){
var menuType_value = localStorage.getItem("menuType");
var menuType_value = localStorage.getItem("menuType");
if (menuType_value == 'classic') {
$('#menu_full').removeClass('menu_full_collapsed').addClass('menu_full_classic');
$('.logo_icon').css('display','none');
$('.logo_full').css('display','block');
$('div#title_menu').removeClass('title_menu_collapsed').addClass('title_menu_classic');
$('div#page').removeClass('page_collapsed').addClass('page_classic');
$('#header_table').removeClass('header_table_collapsed').addClass('header_table_classic');
$('#button_collapse').removeClass('button_collapsed').addClass('button_classic');
$('ul.submenu').css('left', '214px');
$('li.menu_icon').removeClass('menu_icon_collapsed').addClass("no_hidden_menu");
}
else{
if(menuType_value != 'collapsed'){
localStorage.setItem("menuType", "collapsed");
}
$('#menu_full').removeClass('menu_full_classic').addClass('menu_full_collapsed');
$('.logo_full').css('display','none');
$('.logo_icon').css('display','block');
$('div#title_menu').removeClass('title_menu_classic').addClass('title_menu_collapsed');
$('div#page').removeClass('page_classic').addClass('page_collapsed');
$('#header_table').removeClass('header_table_classic').addClass('header_table_collapsed');
$('#button_collapse').removeClass('button_classic').addClass('button_collapsed');
}
$('ul.submenu').css('left', '59px');
$('li.menu_icon').removeClass("no_hidden_menu").addClass('menu_icon_collapsed');
}
});
@ -63,14 +47,18 @@ if (isset($config['autohidden_menu']) && $config['autohidden_menu']) {
}
// Menu container prepared to autohide menu
echo '<div id="menu_full">';
if ($_SESSION['menu_type']=='classic')
echo '<div id="menu_full" class="menu_full_classic">';
else
echo '<div id="menu_full" class="menu_full_collapsed">';
$custom_logo = 'images/custom_logo/'.$config['custom_logo'];
$custom_logo_collapsed = 'images/custom_logo/'.$config['custom_logo_collapsed'];
if (!defined('PANDORA_ENTERPRISE')) {
$logo_title = get_product_name().' Opensource';
$custom_logo = 'images/custom_logo/pandora_logo_head_3.png';
$custom_logo = 'images/custom_logo/pandora_logo_head_green.png';
$custom_logo_collapsed = 'images/custom_logo/pandora_logo_green_collapsed.png';
} else {
if (file_exists(ENTERPRISE_DIR.'/'.$custom_logo)) {
@ -82,11 +70,17 @@ if (!defined('PANDORA_ENTERPRISE')) {
echo '<div class="logo_green"><a href="index.php?sec=main">';
if (isset($config['custom_logo'])) {
echo html_print_image($custom_logo, true, ['border' => '0', 'width' => '215', 'alt' => $logo_title, 'class' => 'logo_full', 'style' => 'display:none']);
if ($_SESSION['menu_type']=='classic')
echo html_print_image($custom_logo, true, ['border' => '0', 'width' => '215', 'alt' => $logo_title, 'class' => 'logo_full', 'style' => 'display:block']);
else
echo html_print_image($custom_logo, true, ['border' => '0', 'width' => '215', 'alt' => $logo_title, 'class' => 'logo_full', 'style' => 'display:none']);
}
if (isset($config['custom_logo_collapsed'])) {
echo html_print_image($custom_logo_collapsed, true, ['border' => '0', 'width' => '60', 'alt' => $logo_title, 'class' => 'logo_icon', 'style' => 'display:block']);
if ($_SESSION['menu_type']=='classic')
echo html_print_image($custom_logo_collapsed, true, ['border' => '0', 'width' => '60', 'alt' => $logo_title, 'class' => 'logo_icon', 'style' => 'display:none']);
else
echo html_print_image($custom_logo_collapsed, true, ['border' => '0', 'width' => '60', 'alt' => $logo_title, 'class' => 'logo_icon', 'style' => 'display:block']);
}
echo '</a></div>';
@ -109,8 +103,10 @@ if (check_acl($config['id_user'], 0, 'AW')
require 'godmode/menu.php';
echo '<div id="button_collapse" class="button_collapse"></div>';
if ($_SESSION['menu_type']=='classic')
echo '<div id="button_collapse" class="button_classic button_collapse"></div>';
else
echo '<div id="button_collapse" class="button_collapsed button_collapse"></div>';
// require ("links_menu.php");
echo '</div>';
@ -131,10 +127,30 @@ $('#button_collapse').on('click', function() {
if($('#menu_full').hasClass('menu_full_classic')){
localStorage.setItem("menuType", "collapsed");
$('ul.submenu').css('left', '59px');
var menuType_val = localStorage.getItem("menuType");
$.ajax({
type: "POST",
url: "ajax.php",
data: {
menuType: menuType_val,
page: "include/functions_menu"
},
dataType: "json"
});
}
else if($('#menu_full').hasClass('menu_full_collapsed')){
localStorage.setItem("menuType", "classic");
$('ul.submenu').css('left', '214px');
var menuType_val = localStorage.getItem("menuType");
$.ajax({
type: "POST",
url: "ajax.php",
data: {
menuType: menuType_val,
page: "include/functions_menu"
},
dataType: "json"
});
}
$('.logo_full').toggle();

View File

@ -18,6 +18,10 @@
*/
// Set session variable to store menu type (classic or collapsed) within this session
if (!empty(get_parameter('menuType')))
$_SESSION['menu_type'] = get_parameter('menuType', 'collapsed');
/**
* Prints a complete menu structure.
*
@ -75,7 +79,12 @@ function menu_print_menu(&$menu)
}
$submenu = false;
$classes = ['menu_icon'];
if ($_SESSION['menu_type']=='classic')
$classes = ['menu_icon', 'no_hidden_menu'];
else
$classes = ['menu_icon', 'menu_icon_collapsed'];
if (isset($main['sub'])) {
$classes[] = '';
$submenu = true;
@ -374,7 +383,11 @@ function menu_print_menu(&$menu)
$length = strlen(__($main['text']));
$padding_top = ( $length >= 18) ? 6 : 12;
$output .= '<div id="title_menu" style="padding-top:'.$padding_top.'px; display:none;">'.$main['text'].'</div>';
if ($_SESSION['menu_type']=='classic')
$output .= '<div id="title_menu" class="title_menu_classic" style="padding-top:'.$padding_top.'px; display:none;">'.$main['text'].'</div>';
else
$output .= '<div id="title_menu" class="title_menu_collapsed" style="padding-top:'.$padding_top.'px; display:none;">'.$main['text'].'</div>';
// Add the notification ball if defined
if (isset($main['notification'])) {
$output .= '<div class="notification_ball">'.$main['notification'].'</div>';

View File

@ -1025,7 +1025,12 @@ if (get_parameter('login', 0) !== 0) {
if ($config['pure'] == 0) {
echo '<div id="container"><div id="head">';
include 'general/header.php';
echo '</div><div id="page"><div id="menu">';
if ($_SESSION['menu_type']=='classic')
echo '</div><div id="page" class="page_classic"><div id="menu">';
else
echo '</div><div id="page" class="page_collapsed"><div id="menu">';
include 'general/main_menu.php';
echo '</div>';
echo '<button onclick="topFunction()" id="top_btn" title="Go to top"></button>';