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

@ -57,15 +57,15 @@
<row>
<description value="Upload your logo or enter the URL" label="%s:"/>
<vbox>
<textbox id="newsettings[login_logo_file]" width="100%"/>
<file onchange="egw.json('admin.admin_config.ajax_upload_anon_images',[widget.get_value()], function(_data){widget._parent._children[0].set_value(_data.path)}).sendRequest()" width="100%" label="upload"/>
<taglist-thumbnail id="newsettings[login_logo_file]" width="100%" allowFreeEntries="true" maxSelection="1" />
<file onchange="egw.json('admin.admin_config.ajax_upload_anon_images',[widget.get_value(), []], function(_data){widget._parent._children[0].set_value(_data)}).sendRequest()" width="100%" label="upload"/>
</vbox>
</row>
<row>
<description value="Upload your header logo or enter the URL" label="%s:"/>
<vbox>
<textbox id="newsettings[login_logo_header]" width="100%"/>
<file onchange="egw.json('admin.admin_config.ajax_upload_anon_images',[widget.get_value()], function(_data){widget._parent._children[0].set_value(_data.path)}).sendRequest()" width="100%" label="upload"/>
<taglist-thumbnail id="newsettings[login_logo_header]" width="100%" allowFreeEntries="true" maxSelection="1"/>
<file onchange="egw.json('admin.admin_config.ajax_upload_anon_images',[widget.get_value(), []], function(_data){widget._parent._children[0].set_value(_data)}).sendRequest()" width="100%" label="upload"/>
</vbox>
</row>
<row>
@ -89,8 +89,8 @@
<row>
<description value="Upload your favicon or enter the URL" label="%s:"/>
<vbox>
<textbox id="newsettings[favicon_file]" class="et2_fullWidth"/>
<file width="100%" label="upload" onchange="egw.json('admin.admin_config.ajax_upload_anon_images',[widget.get_value()], function(_data){widget._parent._children[0].set_value(_data.path)}).sendRequest()"/>
<taglist-thumbnail id="newsettings[favicon_file]" class="et2_fullWidth"/>
<file width="100%" label="upload" onchange="egw.json('admin.admin_config.ajax_upload_anon_images',[widget.get_value(), []], function(_data){widget._parent._children[0].set_value(_data)}).sendRequest()"/>
</vbox>
</row>
<row>

View File

@ -1319,12 +1319,13 @@ var et2_taglist_thumbnail = (function(){ "use strict"; return et2_taglist.extend
init:function ()
{
this._super.apply(this, arguments);
this.div.addClass('et2_taglist_thumbnail');
},
selectionRenderer: function(item)
{
var tag = jQuery('<span>').attr('title',item.label);
jQuery('<img class="et2_taglist_thumbnail"/>').attr('src', item.label).prependTo(tag);
jQuery('<img class="et2_taglist_thumbnail_img"/>').attr('src', item.label).prependTo(tag);
return tag;
}
});}).call(this);

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')
{

View File

@ -1087,8 +1087,16 @@ ul.et2_link_string {
.et2_taglist, .et2_taglist > div.ms-ctn {
min-height: 23px;
}
img.et2_taglist_thumbnail, table.egwGridView_grid .et2_taglist .et2_taglist_thumbnail {
height:100px;
.et2_taglist_thumbnail {
overflow-y: hidden;
}
.et2_taglist_thumbnail .ms-ctn.form-control {
max-height: 220px;
overflow-y: auto;
}
.et2_taglist_thumbnail .et2_taglist_thumbnail_img,
table.egwGridView_grid .et2_taglist_thumbnail .et2_taglist_thumbnail_img {
height:70px;
}
/* Toggle single / multiple */
.et2_taglist_toggle {