work in progress: jocy.talk

git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@3495 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2009-08-04 19:30:00 +00:00
parent 8063d211a9
commit adfb040cd8

View file

@ -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;
},