X-Git-Url: http://cgit.babelmonkeys.de/?p=adhocweb.git;a=blobdiff_plain;f=js%2Fadhoc.js;h=cbe27523ab1ab905719fa82ca2fdce232d15c503;hp=7e2ba521bc30e910dcc9a258bc973493d2e6855b;hb=87bfedccdb91e2ff7cfb165e989e5259c155b513;hpb=e55b23864a9911c15d930b43ed9afe1df5943bf7 diff --git a/js/adhoc.js b/js/adhoc.js index 7e2ba52..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) { - $("