N°5620 - Hide the organization filter with a conf parameter

This commit is contained in:
odain
2022-11-15 09:49:36 +01:00
parent 40e24c25a2
commit ac7309e48c
2 changed files with 19 additions and 6 deletions

View File

@@ -333,6 +333,14 @@ class Config
'source_of_value' => '', 'source_of_value' => '',
'show_in_conf_sample' => false, 'show_in_conf_sample' => false,
], ],
'allow_menu_organization_filter' => [
'type' => 'bool',
'description' => 'Display organization filter in menu',
'default' => true,
'value' => true,
'source_of_value' => '',
'show_in_conf_sample' => false,
],
'allow_target_creation' => [ 'allow_target_creation' => [
'type' => 'bool', 'type' => 'bool',
'description' => 'Displays the + button on external keys to create target objects', 'description' => 'Displays the + button on external keys to create target objects',
@@ -1861,7 +1869,7 @@ class Config
} }
if (strlen($sNoise) > 0) 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', throw new ConfigException('Syntax error in configuration file',
array('file' => $sConfigFile, 'error' => '<tt>'.htmlentities($sNoise, ENT_QUOTES, 'UTF-8').'</tt>')); array('file' => $sConfigFile, 'error' => '<tt>'.htmlentities($sNoise, ENT_QUOTES, 'UTF-8').'</tt>'));
} }
@@ -2671,7 +2679,7 @@ class ConfigPlaceholdersResolver
} }
$sPattern = '/\%(env|server)\((\w+)\)(?:\?:(\w*))?\%/'; //3 capturing groups, ie `%env(HTTP_PORT)?:8080%` produce: `env` `HTTP_PORT` and `8080`. $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)) if (! preg_match_all($sPattern, $rawValue, $aMatchesCollection, PREG_SET_ORDER))
{ {
return $rawValue; return $rawValue;

View File

@@ -196,7 +196,7 @@ class NavigationMenu extends UIBlock implements iKeyboardShortcut
} }
return ''; return '';
} }
/** /**
* @return array * @return array
*/ */
@@ -301,6 +301,11 @@ class NavigationMenu extends UIBlock implements iKeyboardShortcut
$this->bHasSiloSelected = false; $this->bHasSiloSelected = false;
$this->sSiloLabel = null; $this->sSiloLabel = null;
\IssueLog::Info("test allow_menu_organization_filter", null, ['allow_menu_organization_filter' => MetaModel::GetConfig()->Get('allow_menu_organization_filter')]);
if (! MetaModel::GetConfig()->Get('allow_menu_organization_filter')){
return;
}
//TODO 3.0 Use components if we have the time to build select/autocomplete components before release //TODO 3.0 Use components if we have the time to build select/autocomplete components before release
// List of visible Organizations // List of visible Organizations
$iCount = 0; $iCount = 0;
@@ -343,7 +348,7 @@ class NavigationMenu extends UIBlock implements iKeyboardShortcut
$this->aSiloSelection['html'] = '<form data-role="ibo-navigation-menu--silo-selection--form" action="'.utils::GetAbsoluteUrlAppRoot().'pages/UI.php">'; //<select class="org_combo" name="c[org_id]" title="Pick an organization" onChange="this.form.submit();">'; $this->aSiloSelection['html'] = '<form data-role="ibo-navigation-menu--silo-selection--form" action="'.utils::GetAbsoluteUrlAppRoot().'pages/UI.php">'; //<select class="org_combo" name="c[org_id]" title="Pick an organization" onChange="this.form.submit();">';
$oPage = new \CaptureWebPage(); $oPage = new \CaptureWebPage();
$oWidget = new UIExtKeyWidget('Organization', 'org_id', '', true /* search mode */); $oWidget = new UIExtKeyWidget('Organization', 'org_id', '', true /* search mode */);
$iMaxComboLength = MetaModel::GetConfig()->Get('max_combo_length'); $iMaxComboLength = MetaModel::GetConfig()->Get('max_combo_length');
$this->aSiloSelection['html'] .= $oWidget->DisplaySelect($oPage, $iMaxComboLength, false, Dict::S('UI:Layout:NavigationMenu:Silo:Label'), $oSet, $iCurrentOrganization, false, 'c[org_id]', '', $this->aSiloSelection['html'] .= $oWidget->DisplaySelect($oPage, $iMaxComboLength, false, Dict::S('UI:Layout:NavigationMenu:Silo:Label'), $oSet, $iCurrentOrganization, false, 'c[org_id]', '',
@@ -376,7 +381,7 @@ $sAddClearButton
JS; JS;
} }
} }
/** /**
* Compute if the menu is expanded or collapsed * Compute if the menu is expanded or collapsed
* *
@@ -479,4 +484,4 @@ JS;
{ {
return "[data-role='".static::BLOCK_CODE."']"; return "[data-role='".static::BLOCK_CODE."']";
} }
} }