Add pending line in file list before trying to upload. Correct indentation

This commit is contained in:
Brice Maron 2012-05-24 16:56:01 +00:00
parent 2f40f11c87
commit f00a50c76a
1 changed files with 110 additions and 111 deletions

View File

@ -213,6 +213,36 @@ $(document).ready(function() {
} }
}); });
}else{ }else{
var date=new Date();
if(files){
for(var i=0;i<files.length;i++){
if(files[i].size>0){
var size=files[i].size;
}else{
var size=t('files','Pending');
}
if(files && !dirName){
FileList.addFile(getUniqueName(files[i].name),size,date,true);
} else if(dirName) {
var uploadtext = $('tr').filterAttr('data-type', 'dir').filterAttr('data-file', dirName).find('.uploadtext')
var currentUploads = parseInt(uploadtext.attr('currentUploads'));
currentUploads += 1;
uploadtext.attr('currentUploads', currentUploads);
if(currentUploads === 1) {
var img = OC.imagePath('core', 'loading.gif');
var tr=$('tr').filterAttr('data-file',dirName);
tr.find('td.filename').attr('style','background-image:url('+img+')');
uploadtext.text('1 file uploading');
uploadtext.show();
} else {
uploadtext.text(currentUploads + ' files uploading')
}
}
}
}else{
var filename=this.value.split('\\').pop(); //ie prepends C:\fakepath\ in front of the filename
FileList.addFile(getUniqueName(filename),'Pending',date,true);
}
if($.support.xhrFileUpload) { if($.support.xhrFileUpload) {
for(var i=0;i<files.length;i++){ for(var i=0;i<files.length;i++){
var fileName = files[i].name var fileName = files[i].name
@ -321,37 +351,6 @@ $(document).ready(function() {
} }
}); });
} }
var date=new Date();
if(files){
for(var i=0;i<files.length;i++){
if(files[i].size>0){
var size=files[i].size;
}else{
var size=t('files','Pending');
}
if(files && !dirName){
FileList.addFile(getUniqueName(files[i].name),size,date,true);
} else if(dirName) {
var uploadtext = $('tr').filterAttr('data-type', 'dir').filterAttr('data-file', dirName).find('.uploadtext')
var currentUploads = parseInt(uploadtext.attr('currentUploads'));
currentUploads += 1;
uploadtext.attr('currentUploads', currentUploads);
if(currentUploads === 1) {
var img = OC.imagePath('core', 'loading.gif');
var tr=$('tr').filterAttr('data-file',dirName);
tr.find('td.filename').attr('style','background-image:url('+img+')');
uploadtext.text('1 file uploading');
uploadtext.show();
} else {
uploadtext.text(currentUploads + ' files uploading')
}
}
}
}else{
var filename=this.value.split('\\').pop(); //ie prepends C:\fakepath\ in front of the filename
FileList.addFile(getUniqueName(filename),'Pending',date,true);
}
} }
}, },
fail: function(e, data) { fail: function(e, data) {