diff options
Diffstat (limited to 'www/js/jingles.js')
-rw-r--r-- | www/js/jingles.js | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/www/js/jingles.js b/www/js/jingles.js index 16fbf8d..04d7fe6 100644 --- a/www/js/jingles.js +++ b/www/js/jingles.js @@ -27,7 +27,8 @@ var jinglesGroupList = null; var importer = null; function jingles_init() { - rivendell = new Rivendell.Rivendell(auth_username, auth_token); + rivendell = new Rivendell.Rivendell(auth_username, auth_token, '/rd-bin/rdxport.cgi'); + rivendell.setListDropboxesEndpoint('/rh-bin/listdropboxes.cgi'); importer = new Importer(); jinglesGroupList = new JingleGroupList(); jinglesGroupList.fetch(); @@ -54,8 +55,7 @@ JingleGroupList.prototype.fetch = function() { this.groups = []; var self = this; - var command = { LOGIN_NAME: auth_username, PASSWORD: auth_token }; - $.post("/rh-bin/listdropboxes.cgi", command, function(groupsXml, status, req) { + rivendell.listDropboxes(function(groupsXml, status, req) { var dbs = $(groupsXml).find("dropboxList").children(); dbs.each(function(index, groupXml) { if ($('type', groupXml).text() !== 'jingle') { @@ -86,7 +86,7 @@ JingleGroupList.prototype.fetch = function() { self.groups.push(jingleGroup); }); - }, "xml"); + }); }; JingleGroupList.prototype.render = function() { @@ -121,15 +121,13 @@ var JingleGroup = function(title, groupName, description, lowcart, highcart, nor JingleGroup.prototype.fetchCarts = function() { console.log('JingleGroup.prototype.fetchCarts'); var self = this; - var command1 = { COMMAND: 7, LOGIN_NAME: auth_username, PASSWORD: auth_token, CART_NUMBER: this.lowcart, INCLUDE_CUTS: 1 }; - var command2 = { COMMAND: 7, LOGIN_NAME: auth_username, PASSWORD: auth_token, CART_NUMBER: this.highcart, INCLUDE_CUTS: 1 }; $.when( - $.post("/rd-bin/rdxport.cgi", command1, function(cartXml) { + rivendell.listCart(this.lowcart, 1, function(cartXml) { self.mainCart = self.createCartFromXml(cartXml, true); - }, "xml"), - $.post("/rd-bin/rdxport.cgi", command2, function(cartXml) { + }), + rivendell.listCart(this.highcart, 1, function(cartXml) { self.deactivateCart = self.createCartFromXml(cartXml, false); - }, "xml") + }) ).then(function() { $(self.mainCart).on('add', function() { $(self).trigger('add'); @@ -341,8 +339,7 @@ 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(cutXml) { + rivendell.addCut(cart.number, function(cutXml) { var cutNumber = $(cutXml).find('cutNumber').text(); dz.on('sending', function(file, xhr, formData) { formData.append('COMMAND', 2); |