Implement taglist-thumbnail for rest of upload image fields in admin site configuration

This commit is contained in:
Hadi Nategh
2018-05-29 11:05:08 +02:00
parent 92f85df3cb
commit e9f1e8bcad
5 changed files with 48 additions and 30 deletions

View File

@@ -555,20 +555,11 @@ abstract class Framework extends Framework\Extra
$api_messages = lang('it has been more then %1 days since you changed your password',$GLOBALS['egw_info']['server']['change_pwd_every_x_days']);
}
if (substr($GLOBALS['egw_info']['server']['login_logo_file'],0,4) == 'http' ||
$GLOBALS['egw_info']['server']['login_logo_file'][0] == '/')
{
$var['logo_header'] = $var['logo_file'] = $GLOBALS['egw_info']['server']['login_logo_file'];
}
else
{
$var['logo_header'] = $var['logo_file'] = Image::find('phpgwapi',$GLOBALS['egw_info']['server']['login_logo_file']?$GLOBALS['egw_info']['server']['login_logo_file']:'logo', '', null); // null=explicit allow svg
}
$var['logo_header'] = $var['logo_file'] = self::get_login_logo_or_bg_url('login_logo_file', 'logo');
if (substr($GLOBALS['egw_info']['server']['login_logo_header'],0,4) == 'http' ||
$GLOBALS['egw_info']['server']['login_logo_header'][0] == '/')
if ($GLOBALS['egw_info']['server']['login_logo_header'])
{
$var['logo_header'] = $GLOBALS['egw_info']['server']['login_logo_header'];
$var['logo_header'] = self::get_login_logo_or_bg_url('login_logo_header', 'logo');
}
$var['logo_url'] = $GLOBALS['egw_info']['server']['login_logo_url']?$GLOBALS['egw_info']['server']['login_logo_url']:'http://www.eGroupWare.org';
@@ -582,6 +573,31 @@ abstract class Framework extends Framework\Extra
return $var;
}
/**
* Get login logo or background image base on requested config type
*
* @param type $type config type to fetch. e.g.: "login_logo_file"
* @param type $find_type type of image to search on as alternative option. e.g.: "logo"
*
* @return string returns full url of the image
*/
static function get_login_logo_or_bg_url ($type, $find_type)
{
$url = is_array($GLOBALS['egw_info']['server'][$type]) ?
$GLOBALS['egw_info']['server'][$type][0] :
$GLOBALS['egw_info']['server'][$type];
if (substr($url, 0, 4) == 'http' ||
$url[0] == '/')
{
return $url;
}
else
{
return Image::find('api',$url ? $url : $find_type, '', null);
}
}
/**
* Returns Html with user and time
*

View File

@@ -175,15 +175,8 @@ class Login
$var['background_file'] = self::pick_login_background($GLOBALS['egw_info']['server']['login_background_file']);
if (substr($GLOBALS['egw_info']['server']['login_logo_file'], 0, 4) == 'http' ||
$GLOBALS['egw_info']['server']['login_logo_file'][0] == '/')
{
$var['logo_file'] = $GLOBALS['egw_info']['server']['login_logo_file'];
}
else
{
$var['logo_file'] = Api\Image::find('api',$GLOBALS['egw_info']['server']['login_logo_file']?$GLOBALS['egw_info']['server']['login_logo_file']:'login_logo', '', null); // null=explicit allow svg
}
$var['logo_file'] = Api\Framework::get_login_logo_or_bg_url('login_logo_file', 'login_logo');
$var['logo_url'] = $GLOBALS['egw_info']['server']['login_logo_url']?$GLOBALS['egw_info']['server']['login_logo_url']:'http://www.egroupware.org';
if (substr($var['logo_url'],0,4) != 'http')
{