From 6b034ad2f9ef2d5443cc9b1b02b19ba20a11f37f Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 20 Jul 2011 15:50:42 +0200 Subject: [PATCH] Allow users to start a new upload before the current upload has finished --- files/css/files.css | 14 +++++++------- files/js/files.js | 38 ++++++++++++++++++++++++++------------ files/templates/index.php | 10 +++++----- 3 files changed, 38 insertions(+), 24 deletions(-) diff --git a/files/css/files.css b/files/css/files.css index 40ce67c66ff..f4da6fae98c 100644 --- a/files/css/files.css +++ b/files/css/files.css @@ -20,7 +20,7 @@ text-decoration: none; } -#file_upload_form, #file_newfolder_form { +.file_upload_form, #file_newfolder_form { display: inline; margin-left:3em; } @@ -29,23 +29,23 @@ display: none; } -#file_upload_filename, #file_newfolder_name { +.file_upload_filename, #file_newfolder_name { background-repeat: no-repeat; background-position: 0.5em 0; padding-left: 2em; } -#file_upload_filename { +.file_upload_filename { background-image:url(../img/file.png); font-weight:bold; } -#file_upload_start {opacity:0;filter: alpha(opacity = 0);} +.file_upload_start {opacity:0;filter: alpha(opacity = 0);} #file_newfolder_name { background-image:url(../img/folder.png); font-weight:bold; width: 14em; } -#file_upload_start, #file_upload_filename{ +.file_upload_start, .file_upload_filename{ position:absolute; top:0px; left:0px; @@ -53,7 +53,7 @@ font-size: 0.9em; } -#file_upload_wrapper{ +.file_upload_wrapper{ position:relative; top:-1.2em; left:-2em; @@ -66,7 +66,7 @@ width: 3em; } -#file_upload_target { +.file_upload_target { display: none; } diff --git a/files/js/files.js b/files/js/files.js index af0c344f18d..d4191215972 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -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
-
+ " id="max_upload"> )"> " id="dir"> -
- )"/> - +
+ )"/> +
  - +