using new mime icons for tile view in 64x64

This commit is contained in:
Ralf Becker 2015-01-11 18:06:13 +00:00
parent 989adb3fc3
commit 4a12f12683
6 changed files with 34 additions and 11 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -1,6 +1,6 @@
/**
* EGroupware: CSS with less preprocessor
*
* FILEMANAGER
*
* Please do NOT change app.css directly, instead change app.less and compile it!

View File

@ -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' &&

View File

@ -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',

View File

@ -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');