diff options
-rw-r--r-- | core/img/mimetypes/audio.png (renamed from core/img/mimetypes/music.png) | bin | 562 -> 562 bytes | |||
-rw-r--r-- | files/js/filelist.js | 3 | ||||
-rw-r--r-- | files/js/files.js | 9 | ||||
-rwxr-xr-x | lib/helper.php | 5 |
4 files changed, 16 insertions, 1 deletions
diff --git a/core/img/mimetypes/music.png b/core/img/mimetypes/audio.png Binary files differindex 6333b947f07..6333b947f07 100644 --- a/core/img/mimetypes/music.png +++ b/core/img/mimetypes/audio.png diff --git a/files/js/filelist.js b/files/js/filelist.js index 252a9c95807..a53ad672e42 100644 --- a/files/js/filelist.js +++ b/files/js/filelist.js @@ -96,7 +96,8 @@ FileList={ }, loadingDone:function(name){ $('tr[data-file="'+name+'"]').data('loading',false); - $('tr[data-file="'+name+'"] td.filename a').attr('style','background-image:url(img/file.png'); + var mime=$('tr[data-file="'+name+'"]').data('mime'); + $('tr[data-file="'+name+'"] td.filename a').attr('style','background-image:url('+getMimeIcon(mime)+')'); $('tr[data-file="'+name+'"] td.filename').draggable(dragOptions); }, isLoading:function(name){ diff --git a/files/js/files.js b/files/js/files.js index 60f2b2aec87..193c740b6c5 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -437,3 +437,12 @@ function relative_modified_date(timestamp) { else if(timediff < 63113852) { return 'last year'; } else { return diffyears+' years ago'; } } + +function getMimeIcon(mime){ + mime=mime.substr(0,mime.indexOf('/')); + var knownMimes=['image','audio']; + if(knownMimes.indexOf(mime)==-1){ + mime='file'; + } + return OC.imagePath('core','mimetypes/'+mime+'.png'); +}
\ No newline at end of file diff --git a/lib/helper.php b/lib/helper.php index 1fbcc589d10..ffb25877433 100755 --- a/lib/helper.php +++ b/lib/helper.php @@ -110,6 +110,11 @@ class OC_HELPER { if( file_exists( "$SERVERROOT/core/img/mimetypes/$mimetype.png" )){ return "$WEBROOT/core/img/mimetypes/$mimetype.png"; } + //try only the first part of the mimetype + $mimetype=substr($mimetype,0,strpos($mimetype,'-')); + if( file_exists( "$SERVERROOT/core/img/mimetypes/$mimetype.png" )){ + return "$WEBROOT/core/img/mimetypes/$mimetype.png"; + } else{ return "$WEBROOT/core/img/mimetypes/file.png"; } |