1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-31 22:54:11 +00:00

Make open-via-client in community edition and clean code for file/dir icons

This commit is contained in:
Daniel Pan
2016-02-29 15:29:29 +08:00
parent 003838b8f1
commit 463b48c788
23 changed files with 119 additions and 33 deletions

View File

@@ -148,6 +148,77 @@ define([
}
},
FILEEXT_ICON_MAP: {
// text file
'md': 'txt.png',
'txt': 'txt.png',
// pdf file
'pdf' : 'pdf.png',
// document file
'doc' : 'word.png',
'docx' : 'word.png',
'ppt' : 'ppt.png',
'pptx' : 'ppt.png',
'xls' : 'excel.png',
'xlsx' : 'excel.png',
'txt' : 'txt.png',
'odt' : 'word.png',
'fodt' : 'word.png',
'ods' : 'excel.png',
'fods' : 'excel.png',
'odp' : 'ppt.png',
'fodp' : 'ppt.png',
// music file
'mp3' : 'music.png',
'oga' : 'music.png',
'ogg' : 'music.png',
'flac' : 'music.png',
'aac' : 'music.png',
'ac3' : 'music.png',
'wma' : 'music.png',
// image file
'jpg' : 'pic.png',
'jpeg' : 'pic.png',
'png' : 'pic.png',
'svg' : 'pic.png',
'gif' : 'pic.png',
'bmp' : 'pic.png',
'ico' : 'pic.png',
// default
'default' : 'file.png'
},
getFileIconUrl: function(filename, size) {
if (size > 24) {
size = 192;
} else {
size = 24;
}
var file_ext;
if (filename.lastIndexOf('.') == -1) {
return app.config.mediaUrl + "img/file/" + size + "/"
+ this.FILEEXT_ICON_MAP['default'];
} else {
file_ext = filename.substr(filename.lastIndexOf('.') + 1).toLowerCase();
}
if (_.has(this.FILEEXT_ICON_MAP, file_ext)) {
return app.config.mediaUrl + "img/file/" + size + "/" + this.FILEEXT_ICON_MAP[file_ext];
} else {
return app.config.mediaUrl + "img/file/" + size + "/" + this.FILEEXT_ICON_MAP['default'];
}
},
getDirIconUrl: function(is_readonly, size) {
if (is_readonly) {
return app.config.mediaUrl + "img/folder-read-only-192.png";
} else {
return app.config.mediaUrl + "img/folder-beige-192.png";
}
},
showConfirm: function(title, content, yesCallback) {
var $popup = $("#confirm-popup");
var $cont = $('#confirm-con');