get mobil template to load its own css, falling back to pixelegg and default

This commit is contained in:
Ralf Becker 2016-02-17 16:50:54 +00:00
parent b8937dcc63
commit c2622dcd50
2 changed files with 21 additions and 4 deletions

View File

@ -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

View File

@ -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;
}