From adfb040cd8f0083b0cc36db2c1680b461dc20089 Mon Sep 17 00:00:00 2001 From: helmutm Date: Tue, 4 Aug 2009 19:30:00 +0000 Subject: [PATCH] work in progress: jocy.talk git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@3495 fd906abe-77d9-0310-91a1-e0d9ade77398 --- ajax/jocy/talk.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/ajax/jocy/talk.js b/ajax/jocy/talk.js index e993002..6fbda2a 100644 --- a/ajax/jocy/talk.js +++ b/ajax/jocy/talk.js @@ -37,7 +37,7 @@ dojo.declare('jocy.talk.Connection', null, { }, initCometd: function() { if (!this._cometdInitialized) { - dojox.cometd.init(this.url); + dojox.cometd.init(this.url + '/cometd'); this._cometdInitialized = true; } }, @@ -50,6 +50,8 @@ dojo.declare('jocy.talk.Connection', null, { // ReST methods get: function(resourcePath, data, cbName, user, password) { + //return dojo.io.script.get({ + // callbackParamName: 'jsonp', return dojo.xhrGet({ url: this._setupUrl(resourcePath), load: function(response, ioArgs) { @@ -63,7 +65,9 @@ dojo.declare('jocy.talk.Connection', null, { }, getSynchronous: function(resourcePath, data, cbName) { var result = {}; - d = dojo.xhrGet({ + //dojo.io.script.get({ + // callbackParamName: 'jsonp', + dojo.xhrGet({ url: this._setupUrl(resourcePath), load: function(response, ioArgs) { result = response; @@ -88,7 +92,7 @@ dojo.declare('jocy.talk.Connection', null, { }, post: function(resourcePath, data, cbName) { return dojo.xhrGet({ - url: this._setupU(resourcePath), + url: this._setupUrl(resourcePath), load: function(response, ioArgs) { return this._callback(response, ioArgs, cbName); }, @@ -116,9 +120,13 @@ dojo.declare('jocy.talk.Connection', null, { this.initCometd(); dojox.cometd.subscribe(channel, this.client, cbName); }, + unsubscribe: function(channel){ + this.initCometd(); + dojox.cometd.unsubscribe(channel, this.client); + }, // private methods - _setupObjectPath: function(path) { + _setupUrl: function(path) { slash = (path.charAt(0) == '/' ? '' : '/'); return this.url + slash + path; },