diff --git a/filemanager/templates/default/app.css b/filemanager/templates/default/app.css index ce3d69e691..6291559938 100644 --- a/filemanager/templates/default/app.css +++ b/filemanager/templates/default/app.css @@ -77,7 +77,7 @@ table.egwGridView_grid .tile .file_tile { table.egwGridView_grid .tile .file_tile img.vfsMimeIcon { height: auto; width: auto; - max-height: 120px; + max-height: 64px; display:block; margin: 0 auto; } diff --git a/filemanager/templates/pixelegg/app.css b/filemanager/templates/pixelegg/app.css index 7b083f908a..d60b6a57fb 100755 --- a/filemanager/templates/pixelegg/app.css +++ b/filemanager/templates/pixelegg/app.css @@ -1,6 +1,6 @@ /** * EGroupware: CSS with less preprocessor - + * * FILEMANAGER * * Please do NOT change app.css directly, instead change app.less and compile it! @@ -107,7 +107,7 @@ table.egwGridView_grid .tile .file_tile { table.egwGridView_grid .tile .file_tile img.vfsMimeIcon { height: auto; width: auto; - max-height: 120px; + max-height: 64px; display: block; margin: 0 auto; } diff --git a/filemanager/templates/pixelegg/app.less b/filemanager/templates/pixelegg/app.less index 80c0f98138..1005b6a1f6 100644 --- a/filemanager/templates/pixelegg/app.less +++ b/filemanager/templates/pixelegg/app.less @@ -1,6 +1,6 @@ /** * EGroupware: CSS with less preprocessor - + * * FILEMANAGER * * Please do NOT change app.css directly, instead change app.less and compile it! diff --git a/phpgwapi/inc/class.egw_vfs.inc.php b/phpgwapi/inc/class.egw_vfs.inc.php index a160558491..0f68c43af8 100644 --- a/phpgwapi/inc/class.egw_vfs.inc.php +++ b/phpgwapi/inc/class.egw_vfs.inc.php @@ -1131,10 +1131,13 @@ class egw_vfs extends vfs_stream_wrapper $mime_full = strtolower(str_replace ('/','_',$mime_type)); list($mime_part) = explode('_',$mime_full); - if (!($img=$GLOBALS['egw']->common->image('etemplate',$icon='mime'.$size.'_'.$mime_full)) && - !($img=$GLOBALS['egw']->common->image('etemplate',$icon='mime'.$size.'_'.$mime_part))) + if (!($img=common::image('etemplate',$icon='mime'.$size.'_'.$mime_full)) && + // check mime-alias-map before falling back to more generic icons + !(isset(mime_magic::$mime_alias_map[$mime_type]) && + ($img=common::image('etemplate',$icon='mime'.$size.'_'.str_replace('/','_',self::$mime_alias_map[$mime_full])))) && + !($img=common::image('etemplate',$icon='mime'.$size.'_'.$mime_part))) { - $img = $GLOBALS['egw']->common->image('etemplate',$icon='mime'.$size.'_unknown'); + $img = common::image('etemplate',$icon='mime'.$size.'_unknown'); } if ($et_image === 'url') { @@ -1813,7 +1816,7 @@ class egw_vfs extends vfs_stream_wrapper if ($mime_main == 'egw') { - $image = $GLOBALS['egw']->common->image($mime_sub, 'navbar'); + $image = common::image($mime_sub, 'navbar'); } else if ($file && $mime_main == 'image' && in_array($mime_sub, array('png','jpeg','jpg','gif','bmp')) && (string)$GLOBALS['egw_info']['server']['link_list_thumbnail'] != '0' && diff --git a/phpgwapi/inc/class.mime_magic.inc.php b/phpgwapi/inc/class.mime_magic.inc.php index bafe521b77..945d6c12c3 100644 --- a/phpgwapi/inc/class.mime_magic.inc.php +++ b/phpgwapi/inc/class.mime_magic.inc.php @@ -1658,6 +1658,8 @@ class mime_magic ); /** * Mapping some old formats to the newer form, or any other aliasing for mime-types + * + * Should be in sync with ../js/jsapi/egw_image.js */ static $mime_alias_map = array( 'text/vcard' => 'text/x-vcard', diff --git a/phpgwapi/js/jsapi/egw_images.js b/phpgwapi/js/jsapi/egw_images.js index a7aa439dff..53ddb22d14 100644 --- a/phpgwapi/js/jsapi/egw_images.js +++ b/phpgwapi/js/jsapi/egw_images.js @@ -25,6 +25,23 @@ egw.extend('images', egw.MODULE_GLOBAL, function() { */ var images = {}; + /** + * Mapping some old formats to the newer form, or any other aliasing for mime-types + * + * Should be in sync with ../inc/class.mime_magic.inc.php + */ + var mime_alias_map = { + 'text/vcard': 'text/x-vcard', + 'text/comma-separated-values': 'text/csv', + 'text/rtf': 'application/rtf', + 'text/xml': 'application/xml', + 'text/x-diff': 'text/diff', + 'application/x-jar': 'application/java-archive', + 'application/x-javascript': 'application/javascript', + 'application/x-troff': 'text/troff', + 'application/x-egroupware-etemplate': 'application/xml' + }; + return { /** * Set imagemap, called from /phpgwapi/images.php @@ -99,12 +116,12 @@ egw.extend('images', egw.MODULE_GLOBAL, function() { * * @param {string} _mime * @param {string} _path vfs path to generate thumbnails for images - * @param {number} _size defaults to 16 (only supported size currently) + * @param {number} _size defaults to 128 (only supported size currently) * @returns url of image */ mime_icon: function(_mime, _path, _size) { - if (typeof _size == 'undefined') _size = 16; + if (typeof _size == 'undefined') _size = 128; if (!_mime) _mime = 'unknown'; if (_mime == 'httpd/unix-directory') _mime = 'directory'; @@ -123,7 +140,8 @@ egw.extend('images', egw.MODULE_GLOBAL, function() { } else { - if ((typeof type[1] == 'undefined' || !(image = this.image('mime'+_size+'_'+type[0]+'_'+type[1], 'etemplate'))) && + if ((typeof type[1] == 'undefined' || !(image = this.image('mime'+_size+'_'+type[0]+'_'+type[1], 'etemplate')) && + !(typeof mime_alias_map[_mime] != 'undefined' && (image=this.mime_icon(mime_alias_map[_mime], _path, _size)))) && !(image = this.image('mime'+_size+'_'+type[0], 'etemplate'))) { image = this.image('mime'+_size+'_unknown', 'etemplate');