summaryrefslogtreecommitdiff
path: root/www/js/rivendell.js
diff options
context:
space:
mode:
Diffstat (limited to 'www/js/rivendell.js')
-rw-r--r--www/js/rivendell.js79
1 files changed, 52 insertions, 27 deletions
diff --git a/www/js/rivendell.js b/www/js/rivendell.js
index 70546dc..24ef2c7 100644
--- a/www/js/rivendell.js
+++ b/www/js/rivendell.js
@@ -37,7 +37,7 @@ Rivendell.Rivendell.prototype.listLog = function(name, success) {
PASSWORD: this.token,
NAME: name
};
- return $.post(this.rdxportEndpoint, command, success, "xml");
+ return $.post(this.rdxportEndpoint, command, success, 'xml');
};
Rivendell.Rivendell.prototype.listLogs = function(success) {
@@ -49,7 +49,7 @@ Rivendell.Rivendell.prototype.listLogs = function(success) {
/*SERVICE_NAME: serviceName,
TRACKABLE: trackable*/
};
- return $.post(this.rdxportEndpoint, command, success, "xml");
+ return $.post(this.rdxportEndpoint, command, success, 'xml');
};
Rivendell.Rivendell.prototype.listServices = function(success) {
@@ -60,7 +60,7 @@ Rivendell.Rivendell.prototype.listServices = function(success) {
//todo: fix optionals
/*TRACKABLE: trackable*/
};
- return $.post(this.rdxportEndpoint, command, success, "xml");
+ return $.post(this.rdxportEndpoint, command, success, 'xml');
};
Rivendell.Rivendell.prototype.listGroups = function(success) {
@@ -69,7 +69,7 @@ Rivendell.Rivendell.prototype.listGroups = function(success) {
LOGIN_NAME: this.username,
PASSWORD: this.token
};
- return $.post(this.rdxportEndpoint, command, success, "xml");
+ return $.post(this.rdxportEndpoint, command, success, 'xml');
};
Rivendell.Rivendell.prototype.listGroup = function(groupName, success) {
@@ -79,7 +79,7 @@ Rivendell.Rivendell.prototype.listGroup = function(groupName, success) {
PASSWORD: this.token,
GROUP_NAME: groupName
};
- return $.post(this.rdxportEndpoint, command, success, "xml");
+ return $.post(this.rdxportEndpoint, command, success, 'xml');
};
Rivendell.Rivendell.prototype.listCarts = function(groupName, includeCuts, success) {
@@ -90,7 +90,7 @@ Rivendell.Rivendell.prototype.listCarts = function(groupName, includeCuts, succe
GROUP_NAME: groupName,
INCLUDE_CUTS: includeCuts
};
- return $.post(this.rdxportEndpoint, command, success, "xml");
+ return $.post(this.rdxportEndpoint, command, success, 'xml');
};
Rivendell.Rivendell.prototype.listCart = function(cartNumber, includeCuts, success) {
@@ -113,7 +113,7 @@ Rivendell.Rivendell.prototype.addCart = function(groupName, type, cartNumber, su
TYPE: type,
CART_NUMBER: cartNumber
};
- return $.post(this.rdxportEndpoint, command, success, "xml");
+ return $.post(this.rdxportEndpoint, command, success, 'xml');
};
Rivendell.Rivendell.prototype.editCart = function(cartNumber, options, success) {
@@ -121,7 +121,7 @@ Rivendell.Rivendell.prototype.editCart = function(cartNumber, options, success)
options.LOGIN_NAME = this.username;
options.PASSWORD = this.token;
options.CART_NUMBER = cartNumber;
- return $.post(this.rdxportEndpoint, options, success, "xml");
+ return $.post(this.rdxportEndpoint, options, success, 'xml');
};
Rivendell.Rivendell.prototype.removeCart = function(cartNumber, success) {
@@ -131,7 +131,7 @@ Rivendell.Rivendell.prototype.removeCart = function(cartNumber, success) {
PASSWORD: this.token,
CART_NUMBER: cartNumber
};
- return $.post(this.rdxportEndpoint, command, success, "xml");
+ return $.post(this.rdxportEndpoint, command, success, 'xml');
};
Rivendell.Rivendell.prototype.listCuts = function(cartNumber, success) {
@@ -171,7 +171,7 @@ Rivendell.Rivendell.prototype.editCut = function(cartNumber, cutNumber, options,
options.PASSWORD = this.token;
options.CART_NUMBER = cartNumber;
options.CUT_NUMBER = cutNumber;
- return $.post(this.rdxportEndpoint, options, success, "xml");
+ return $.post(this.rdxportEndpoint, options, success, 'xml');
};
Rivendell.Rivendell.prototype.addAndEditCut = function(cartNumber, options, success) {
@@ -362,16 +362,16 @@ Rivendell.GroupList.prototype.destroy = function() {
};
Rivendell.Group = function(groupName, description, lowcart, highcart, normlevel, trimlevel) {
- this.groupXml = null;
+ this.xml = null;
if (arguments.length === 1) {
- this.groupXml = groupName;
- this.groupName = $('group', this.groupXml).text();
- this.description = $('group-description', this.groupXml).text();
- this.lowcart = $('group-low-cart', this.groupXml).text();
- this.highcart = $('group-high-cart', this.groupXml).text();
- this.normlevel = $('normalization-level', this.groupXml).text();
- this.trimlevel = $('autotrim-level', this.groupXml).text();
+ this.xml = arguments[0];
+ this.groupName = $('group', this.xml).text();
+ this.description = $('group-description', this.xml).text();
+ this.lowcart = $('group-low-cart', this.xml).text();
+ this.highcart = $('group-high-cart', this.xml).text();
+ this.normlevel = $('normalization-level', this.xml).text();
+ this.trimlevel = $('autotrim-level', this.xml).text();
} else {
this.groupName = groupName;
this.description = description;
@@ -380,19 +380,44 @@ Rivendell.Group = function(groupName, description, lowcart, highcart, normlevel,
this.normlevel = normlevel;
this.trimlevel = trimlevel;
}
+
+ this.carts = [];
};
Rivendell.Cart = function(number, title, groupName, group) {
- this.number = number;
- this.title = title;
- this.groupName = groupName;
- this.group = group;
+ this.xml = null;
+
+ if (arguments.length === 2) {
+ this.xml = arguments[0];
+ this.number = $('number', this.xml).text();
+ this.title = $('title', this.xml).text();
+ this.groupName = $('groupName', this.xml).text();
+ this.group = arguments[1];
+ } else {
+ this.number = number;
+ this.title = title;
+ this.groupName = groupName;
+ this.group = group;
+ }
+
+ this.cuts = [];
};
-Rivendell.Cut = function(cart, cartNumber, name, description) {
- this.cart = cart;
- this.cartNumber = cartNumber;
+Rivendell.Cut = function(name, description, cart) {
+ this.xml = null;
+
+ if (arguments.length === 2) {
+ this.xml = arguments[0];
+ this.name = $('cutName', this.xml).text();
+ this.description = $('description', this.xml).text();
+ this.cart = arguments[1];
+ } else {
+ this.name = name;
+ this.description = description;
+ this.cart = cart;
+ }
this.number = name.substr(-3);
- this.name = name;
- this.description = description;
+ this.cartNumber = cart.number;
+
+
};