From c2622dcd500d89c4ae9a056074695f384120d631 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 17 Feb 2016 16:50:54 +0000 Subject: [PATCH] get mobil template to load its own css, falling back to pixelegg and default --- phpgwapi/inc/class.egw_framework.inc.php | 18 +++++++++++++++--- pixelegg/inc/class.pixelegg_framework.inc.php | 7 ++++++- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/phpgwapi/inc/class.egw_framework.inc.php b/phpgwapi/inc/class.egw_framework.inc.php index 6d1ca94cb0..c764a498e3 100644 --- a/phpgwapi/inc/class.egw_framework.inc.php +++ b/phpgwapi/inc/class.egw_framework.inc.php @@ -52,6 +52,13 @@ abstract class egw_framework */ var $template_dir; + /** + * Application specific template directories to try in given order for CSS + * + * @var string + */ + var $template_dirs = array(); + /** * true if $this->header() was called * @@ -81,6 +88,9 @@ abstract class egw_framework $GLOBALS['egw']->framework = $this; } $this->template_dir = '/phpgwapi/templates/'.$template; + + $this->template_dirs[] = $template; + $this->template_dirs[] = 'default'; } /** @@ -2252,10 +2262,12 @@ abstract class egw_framework if (!is_null($name)) { - $path = '/'.$app.'/templates/'.$GLOBALS['egw_info']['server']['template_set'].'/'.$name.'.css'; - if (!file_exists(EGW_SERVER_ROOT.$path)) + foreach($GLOBALS['egw']->framework->template_dirs as $dir) { - $path = '/'.$app.'/templates/default/'.$name.'.css'; + if (file_exists(EGW_SERVER_ROOT.($path = '/'.$app.'/templates/'.$dir.'/'.$name.'.css'))) + { + break; + } } } else diff --git a/pixelegg/inc/class.pixelegg_framework.inc.php b/pixelegg/inc/class.pixelegg_framework.inc.php index 21ebbed3aa..f9529ab538 100755 --- a/pixelegg/inc/class.pixelegg_framework.inc.php +++ b/pixelegg/inc/class.pixelegg_framework.inc.php @@ -27,6 +27,8 @@ class pixelegg_framework extends jdots_framework */ const JS_INCLUDE_APP = 'pixelegg'; + + /** * Enable to use this template sets login.tpl for login page */ @@ -42,6 +44,9 @@ class pixelegg_framework extends jdots_framework function __construct($template=self::APP) { parent::__construct($template); // call the constructor of the extended class + + // search 'mobile' dirs first + if (html::$ua_mobile) array_unshift ($this->template_dirs, 'mobile'); } /** @@ -181,7 +186,7 @@ body .dialogHeadbar{ } body #egw_fw_sidebar #egw_fw_sidemenu .egw_fw_ui_category_active{background-color: $sidebox_color !important}; "; - } + } } return $ret; }