translate mime types to icons, update some icons, move file preview (upload progress) below table header
This commit is contained in:
parent
02fc082e45
commit
9fa3956aa8
@ -74,6 +74,7 @@ function z_mime_content_type($filename) {
|
|||||||
// 'webm' => 'audio/webm',
|
// 'webm' => 'audio/webm',
|
||||||
'mp4' => 'video/mp4',
|
'mp4' => 'video/mp4',
|
||||||
// 'mp4' => 'audio/mp4',
|
// 'mp4' => 'audio/mp4',
|
||||||
|
'mkv' => 'video/x-matroska',
|
||||||
|
|
||||||
// adobe
|
// adobe
|
||||||
'pdf' => 'application/pdf',
|
'pdf' => 'application/pdf',
|
||||||
|
@ -2608,32 +2608,33 @@ function getIconFromType($type) {
|
|||||||
'application/octet-stream' => 'fa-file-o',
|
'application/octet-stream' => 'fa-file-o',
|
||||||
//Text
|
//Text
|
||||||
'text/plain' => 'fa-file-text-o',
|
'text/plain' => 'fa-file-text-o',
|
||||||
'application/msword' => 'fa-file-text-o',
|
'application/msword' => 'fa-file-word-o',
|
||||||
'application/pdf' => 'fa-file-text-o',
|
'application/pdf' => 'fa-file-pdf-o',
|
||||||
'application/vnd.oasis.opendocument.text' => 'fa-file-text-o',
|
'application/vnd.oasis.opendocument.text' => 'fa-file-word-o',
|
||||||
'application/epub+zip' => 'fa-book',
|
'application/epub+zip' => 'fa-book',
|
||||||
//Spreadsheet
|
//Spreadsheet
|
||||||
'application/vnd.oasis.opendocument.spreadsheet' => 'fa-table',
|
'application/vnd.oasis.opendocument.spreadsheet' => 'fa-file-excel-o',
|
||||||
'application/vnd.ms-excel' => 'fa-table',
|
'application/vnd.ms-excel' => 'fa-file-excel-o',
|
||||||
//Image
|
//Image
|
||||||
'image/jpeg' => 'fa-picture-o',
|
'image/jpeg' => 'fa-picture-o',
|
||||||
'image/png' => 'fa-picture-o',
|
'image/png' => 'fa-picture-o',
|
||||||
'image/gif' => 'fa-picture-o',
|
'image/gif' => 'fa-picture-o',
|
||||||
'image/svg+xml' => 'fa-picture-o',
|
'image/svg+xml' => 'fa-picture-o',
|
||||||
//Archive
|
//Archive
|
||||||
'application/zip' => 'fa-archive',
|
'application/zip' => 'fa-file-archive-o',
|
||||||
'application/x-rar-compressed' => 'fa-archive',
|
'application/x-rar-compressed' => 'fa-file-archive-o',
|
||||||
//Audio
|
//Audio
|
||||||
'audio/mpeg' => 'fa-music',
|
'audio/mpeg' => 'fa-file-audio-o',
|
||||||
'audio/wav' => 'fa-music',
|
'audio/wav' => 'fa-file-audio-o',
|
||||||
'application/ogg' => 'fa-music',
|
'application/ogg' => 'fa-file-audio-o',
|
||||||
'audio/ogg' => 'fa-music',
|
'audio/ogg' => 'fa-file-audio-o',
|
||||||
'audio/webm' => 'fa-music',
|
'audio/webm' => 'fa-file-audio-o',
|
||||||
'audio/mp4' => 'fa-music',
|
'audio/mp4' => 'fa-file-audio-o',
|
||||||
//Video
|
//Video
|
||||||
'video/quicktime' => 'fa-film',
|
'video/quicktime' => 'fa-file-video-o',
|
||||||
'video/webm' => 'fa-film',
|
'video/webm' => 'fa-file-video-o',
|
||||||
'video/mp4' => 'fa-film'
|
'video/mp4' => 'fa-file-video-o',
|
||||||
|
'video/x-matroska' => 'fa-file-video-o'
|
||||||
);
|
);
|
||||||
|
|
||||||
$iconFromType = 'fa-file-o';
|
$iconFromType = 'fa-file-o';
|
||||||
|
@ -83,11 +83,13 @@ function UploadFileSelectHandler(e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function prepareHtml(f, i) {
|
function prepareHtml(f, i) {
|
||||||
$("#cloud-index").prepend(
|
$("#cloud-index tr:nth-child(2)").after(
|
||||||
"<tr class='new-upload'>" + "<td id='upload-progress-" + i + "'></td><td>" + f.name +
|
"<tr class='new-upload'>" +
|
||||||
"</td><td>" + f.type +
|
"<td><i class='fa " + getIconFromType(f.type) + "' title='" + f.type + "'></i></td>" +
|
||||||
"</td><td></td><td></td><td></td><td></td><td>" + formatSizeUnits(f.size) +
|
"<td>" + f.name + "</td>" +
|
||||||
"</td><td></td></tr>"
|
"<td id='upload-progress-" + i + "'></td><td></td><td></td><td></td><td></td>" +
|
||||||
|
"<td class='hiiden-xs'>" + formatSizeUnits(f.size) + "</td><td class='hiiden-xs'></td>" +
|
||||||
|
"</tr>"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,6 +103,51 @@ function formatSizeUnits(bytes){
|
|||||||
return bytes;
|
return bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// this is basically a js port of include/text.php getIconFromType() function
|
||||||
|
function getIconFromType(type) {
|
||||||
|
var map = {
|
||||||
|
//Common file
|
||||||
|
'application/octet-stream': 'fa-file-o',
|
||||||
|
//Text
|
||||||
|
'text/plain': 'fa-file-text-o',
|
||||||
|
'application/msword': 'fa-file-word-o',
|
||||||
|
'application/pdf': 'fa-file-pdf-o',
|
||||||
|
'application/vnd.oasis.opendocument.text': 'fa-file-word-o',
|
||||||
|
'application/epub+zip': 'fa-book',
|
||||||
|
//Spreadsheet
|
||||||
|
'application/vnd.oasis.opendocument.spreadsheet': 'fa-file-excel-o',
|
||||||
|
'application/vnd.ms-excel': 'fa-file-excel-o',
|
||||||
|
//Image
|
||||||
|
'image/jpeg': 'fa-picture-o',
|
||||||
|
'image/png': 'fa-picture-o',
|
||||||
|
'image/gif': 'fa-picture-o',
|
||||||
|
'image/svg+xml': 'fa-picture-o',
|
||||||
|
//Archive
|
||||||
|
'application/zip': 'fa-file-archive-o',
|
||||||
|
'application/x-rar-compressed': 'fa-file-archive-o',
|
||||||
|
//Audio
|
||||||
|
'audio/mpeg': 'fa-file-audio-o',
|
||||||
|
'audio/wav': 'fa-file-audio-o',
|
||||||
|
'application/ogg': 'fa-file-audio-o',
|
||||||
|
'audio/ogg': 'fa-file-audio-o',
|
||||||
|
'audio/webm': 'fa-file-audio-o',
|
||||||
|
'audio/mp4': 'fa-file-audio-o',
|
||||||
|
//Video
|
||||||
|
'video/quicktime': 'fa-file-video-o',
|
||||||
|
'video/webm': 'fa-file-video-o',
|
||||||
|
'video/mp4': 'fa-file-video-o',
|
||||||
|
'video/x-matroska': 'fa-file-video-o'
|
||||||
|
};
|
||||||
|
|
||||||
|
var iconFromType = 'fa-file-o';
|
||||||
|
|
||||||
|
if (type in map) {
|
||||||
|
iconFromType = map[type];
|
||||||
|
}
|
||||||
|
|
||||||
|
return iconFromType;
|
||||||
|
}
|
||||||
|
|
||||||
// upload files
|
// upload files
|
||||||
function UploadFile(file, idx) {
|
function UploadFile(file, idx) {
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user