forked from extern/egroupware
move common::get_tpl_dir to Api\Framework\Template::get_dir, and replaced some other overlooked methods
This commit is contained in:
parent
ebc14c847c
commit
b6403e336e
@ -109,7 +109,7 @@ class Base
|
||||
case 'framework':
|
||||
return $this->framework = Api\Framework::factory();
|
||||
case 'template': // need to be instancated for the current app
|
||||
if (!($tpl_dir = common::get_tpl_dir($this->currentapp)))
|
||||
if (!($tpl_dir = Api\Framework\Template::get_dir($this->currentapp)))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -801,11 +801,11 @@ class Select extends Etemplate\Widget
|
||||
*
|
||||
* @param int $id
|
||||
* @param array $acc =null optional values for keys account_(type|lid|lastname|firstname) to not read them again
|
||||
* @param int $longnames
|
||||
* @param boolean $show_type true: return array with values for keys label and icon, false: only label
|
||||
* @param int $longnames =0
|
||||
* @param boolean $show_type =false true: return array with values for keys label and icon, false: only label
|
||||
* @return string|array
|
||||
*/
|
||||
private static function accountInfo($id,$acc=null,$longnames=0,$show_type=false)
|
||||
public static function accountInfo($id,$acc=null,$longnames=0,$show_type=false)
|
||||
{
|
||||
if (!$id)
|
||||
{
|
||||
|
@ -335,7 +335,7 @@ class Tree extends Etemplate\Widget
|
||||
/**
|
||||
* Return image relative to trees image-path
|
||||
*
|
||||
* @param string $image url of image, eg. from common::image($image, $app)
|
||||
* @param string $image url of image, eg. from Api\Image::find($image, $app)
|
||||
* @return string path relative to image-path, to use when returning tree data eg. via json
|
||||
*/
|
||||
public static function imagePath($image)
|
||||
|
@ -559,4 +559,59 @@ class Template
|
||||
}
|
||||
return False;
|
||||
}
|
||||
|
||||
/**
|
||||
* get template dir of an application
|
||||
*
|
||||
* @param $appname appication name optional can be derived from $GLOBALS['egw_info']['flags']['currentapp'];
|
||||
* @return string|boolean dir or false if no dir is found
|
||||
*/
|
||||
static function get_dir($appname = '')
|
||||
{
|
||||
if (!$appname)
|
||||
{
|
||||
$appname = $GLOBALS['egw_info']['flags']['currentapp'];
|
||||
}
|
||||
if ($appname == 'logout' || $appname == 'login')
|
||||
{
|
||||
$appname = 'phpgwapi';
|
||||
}
|
||||
|
||||
if (!isset($GLOBALS['egw_info']['server']['template_set']) && isset($GLOBALS['egw_info']['user']['preferences']['common']['template_set']))
|
||||
{
|
||||
$GLOBALS['egw_info']['server']['template_set'] = $GLOBALS['egw_info']['user']['preferences']['common']['template_set'];
|
||||
}
|
||||
|
||||
// Setting this for display of template choices in user preferences
|
||||
if ($GLOBALS['egw_info']['server']['template_set'] == 'user_choice')
|
||||
{
|
||||
$GLOBALS['egw_info']['server']['usrtplchoice'] = 'user_choice';
|
||||
}
|
||||
|
||||
if (($GLOBALS['egw_info']['server']['template_set'] == 'user_choice' ||
|
||||
!isset($GLOBALS['egw_info']['server']['template_set'])) &&
|
||||
isset($GLOBALS['egw_info']['user']['preferences']['common']['template_set']))
|
||||
{
|
||||
$GLOBALS['egw_info']['server']['template_set'] = $GLOBALS['egw_info']['user']['preferences']['common']['template_set'];
|
||||
}
|
||||
if (!file_exists(EGW_SERVER_ROOT.'/phpgwapi/templates/'.basename($GLOBALS['egw_info']['server']['template_set']).'/class.'.
|
||||
$GLOBALS['egw_info']['server']['template_set'].'_framework.inc.php') &&
|
||||
!file_exists(EGW_SERVER_ROOT.'/'.basename($GLOBALS['egw_info']['server']['template_set']).'/inc/class.'.
|
||||
$GLOBALS['egw_info']['server']['template_set'].'_framework.inc.php'))
|
||||
{
|
||||
$GLOBALS['egw_info']['server']['template_set'] = 'idots';
|
||||
}
|
||||
$tpldir = EGW_SERVER_ROOT . '/' . $appname . '/templates/' . $GLOBALS['egw_info']['server']['template_set'];
|
||||
$tpldir_default = EGW_SERVER_ROOT . '/' . $appname . '/templates/default';
|
||||
|
||||
if (@is_dir($tpldir))
|
||||
{
|
||||
return $tpldir;
|
||||
}
|
||||
elseif (@is_dir($tpldir_default))
|
||||
{
|
||||
return $tpldir_default;
|
||||
}
|
||||
return False;
|
||||
}
|
||||
}
|
||||
|
@ -389,7 +389,7 @@ function hl_email_tag_transform($element, $attribute_array=0)
|
||||
{
|
||||
$attribute_array['alt']= $attribute_array['alt'].' [blocked (reason: url length):'.$attribute_array['src'].']';
|
||||
if (!isset($attribute_array['title'])) $attribute_array['title']=$attribute_array['alt'];
|
||||
$attribute_array['src']=common::image('phpgwapi','dialog_error');
|
||||
$attribute_array['src']=Api\Image::find('phpgwapi','dialog_error');
|
||||
}
|
||||
if (!preg_match('/^cid:.*/',$attribute_array['src']))
|
||||
{
|
||||
@ -400,7 +400,7 @@ function hl_email_tag_transform($element, $attribute_array=0)
|
||||
{
|
||||
$attribute_array['alt']= $attribute_array['alt'].' [blocked external image:'.$attribute_array['src'].']';
|
||||
if (!isset($attribute_array['title'])) $attribute_array['title']=$attribute_array['alt'];
|
||||
$attribute_array['src']=common::image('mail','no-image-shown');
|
||||
$attribute_array['src']=Api\Image::find('mail','no-image-shown');
|
||||
$attribute_array['border'] = 1;
|
||||
if ($attribute_array['style'])
|
||||
{
|
||||
|
@ -145,7 +145,7 @@ class Link extends Link\Storage
|
||||
'name' => 'Accounts',
|
||||
'icon' => 'addressbook/accounts',
|
||||
'query' => 'accounts::link_query',
|
||||
'title' => 'common::grab_owner_name',
|
||||
'title' => 'EGroupware\\Api\\Accounts::username',
|
||||
'view' => array('menuaction'=>'addressbook.addressbook_ui.view','ajax'=>'true'),
|
||||
'view_id' => 'account_id'
|
||||
),
|
||||
|
@ -489,54 +489,11 @@ class common
|
||||
*
|
||||
* @param $appname appication name optional can be derived from $GLOBALS['egw_info']['flags']['currentapp'];
|
||||
* @return string|boolean dir or false if no dir is found
|
||||
* @deprecated use Api\Framework\Template::get_dir($appname)
|
||||
*/
|
||||
static function get_tpl_dir($appname = '')
|
||||
{
|
||||
if (!$appname)
|
||||
{
|
||||
$appname = $GLOBALS['egw_info']['flags']['currentapp'];
|
||||
}
|
||||
if ($appname == 'logout' || $appname == 'login')
|
||||
{
|
||||
$appname = 'phpgwapi';
|
||||
}
|
||||
|
||||
if (!isset($GLOBALS['egw_info']['server']['template_set']) && isset($GLOBALS['egw_info']['user']['preferences']['common']['template_set']))
|
||||
{
|
||||
$GLOBALS['egw_info']['server']['template_set'] = $GLOBALS['egw_info']['user']['preferences']['common']['template_set'];
|
||||
}
|
||||
|
||||
// Setting this for display of template choices in user preferences
|
||||
if ($GLOBALS['egw_info']['server']['template_set'] == 'user_choice')
|
||||
{
|
||||
$GLOBALS['egw_info']['server']['usrtplchoice'] = 'user_choice';
|
||||
}
|
||||
|
||||
if (($GLOBALS['egw_info']['server']['template_set'] == 'user_choice' ||
|
||||
!isset($GLOBALS['egw_info']['server']['template_set'])) &&
|
||||
isset($GLOBALS['egw_info']['user']['preferences']['common']['template_set']))
|
||||
{
|
||||
$GLOBALS['egw_info']['server']['template_set'] = $GLOBALS['egw_info']['user']['preferences']['common']['template_set'];
|
||||
}
|
||||
if (!file_exists(EGW_SERVER_ROOT.'/phpgwapi/templates/'.basename($GLOBALS['egw_info']['server']['template_set']).'/class.'.
|
||||
$GLOBALS['egw_info']['server']['template_set'].'_framework.inc.php') &&
|
||||
!file_exists(EGW_SERVER_ROOT.'/'.basename($GLOBALS['egw_info']['server']['template_set']).'/inc/class.'.
|
||||
$GLOBALS['egw_info']['server']['template_set'].'_framework.inc.php'))
|
||||
{
|
||||
$GLOBALS['egw_info']['server']['template_set'] = 'idots';
|
||||
}
|
||||
$tpldir = EGW_SERVER_ROOT . '/' . $appname . '/templates/' . $GLOBALS['egw_info']['server']['template_set'];
|
||||
$tpldir_default = EGW_SERVER_ROOT . '/' . $appname . '/templates/default';
|
||||
|
||||
if (@is_dir($tpldir))
|
||||
{
|
||||
return $tpldir;
|
||||
}
|
||||
elseif (@is_dir($tpldir_default))
|
||||
{
|
||||
return $tpldir_default;
|
||||
}
|
||||
return False;
|
||||
return Api\Framework\Template::get_dir($appname);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user