automatic select mobile theme for mobile user agents

This commit is contained in:
Ralf Becker 2014-12-01 08:43:07 +00:00
parent f78f8762b0
commit e6cf7c95d3

View File

@ -1283,11 +1283,14 @@ abstract class egw_framework
// eTemplate2 - load in top so sidebox has styles too // eTemplate2 - load in top so sidebox has styles too
self::includeCSS('/etemplate/templates/default/etemplate2.css'); self::includeCSS('/etemplate/templates/default/etemplate2.css');
// Theme likes to override eTemplate2 // For mobile user-agent we prefer mobile theme over selected one with a final fallback to theme named as template
$theme_css = $this->template_dir.'/css/'.$GLOBALS['egw_info']['user']['preferences']['common']['theme'].'.css'; $themes_to_check = array();
if(!file_exists(EGW_SERVER_ROOT.$theme_css)) if (html::$ua_mobile) $themes_to_check[] = $this->template_dir.'/css/mobile.css';
$themes_to_check[] = $this->template_dir.'/css/'.$GLOBALS['egw_info']['user']['preferences']['common']['theme'].'.css';
$themes_to_check[] = $this->template_dir.'/css/'.$this->template.'.css';
foreach($themes_to_check as $theme_css)
{ {
$theme_css = $this->template_dir.'/css/'.$this->template.'.css'; if (file_exists(EGW_SERVER_ROOT.$theme_css)) break;
} }
self::includeCSS($theme_css); self::includeCSS($theme_css);