From 33c32a8d851124919232f87dbce1796805737a3f Mon Sep 17 00:00:00 2001 From: Jakub Skoczen Date: Wed, 9 Jun 2010 20:32:58 +0200 Subject: [PATCH] Add 'serviceId' param to init to allow selection of custom service definitons --- js/pz2.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/js/pz2.js b/js/pz2.js index 34c507b..58cf4a3 100644 --- a/js/pz2.js +++ b/js/pz2.js @@ -69,6 +69,7 @@ var pz2 = function ( paramArray ) this.keepAlive = paramArray.keepAlive; this.sessionID = null; + this.serviceId = paramArray.serviceId || null; this.initStatusOK = false; this.pingStatusOK = false; this.searchStatusOK = false; @@ -121,7 +122,7 @@ var pz2 = function ( paramArray ) } // else, auto init session or wait for a user init? if (this.useSessions && paramArray.autoInit !== false) { - this.init(); + this.init(this.sessionId, this.serviceId); } }; @@ -165,12 +166,12 @@ pz2.prototype = this.resetCallback(); }, - init: function ( sessionId ) + init: function (sessionId, serviceId) { this.reset(); // session id as a param - if ( sessionId != undefined && this.useSessions ) { + if (sessionId && this.useSessions ) { this.initStatusOK = true; this.sessionID = sessionId; this.ping(); @@ -178,8 +179,10 @@ pz2.prototype = } else if (this.useSessions) { var context = this; var request = new pzHttpRequest(this.pz2String, this.errorHandler); + var opts = {'command' : 'init'}; + if (serviceId) opts.service = serviceId; request.safeGet( - { "command": "init" }, + opts, function(data) { if ( data.getElementsByTagName("status")[0] .childNodes[0].nodeValue == "OK" ) { -- 1.7.10.4