use proper file icons for image and audio files
This commit is contained in:
parent
dbcebba882
commit
6d0c8ea7e4
Before Width: | Height: | Size: 562 B After Width: | Height: | Size: 562 B |
|
@ -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){
|
||||
|
|
|
@ -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');
|
||||
}
|
|
@ -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";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue