X-Git-Url: http://lists.indexdata.com/cgi-bin?a=blobdiff_plain;f=js%2Fpz2.js;h=fb6264c2b64e0bfb3c22b4645a0be2f6cd7c7a61;hb=5f9bcb0650ab5b1661bf75f320dfbb204c6b6d6b;hp=8ef4db8889a3db758a45188e4fba84383e72fdd0;hpb=a293edf0d13509b00a61e25b159879fb97dffc17;p=pazpar2-moved-to-github.git diff --git a/js/pz2.js b/js/pz2.js index 8ef4db8..fb6264c 100644 --- a/js/pz2.js +++ b/js/pz2.js @@ -171,7 +171,7 @@ pz2.prototype = this.stop(); if ( this.resetCallback ) - this.resetCallback(); + this.resetCallback(this.windowid); }, init: function (sessionId, serviceId) @@ -215,7 +215,7 @@ pz2.prototype = context.keepAlive ); if ( context.initCallback ) - context.initCallback(); + context.initCallback(context.windowid); } else context.throwError('Init failed. Malformed WS resonse.', @@ -241,7 +241,7 @@ pz2.prototype = var request = new pzHttpRequest(this.pz2String, this.errorHandler); request.safeGet( - { "command": "ping", "session": this.sessionID, "windowid" : this.windowid }, + { "command": "ping", "session": this.sessionID, "windowid" : context.windowid }, function(data) { if ( data.getElementsByTagName("status")[0] .childNodes[0].nodeValue == "OK" ) { @@ -344,7 +344,7 @@ pz2.prototype = var context = this; var request = new pzHttpRequest(this.pz2String, this.errorHandler); request.safeGet( - { "command": "stat", "session": this.sessionID, "windowid" : this.windowid }, + { "command": "stat", "session": this.sessionID, "windowid" : context.windowid }, function(data) { if ( data.getElementsByTagName("stat") ) { var activeClients = @@ -366,7 +366,7 @@ pz2.prototype = }, delay ); - context.statCallback(stat); + context.statCallback(stat, context.windowid); } else context.throwError('Stat failed. Malformed WS resonse.', @@ -472,7 +472,7 @@ pz2.prototype = context.show(); }, delay); - context.showCallback(show); + context.showCallback(show, context.windowid); } ); }, @@ -524,7 +524,7 @@ pz2.prototype = record = new Array(); record['xmlDoc'] = data; record['offset'] = context.currRecOffset; - callback(record, args); + callback(record, args, context.windowid); //pz2 record } else if ( recordNode = data.getElementsByTagName("record")[0] ) { @@ -554,7 +554,7 @@ pz2.prototype = }, delay ); - callback(record, args); + callback(record, args, context.windowid); } else context.throwError('Record failed. Malformed WS resonse.', @@ -643,7 +643,7 @@ pz2.prototype = delay ); - context.termlistCallback(termList); + context.termlistCallback(termList, context.windowid); } else context.throwError('Termlist failed. Malformed WS resonse.', @@ -732,7 +732,7 @@ pz2.prototype = delay ); - context.bytargetCallback(bytarget); + context.bytargetCallback(bytarget, context.windowid); } else context.throwError('Bytarget failed. Malformed WS resonse.', @@ -769,7 +769,7 @@ pz2.prototype = ** AJAX HELPER CLASS *********************************************************** ******************************************************************************** */ -var pzHttpRequest = function (url, errorHandler, cookieDomain) { +var pzHttpRequest = function (url, errorHandler, cookieDomain, windowId) { this.maxUrlLength = 2048; this.request = null; this.url = url; @@ -779,6 +779,7 @@ var pzHttpRequest = function (url, errorHandler, cookieDomain) { this.isXDR = false; this.domainRegex = /https?:\/\/([^:/]+).*/; this.cookieDomain = cookieDomain || null; + this.windowId = windowId || window.name; var xhr = new XMLHttpRequest(); var domain = this._getDomainFromUrl(url); @@ -906,9 +907,9 @@ pzHttpRequest.prototype = //session cookie, resend it var domain = this._getDomainFromUrl(url); if (domain && this._isCrossDomain(domain) && - this.getCookie(domain+":SESSID")) { + this.getCookie(domain+":"+this.windowId+":SESSID")) { //rewrite the URL - var sessparam = ';jsessionid=' + this.getCookie(domain+":SESSID"); + var sessparam = ';jsessionid=' + this.getCookie(domain+":"+this.windowId+":SESSID"); var q = url.indexOf('?'); if (q == -1) { url += sessparam; @@ -1020,7 +1021,7 @@ pzHttpRequest.prototype = var jsessionId = this.request.responseXML .documentElement.getAttribute('jsessionId'); if (jsessionId) - this.setCookie(domain+":SESSID", jsessionId); + this.setCookie(domain+":"+this.windowId+":SESSID", jsessionId); } this.callback(this.request.responseXML); } else {