X-Git-Url: http://cgit.babelmonkeys.de/?p=adhocweb.git;a=blobdiff_plain;f=js%2Fadhoc.js;h=cbe27523ab1ab905719fa82ca2fdce232d15c503;hp=3f2ae2b4e96843896f95fdc1a4dc8c540be2e529;hb=87bfedccdb91e2ff7cfb165e989e5259c155b513;hpb=9f26ed9cdd3330b0fb922e1475d3175caa46d528 diff --git a/js/adhoc.js b/js/adhoc.js index 3f2ae2b..cbe2752 100644 --- a/js/adhoc.js +++ b/js/adhoc.js @@ -23,27 +23,33 @@ if (!Function.prototype.bind) { Strophe.addNamespace("ADHOC", "http://jabber.org/protocol/commands"); -var Adhoc = { - status: { +function Adhoc(view, readycb) { + this.status = { sessionid: null, cmdNode: null, - queryJID: null - }, + queryJID: null, + readycb: readycb, + view: view + }; +} + +Adhoc.prototype = { + constructor: Adhoc, - addNote: function (elem, text, type) { + addNote: function (text, type) { if (!type) { type = "info"; } text = text.replace(/\n/g, "
"); - $(elem).append("

" + text + "

"); + $(this.status.view).append("

" + text + "

"); }, - addForm: function (elem, x) { + addForm: function (x) { var self = this; - var form = $("
"); + var form = $(""); form.submit(function(event) { self.executeCommand("execute", self.serializeToDataform('form'), - function(e) { self.displayResult(elem, e) }); + function(e) { self.displayResult(e) }); event.preventDefault(); }); var fieldset = $("
"); @@ -51,19 +57,18 @@ var Adhoc = { $(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) { - $("