0012006: customize branding via config
authorsstamer <s.stamer@metaways.de>
Tue, 24 May 2016 12:21:25 +0000 (14:21 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Thu, 7 Jul 2016 09:19:16 +0000 (11:19 +0200)
https://forge.tine20.org/view.php?id=12006

Change-Id: I8ac9bd9b49dfd2a6b21a31069894e169d1dc39a0
Reviewed-on: http://gerrit.tine20.com/customers/3308
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
Tested-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Tinebase/Config.php
tine20/Tinebase/Frontend/Json.php
tine20/Tinebase/View.php
tine20/Tinebase/js/AboutDialog.js
tine20/Tinebase/js/AppTabsPanel.js
tine20/Tinebase/js/LoginPanel.js
tine20/Tinebase/js/tineInit.js
tine20/Tinebase/views/jsclient.php

index 91de50b..ad36d8b 100644 (file)
@@ -367,6 +367,12 @@ class Tinebase_Config extends Tinebase_Config_Abstract
      * @var array of strings
      */
     const FAT_CLIENT_CUSTOM_JS = 'fatClientCustomJS';
+    
+    const BRANDING_LOGO = 'branding_logo';
+    const BRANDING_FAVICON = 'branding_favicon';
+    const BRANDING_TITLE = 'branding_title';
+    const BRANDING_WEBURL = 'branding_weburl';
+    const BRANDING_DESCRIPTION = 'branding_description';
 
     /**
      * (non-PHPdoc)
@@ -857,6 +863,61 @@ class Tinebase_Config extends Tinebase_Config_Abstract
             'setByAdminModule'      => FALSE,
             'setBySetupModule'      => FALSE,
         ),
+        self::BRANDING_DESCRIPTION => array(
+                //_('custom description')
+                'label'                 => 'custom description',
+                //_('Custom description for branding.')
+                'description'           => 'Custom description for branding.',
+                'type'                  => 'string',
+                'default'               => '',
+                'clientRegistryInclude' => FALSE,
+                'setByAdminModule'      => FALSE,
+                'setBySetupModule'      => FALSE,
+        ),
+        self::BRANDING_WEBURL => array(
+                //_('custom weburl')
+                'label'                 => 'custom weburl',
+                //_('Custom weburl for branding.')
+                'description'           => 'Custom weburl for branding.',
+                'type'                  => 'string',
+                'default'               => '',
+                'clientRegistryInclude' => FALSE,
+                'setByAdminModule'      => FALSE,
+                'setBySetupModule'      => FALSE,
+        ),
+        self::BRANDING_TITLE => array(
+                //_('custom title')
+                'label'                 => 'custom title',
+                //_('Custom title for branding.')
+                'description'           => 'Custom ltitle for branding.',
+                'type'                  => 'string',
+                'default'               => '',
+                'clientRegistryInclude' => FALSE,
+                'setByAdminModule'      => FALSE,
+                'setBySetupModule'      => FALSE,
+        ),
+        self::BRANDING_LOGO => array(
+                //_('custom logo path')
+                'label'                 => 'custom logo path',
+                //_('Path to custom logo.')
+                'description'           => 'Path to custom logo.',
+                'type'                  => 'string',
+                'default'               => '',
+                'clientRegistryInclude' => FALSE,
+                'setByAdminModule'      => FALSE,
+                'setBySetupModule'      => FALSE,
+        ),
+        self::BRANDING_FAVICON => array(
+                //_('custom favicon path')
+                'label'                 => 'custom favicon path',
+                //_('Path to custom favicon.')
+                'description'           => 'Path to custom favicon.',
+                'type'                  => 'string',
+                'default'               => '',
+                'clientRegistryInclude' => FALSE,
+                'setByAdminModule'      => FALSE,
+                'setBySetupModule'      => FALSE,
+        ),
     );
     
     /**
index a3e752c..4985e08 100644 (file)
@@ -749,6 +749,10 @@ class Tinebase_Frontend_Json extends Tinebase_Frontend_Json_Abstract
             'thousandSeparator' => $symbols['group'],
             'decimalSeparator'  => $symbols['decimal'],
             'filesystemAvailable' => Tinebase_Core::isFilesystemAvailable(),
+            'brandingWeburl'    => Tinebase_Config::getInstance()->get(Tinebase_Config::BRANDING_WEBURL),
+            'brandingLogo'      => Tinebase_Config::getInstance()->get(Tinebase_Config::BRANDING_LOGO),
+            'brandingFavicon'   => Tinebase_Config::getInstance()->get(Tinebase_Config::BRANDING_FAVICON),
+            'brandingTitle'   => Tinebase_Config::getInstance()->get(Tinebase_Config::BRANDING_TITLE),
         );
         
         if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__
index c6b38b1..2f56a2c 100644 (file)
@@ -22,6 +22,7 @@ class Tinebase_View
         $extJS     = 'ext-all.css';
         $themePath = 'tine20';
         $favicon   = 'images/favicon.ico';
+        $title     = 'Tine 2.0';
         
         $themeConfig = Tinebase_Core::getConfig()->theme;
         
@@ -40,11 +41,16 @@ class Tinebase_View
                 }
             }
         }
+        //Do we have a branding favicon?
+        $favicon = Tinebase_Config::getInstance()->get(Tinebase_Config::BRANDING_FAVICON) ? Tinebase_Config::getInstance()->get(Tinebase_Config::BRANDING_FAVICON) : $favicon;
+        //Do we have a branding title?
+        $title = Tinebase_Config::getInstance()->get(Tinebase_Config::BRANDING_TITLE) ? Tinebase_Config::getInstance()->get(Tinebase_Config::BRANDING_TITLE) : $title;
         
         $result = array(
-            $favicon,
-            '<link rel="stylesheet" type="text/css" href="library/ExtJS/resources/css/' . $extJS . '" />',
-            '<link rel="stylesheet" type="text/css" href="themes/' . $themePath . '/resources/css/' . $themePath . '.css" />'
+            'favicon'   => $favicon,
+            'extJs'     => '<link rel="stylesheet" type="text/css" href="library/ExtJS/resources/css/' . $extJS . '" />',
+            'themePath' => '<link rel="stylesheet" type="text/css" href="themes/' . $themePath . '/resources/css/' . $themePath . '.css" />',
+            'title'     => $title
         );
         
         return $result;
index aaefd00..3d71b22 100644 (file)
@@ -51,7 +51,7 @@ Tine.Tinebase.AboutDialog = Ext.extend(Ext.Window, {
             layout: 'fit',
             border: false,
             html: this.aboutTpl.applyTemplate({
-                logo: Tine.Tinebase.LoginPanel.prototype.loginLogo,
+                logo: Tine.logo,
                 logoLink: Tine.weburl,
                 linkText: String.format(i18n._('Learn more about {0}'), Tine.title),
                 codeName: version.codeName,
index 5c03622..babef5f 100644 (file)
@@ -149,6 +149,10 @@ Ext.extend(Tine.Tinebase.AppTabsPanel, Ext.TabPanel, {
         
         // remove plain style
         this.header.removeClass('x-tab-panel-header-plain');
+        
+        if (Tine.favicon) {
+            Ext.util.CSS.updateRule('.tine-favicon', 'background-image', 'url(../../'+ Tine.favicon + ')');
+        }
     },
     
     /**
index 4970ea3..838625b 100644 (file)
@@ -34,11 +34,6 @@ Tine.Tinebase.LoginPanel = Ext.extend(Ext.Panel, {
     loginMethod: 'Tinebase.login',
     
     /**
-     * @cfg {String} loginLogo logo to show
-     */
-    loginLogo: 'images/tine_logo.png',
-    
-    /**
      * @cfg {String} onLogin callback after successfull login
      */
     onLogin: Ext.emptyFn,
@@ -64,6 +59,7 @@ Tine.Tinebase.LoginPanel = Ext.extend(Ext.Panel, {
     getLoginPanel: function () {
 
         var modSsl = Tine.Tinebase.registry.get('modSsl');
+        //Do we have a cutom Logo for branding?
 
         if (! this.loginPanel) {
             this.loginPanel = new Ext.FormPanel({
@@ -76,7 +72,7 @@ Tine.Tinebase.LoginPanel = Ext.extend(Ext.Panel, {
                     xtype: 'container',
                     cls: 'tb-login-lobobox',
                     border: false,
-                    html: '<a target="_blank" href="' + Tine.weburl + '" border="0"><img src="' + this.loginLogo + '" /></a>'
+                    html: '<a target="_blank" href="' + Tine.weburl + '" border="0"><img src="' + Tine.logo + '" /></a>'
                 }, {
                     xtype: 'label',
                     cls: 'tb-login-big-label',
index aa2010b..844248a 100644 (file)
@@ -51,6 +51,8 @@ Tine.clientVersion.releaseTime      = 'none';
  * 
  * @type String
  */
+Tine.logo = 'images/tine_logo.png';
+Tine.favicon;
 Tine.title = 'Tine 2.0';
 Tine.weburl = 'https://www.tine20.org/en/the-project/contribute.html';
 Tine.helpUrl = 'http://www.tine20.org/wiki/index.php/Main_Page';
@@ -656,7 +658,13 @@ Tine.Tinebase.tineInit = {
         }
 
         Tine.helpUrl = Tine.Tinebase.registry.get('helpUrl') || Tine.helpUrl;
-
+        //Do we have a custom weburl for branding?
+        Tine.weburl = Tine.Tinebase.registry.get('brandingWeburl') ? Tine.Tinebase.registry.get('brandingWeburl') : Tine.weburl;
+        //DO we have a custom title for branding?
+        Tine.title = Tine.Tinebase.registry.get('brandingTitle') ? Tine.Tinebase.registry.get('brandingTitle') : Tine.title;
+        Tine.logo = Tine.Tinebase.registry.get('brandingLogo') ? Tine.Tinebase.registry.get('brandingLogo') : Tine.logo;
+        Tine.favicon = Tine.Tinebase.registry.get('brandingFavicon') ? Tine.Tinebase.registry.get('brandingFavicon') : Tine.favicon;
+        
         Ext.override(Ext.ux.file.Upload, {
             maxFileUploadSize: Tine.Tinebase.registry.get('maxFileUploadSize'),
             maxPostSize: Tine.Tinebase.registry.get('maxPostSize')
index 7921eb9..eb638ef 100644 (file)
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
-    <title>Tine 2.0</title>
+    <title><?php echo $theme_config['title']; ?></title>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     <meta http-equiv="X-Tine20-Version" content="<?php echo TINE20_PACKAGESTRING ?>" />
     
-    <link rel="shortcut icon" href="<?php echo $theme_config[0]; ?>" type="image/x-icon" />
+    <link rel="shortcut icon" href="<?php echo $theme_config['favicon']; ?>" type="image/x-icon" />
     <link rel="chrome-application-definition" href="chrome_web_app.json" />
 </head>
 <body>
     <!-- Loading Indicator -->
-    <div class="tine-viewport-waitcycle" style="position: absolute; top: 50%; left: 50%; background-image: url(data:image/gif;base64,R0lGODlhEAAQALMMAKqooJGOhp2bk7e1rZ2bkre1rJCPhqqon8PBudDOxXd1bISCef///wAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQFAAAMACwAAAAAEAAQAAAET5DJyYyhmAZ7sxQEs1nMsmACGJKmSaVEOLXnK1PuBADepCiMg/DQ+/2GRI8RKOxJfpTCIJNIYArS6aRajWYZCASDa41Ow+Fx2YMWOyfpTAQAIfkEBQAADAAsAAAAABAAEAAABE6QyckEoZgKe7MEQMUxhoEd6FFdQWlOqTq15SlT9VQM3rQsjMKO5/n9hANixgjc9SQ/CgKRUSgw0ynFapVmGYkEg3v1gsPibg8tfk7CnggAIfkEBQAADAAsAAAAABAAEAAABE2QycnOoZjaA/IsRWV1goCBoMiUJTW8A0XMBPZmM4Ug3hQEjN2uZygahDyP0RBMEpmTRCKzWGCkUkq1SsFOFQrG1tr9gsPc3jnco4A9EQAh+QQFAAAMACwAAAAAEAAQAAAETpDJyUqhmFqbJ0LMIA7McWDfF5LmAVApOLUvLFMmlSTdJAiM3a73+wl5HYKSEET2lBSFIhMIYKRSimFriGIZiwWD2/WCw+Jt7xxeU9qZCAAh+QQFAAAMACwAAAAAEAAQAAAETZDJyRCimFqbZ0rVxgwF9n3hSJbeSQ2rCWIkpSjddBzMfee7nQ/XCfJ+OQYAQFksMgQBxumkEKLSCfVpMDCugqyW2w18xZmuwZycdDsRACH5BAUAAAwALAAAAAAQABAAAARNkMnJUqKYWpunUtXGIAj2feFIlt5JrWybkdSydNNQMLaND7pC79YBFnY+HENHMRgyhwPGaQhQotGm00oQMLBSLYPQ9QIASrLAq5x0OxEAIfkEBQAADAAsAAAAABAAEAAABE2QycmUopham+da1cYkCfZ94UiW3kmtbJuRlGF0E4Iwto3rut6tA9wFAjiJjkIgZAYDTLNJgUIpgqyAcTgwCuACJssAdL3gpLmbpLAzEQA7); width: 16px; height: 16px">&#160;</div><div class="tine-viewport-poweredby" style="position: absolute; bottom: 10px; right: 10px; font:normal 12px arial, helvetica,tahoma,sans-serif;">Powered by: <a target="_blank" href="http://www.tine20.com/info/community.html" title="online open source groupware and crm">Tine 2.0</a></div>
+    <div class="tine-viewport-waitcycle" style="position: absolute; top: 50%; left: 50%; background-image: url(data:image/gif;base64,R0lGODlhEAAQALMMAKqooJGOhp2bk7e1rZ2bkre1rJCPhqqon8PBudDOxXd1bISCef///wAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQFAAAMACwAAAAAEAAQAAAET5DJyYyhmAZ7sxQEs1nMsmACGJKmSaVEOLXnK1PuBADepCiMg/DQ+/2GRI8RKOxJfpTCIJNIYArS6aRajWYZCASDa41Ow+Fx2YMWOyfpTAQAIfkEBQAADAAsAAAAABAAEAAABE6QyckEoZgKe7MEQMUxhoEd6FFdQWlOqTq15SlT9VQM3rQsjMKO5/n9hANixgjc9SQ/CgKRUSgw0ynFapVmGYkEg3v1gsPibg8tfk7CnggAIfkEBQAADAAsAAAAABAAEAAABE2QycnOoZjaA/IsRWV1goCBoMiUJTW8A0XMBPZmM4Ug3hQEjN2uZygahDyP0RBMEpmTRCKzWGCkUkq1SsFOFQrG1tr9gsPc3jnco4A9EQAh+QQFAAAMACwAAAAAEAAQAAAETpDJyUqhmFqbJ0LMIA7McWDfF5LmAVApOLUvLFMmlSTdJAiM3a73+wl5HYKSEET2lBSFIhMIYKRSimFriGIZiwWD2/WCw+Jt7xxeU9qZCAAh+QQFAAAMACwAAAAAEAAQAAAETZDJyRCimFqbZ0rVxgwF9n3hSJbeSQ2rCWIkpSjddBzMfee7nQ/XCfJ+OQYAQFksMgQBxumkEKLSCfVpMDCugqyW2w18xZmuwZycdDsRACH5BAUAAAwALAAAAAAQABAAAARNkMnJUqKYWpunUtXGIAj2feFIlt5JrWybkdSydNNQMLaND7pC79YBFnY+HENHMRgyhwPGaQhQotGm00oQMLBSLYPQ9QIASrLAq5x0OxEAIfkEBQAADAAsAAAAABAAEAAABE2QycmUopham+da1cYkCfZ94UiW3kmtbJuRlGF0E4Iwto3rut6tA9wFAjiJjkIgZAYDTLNJgUIpgqyAcTgwCuACJssAdL3gpLmbpLAzEQA7); width: 16px; height: 16px">&#160;</div><div class="tine-viewport-poweredby" style="position: absolute; bottom: 10px; right: 10px; font:normal 12px arial, helvetica,tahoma,sans-serif;">Powered by: <a target="_blank" href="http://www.tine20.com/info/community.html" title="online open source groupware and crm"><?php echo $theme_config['title']; ?></a></div>
     <?php
     if(isset(Tinebase_Core::getConfig()->captcha->count) && Tinebase_Core::getConfig()->captcha->count != 0)
     {
@@ -34,7 +34,7 @@
     <!-- EXT JS -->
 
     <?php 
-        echo $theme_config[1] . "\n";
+        echo $theme_config['extJs'] . "\n";
     ?>
 
     <script type="text/javascript" src="library/ExtJS/adapter/ext/ext-base<?php echo TINE20_BUILDTYPE != 'RELEASE' ? '-debug' : '' ?>.js"></script>
@@ -43,7 +43,7 @@
     <?php require 'Tinebase/views/includeJsAndCss.php'; ?>
         
     <?php 
-        echo $theme_config[2] . "\n";
+        echo $theme_config['themePath'] . "\n";
     ?>
 
     <noscript><p>You need to enable javascript to use <a target="_blank" href="http://www.tine20.com/info/community.html" title="online open source groupware and crm">Tine 2.0</a></p></noscript>