diff options
author | Peter Grassberger <petertheone@gmail.com> | 2015-09-22 16:47:44 (GMT) |
---|---|---|
committer | Peter Grassberger <petertheone@gmail.com> | 2015-09-22 16:47:44 (GMT) |
commit | 6ed66606527e75937a6000af14c7a8d04be089e7 (patch) | |
tree | 6dcda2dc2d22b01763b91a43f12228bfe48eb4bf /www/js | |
parent | f2cf3cf6fb0df68168245c82a029279f190ffe94 (diff) |
fix import to correct newly created cut
Diffstat (limited to 'www/js')
-rw-r--r-- | www/js/jingles.js | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/www/js/jingles.js b/www/js/jingles.js index 3c1acfa..2dc3b40 100644 --- a/www/js/jingles.js +++ b/www/js/jingles.js @@ -204,6 +204,11 @@ JingleGroup.prototype.render = function() { $.each(cuts, function(index, cut) { $('table > tbody', self.$el).append(cut.render()); });*/ + if (this.mainCart) { + $.each(this.mainCart.cuts, function(index, cut) { + $('table > tbody', self.$el).append(cut.render()); + }); + } if (this.deactivateCart) { $.each(this.deactivateCart.cuts, function(index, cut) { $('table > tbody', self.$el).append(cut.render()); @@ -363,7 +368,20 @@ var Importer = function() { Importer.prototype.importAddCut = function(cart, dz, file) { // todo: set additional parameters like DESCRIPTION here, when patch has been applied. var data = { COMMAND: 10, LOGIN_NAME: auth_username, PASSWORD: auth_token, CART_NUMBER: cart.number, DESCRIPTION: 'test' }; - $.post("/rd-bin/rdxport.cgi", data, null, "xml").done(function() { + $.post("/rd-bin/rdxport.cgi", data, null, "xml").done(function(cutXml) { + var cutNumber = $(cutXml).find('cutNumber').text(); + console.log(cutNumber); + dz.on('sending', function(file, xhr, formData) { + formData.append('COMMAND', 2); + formData.append('LOGIN_NAME', auth_username); + formData.append('PASSWORD', auth_token); + formData.append('CART_NUMBER', cart.number); + formData.append('CUT_NUMBER', cutNumber); + formData.append('CHANNELS', 2); + formData.append('NORMALIZATION_LEVEL', cart.normlevel); + formData.append('AUTOTRIM_LEVEL', cart.trimlevel); + formData.append('USE_METADATA', 1); + }); dz.processQueue(); }).fail(function(xhr, status, err) { self.importFileUploadError(cart, dz, file, err, xhr); @@ -475,17 +493,6 @@ Importer.prototype.showUploadModal = function(cart) { this.on("error", function(file, msg) { self.importFileSelectError(this, file, msg); }); - this.on('sending', function(file, xhr, formData) { - formData.append('COMMAND', 2); - formData.append('LOGIN_NAME', auth_username); - formData.append('PASSWORD', auth_token); - formData.append('CART_NUMBER', cart.number); - formData.append('CUT_NUMBER', 1); // todo: set to correct cut number! - formData.append('CHANNELS', 2); - formData.append('NORMALIZATION_LEVEL', cart.normlevel); - formData.append('AUTOTRIM_LEVEL', cart.trimlevel); - formData.append('USE_METADATA', 1); - }); } }); |