Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

N°3777 - favicon: change easily favicon #619

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion application/loginwebpage.class.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public static function NewLoginWebPage()
}

protected static $m_sLoginFailedMessage = '';

public function __construct($sTitle = null)
{
if ($sTitle === null) {
Expand All @@ -101,6 +101,17 @@ public function SetStyleSheet()
$this->add_linked_stylesheet(utils::GetAbsoluteUrlAppRoot().'css/font-awesome/css/all.min.css');
}

/**
* Return the absolute URL for the favicon
*
* @return string
* @throws \Exception
*/
protected function GetFaviconAbsoluteUrl()
{
return Branding::GetLoginFavIconAbsoluteUrl();
}

public static function SetLoginFailedMessage($sMessage)
{
self::$m_sLoginFailedMessage = $sMessage;
Expand Down
75 changes: 42 additions & 33 deletions core/config.class.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,90 +185,98 @@ class Config
'source_of_value' => '',
'show_in_conf_sample' => false,
],
'temporary_object.garbage_interval' => [
'temporary_object.garbage_interval' => [
'type' => 'integer',
'description' => 'Seconds between garbage collections',
'default' => 60,
'value' => false,
'source_of_value' => '',
'show_in_conf_sample' => false,
],
'app_env_label' => [
'app_env_label' => [
'type' => 'string',
'description' => 'Label displayed to describe the current application environment, defaults to the environment name (e.g. "production")',
'default' => '',
'value' => '',
'source_of_value' => '',
'show_in_conf_sample' => false,
],
'app_root_url' => [
'app_root_url' => [
'type' => 'string',
'description' => 'Root URL used for navigating within the application, or from an email to the application (you can put $SERVER_NAME$ as a placeholder for the server\'s name)',
'default' => '',
'value' => '',
'source_of_value' => '',
'show_in_conf_sample' => true,
],
'app_icon_url' => [
'branding_environment' => [
'type' => 'string',
'description' => 'type of branding. usefull for put different logo depending environment',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo (useful)

'default' => null,
'value' => null,
'source_of_value' => '',
'show_in_conf_sample' => false,
],
'app_icon_url' => [
'type' => 'string',
'description' => 'Hyperlink to redirect the user when clicking on the application icon (in the main window, or login/logoff pages)',
'default' => 'http://www.combodo.com/itop',
'value' => '',
'source_of_value' => '',
'show_in_conf_sample' => false,
],
'db_host' => [
'db_host' => [
'type' => 'string',
'default' => null,
'value' => '',
'source_of_value' => '',
'show_in_conf_sample' => true,
],
'db_user' => [
'type' => 'string',
'default' => null,
'value' => '',
'source_of_value' => '',
'db_user' => [
'type' => 'string',
'default' => null,
'value' => '',
'source_of_value' => '',
'show_in_conf_sample' => true,
],
'db_pwd' => [
'type' => 'string',
'default' => null,
'value' => '',
'source_of_value' => '',
'db_pwd' => [
'type' => 'string',
'default' => null,
'value' => '',
'source_of_value' => '',
'show_in_conf_sample' => true,
],
'db_name' => [
'type' => 'string',
'default' => null,
'value' => '',
'source_of_value' => '',
'db_name' => [
'type' => 'string',
'default' => null,
'value' => '',
'source_of_value' => '',
'show_in_conf_sample' => true,
],
'db_subname' => [
'type' => 'string',
'default' => null,
'value' => '',
'source_of_value' => '',
'db_subname' => [
'type' => 'string',
'default' => null,
'value' => '',
'source_of_value' => '',
'show_in_conf_sample' => true,
],
'db_tls.enabled' => [
'type' => 'bool',
'description' => 'If true then the connection to the DB will be encrypted',
'default' => false,
'value' => false,
'source_of_value' => '',
'db_tls.enabled' => [
'type' => 'bool',
'description' => 'If true then the connection to the DB will be encrypted',
'default' => false,
'value' => false,
'source_of_value' => '',
'show_in_conf_sample' => false,
],
'db_tls.ca' => [
'db_tls.ca' => [
'type' => 'string',
'description' => 'Path to certificate authority file for SSL',
'default' => null,
'value' => '',
'source_of_value' => '',
'show_in_conf_sample' => false,
],
'db_core_transactions_enabled' => [
'db_core_transactions_enabled' => [
'type' => 'bool',
'description' => 'If true, CRUD transactions in iTop core will be enabled',
'default' => true,
Expand Down Expand Up @@ -1833,6 +1841,7 @@ public function Set($sPropCode, $value, $sSourceDesc = 'unknown', $bCanOverride
*/
public function Get($sPropCode)
{

return $this->m_aSettings[$sPropCode]['value'];
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3.2">
<branding>
<brandings>
<themes>
<theme id="darkmoon" _delta="define">
<variables>
Expand All @@ -17,5 +17,5 @@
<precompiled_stylesheet>combodo-backoffice-darkmoon-theme/precompiled-themes/main.css</precompiled_stylesheet>
</theme>
</themes>
</branding>
</brandings>
</itop_design>
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ public function Process(Container $oContainer)
$aPortalConf = $this->ParseGlobalProperties($aPortalConf);
// - Rectifying portal logo url
$aPortalConf = $this->AppendLogoUri($aPortalConf);
// - Rectifying portal favicon url
$aPortalConf = $this->AppendFavIconUri($aPortalConf);
}
catch (Exception $oException)
{
Expand All @@ -69,22 +71,24 @@ public function Process(Container $oContainer)
*/
private function GetInitialPortalConf()
{

$aPortalConf = array(
'properties' => array(
'id' => $_ENV['PORTAL_ID'],
'name' => 'Page:DefaultTitle',
'logo' => Branding::GetPortalLogoAbsoluteUrl(),
'themes' => array(
'id' => $_ENV['PORTAL_ID'],
'name' => 'Page:DefaultTitle',
'logo' => Branding::GetPortalLogoAbsoluteUrl(),
'favicon' => Branding::GetPortalFavIconAbsoluteUrl(),
'themes' => array(
'bootstrap' => 'itop-portal-base/portal/public/css/bootstrap-theme-combodo.scss',
'portal' => 'itop-portal-base/portal/public/css/portal.scss',
'others' => array(),
'portal' => 'itop-portal-base/portal/public/css/portal.scss',
'others' => array(),
),
'templates' => array(
'templates' => array(
'layout' => 'itop-portal-base/portal/templates/layout.html.twig',
'home' => 'itop-portal-base/portal/templates/home/layout.html.twig',
'home' => 'itop-portal-base/portal/templates/home/layout.html.twig',
),
'urlmaker_class' => null,
'triggers_query' => null,
'urlmaker_class' => null,
'triggers_query' => null,
'attachments' => array(
'allow_delete' => true,
),
Expand Down Expand Up @@ -116,11 +120,8 @@ private function ParseGlobalProperties(array $aPortalConf)
case 'name':
case 'urlmaker_class':
case 'triggers_query':
$aPortalConf['properties'][$oPropertyNode->nodeName] = $oPropertyNode->GetText(
$aPortalConf['properties'][$oPropertyNode->nodeName]
);
break;
case 'logo':
case 'favicon':
$aPortalConf['properties'][$oPropertyNode->nodeName] = $oPropertyNode->GetText(
$aPortalConf['properties'][$oPropertyNode->nodeName]
);
Expand Down Expand Up @@ -263,13 +264,31 @@ private function ParseAllowedPortalsOptions(array $aPortalConf, DesignElement $o
private function AppendLogoUri(array $aPortalConf)
{
$sLogoUri = $aPortalConf['properties']['logo'];
if (!preg_match('/^http/', $sLogoUri))
{
if (!preg_match('/^http/', $sLogoUri)) {
// We prefix it with the server base url
$sLogoUri = utils::GetAbsoluteUrlAppRoot().'env-'.utils::GetCurrentEnvironment().'/'.$sLogoUri;
}
$aPortalConf['properties']['logo'] = $sLogoUri;

return $aPortalConf;
}

/**
* @param array $aPortalConf
*
* @return array
* @throws \Exception
* @since 3.1.1 N°3363
*/
private function AppendFaviconUri(array $aPortalConf)
{
$sFaviconUri = $aPortalConf['properties']['favicon'];
if (!preg_match('/^http/', $sFaviconUri)) {
// We prefix it with the server base url
$sFaviconUri = utils::GetAbsoluteUrlAppRoot().'env-'.utils::GetCurrentEnvironment().'/'.$sFaviconUri;
}
$aPortalConf['properties']['favicon'] = $sFaviconUri;

return $aPortalConf;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
{% block pPageExtraMetas %}
{% endblock %}
<title>{% block pPageTitle %}{% if sPageTitle is defined and sPageTitle is not null %}{{ sPageTitle }} - {{ constant('ITOP_APPLICATION_SHORT') }}{% else %}{{ 'Page:DefaultTitle'|dict_format(constant('ITOP_APPLICATION_SHORT')) }}{% endif %}{% endblock %}</title>
<link rel="shortcut icon" href="{{ app['combodo.absolute_url'] ~ 'images/favicon.ico'|add_itop_version }}" />
<link rel="shortcut icon" href="{{ app['combodo.portal.instance.conf'].properties.favicon|add_itop_version }}"/>

{% block pPageStylesheets %}
{# First bootstrap core, lib themes, then bootstrap theme, portal adjustements #}
Expand Down Expand Up @@ -250,7 +250,7 @@
</nav>
{% endblock %}

{# Sidebar navigation menu for normal screens #}
{# Sidebar navigation menu for normal screens #}
{% block pNavigationSideMenuWrapper %}
<nav class="navbar-default hidden-xs col-sm-3 col-md-2" id="sidebar" role="navigation">
<div class="user_card bg-primary">
Expand Down
10 changes: 5 additions & 5 deletions datamodels/2.x/itop-structure/datamodel.itop-structure.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1995,7 +1995,7 @@
<enable_action>UR_ACTION_MODIFY</enable_action>
</menu>
</menus>
<branding>
<brandings>
<themes>
<theme id="fullmoon" _delta="define">
<variables>
Expand Down Expand Up @@ -2024,13 +2024,13 @@
</themes>
<themes_common>
<variables>
</variables>
</variables>
<imports>
</imports>
</imports>
<stylesheets>
</stylesheets>
</stylesheets>
</themes_common>
</branding>
</brandings>
<user_rights>
<groups>
</groups>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<itop_design version="3.2">
<branding>
<brandings>
<themes>
<theme id="light-grey" _delta="define">
<variables>
Expand Down Expand Up @@ -29,5 +29,5 @@
</stylesheets>
</theme>
</themes>
</branding>
</brandings>
</itop_design>
Loading