diff options
Diffstat (limited to 'www/js')
-rw-r--r-- | www/js/importer.js | 20 | ||||
-rw-r--r-- | www/js/jingles.js | 5 | ||||
-rw-r--r-- | www/js/musicpools.js | 5 | ||||
-rw-r--r-- | www/js/shows.js | 20 |
4 files changed, 35 insertions, 15 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) { diff --git a/www/js/jingles.js b/www/js/jingles.js index c60d7fe..0bb586c 100644 --- a/www/js/jingles.js +++ b/www/js/jingles.js @@ -147,8 +147,11 @@ Rivendell.JingleGroupView.prototype.uploadProgress = function(upload, file) { } }; -Rivendell.JingleGroupView.prototype.uploadError = function(upload, file, msg) { +Rivendell.JingleGroupView.prototype.uploadError = function(upload, file, msg, xhr, acknowledge) { // todo + + // to this on ok click. + acknowledge(); }; Rivendell.JingleCartView = function(model, groupView, active) { diff --git a/www/js/musicpools.js b/www/js/musicpools.js index a5cd323..3a694b9 100644 --- a/www/js/musicpools.js +++ b/www/js/musicpools.js @@ -182,8 +182,11 @@ Rivendell.MusicpoolView.prototype.uploadProgress = function(upload, file) { } }; -Rivendell.MusicpoolView.prototype.uploadError = function(upload, file, msg) { +Rivendell.MusicpoolView.prototype.uploadError = function(upload, file, msg, xhr, acknowledge) { // todo + + // to this on ok click. + acknowledge(); }; Rivendell.MusicpoolCartView = function(model) { diff --git a/www/js/shows.js b/www/js/shows.js index 43149c3..1897352 100644 --- a/www/js/shows.js +++ b/www/js/shows.js @@ -258,18 +258,21 @@ Rivendell.ShowView.prototype.uploadProgress = function(upload, file) { } }; -Rivendell.ShowView.prototype.uploadError = function(upload, file, msg) { +Rivendell.ShowView.prototype.uploadError = function(upload, file, msg, xhr, acknowledge) { if (!file.cartNumber) { return; } - var dismiss_button = '<button class="btn btn-info btn-xs">' + - '<span class="glyphicon glyphicon-remove"></span> Ok</button>'; + var responseCode = xhr.status; + var errorString = xhr.statusText; + + //var xmlDoc = $.parseXML(msg); + //var msg = $(xmlDoc); + //var responseCode = msg.find('ResponseCode').text(); + //var errorString = msg.find('ErrorString').text(); + var reason = $('<span>').addClass('label').addClass('label-danger').text(responseCode).after($('<b>').html(' ' + errorString)); - var xmlDoc = $.parseXML(msg); - var msg = $(xmlDoc); - var resp_code = msg.find('ResponseCode').text(); - var err_string = msg.find('ErrorString').text(); - var reason = $('<span>').addClass('label').addClass('label-danger').text(resp_code).after($('<b>').html(' ' + err_string)); + var dismiss_button = '<button class="btn btn-info btn-xs">' + + '<span class="glyphicon glyphicon-remove"></span> Ok</button>'; var $errorRow = $('<tr>') .attr("id", "show-cart-" + file.cartNumber) @@ -283,6 +286,7 @@ Rivendell.ShowView.prototype.uploadError = function(upload, file, msg) { $('button', $errorRow).on('click', function() { var $emptyRow = Rivendell.ShowCartView.renderEmpty(self.model, self, file.cartNumber); $('#show-cart-' + file.cartNumber).replaceWith($emptyRow); + acknowledge(); }); $('#show-cart-' + file.cartNumber).replaceWith($errorRow); |