summaryrefslogtreecommitdiff
path: root/www
diff options
context:
space:
mode:
Diffstat (limited to 'www')
-rw-r--r--www/js/importer.js30
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) {