diff options
author | Peter Grassberger <petertheone@gmail.com> | 2016-02-02 23:04:45 (GMT) |
---|---|---|
committer | Peter Grassberger <petertheone@gmail.com> | 2016-02-02 23:04:45 (GMT) |
commit | f8ee82cd94a3fb16a392e6734f0e4c8f1ca3bf67 (patch) | |
tree | 1f4ea55d19b51f0846def7eb17620e4835da903a | |
parent | e3725629c6a74bccaa5b96f9ad93c752ad66799b (diff) |
some importer changes
-rw-r--r-- | www/js/importer.js | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/www/js/importer.js b/www/js/importer.js index e06e46c..f2c3db3 100644 --- a/www/js/importer.js +++ b/www/js/importer.js @@ -26,6 +26,8 @@ var Rivendell = Rivendell || {}; Rivendell.Importer = function() { this.$el = $('#uploadModal'); + + this.uploads = []; }; Rivendell.Importer.prototype.resetModal = function() { @@ -47,7 +49,7 @@ Rivendell.Importer.prototype.openModal = function(group, groupView, createCart, var $form = $('<form>'); var self = this; - $form.dropzone({ + var dropzone = $form.dropzone({ url: '/rd-bin/rdxport.cgi', parallelUploads: 1, maxFilesize: 2048, @@ -61,12 +63,11 @@ Rivendell.Importer.prototype.openModal = function(group, groupView, createCart, this.on('addedfile', function(file) { self.importFileAdded(this, file, group, groupView, createCart, useMetadata); }); - this.on('error', function(file, msg) { - self.importFileSelectError(this, file, msg); - }); } }); + this.uploads.push(dropzone); + $('.modal-body', this.$el).empty().append($form); this.$el.modal({keyboard: true}); }; @@ -86,18 +87,9 @@ Rivendell.Importer.prototype.importFileAdded = function(dropzone, file, group, g }).removeAttr('disabled'); }; -Rivendell.Importer.prototype.importFileSelectError = function(dropzone, file, msg) { - this.resetModal(); - dropzone.removeFile(file); -}; - Rivendell.Importer.prototype.importCartConfirm = function(dropzone, group, groupView, createCart, useMetadata) { this.$el.modal('hide'); - //var progressBar = group.addUpload(); - - - //var cart_row = $('#show-cart-' + cart); //cart_row.find('.btn').attr('disabled','disabled'); //var importing_row = jingles_newImportingEntry(cart); @@ -133,13 +125,11 @@ Rivendell.Importer.prototype.importCartConfirm = function(dropzone, group, group }; Rivendell.Importer.prototype.importFileUploadSuccess = function(dropzone, file, group) { - //var command = { LOGIN_NAME: auth_username, PASSWORD: auth_token, DESCRIPTION: file. }; - - //jingles_updateGroupCartInfo(cart); dropzone.disable(); - //progressBar.remove(); + this.uploads = $.grep(this.uploads, function(element) { + return element !== dropzone; + }); group.fetchCarts(); - //$(this.currentGroup.mainCart).trigger('add'); }; Rivendell.Importer.prototype.importFileUploadError = function(dropzone, file, msg, xhr) { @@ -149,7 +139,11 @@ Rivendell.Importer.prototype.importFileUploadError = function(dropzone, file, ms //}); //$('#show-cart-' + cart).replaceWith(error_row); //error_row.find('.file-name').text(file.name); + dropzone.removeFile(file); dropzone.disable(); + this.uploads = $.grep(this.uploads, function(element) { + return element !== dropzone; + }); }; Rivendell.Importer.prototype.importAddCut = function(dropzone, group, file, createCart, cart, useMetadata) { |