diff --git a/js/layouts/navigation-menu.js b/js/layouts/navigation-menu.js index fabb4a775..b1150388e 100644 --- a/js/layouts/navigation-menu.js +++ b/js/layouts/navigation-menu.js @@ -115,8 +115,8 @@ $(function() this.element.toggleClass(this.css_classes.menu_expanded); // Save state in user preferences - const sPrefValue = this.element.hasClass(this.css_classes.menu_expanded) ? 'opened' : 'closed'; - SetUserPreference('menu_pane', sPrefValue, true); + const sPrefValue = this.element.hasClass(this.css_classes.menu_expanded) ? 'expanded' : 'collapsed'; + SetUserPreference('navigation_menu.expanded', sPrefValue, true); }, _onMenuGroupClick: function(oEvent, oMenuGroupElem) { @@ -192,7 +192,7 @@ $(function() this.element.find(this.js_selectors.menu_filter_hint).hide(); // Save state in user preferences - SetUserPreference('navigation_menu_filter_hint', false, true); + SetUserPreference('navigation_menu.show_filter_hint', false, true); }, _onUserMenuTogglerClick: function(oEvent) diff --git a/pages/ajax.render.php b/pages/ajax.render.php index a3a885c14..9d40bd4b6 100644 --- a/pages/ajax.render.php +++ b/pages/ajax.render.php @@ -824,7 +824,7 @@ try break; case 'set_pref': - $sCode = utils::ReadPostedParam('code', ''); + $sCode = utils::ReadPostedParam('code', '', 'raw_data'); $sValue = utils::ReadPostedParam('value', '', 'raw_data'); appUserPreferences::SetPref($sCode, $sValue); break; diff --git a/sources/application/UI/Base/Layout/NavigationMenu/NavigationMenu.php b/sources/application/UI/Base/Layout/NavigationMenu/NavigationMenu.php index 2cbc311d3..cd0f6c182 100644 --- a/sources/application/UI/Base/Layout/NavigationMenu/NavigationMenu.php +++ b/sources/application/UI/Base/Layout/NavigationMenu/NavigationMenu.php @@ -376,13 +376,20 @@ JS; // Check if menu should be opened only if we re not in demo mode if (false === MetaModel::GetConfig()->Get('demo_mode')) { + // Force state if necessary... if (utils::ReadParam('force_menu_pane', null) === 0) { $bIsExpanded = false; } - elseif (appUserPreferences::GetPref('menu_pane', 'closed') === 'opened') + // ... otherwise look for the new user pref ... + elseif (appUserPreferences::GetPref('navigation_menu.expanded', null) !== null) { - $bIsExpanded = true; + $bIsExpanded = appUserPreferences::GetPref('navigation_menu.expanded', null) === 'expanded'; + } + // ... or fallback on the old one + elseif (appUserPreferences::GetPref('menu_pane', null) !== null) + { + $bIsExpanded = appUserPreferences::GetPref('menu_pane', null) === 'opened'; } } @@ -402,7 +409,7 @@ JS; */ protected function ComputeMenuFilterHintState(): void { - $this->bShowMenuFilterHint = (true === appUserPreferences::GetPref('navigation_menu_filter_hint', static::DEFAULT_SHOW_MENU_FILTER_HINT)); + $this->bShowMenuFilterHint = (true === appUserPreferences::GetPref('navigation_menu.show_filter_hint', static::DEFAULT_SHOW_MENU_FILTER_HINT)); } /**