mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-08 00:54:15 +01:00
mime_icon method for vfs-mime widget
This commit is contained in:
parent
32f02acf8f
commit
fbdb8f3c55
@ -199,7 +199,7 @@ var et2_vfsMime = et2_valueWidget.extend([et2_IDetachedDOM], {
|
||||
{
|
||||
src += "&thsize="+this.options.size;
|
||||
}
|
||||
this.image.css("width", "100%");
|
||||
this.image.css("max-width", "100%");
|
||||
}
|
||||
this.image.attr("src", src);
|
||||
}
|
||||
@ -233,7 +233,7 @@ et2_register_widget(et2_vfsMime, ["vfs-mime"]);
|
||||
*/
|
||||
var et2_vfsSize = et2_description.extend({
|
||||
init: function() {
|
||||
this._super.apply(this, arguments);
|
||||
this._super.apply(this, arguments);
|
||||
this.span.addClass("et2_vfs");
|
||||
},
|
||||
human_size: function(size) {
|
||||
|
@ -89,6 +89,43 @@ egw.extend('images', egw.MODULE_GLOBAL, function() {
|
||||
if(matches != null) tries[_app + " (matched)"]= matches;
|
||||
console.log('egw.image("'+_name+'", "'+_app+'") image NOT found! Tried ', tries);
|
||||
return null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Get image url for a given mime-type and option file
|
||||
*
|
||||
* @param _mime
|
||||
* @param _path vfs path to generate thumbnails for images
|
||||
* @param _size defaults to 16 (only supported size currently)
|
||||
* @returns url of image
|
||||
*/
|
||||
mime_icon: function(_mime, _path, _size)
|
||||
{
|
||||
if (typeof _size == 'undefined') _size = 16;
|
||||
if (!_mime) _mime = 'unknown';
|
||||
if (_mime == 'httpd/unix-directory') _mime = 'directory';
|
||||
|
||||
var type = _mime.toLowerCase().split('/');
|
||||
var image;
|
||||
|
||||
if (type[0] == 'egw' && (image = this.image('navbar',type[1])))
|
||||
{
|
||||
|
||||
}
|
||||
else if (typeof _path == 'string' && type[0] == 'image' && type[1].match(/^(png|jpe?g|gif|bmp)$/))
|
||||
{
|
||||
var thsize = this.config('link_list_thumbnail') || 32;
|
||||
image = this.link('/etemplate/thumbnail.php',{ 'path': _path, 'thsize': thsize});
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((typeof type[1] == 'undefined' || !(image = this.image('mime'+_size+'_'+type[0]+'_'+type[1], 'etemplate'))) &&
|
||||
!(image = this.image('mime'+_size+'_'+type[0], 'etemplate')))
|
||||
{
|
||||
image = this.image('mime'+_size+'_unknown', 'etemplate');
|
||||
}
|
||||
}
|
||||
return image;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user