X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=js%2Fpz2.js;h=a799b4090884e0deafd23a932e2d3ee1caac9f71;hb=346fff3bfe0766c265c147ccd46ed013172307f9;hp=8ae13790f77e414a38e31016eac75941648622af;hpb=73d850607f4b24e591405c59b2accd475d73c054;p=pazpar2-moved-to-github.git diff --git a/js/pz2.js b/js/pz2.js index 8ae1379..a799b40 100644 --- a/js/pz2.js +++ b/js/pz2.js @@ -32,6 +32,7 @@ var pz2 = function ( paramArray ) throw new Error("Pz2.js: Array with parameters has to be supplied."); //supported pazpar2's protocol version + this.windowid = paramArray.windowid || window.name; this.suppProtoVer = '1'; if (typeof paramArray.pazpar2path != "undefined") this.pz2String = paramArray.pazpar2path; @@ -170,7 +171,7 @@ pz2.prototype = this.stop(); if ( this.resetCallback ) - this.resetCallback(); + this.resetCallback(this.windowid); }, init: function (sessionId, serviceId) @@ -214,7 +215,7 @@ pz2.prototype = context.keepAlive ); if ( context.initCallback ) - context.initCallback(); + context.initCallback(this.windowid); } else context.throwError('Init failed. Malformed WS resonse.', @@ -240,7 +241,7 @@ pz2.prototype = var request = new pzHttpRequest(this.pz2String, this.errorHandler); request.safeGet( - { "command": "ping", "session": this.sessionID, "windowid" : window.name }, + { "command": "ping", "session": this.sessionID, "windowid" : this.windowid }, function(data) { if ( data.getElementsByTagName("status")[0] .childNodes[0].nodeValue == "OK" ) { @@ -290,7 +291,7 @@ pz2.prototype = "command": "search", "query": this.currQuery, "session": this.sessionID, - "windowid" : window.name + "windowid" : this.windowid }; if( sort !== undefined ) { @@ -343,7 +344,7 @@ pz2.prototype = var context = this; var request = new pzHttpRequest(this.pz2String, this.errorHandler); request.safeGet( - { "command": "stat", "session": this.sessionID, "windowid" : window.name }, + { "command": "stat", "session": this.sessionID, "windowid" : this.windowid }, function(data) { if ( data.getElementsByTagName("stat") ) { var activeClients = @@ -365,7 +366,7 @@ pz2.prototype = }, delay ); - context.statCallback(stat); + context.statCallback(stat, this.windowid); } else context.throwError('Stat failed. Malformed WS resonse.', @@ -401,7 +402,7 @@ pz2.prototype = "sort": this.currentSort, "block": 1, "type": this.showResponseType, - "windowid" : window.name + "windowid" : this.windowid }; if (query_state) requestParameters["query-state"] = query_state; @@ -471,7 +472,7 @@ pz2.prototype = context.show(); }, delay); - context.showCallback(show); + context.showCallback(show, this.windowid); } ); }, @@ -490,7 +491,7 @@ pz2.prototype = "command": "record", "session": this.sessionID, "id": this.currRecID, - "windowid" : window.name + "windowid" : this.windowid }; this.currRecOffset = null; @@ -523,7 +524,7 @@ pz2.prototype = record = new Array(); record['xmlDoc'] = data; record['offset'] = context.currRecOffset; - callback(record, args); + callback(record, args, this.windowid); //pz2 record } else if ( recordNode = data.getElementsByTagName("record")[0] ) { @@ -553,7 +554,7 @@ pz2.prototype = }, delay ); - callback(record, args); + callback(record, args, this.windowid); } else context.throwError('Record failed. Malformed WS resonse.', @@ -579,7 +580,7 @@ pz2.prototype = "command": "termlist", "session": this.sessionID, "name": this.termKeys, - "windowid" : window.name, + "windowid" : this.windowid, "version" : this.version }, @@ -642,7 +643,7 @@ pz2.prototype = delay ); - context.termlistCallback(termList); + context.termlistCallback(termList, this.windowid); } else context.throwError('Termlist failed. Malformed WS resonse.', @@ -672,7 +673,7 @@ pz2.prototype = "command": "bytarget", "session": this.sessionID, "block": 1, - "windowid" : window.name, + "windowid" : this.windowid, "version" : this.version }, function(data) { @@ -731,7 +732,7 @@ pz2.prototype = delay ); - context.bytargetCallback(bytarget); + context.bytargetCallback(bytarget, this.windowid); } else context.throwError('Bytarget failed. Malformed WS resonse.',