diff --git a/datamodels/2.x/itop-portal-base/portal/src/helpers/applicationhelper.class.inc.php b/datamodels/2.x/itop-portal-base/portal/src/helpers/applicationhelper.class.inc.php index 00b06272f..0da1a2bb9 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/helpers/applicationhelper.class.inc.php +++ b/datamodels/2.x/itop-portal-base/portal/src/helpers/applicationhelper.class.inc.php @@ -202,6 +202,7 @@ class ApplicationHelper return Dict::S($sStringCode, $sDefault, $bUserLanguageOnly); }) ); + // A filter to format a string via the Dict::Format function // Usage in twig : {{ 'String:ToTranslate'|dict_format() }} $oApp['twig']->addFilter(new Twig_SimpleFilter('dict_format', function($sStringCode, $sParam01 = null, $sParam02 = null, $sParam03 = null, $sParam04 = null) @@ -209,10 +210,12 @@ class ApplicationHelper return Dict::Format($sStringCode, $sParam01, $sParam02, $sParam03, $sParam04); }) ); + // Filters to enable base64 encode/decode // Usage in twig : {{ 'String to encode'|base64_encode }} $oApp['twig']->addFilter(new Twig_SimpleFilter('base64_encode', 'base64_encode')); $oApp['twig']->addFilter(new Twig_SimpleFilter('base64_decode', 'base64_decode')); + // Filters to enable json decode (encode already exists) // Usage in twig : {{ aSomeArray|json_decode }} $oApp['twig']->addFilter(new Twig_SimpleFilter('json_decode', function($sJsonString, $bAssoc = false) @@ -220,6 +223,21 @@ class ApplicationHelper return json_decode($sJsonString, $bAssoc); }) ); + + // Filter to add itopversion to an url + $oApp['twig']->addFilter(new Twig_SimpleFilter('add_itop_version', function($sUrl) + { + if (strpos($sUrl, '?') === false) + { + $sUrl = $sUrl . "?itopversion=" . ITOP_VERSION; + } + else + { + $sUrl = $sUrl . "&itopversion=" . ITOP_VERSION; + } + + return $sUrl; + })); } /** diff --git a/datamodels/2.x/itop-portal-base/portal/src/views/layout.html.twig b/datamodels/2.x/itop-portal-base/portal/src/views/layout.html.twig index 937c0d71b..22dcb3a94 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/views/layout.html.twig +++ b/datamodels/2.x/itop-portal-base/portal/src/views/layout.html.twig @@ -23,83 +23,83 @@ {% block pPageExtraMetas %} {% endblock %} {% block pPageTitle %}{% if sPageTitle is defined and sPageTitle is not null %}{{ sPageTitle }} - {{ constant('ITOP_APPLICATION') }}{% else %}{{ 'Page:DefaultTitle'|dict_s }}{% endif %}{% endblock %} - + {% block pPageStylesheets %} {# First bootstrap core, lib themes, then bootstrap theme, portal adjustements #} - + {# - Bootstrap Datetime picker #} - + {# - Datatables #} - - - - - - + + + + + + {# - Font Combodo #} - + {# - Font awesome #} - + {# - Misc libs #} - - + + {# - Bootstrap theme #} - + {# - Portal adjustments for BS theme #} - + {# Custom CSS that is supposed to do adjustments to the portal #} {% if app['combodo.portal.instance.conf'].properties.themes.custom is defined %} - + {% endif %} {# Others CSS that will come after the theme/portal/custom, in an undefined order #} {% if app['combodo.portal.instance.conf'].properties.themes.others is defined %} {% for theme in app['combodo.portal.instance.conf'].properties.themes.others %} - + {% endfor %} {% endif %} {% endblock %} {% block pPageScripts %} - - - - - - - + + + + + + + {# Visible.js to check if an element is visible on screen #} - + {# Base64.js #} - + {# Moment.js #} - + {# Datatables #} - - - - - - - - + + + + + + + + {# CKEditor files for HTML WYSIWYG #} - - + + {# Date-time picker for Bootstrap #} - + {# Typeahead files for autocomplete #} - - - - + + + + {# Form files #} - - - - + + + + {# Form files for portal #} - - - + + + {% endblock %}