0010490 - Create graphical input for theme
authorFlávio Gomes da Silva Lisboa <flavio.lisboa@serpro.gov.br>
Thu, 27 Nov 2014 13:23:45 +0000 (11:23 -0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Wed, 22 Apr 2015 17:44:05 +0000 (19:44 +0200)
 - Configuration Manager shows group for theme
 - Structure of configuration changes to:
   'theme' => array(
        'active' => [TRUE|FALSE],
        'path' => [theme folder name],
        'useBlueAsBase' => [TRUE|FALSE]
   )

Change-Id: Ie12edb6f9e93dd04b3d1704e52870b4fd0f3f9c5
Reviewed-on: https://gerrit.tine20.org/tine20/3072
Tested-by: jenkins user
Reviewed-by: Lars Kneschke <l.kneschke@metaways.de>
Reviewed-by: Flávio Gomes da Silva Lisboa <flavio.lisboa@serpro.gov.br>
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
Tested-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Setup/js/ConfigManagerPanel.js
tine20/Tinebase/View.php

index ee9a0ea..ba37859 100644 (file)
@@ -484,7 +484,26 @@ Tine.Setup.ConfigManagerPanel = Ext.extend(Tine.Tinebase.widgets.form.ConfigPane
                     value: Tine.Setup.registry.get(this.registryKey)['mapPanel'],
                     store: [[0, this.app.i18n._('disabled')], [1,this.app.i18n._('enabled')]]
                 }, commonComboConfig)
-            ] 
+           ] 
+        },
+        {
+            title: this.app.i18n._('Use Custom Theme'),
+            id: 'setup-theme-group',
+            checkboxToggle: true,
+            collapsed: true,
+            defaults: {
+                width: 300,
+                tabIndex: this.getTabIndex
+            },
+            items: [{
+                name: 'theme_path',
+                fieldLabel: this.app.i18n._('Theme path')
+            }, {
+                name: 'theme_useBlueAsBase',
+                fieldLabel: this.app.i18n._('Use blue theme as base'),
+                xtype: 'checkbox',
+                value: true
+            }]
         }];
     },
     
index 08072ec..c6b38b1 100644 (file)
@@ -1,11 +1,11 @@
 <?php
 /**
- * Tine 2.0
+ * Tine 2.0 - https://www.tine20.org
  *
  * @package     Tinebase
  * @subpackage  View
  * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
- * @copyright   Copyright (c) 2007-2012 Metaways Infosystems GmbH (http://www.metaways.de)
+ * @copyright   Copyright (c) 2007-2015 Metaways Infosystems GmbH (http://www.metaways.de)
  * @author      Flávio Gomes da Silva Lisboa <flavio.lisboa@serpro.gov.br>
  */
 
  */
 class Tinebase_View
 {
-
     public static function getThemeConfig()
     {
         $extJS     = 'ext-all.css';
-        $pathTheme = 'tine20';
-        $theme_config = array('','','');
-        $favicon = 'images/favicon.ico';
-
-        if(isset(Tinebase_Core::getConfig()->themes->default))
-        {
-            //set the theme to the one set in the config file
-            $numDefaultTheme = Tinebase_Core::getConfig()->themes->default;
-            //if the cookie name is defined in the config file and the cookie value is set, 
-            //set the theme to the one set in the cookie
-            if ((isset(Tinebase_Core::getConfig()->themes->cookieTheme)) &&
-            (!empty(Tinebase_Core::getConfig()->themes->cookieTheme)) &&
-            (isset($_COOKIE[Tinebase_Core::getConfig()->themes->cookieTheme])))//the cookie of the theme is set
-            {
-                $numDefaultTheme = $_COOKIE[Tinebase_Core::getConfig()->themes->cookieTheme];
-            }
-            //if the selected theme exists in the config file, get its path and options
-            if (isset(Tinebase_Core::getConfig()->themes->themelist->get($numDefaultTheme)->path))
-            {
-                $pathTheme = Tinebase_Core::getConfig()->themes->themelist->get($numDefaultTheme)->path;
+        $themePath = 'tine20';
+        $favicon   = 'images/favicon.ico';
+        
+        $themeConfig = Tinebase_Core::getConfig()->theme;
+        
+        if ($themeConfig instanceof Tinebase_Config_Struct && $themeConfig->active) {
+            if ($themeConfig->path) {
+                $themePath = $themeConfig->path;
+                
                 //is useBlueAsBase set?
-                if ((!isset(Tinebase_Core::getConfig()->themes->themelist->get($numDefaultTheme)->useBlueAsBase)) ||
-                        (Tinebase_Core::getConfig()->themes->themelist->get($numDefaultTheme)->useBlueAsBase == 0))
-                {
+                if ($themeConfig->useBlueAsBase) {
                     $extJS = 'ext-all-notheme.css';
                 }
+                
                 //is there a customized favicon?
-                if (file_exists('themes/' . $pathTheme . '/resources/images/favicon.ico')) 
-                {
-                    $favicon = 'themes/' . $pathTheme . '/resources/images/favicon.ico';
+                if (file_exists('themes/' . $themePath . '/resources/images/favicon.ico')) {
+                    $favicon = 'themes/' . $themePath . '/resources/images/favicon.ico';
                 }
             }
         }
-
-        $theme_config[0] =  $favicon;
-        $theme_config[1] =  '<link rel="stylesheet" type="text/css" href="library/ExtJS/resources/css/'.$extJS.'" />';
-        $theme_config[2] =  '<link rel="stylesheet" type="text/css" href="themes/'.$pathTheme.'/resources/css/'.$pathTheme.'.css" />';
-        return $theme_config;
+        
+        $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" />'
+        );
+        
+        return $result;
     }
-
 }