summaryrefslogtreecommitdiff
path: root/www/js/importer.js
diff options
context:
space:
mode:
Diffstat (limited to 'www/js/importer.js')
-rw-r--r--www/js/importer.js20
1 files changed, 15 insertions, 5 deletions
diff --git a/www/js/importer.js b/www/js/importer.js
index 7f8a0d8..bac23f6 100644
--- a/www/js/importer.js
+++ b/www/js/importer.js
@@ -57,6 +57,13 @@ Rivendell.Importer.prototype.openModal = function(group, groupView, createCart,
var self = this;
dropzone.on('addedfile', function(file) {
+ if (!Dropzone.isValidFile(file, dropzone.options.acceptedFiles)) {
+ $('div.modal-header h4', self.$el).text('Nicht unterstützter Dateityp.');
+ $('.modal-body', this.$el).css("background-image", "url('/img/dz-backdrop.png')");
+ $('#uploadModal-confirm', this.$el).attr('disabled','disabled').off('click');
+ return;
+ }
+
$('div.modal-header h4', self.$el).text(file.name);
$('div.modal-body', self.$el).css("background-image", "url('/img/audio_file.png')");
@@ -143,20 +150,21 @@ Rivendell.Upload.prototype.import = function() {
Rivendell.Upload.prototype.addCart = function(success) {
var files = this.dropzone.getAcceptedFiles();
+ var file = files[files.length - 1];
var self = this;
if (this.createCart) {
rdxport.addCart(this.group.groupName, 'audio', this.newCartNumber, function(cartXML) {
self.cart = new Rivendell.Cart(cartXML, self.group);
- success(files[0]);
+ success(file);
}).fail(function() {
//self.importFileUploadError(files[0], 'Failed to add Cart.');
});
} else {
this.cart = this.group.carts[0];
- success(files[0]);
+ success(file);
}
-};
+}
Rivendell.Upload.prototype.importFileUploadSuccess = function() {
this.dropzone.off(Dropzone.ERROR);
@@ -169,8 +177,10 @@ Rivendell.Upload.prototype.importFileUploadSuccess = function() {
};
Rivendell.Upload.prototype.importFileUploadError = function(file, msg, xhr) {
- this.groupView.uploadError(self, file, msg);
- this.cancel();
+ var self = this;
+ this.groupView.uploadError(this, file, msg, xhr, function() {
+ self.cancel();
+ });
};
Rivendell.Upload.prototype.addCut = function(file) {