diff --git a/application/itopwebpage.class.inc.php b/application/itopwebpage.class.inc.php
index 92bf37e9e..29ab8933c 100644
--- a/application/itopwebpage.class.inc.php
+++ b/application/itopwebpage.class.inc.php
@@ -21,6 +21,7 @@ require_once(APPROOT."/application/nicewebpage.class.inc.php");
require_once(APPROOT."/application/applicationcontext.class.inc.php");
require_once(APPROOT."/application/user.preferences.class.inc.php");
+use Combodo\iTop\Application\Branding;
use Combodo\iTop\Application\TwigBase\Twig\TwigHelper;
/**
@@ -28,13 +29,6 @@ use Combodo\iTop\Application\TwigBase\Twig\TwigHelper;
*/
class iTopWebPage extends NiceWebPage implements iTabbedPage
{
- /** @var string ENUM_APP_ICON_SHAPE_SQUARE */
- const ENUM_APP_ICON_SHAPE_SQUARE = 'square';
- /** @var string ENUM_APP_ICON_SHAPE_FULL */
- const ENUM_APP_ICON_SHAPE_FULL = 'full';
- /** @var string DEFAULT_APP_ICON_SHAPE */
- const DEFAULT_APP_ICON_SHAPE = self::ENUM_APP_ICON_SHAPE_FULL;
-
/** @var string ENUM_BREADCRUMB_ENTRY_ICON_TYPE_IMAGE */
const ENUM_BREADCRUMB_ENTRY_ICON_TYPE_IMAGE = 'image';
/** @var string ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES */
@@ -42,18 +36,6 @@ class iTopWebPage extends NiceWebPage implements iTabbedPage
/** @var string DEFAULT_BREADCRUMB_ENTRY_ICON_TYPE */
const DEFAULT_BREADCRUMB_ENTRY_ICON_TYPE = self::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_IMAGE;
- /** @var array Default and branding filenames for the app. icon in the backoffice */
- protected static $aAppIconFilenames = [
- self::ENUM_APP_ICON_SHAPE_SQUARE => [
- 'default' => 'itop-logo-square.png',
- 'branding' => 'backoffice-square-logo.png',
- ],
- self::ENUM_APP_ICON_SHAPE_FULL => [
- 'default' => 'itop-logo.png',
- 'branding' => 'main-logo.png',
- ],
- ];
-
private $m_sMenu;
// private $m_currentOrganization;
private $m_aMessages;
@@ -855,34 +837,6 @@ JS
return $sRevisionNumber;
}
- /**
- * Return the absolute URL to the application logo of $sShape
- *
- * @see static::ENUM_APP_ICON_SHAPE_SQUARE, static::ENUM_APP_ICON_SHAPE_FULL, ...
- *
- * @param string $sShape Shape of the icon to return
- *
- * @return string
- * @throws \Exception
- * @since 2.8.0
- */
- protected function GetApplicationIconUrl($sShape = self::DEFAULT_APP_ICON_SHAPE)
- {
- $sIconDefaultFilename = static::$aAppIconFilenames[$sShape]['default'];
- $sIconBrandingFilename = static::$aAppIconFilenames[$sShape]['branding'];
-
- $sIconAbsUrl = utils::GetAbsoluteUrlAppRoot().'images/'.$sIconDefaultFilename;
- // Check if icon is overloaded by the branding
- if (file_exists(MODULESROOT.'branding/'.$sIconBrandingFilename))
- {
- $sIconAbsUrl = utils::GetAbsoluteUrlModulesRoot().'branding/'.$sIconBrandingFilename;
- }
-
- $sIconAbsUrl .= '?t='.utils::GetCacheBusterTimestamp();
-
- return $sIconAbsUrl;
- }
-
/**
* Return the navigation menu data (id, menu groups, ...)
*
@@ -898,8 +852,8 @@ JS
return [
'sId' => 'ibo-navigation-menu',
'sAppRevisionNumber' => $this->GetApplicationRevisionNumber(),
- 'sAppSquareIconUrl' => $this->GetApplicationIconUrl(static::ENUM_APP_ICON_SHAPE_SQUARE),
- 'sAppFullIconUrl' => $this->GetApplicationIconUrl(static::ENUM_APP_ICON_SHAPE_FULL),
+ 'sAppSquareIconUrl' => Branding::GetSquareMainLogoAbsoluteUrl(),
+ 'sAppFullIconUrl' => Branding::GetFullMainLogoAbsoluteUrl(),
'sAppIconLink' => MetaModel::GetConfig()->Get('app_icon_url'),
'aMenuGroups' => ApplicationMenu::GetMenuGroups($oAppContext->GetAsHash()),
];
@@ -1472,11 +1426,11 @@ EOF;
$sOnlineHelpUrl = MetaModel::GetConfig()->Get('online_help');
//$sLogOffMenu = "
";
- $sDisplayIcon = utils::GetAbsoluteUrlAppRoot().'images/itop-logo.png?t='.utils::GetCacheBusterTimestamp();
- if (file_exists(MODULESROOT.'branding/main-logo.png'))
- {
- $sDisplayIcon = utils::GetAbsoluteUrlModulesRoot().'branding/main-logo.png?t='.utils::GetCacheBusterTimestamp();
- }
+// $sDisplayIcon = utils::GetAbsoluteUrlAppRoot().'images/itop-logo.png?t='.utils::GetCacheBusterTimestamp();
+// if (file_exists(MODULESROOT.'branding/main-logo.png'))
+// {
+// $sDisplayIcon = utils::GetAbsoluteUrlModulesRoot().'branding/main-logo.png?t='.utils::GetCacheBusterTimestamp();
+// }
$sHtml .= $sNorthPane;
$sHtml .= '
';
diff --git a/datamodels/2.x/itop-portal-base/portal/src/DependencyInjection/SilexCompatBootstrap/PortalXmlConfiguration/Basic.php b/datamodels/2.x/itop-portal-base/portal/src/DependencyInjection/SilexCompatBootstrap/PortalXmlConfiguration/Basic.php
index 0c2caba4b..b7ee652f6 100644
--- a/datamodels/2.x/itop-portal-base/portal/src/DependencyInjection/SilexCompatBootstrap/PortalXmlConfiguration/Basic.php
+++ b/datamodels/2.x/itop-portal-base/portal/src/DependencyInjection/SilexCompatBootstrap/PortalXmlConfiguration/Basic.php
@@ -19,6 +19,7 @@
namespace Combodo\iTop\Portal\DependencyInjection\SilexCompatBootstrap\PortalXmlConfiguration;
+use Combodo\iTop\Application\Branding;
use Combodo\iTop\DesignElement;
use Combodo\iTop\Portal\Helper\UIExtensionsHelper;
use DOMFormatException;
@@ -72,7 +73,7 @@ class Basic extends AbstractConfiguration
'properties' => array(
'id' => $_ENV['PORTAL_ID'],
'name' => 'Page:DefaultTitle',
- 'logo' => (file_exists(MODULESROOT.'branding/portal-logo.png')) ? utils::GetAbsoluteUrlModulesRoot().'branding/portal-logo.png' : '../images/logo-itop-dark-bg.svg',
+ 'logo' => Branding::GetPortalLogoAbsoluteUrl(),
'themes' => array(
'bootstrap' => 'itop-portal-base/portal/public/css/bootstrap-theme-combodo.scss',
'portal' => 'itop-portal-base/portal/public/css/portal.scss',
diff --git a/lib/composer/autoload_classmap.php b/lib/composer/autoload_classmap.php
index 8f8e6b200..01433a2f7 100644
--- a/lib/composer/autoload_classmap.php
+++ b/lib/composer/autoload_classmap.php
@@ -137,6 +137,7 @@ return array(
'CharConcatWSExpression' => $baseDir . '/core/oql/expression.class.inc.php',
'CheckStopWatchThresholds' => $baseDir . '/core/ormstopwatch.class.inc.php',
'CheckableExpression' => $baseDir . '/core/oql/oqlquery.class.inc.php',
+ 'Combodo\\iTop\\Application\\Branding' => $baseDir . '/sources/application/Branding.php',
'Combodo\\iTop\\Application\\Search\\AjaxSearchException' => $baseDir . '/sources/application/search/ajaxsearchexception.class.inc.php',
'Combodo\\iTop\\Application\\Search\\CriterionConversionAbstract' => $baseDir . '/sources/application/search/criterionconversionabstract.class.inc.php',
'Combodo\\iTop\\Application\\Search\\CriterionConversion\\CriterionToOQL' => $baseDir . '/sources/application/search/criterionconversion/criteriontooql.class.inc.php',
@@ -315,6 +316,7 @@ return array(
'NewObjectMenuNode' => $baseDir . '/application/menunode.class.inc.php',
'NewsroomProviderBase' => $baseDir . '/application/newsroomprovider.class.inc.php',
'NiceWebPage' => $baseDir . '/application/nicewebpage.class.inc.php',
+ 'NotYetEvaluatedExpression' => $baseDir . '/core/oql/expression.class.inc.php',
'OQLActualClassTreeResolver' => $baseDir . '/core/oqlactualclasstreeresolver.class.inc.php',
'OQLClassNode' => $baseDir . '/core/oqlclassnode.class.inc.php',
'OQLClassTreeBuilder' => $baseDir . '/core/oqlclasstreebuilder.class.inc.php',
diff --git a/lib/composer/autoload_real.php b/lib/composer/autoload_real.php
index ac16a9508..e8c595bf1 100644
--- a/lib/composer/autoload_real.php
+++ b/lib/composer/autoload_real.php
@@ -13,9 +13,6 @@ class ComposerAutoloaderInit0018331147de7601e7552f7da8e3bb8b
}
}
- /**
- * @return \Composer\Autoload\ClassLoader
- */
public static function getLoader()
{
if (null !== self::$loader) {
diff --git a/lib/composer/autoload_static.php b/lib/composer/autoload_static.php
index 818c364ae..1d5bd7266 100644
--- a/lib/composer/autoload_static.php
+++ b/lib/composer/autoload_static.php
@@ -367,6 +367,7 @@ class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b
'CharConcatWSExpression' => __DIR__ . '/../..' . '/core/oql/expression.class.inc.php',
'CheckStopWatchThresholds' => __DIR__ . '/../..' . '/core/ormstopwatch.class.inc.php',
'CheckableExpression' => __DIR__ . '/../..' . '/core/oql/oqlquery.class.inc.php',
+ 'Combodo\\iTop\\Application\\Branding' => __DIR__ . '/../..' . '/sources/application/Branding.php',
'Combodo\\iTop\\Application\\Search\\AjaxSearchException' => __DIR__ . '/../..' . '/sources/application/search/ajaxsearchexception.class.inc.php',
'Combodo\\iTop\\Application\\Search\\CriterionConversionAbstract' => __DIR__ . '/../..' . '/sources/application/search/criterionconversionabstract.class.inc.php',
'Combodo\\iTop\\Application\\Search\\CriterionConversion\\CriterionToOQL' => __DIR__ . '/../..' . '/sources/application/search/criterionconversion/criteriontooql.class.inc.php',
@@ -545,6 +546,7 @@ class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b
'NewObjectMenuNode' => __DIR__ . '/../..' . '/application/menunode.class.inc.php',
'NewsroomProviderBase' => __DIR__ . '/../..' . '/application/newsroomprovider.class.inc.php',
'NiceWebPage' => __DIR__ . '/../..' . '/application/nicewebpage.class.inc.php',
+ 'NotYetEvaluatedExpression' => __DIR__ . '/../..' . '/core/oql/expression.class.inc.php',
'OQLActualClassTreeResolver' => __DIR__ . '/../..' . '/core/oqlactualclasstreeresolver.class.inc.php',
'OQLClassNode' => __DIR__ . '/../..' . '/core/oqlclassnode.class.inc.php',
'OQLClassTreeBuilder' => __DIR__ . '/../..' . '/core/oqlclasstreebuilder.class.inc.php',
diff --git a/setup/compiler.class.inc.php b/setup/compiler.class.inc.php
index 6a2d3c557..0cfa3a1e4 100644
--- a/setup/compiler.class.inc.php
+++ b/setup/compiler.class.inc.php
@@ -2745,8 +2745,9 @@ EOF;
// Transform file refs into files in the images folder
$this->CompileFiles($oBrandingNode, $sTempTargetDir.'/branding', $sFinalTargetDir.'/branding', 'branding');
- $this->CompileLogo($oBrandingNode, $sTempTargetDir, $sFinalTargetDir, 'main_logo', 'main-logo');
$this->CompileLogo($oBrandingNode, $sTempTargetDir, $sFinalTargetDir, 'login_logo', 'login-logo');
+ $this->CompileLogo($oBrandingNode, $sTempTargetDir, $sFinalTargetDir, 'main_logo', 'main-logo-full');
+ $this->CompileLogo($oBrandingNode, $sTempTargetDir, $sFinalTargetDir, 'main_logo_square', 'main-logo-square');
$this->CompileLogo($oBrandingNode, $sTempTargetDir, $sFinalTargetDir, 'portal_logo', 'portal-logo');
// Cleanup the images directory (eventually made by CompileFiles)
diff --git a/sources/application/Branding.php b/sources/application/Branding.php
new file mode 100644
index 000000000..37d0ebed5
--- /dev/null
+++ b/sources/application/Branding.php
@@ -0,0 +1,133 @@
+
+ * @package Combodo\iTop\Application
+ * @since 2.8.0
+ */
+class Branding
+{
+ /** @var string Full main logo, used everywhere when there is no need for a special one */
+ const ENUM_LOGO_TYPE_MAIN_LOGO_FULL = 'main_logo_full';
+ /** @var string Square main logo, used in the collapsed menu of the backoffice */
+ const ENUM_LOGO_TYPE_MAIN_LOGO_SQUARE = 'main_logo_square';
+ /** @var string Logo used in the end-users portal */
+ const ENUM_LOGO_TYPE_PORTAL_LOGO = 'portal_logo';
+ /** @var string Logo used in the login pages */
+ const ENUM_LOGO_TYPE_LOGIN_LOGO = 'login_logo';
+ /** @var string Default logo */
+ const DEFAULT_LOGO_TYPE = self::ENUM_LOGO_TYPE_MAIN_LOGO_FULL;
+
+ /** @var \string[][] Relative paths to the default/custom logos from the current environment folder */
+ public static $aLogoPaths = [
+ self::ENUM_LOGO_TYPE_MAIN_LOGO_FULL => [
+ 'default' => 'images/itop-logo.png',
+ 'custom' => 'branding/main-logo-full.png',
+ ],
+ self::ENUM_LOGO_TYPE_MAIN_LOGO_SQUARE => [
+ 'default' => 'images/itop-logo-square.png',
+ 'custom' => 'branding/main-logo-square.png',
+ ],
+ self::ENUM_LOGO_TYPE_PORTAL_LOGO => [
+ 'default' => 'images/logo-itop-dark-bg.svg',
+ 'custom' => 'branding/portal-logo.png',
+ ],
+ self::ENUM_LOGO_TYPE_LOGIN_LOGO => [
+ 'default' => 'images/itop-logo.png',
+ 'custom' => 'branding/login-logo.png',
+ ],
+ ];
+
+ /**
+ * Return the absolute URL for the full main logo
+ *
+ * @param string $sType Type of the logo to return
+ * @see static::ENUM_LOGO_TYPE_XXX
+ *
+ * @return string
+ * @throws \Exception
+ */
+ public static function GetLogoAbsoluteUrl($sType = self::DEFAULT_LOGO_TYPE)
+ {
+ $sDefaultLogoPath = static::$aLogoPaths[$sType]['default'];
+ $sCustomLogoPath = static::$aLogoPaths[$sType]['custom'];
+
+ if (file_exists(MODULESROOT.$sCustomLogoPath))
+ {
+ $sUrl = utils::GetAbsoluteUrlModulesRoot().$sCustomLogoPath;
+ }
+ else
+ {
+ $sUrl = utils::GetAbsoluteUrlAppRoot().$sDefaultLogoPath;
+ }
+
+ return $sUrl.'?t='.utils::GetCacheBusterTimestamp();
+ }
+
+ /**
+ * Return the absolute URL for the full main logo
+ *
+ * @return string
+ * @throws \Exception
+ */
+ public static function GetFullMainLogoAbsoluteUrl()
+ {
+ return static::GetLogoAbsoluteUrl(static::ENUM_LOGO_TYPE_MAIN_LOGO_FULL);
+ }
+
+ /**
+ * Return the absolute URL for the square main logo
+ *
+ * @return string
+ * @throws \Exception
+ */
+ public static function GetSquareMainLogoAbsoluteUrl()
+ {
+ return static::GetLogoAbsoluteUrl(static::ENUM_LOGO_TYPE_MAIN_LOGO_SQUARE);
+ }
+
+ /**
+ * Return the absolute URL for the portal logo
+ *
+ * @return string
+ * @throws \Exception
+ */
+ public static function GetPortalLogoAbsoluteUrl()
+ {
+ return static::GetLogoAbsoluteUrl(static::ENUM_LOGO_TYPE_PORTAL_LOGO);
+ }
+
+ /**
+ * Return the absolute URL for the login logo
+ *
+ * @return string
+ * @throws \Exception
+ */
+ public static function GetLoginLogoAbsoluteUrl()
+ {
+ return static::GetLogoAbsoluteUrl(static::ENUM_LOGO_TYPE_LOGIN_LOGO);
+ }
+}
\ No newline at end of file