diff --git a/core/config.class.inc.php b/core/config.class.inc.php index 414d15909..110675028 100644 --- a/core/config.class.inc.php +++ b/core/config.class.inc.php @@ -1254,6 +1254,14 @@ class Config 'source_of_value' => '', 'show_in_conf_sample' => false, ], + 'navigation_menu.show_organization_filter' => [ + 'type' => 'bool', + 'description' => 'Display organization filter in menu', + 'default' => true, + 'value' => true, + 'source_of_value' => '', + 'show_in_conf_sample' => false, + ], 'quick_create.enabled' => [ 'type' => 'bool', 'description' => 'Whether or not the quick create is enabled', @@ -1885,7 +1893,7 @@ class Config } if (strlen($sNoise) > 0) { - // Note: sNoise is an html output, but so far it was ok for me (e.g. showing the entire call stack) + // Note: sNoise is an html output, but so far it was ok for me (e.g. showing the entire call stack) throw new ConfigException('Syntax error in configuration file', array('file' => $sConfigFile, 'error' => ''.utils::EscapeHtml($sNoise, ENT_QUOTES).'')); } @@ -2695,7 +2703,7 @@ class ConfigPlaceholdersResolver } $sPattern = '/\%(env|server)\((\w+)\)(?:\?:(\w*))?\%/'; //3 capturing groups, ie `%env(HTTP_PORT)?:8080%` produce: `env` `HTTP_PORT` and `8080`. - + if (! preg_match_all($sPattern, $rawValue, $aMatchesCollection, PREG_SET_ORDER)) { return $rawValue; diff --git a/sources/Application/UI/Base/Layout/NavigationMenu/NavigationMenu.php b/sources/Application/UI/Base/Layout/NavigationMenu/NavigationMenu.php index 6229d755c..6dd7b91d6 100644 --- a/sources/Application/UI/Base/Layout/NavigationMenu/NavigationMenu.php +++ b/sources/Application/UI/Base/Layout/NavigationMenu/NavigationMenu.php @@ -19,7 +19,6 @@ namespace Combodo\iTop\Application\UI\Base\Layout\NavigationMenu; - use ApplicationContext; use ApplicationMenu; use appUserPreferences; @@ -196,7 +195,7 @@ class NavigationMenu extends UIBlock implements iKeyboardShortcut } return ''; } - + /** * @return array */ @@ -290,6 +289,14 @@ class NavigationMenu extends UIBlock implements iKeyboardShortcut } } + /** + * @return True if the silo selection is enabled, false otherwise + * @since 3.1.0 + */ + public function IsSiloSelectionEnabled() : bool { + return MetaModel::GetConfig()->Get('navigation_menu.show_organization_filter'); + } + /** * @return void * @throws \CoreException @@ -301,6 +308,10 @@ class NavigationMenu extends UIBlock implements iKeyboardShortcut $this->bHasSiloSelected = false; $this->sSiloLabel = null; + if (! $this->IsSiloSelectionEnabled()){ + return; + } + //TODO 3.0 Use components if we have the time to build select/autocomplete components before release // List of visible Organizations $iCount = 0; @@ -343,7 +354,7 @@ class NavigationMenu extends UIBlock implements iKeyboardShortcut $this->aSiloSelection['html'] = '