X-Git-Url: http://cgit.babelmonkeys.de/?p=adhocweb.git;a=blobdiff_plain;f=js%2Fadhoc.js;h=cbe27523ab1ab905719fa82ca2fdce232d15c503;hp=0266318c9e99626dd0b9d0a053ffc2899e54e02d;hb=dae39db82120c09ddb00ec62ac677b6213e65e28;hpb=5a45869a032410c17d02374b8de20e496c114de3
diff --git a/js/adhoc.js b/js/adhoc.js
index 0266318..cbe2752 100644
--- a/js/adhoc.js
+++ b/js/adhoc.js
@@ -46,7 +46,7 @@ Adhoc.prototype = {
addForm: function (x) {
var self = this;
- var form = $("
");
+ var form = $("");
form.submit(function(event) {
self.executeCommand("execute", self.serializeToDataform('form'),
function(e) { self.displayResult(e) });
@@ -57,17 +57,16 @@ Adhoc.prototype = {
$(x).find("title").each(function() { $("").text($(this).text()).appendTo(fieldset); });
$(x).find("instructions").each(function() { $("").text($(this).text()).appendTo(fieldset); });
$(x).find("field").each(function() {
+ var clearfix = $("");
var item = self.buildHTMLField(this);
var label = $(this).attr("label");
if(label) {
- $("").text(label).attr("for", $(this).attr("var")).appendTo(fieldset);
- $("
").appendTo(fieldset);
+ $("").text(label).attr("for", $(this).attr("var")).appendTo(clearfix);
}
if ($(x).attr("type") === "result")
item.attr("readonly", true);
- fieldset.append(item);
- if ($(this).attr("type") !== "hidden")
- fieldset.append("
");
+ clearfix.append(item);
+ fieldset.append(clearfix);
});
$(self.status.view).append(form);
},
@@ -157,6 +156,7 @@ Adhoc.prototype = {
var self = this;
var status = $(result).find("command").attr("status");
var kinds = {'prev': 'Prev', 'next': 'Next', 'complete': 'Complete'};
+ var actions = $(result).find("actions:first");
$(self.status.view).empty();
$(result).find("command > *").each(function() {
@@ -167,24 +167,24 @@ Adhoc.prototype = {
}
});
if (status === "executing") {
+ var controls = $("");
for (kind in kinds) {
- (function(type) {
- input = $("").click(function() {
- self.executeCommand(type, (type!= 'prev') && self.serializeToDataform('form'), function(e) { self.displayResult(e) });
- });
- })(kind);
- if ($(result).find('actions ' + kind).length > 0)
+ var input;
+ (function (type) {
+ input = $("").click(function() {
+ self.executeCommand(type, (type != 'prev') && self.serializeToDataform('form'), function(e) { self.displayResult(e) });
+ }).appendTo(controls);
+ })(kind);
+ if (actions.find(kind).length > 0)
input.removeAttr("disabled");
- $(self.status.view).append(input);
+ if (actions.attr("execute") == kind)
+ input.addClass("primary");
}
- $("").click(function() {
- self.executeCommand("execute", self.serializeToDataform('form'), function(e) { self.displayResult(e) });
- }).appendTo(self.status.view);
-
- $("").click(function() {
+ $("").click(function() {
self.cancelCommand(function(e) { self.displayResult(e) });
- }).appendTo(self.status.view);
+ }).appendTo(controls);
+ $(self.status.view + " fieldset").append(controls);
} else {
self.status.sessionid = null;
self.status.cmdNode = null;