mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-09 15:00:07 +01:00
allow to load template-set specific templates, eg. addressbook/templates/pixelegg/edit.xet instead of addressbook/templates/default/edit.xet, if user is on pixelegg template-set
This commit is contained in:
parent
87d98928fe
commit
ef1679a899
@ -39,13 +39,13 @@ class etemplate_widget_template extends etemplate_widget
|
||||
* Get instance of template specified by name, template(-set) and version
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $template_set='default'
|
||||
* @param string $template_set=null default try template-set from user and if not found "default"
|
||||
* @param string $version=''
|
||||
* @param string $load_via='' use given template to load $name
|
||||
* @todo Reading customized templates from database
|
||||
* @return etemplate_widget_template|boolean false if not found
|
||||
*/
|
||||
public static function instance($name, $template_set='default', $version='', $load_via='')
|
||||
public static function instance($name, $template_set=null, $version='', $load_via='')
|
||||
{
|
||||
$start = microtime(true);
|
||||
if (isset(self::$cache[$name]) || !($path = self::relPath($name, $template_set, $version)))
|
||||
@ -116,24 +116,28 @@ class etemplate_widget_template extends etemplate_widget
|
||||
* Get path/URL relative to EGroupware install of a template
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $template_set='default'
|
||||
* @param string $template_set=null default try template-set from user and if not found "default"
|
||||
* @param string $version=''
|
||||
* @return string|boolean path of template xml file or false if not found
|
||||
*/
|
||||
public static function relPath($name, $template_set='default', $version='')
|
||||
public static function relPath($name, $template_set=null, $version='')
|
||||
{
|
||||
list($app, $rest) = explode('.', $name, 2);
|
||||
|
||||
if (empty($template_set))
|
||||
{
|
||||
$template_set = $GLOBALS['egw_info']['user']['preferences']['common']['template_set'];
|
||||
}
|
||||
$path = '/'.$app.'/templates/'.$template_set.'/'.$rest.'.xet';
|
||||
|
||||
if (file_exists(EGW_SERVER_ROOT.$path)) return $path;
|
||||
|
||||
if ($templateSet != 'default')
|
||||
if (!file_exists(EGW_SERVER_ROOT.$path)) // try default
|
||||
{
|
||||
$path = '/'.$app.'/templates/default/'.$rest.'.xet';
|
||||
|
||||
if (file_exists(EGW_SERVER_ROOT.$path)) return $path;
|
||||
if (!file_exists(EGW_SERVER_ROOT.$path)) $path = false;
|
||||
}
|
||||
return false;
|
||||
//error_log(__METHOD__."('$name', '$template_set') returning ".array2string($path));
|
||||
return $path;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user