diff --git a/application/twigextension.class.inc.php b/application/twigextension.class.inc.php index 8a8cec26f..81dbec88e 100644 --- a/application/twigextension.class.inc.php +++ b/application/twigextension.class.inc.php @@ -6,7 +6,6 @@ use AttributeDate; use AttributeDateTime; use Dict; use Exception; -use MetaModel; use Twig_Environment; use Twig_SimpleFilter; use Twig_SimpleFunction; @@ -111,22 +110,6 @@ class TwigExtension return utils::IsDevelopmentEnvironment(); })); - // Function to get configuration parameter - // Usage in twig: {{ get_config_parameter('foo') }} - $oTwigEnv->addFunction(new Twig_SimpleFunction('get_config_parameter', function($sParamName) - { - $oConfig = MetaModel::GetConfig(); - return $oConfig->Get($sParamName); - })); - - // Function to get a module setting - // Usage in twig: {{ get_module_setting(, [, ]) }} - // since 3.0.0, but see N°4034 for upcoming evolutions in the 3.1 - $oTwigEnv->addFunction(new Twig_SimpleFunction('get_module_setting', function (string $sModuleCode, string $sPropertyCode, $defaultValue = null) { - $oConfig = MetaModel::GetConfig(); - return $oConfig->GetModuleSetting($sModuleCode, $sPropertyCode, $defaultValue); - })); - // Function to get the URL of a static page in a module // Usage in twig: {{ get_static_page_module_url('itop-my-module', 'path-to-my-page') }} $oTwigEnv->addFunction(new Twig_SimpleFunction('get_static_page_module_url', function($sModuleName, $sPage) diff --git a/datamodels/2.x/itop-portal-base/portal/config/bootstrap.php b/datamodels/2.x/itop-portal-base/portal/config/bootstrap.php index 2a64a5c79..39d58311b 100644 --- a/datamodels/2.x/itop-portal-base/portal/config/bootstrap.php +++ b/datamodels/2.x/itop-portal-base/portal/config/bootstrap.php @@ -157,6 +157,7 @@ if (!defined('PORTAL_ID')) // Env. vars to be used in templates and others $_ENV['COMBODO_CURRENT_ENVIRONMENT'] = utils::GetCurrentEnvironment(); $_ENV['COMBODO_ABSOLUTE_URL'] = utils::GetAbsoluteUrlAppRoot(); +$_ENV['COMBODO_CONF_APP_ICON_URL'] = MetaModel::GetConfig()->Get('app_icon_url'); $_ENV['COMBODO_MODULES_ABSOLUTE_URL'] = utils::GetAbsoluteUrlModulesRoot(); $_ENV['COMBODO_PORTAL_BASE_ABSOLUTE_URL'] = utils::GetAbsoluteUrlModulesRoot().'itop-portal-base/portal/public/'; $_ENV['COMBODO_PORTAL_BASE_ABSOLUTE_PATH'] = MODULESROOT.'/itop-portal-base/portal/public/'; diff --git a/datamodels/2.x/itop-portal-base/portal/config/services.yaml b/datamodels/2.x/itop-portal-base/portal/config/services.yaml index 249b6b42e..0aa428246 100644 --- a/datamodels/2.x/itop-portal-base/portal/config/services.yaml +++ b/datamodels/2.x/itop-portal-base/portal/config/services.yaml @@ -30,6 +30,7 @@ parameters: # Used in templates combodo.current_environment: '%env(string:COMBODO_CURRENT_ENVIRONMENT)%' combodo.absolute_url: '%env(string:COMBODO_ABSOLUTE_URL)%' + combodo.conf.app_icon_url: '%env(string:COMBODO_CONF_APP_ICON_URL)%' combodo.modules.absolute_url: '%env(string:COMBODO_MODULES_ABSOLUTE_URL)%' combodo.modules.absolute_path: !php/const MODULESROOT combodo.portal.base.absolute_url: '%env(string:COMBODO_PORTAL_BASE_ABSOLUTE_URL)%' diff --git a/datamodels/2.x/itop-portal-base/portal/src/Twig/AppExtension.php b/datamodels/2.x/itop-portal-base/portal/src/Twig/AppExtension.php index ef66b4398..6ad776794 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Twig/AppExtension.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Twig/AppExtension.php @@ -20,15 +20,13 @@ namespace Combodo\iTop\Portal\Twig; use AttributeDate; -use Twig\Extension\AbstractExtension; - use AttributeDateTime; use AttributeText; +use Dict; +use Twig\Extension\AbstractExtension; use Twig_SimpleFilter; use Twig_SimpleFunction; use utils; -use Dict; -use MetaModel; /** * Class AppExtension @@ -186,28 +184,6 @@ class AppExtension extends AbstractExtension return utils::IsDevelopmentEnvironment(); }); - // Function to get configuration parameter - // Usage in twig: {{ get_config_parameter('foo') }} - $functions[] = new Twig_SimpleFunction('get_config_parameter', function ($sParamName) { - $oConfig = MetaModel::GetConfig(); - - return $oConfig->Get($sParamName); - }); - - /** - * Function to get a module setting - * Usage in twig: {{ get_module_setting(, [, ]) }} - * - * @uses Config::GetModuleSetting() - * @since 3.0.0 - */ - $functions[] = new Twig_SimpleFunction('get_module_setting', - function (string $sModuleCode, string $sPropertyCode, $defaultValue = null) { - $oConfig = MetaModel::GetConfig(); - - return $oConfig->GetModuleSetting($sModuleCode, $sPropertyCode, $defaultValue); - }); - /** * Function to get iTop's app root absolute URL (eg. https://aaa.bbb.ccc/xxx/yyy/) * Usage in twig: {{ get_absolute_url_app_root() }} diff --git a/datamodels/2.x/itop-portal-base/portal/templates/layout.html.twig b/datamodels/2.x/itop-portal-base/portal/templates/layout.html.twig index 506dbb465..885b7cea5 100644 --- a/datamodels/2.x/itop-portal-base/portal/templates/layout.html.twig +++ b/datamodels/2.x/itop-portal-base/portal/templates/layout.html.twig @@ -186,7 +186,7 @@ {% block pNavigationTopMenuLogo %} - + {% if app['combodo.portal.instance.conf'].properties.logo is not null %} {{ app['combodo.portal.instance.conf'].properties.name|dict_s }} {% else %} @@ -314,7 +314,7 @@ {% if app['kernel'].debug == true %}
Debug : Taille
{% endif %} -
+ {{ app['combodo.portal.instance.conf'].properties.name|dict_s }} {% endblock %} diff --git a/sources/application/TwigBase/Twig/Extension.php b/sources/application/TwigBase/Twig/Extension.php index 65d4a1005..c1632003c 100644 --- a/sources/application/TwigBase/Twig/Extension.php +++ b/sources/application/TwigBase/Twig/Extension.php @@ -14,7 +14,6 @@ use Combodo\iTop\Application\UI\Base\iUIBlock; use Combodo\iTop\Renderer\BlockRenderer; use Dict; use Exception; -use MetaModel; use Twig_Environment; use Twig_SimpleFilter; use Twig_SimpleFunction; @@ -143,28 +142,6 @@ class Extension return utils::IsDevelopmentEnvironment(); })); - // Function to get configuration parameter - // Usage in twig: {{ get_config_parameter('foo') }} - $oTwigEnv->addFunction(new Twig_SimpleFunction('get_config_parameter', function ($sParamName) { - $oConfig = MetaModel::GetConfig(); - - return $oConfig->Get($sParamName); - })); - - /** - * Function to get a module setting - * Usage in twig: {{ get_module_setting(, [, ]) }} - * - * @uses Config::GetModuleSetting() - * @since 3.0.0 - */ - $oTwigEnv->addFunction(new Twig_SimpleFunction('get_module_setting', - function (string $sModuleCode, string $sPropertyCode, $defaultValue = null) { - $oConfig = MetaModel::GetConfig(); - - return $oConfig->GetModuleSetting($sModuleCode, $sPropertyCode, $defaultValue); - })); - // Function to get iTop's app root absolute URL (eg. https://aaa.bbb.ccc/xxx/yyy/) // Usage in twig: {{ get_absolute_url_app_root() }} /** @since 3.0.0 */ diff --git a/sources/application/UI/Base/Layout/ActivityPanel/ActivityEntry/ActivityEntry.php b/sources/application/UI/Base/Layout/ActivityPanel/ActivityEntry/ActivityEntry.php index a4c917ffa..794914318 100644 --- a/sources/application/UI/Base/Layout/ActivityPanel/ActivityEntry/ActivityEntry.php +++ b/sources/application/UI/Base/Layout/ActivityPanel/ActivityEntry/ActivityEntry.php @@ -24,6 +24,7 @@ use AttributeDateTime; use Combodo\iTop\Application\UI\Base\UIBlock; use Combodo\iTop\Core\CMDBChange\CMDBChangeOrigin; use DateTime; +use MetaModel; use UserRights; use utils; @@ -74,6 +75,8 @@ class ActivityEntry extends UIBlock */ protected $sOrigin; + protected $bShowAuthorNameBelowEntries; + /** * ActivityEntry constructor. * @@ -94,6 +97,7 @@ class ActivityEntry extends UIBlock $this->SetDateTime($oDateTime); $this->SetAuthor($sAuthorLogin); $this->SetOrigin(static::DEFAULT_ORIGIN); + $this->SetShowAuthorNameBelowEntries(MetaModel::GetConfig()->Get('activity_panel.show_author_name_below_entries')); } /** @@ -306,6 +310,22 @@ class ActivityEntry extends UIBlock return $this->sOrigin; } + /** + * @return mixed + */ + public function ShowAuthorNameBelowEntries(): bool + { + return $this->bShowAuthorNameBelowEntries; + } + + /** + * @param bool $bShowAuthorNameBelowEntries + */ + public function SetShowAuthorNameBelowEntries($bShowAuthorNameBelowEntries): void + { + $this->bShowAuthorNameBelowEntries = $bShowAuthorNameBelowEntries; + } + /** * @return string|null The CSS decoration classes for the origin of the entry * @see \CMDBChangeOrigin diff --git a/sources/application/UI/Base/Layout/ActivityPanel/ActivityPanel.php b/sources/application/UI/Base/Layout/ActivityPanel/ActivityPanel.php index aabe1b1e7..d7f67a348 100644 --- a/sources/application/UI/Base/Layout/ActivityPanel/ActivityPanel.php +++ b/sources/application/UI/Base/Layout/ActivityPanel/ActivityPanel.php @@ -90,6 +90,17 @@ class ActivityPanel extends UIBlock protected $oComposeMenu; /** @var bool Whether a confirmation dialog should be prompt when multiple entries are about to be submitted at once */ protected $bShowMultipleEntriesSubmitConfirmation; + /** @var int */ + protected $iDatetimesReformatLimit; + /** @var int */ + protected $iLockWatcherPeriod; + /** @var bool */ + protected $bPrefilterOnlyCurrentLog; + /** @var bool */ + protected $bPrefilterStateChangesOnLogs; + /** @var bool */ + protected $bPrefilterEditsOnLogs; + /** * ActivityPanel constructor. @@ -105,12 +116,18 @@ class ActivityPanel extends UIBlock { parent::__construct($sId); + $oConfig = MetaModel::GetConfig(); $this->InitializeCaseLogTabs(); $this->InitializeCaseLogTabsEntryForms(); $this->InitializeComposeMenu(); $this->SetObjectMode(cmdbAbstractObject::DEFAULT_DISPLAY_MODE); $this->SetObject($oObject); $this->SetEntries($aEntries); + $this->SetDatetimesReformatLimit($oConfig->Get('activity_panel.datetimes_reformat_limit')); + $this->SetLockWatcherPeriod($oConfig->Get('activity_panel.lock_watcher_period')); + $this->SetPrefilterOnlyCurrentLog($oConfig->Get('activity_panel.prefilter_only_current_log')); + $this->SetPrefilterStateChangesOnLogs($oConfig->Get('activity_panel.prefilter_state_changes_on_logs')); + $this->SetPrefilterEditsOnLogs($oConfig->Get('activity_panel.prefilter_edits_on_logs')); $this->bAreEntriesSorted = false; $this->bHasMoreEntriesToLoad = false; $this->aLastLoadedEntriesIds = []; @@ -846,6 +863,86 @@ class ActivityPanel extends UIBlock return utils::GetAbsoluteUrlAppRoot().'pages/ajax.render.php'; } + /** + * @return int + */ + public function GetDatetimesReformatLimit(): int + { + return $this->iDatetimesReformatLimit; + } + + /** + * @param int $iDatetimesReformatLimit + */ + public function SetDatetimesReformatLimit(int $iDatetimesReformatLimit): void + { + $this->iDatetimesReformatLimit = $iDatetimesReformatLimit; + } + + /** + * @return int + */ + public function GetLockWatcherPeriod(): int + { + return $this->iLockWatcherPeriod; + } + + /** + * @param int $iLockWatcherPeriod + */ + public function SetLockWatcherPeriod(int $iLockWatcherPeriod): void + { + $this->iLockWatcherPeriod = $iLockWatcherPeriod; + } + + /** + * @return bool + */ + public function GetPrefilterOnlyCurrentLog(): bool + { + return $this->bPrefilterOnlyCurrentLog; + } + + /** + * @param bool $bPrefilterOnlyCurrentLog + */ + public function SetPrefilterOnlyCurrentLog(bool $bPrefilterOnlyCurrentLog): void + { + $this->bPrefilterOnlyCurrentLog = $bPrefilterOnlyCurrentLog; + } + + /** + * @return bool + */ + public function GetPrefilterStateChangesOnLogs(): bool + { + return $this->bPrefilterStateChangesOnLogs; + } + + /** + * @param bool $bPrefilterStateChangesOnLogs + */ + public function SetPrefilterStateChangesOnLogs(bool $bPrefilterStateChangesOnLogs): void + { + $this->bPrefilterStateChangesOnLogs = $bPrefilterStateChangesOnLogs; + } + + /** + * @return bool + */ + public function GetPrefilterEditsOnLogs(): bool + { + return $this->bPrefilterEditsOnLogs; + } + + /** + * @param bool $bPrefilterEditsOnLogs + */ + public function SetPrefilterEditsOnLogs(bool $bPrefilterEditsOnLogs): void + { + $this->bPrefilterEditsOnLogs = $bPrefilterEditsOnLogs; + } + /** * @inheritdoc */ diff --git a/sources/application/UI/Base/Layout/NavigationMenu/NavigationMenu.php b/sources/application/UI/Base/Layout/NavigationMenu/NavigationMenu.php index 6229d755c..f5d1deaad 100644 --- a/sources/application/UI/Base/Layout/NavigationMenu/NavigationMenu.php +++ b/sources/application/UI/Base/Layout/NavigationMenu/NavigationMenu.php @@ -86,6 +86,9 @@ class NavigationMenu extends UIBlock implements iKeyboardShortcut protected $bIsExpanded; /** @var bool Whether the hint on how the menu filter works shoudl be displayed or not */ protected $bShowMenuFilterHint; + /** @var bool */ + protected $bShowMenusCount; + /** * NavigationMenu constructor. @@ -106,10 +109,13 @@ class NavigationMenu extends UIBlock implements iKeyboardShortcut ) { parent::__construct($sId); + $oConfig = MetaModel::GetConfig(); + $this->sAppRevisionNumber = utils::GetAppRevisionNumber(); $this->sAppSquareIconUrl = Branding::GetCompactMainLogoAbsoluteUrl(); $this->sAppFullIconUrl = Branding::GetFullMainLogoAbsoluteUrl(); - $this->sAppIconLink = MetaModel::GetConfig()->Get('app_icon_url'); + $this->sAppIconLink = $oConfig->Get('app_icon_url'); + $this->SetShowMenusCount($oConfig->Get('navigation_menu.show_menus_count')); $this->aSiloSelection = array(); $this->aMenuGroups = ApplicationMenu::GetMenuGroups($oAppContext->GetAsHash()); $this->oUserMenu = $oUserMenu; @@ -479,4 +485,21 @@ JS; { return "[data-role='".static::BLOCK_CODE."']"; } + + /** + * @return bool + */ + public function GetShowMenusCount(): bool + { + return $this->bShowMenusCount; + } + + /** + * @param bool $bShowMenusCount + */ + public function SetShowMenusCount(bool $bShowMenusCount): void + { + $this->bShowMenusCount = $bShowMenusCount; + } + } \ No newline at end of file diff --git a/templates/base/layouts/activity-panel/activity-entry/layout.html.twig b/templates/base/layouts/activity-panel/activity-entry/layout.html.twig index d7fa10811..a302cabca 100644 --- a/templates/base/layouts/activity-panel/activity-entry/layout.html.twig +++ b/templates/base/layouts/activity-panel/activity-entry/layout.html.twig @@ -39,7 +39,7 @@ {% endif %} - {% if get_config_parameter('activity_panel.show_author_name_below_entries') %} + {% if oUIBlock.ShowAuthorNameBelowEntries() %} {% endif %}