From f00a50c76a76f6613ac9c9fcdef57f109e79f003 Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Thu, 24 May 2012 16:56:01 +0000 Subject: [PATCH] Add pending line in file list before trying to upload. Correct indentation --- apps/files/js/files.js | 221 ++++++++++++++++++++--------------------- 1 file changed, 110 insertions(+), 111 deletions(-) diff --git a/apps/files/js/files.js b/apps/files/js/files.js index 35d80b3cff2..ae6f7ada66d 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -213,115 +213,6 @@ $(document).ready(function() { } }); }else{ - if($.support.xhrFileUpload) { - for(var i=0;i tr').not('[data-mime]').fadeOut(); - $('#fileList > tr').not('[data-mime]').remove(); - } - }) - .error(function(jqXHR, textStatus, errorThrown) { - if(errorThrown === 'abort') { - $('#notification').hide(); - $('#notification').text(t('files', 'Upload cancelled.')); - $('#notification').fadeIn(); - } - }); - uploadingFiles[files[i].name] = jqXHR; - } - } - }else{ - data.submit().success(function(data, status) { - response = jQuery.parseJSON(data[0].body.innerText); - if(response[0] != undefined && response[0].status == 'success') { - var file=response[0]; - delete uploadingFiles[file.name]; - $('tr').filterAttr('data-file',file.name).data('mime',file.mime); - var size = $('tr').filterAttr('data-file',file.name).find('td.filesize').text(); - if(size==t('files','Pending')){ - $('tr').filterAttr('data-file',file.name).find('td.filesize').text(file.size); - } - FileList.loadingDone(file.name); - } else { - $('#notification').text(t('files', response.data.message)); - $('#notification').fadeIn(); - $('#fileList > tr').not('[data-mime]').fadeOut(); - $('#fileList > tr').not('[data-mime]').remove(); - } - }); - } - var date=new Date(); if(files){ for(var i=0;i tr').not('[data-mime]').fadeOut(); + $('#fileList > tr').not('[data-mime]').remove(); + } + }) + .error(function(jqXHR, textStatus, errorThrown) { + if(errorThrown === 'abort') { + $('#notification').hide(); + $('#notification').text(t('files', 'Upload cancelled.')); + $('#notification').fadeIn(); + } + }); + uploadingFiles[files[i].name] = jqXHR; + } + } + }else{ + data.submit().success(function(data, status) { + response = jQuery.parseJSON(data[0].body.innerText); + if(response[0] != undefined && response[0].status == 'success') { + var file=response[0]; + delete uploadingFiles[file.name]; + $('tr').filterAttr('data-file',file.name).data('mime',file.mime); + var size = $('tr').filterAttr('data-file',file.name).find('td.filesize').text(); + if(size==t('files','Pending')){ + $('tr').filterAttr('data-file',file.name).find('td.filesize').text(file.size); + } + FileList.loadingDone(file.name); + } else { + $('#notification').text(t('files', response.data.message)); + $('#notification').fadeIn(); + $('#fileList > tr').not('[data-mime]').fadeOut(); + $('#fileList > tr').not('[data-mime]').remove(); + } + }); } } }, -- 2.39.5