use proper file icons for image and audio files

This commit is contained in:
Robin Appelman 2011-07-29 01:36:31 +02:00
parent dbcebba882
commit 6d0c8ea7e4
4 changed files with 16 additions and 1 deletions

View File

Before

Width:  |  Height:  |  Size: 562 B

After

Width:  |  Height:  |  Size: 562 B

View File

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

View File

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

View File

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