|
|
|
@ -143,21 +143,26 @@ $(document).ready(function() { |
|
|
|
|
return false; |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
$('#file_upload_start').change(function(){ |
|
|
|
|
var files=$('#file_upload_start')[0].files; |
|
|
|
|
$('#file_upload_target').load(function(){ |
|
|
|
|
var response=jQuery.parseJSON($('#file_upload_target').contents().find('body').text()); |
|
|
|
|
$('.file_upload_start').live('change',function(){ |
|
|
|
|
var form=$(this).parent().parent(); |
|
|
|
|
var uploadId=form.attr('data-upload-id'); |
|
|
|
|
var files=this.files; |
|
|
|
|
var target=form.children('iframe'); |
|
|
|
|
target.load(function(){ |
|
|
|
|
var response=jQuery.parseJSON(target.contents().find('body').text()); |
|
|
|
|
//set mimetype and if needed filesize
|
|
|
|
|
for(var i=0;i<response.length;i++){ |
|
|
|
|
var file=response[i]; |
|
|
|
|
$('tr[data-file="'+file.name+'"]').attr('data-mime',file.mime); |
|
|
|
|
if(size=='Pending'){ |
|
|
|
|
$('tr[data-file='+file.name+'] td.filesize').text(file.size); |
|
|
|
|
if(response){ |
|
|
|
|
for(var i=0;i<response.length;i++){ |
|
|
|
|
var file=response[i]; |
|
|
|
|
$('tr[data-file="'+file.name+'"]').attr('data-mime',file.mime); |
|
|
|
|
if(size=='Pending'){ |
|
|
|
|
$('tr[data-file='+file.name+'] td.filesize').text(file.size); |
|
|
|
|
} |
|
|
|
|
FileList.loadingDone(file.name); |
|
|
|
|
} |
|
|
|
|
FileList.loadingDone(file.name); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
$('#file_upload_form').submit(); |
|
|
|
|
form.submit(); |
|
|
|
|
var date=new Date(); |
|
|
|
|
var uploadTime=formatDate(date); |
|
|
|
|
for(var i=0;i<files.length;i++){ |
|
|
|
@ -168,11 +173,20 @@ $(document).ready(function() { |
|
|
|
|
} |
|
|
|
|
FileList.addFile(files[i].name,size,uploadTime,true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//clone the upload form and hide the new one to allow users to start a new upload while the old one is still uploading
|
|
|
|
|
var clone=form.clone(); |
|
|
|
|
uploadId++; |
|
|
|
|
clone.attr('data-upload-id',uploadId); |
|
|
|
|
clone.attr('target','file_upload_target_'+uploadId); |
|
|
|
|
clone.children('iframe').attr('name','file_upload_target_'+uploadId) |
|
|
|
|
clone.insertBefore(form); |
|
|
|
|
form.hide(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
//add multiply file upload attribute to all browsers except konqueror (which crashes when it's used)
|
|
|
|
|
if(navigator.userAgent.search(/konqueror/i)==-1){ |
|
|
|
|
$('#file_upload_start').attr('multiple','multiple') |
|
|
|
|
$('.file_upload_start').attr('multiple','multiple') |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|