JS forwards identifier for current browser window
authorNiels Erik G. Nielsen <nielserik@indexdata.com>
Sat, 7 May 2011 13:05:23 +0000 (09:05 -0400)
committerNiels Erik G. Nielsen <nielserik@indexdata.com>
Sat, 7 May 2011 13:05:23 +0000 (09:05 -0400)
... to enable support for multiple simultaneous Pazpar2 sessions
    in different windows/tabs of the same browser via Service Proxy

js/pz2.js

index 8aab9bf..31d2c33 100644 (file)
--- a/js/pz2.js
+++ b/js/pz2.js
@@ -226,7 +226,7 @@ pz2.prototype =
         var context = this;
         var request = new pzHttpRequest(this.pz2String, this.errorHandler);
         request.safeGet(
-            { "command": "ping", "session": this.sessionID },
+            { "command": "ping", "session": this.sessionID, "windowId" : self.window.name },
             function(data) {
                 if ( data.getElementsByTagName("status")[0]
                         .childNodes[0].nodeValue == "OK" ) {
@@ -271,14 +271,15 @@ pz2.prototype =
         else
             var start = 0;
 
-       var searchParams = { 
-            "command": "search",
-            "query": this.currQuery, 
-            "session": this.sessionID 
+             var searchParams = { 
+          "command": "search",
+          "query": this.currQuery, 
+          "session": this.sessionID,
+          "windowId" : self.window.name
         };
        
         if (filter !== undefined)
-           searchParams["filter"] = filter;
+               searchParams["filter"] = filter;
 
         // copy additional parmeters, do not overwrite
         if (addParamsArr != undefined) {
@@ -322,7 +323,7 @@ pz2.prototype =
         var context = this;
         var request = new pzHttpRequest(this.pz2String, this.errorHandler);
         request.safeGet(
-            { "command": "stat", "session": this.sessionID },
+            { "command": "stat", "session": this.sessionID, "windowId" : self.window.name },
             function(data) {
                 if ( data.getElementsByTagName("stat") ) {
                     var activeClients = 
@@ -379,7 +380,8 @@ pz2.prototype =
             "num": this.currentNum, 
             "sort": this.currentSort, 
             "block": 1,
-            "type": this.showResponseType
+            "type": this.showResponseType,
+            "windowId" : self.window.name
           },
           function(data, type) {
             var show = null;
@@ -453,7 +455,8 @@ pz2.prototype =
        var recordParams = { 
             "command": "record", 
             "session": this.sessionID,
-            "id": this.currRecID 
+            "id": this.currRecID,
+            "windowId" : self.window.name
         };
        
        this.currRecOffset = null;
@@ -541,7 +544,8 @@ pz2.prototype =
             { 
                 "command": "termlist", 
                 "session": this.sessionID, 
-                "name": this.termKeys 
+                "name": this.termKeys,
+                "windowId" : self.window.name
             },
             function(data) {
                 if ( data.getElementsByTagName("termlist") ) {
@@ -618,7 +622,7 @@ pz2.prototype =
         var context = this;
         var request = new pzHttpRequest(this.pz2String, this.errorHandler);
         request.safeGet(
-            { "command": "bytarget", "session": this.sessionID },
+            { "command": "bytarget", "session": this.sessionID, "windowId" : self.window.name},
             function(data) {
                 if ( data.getElementsByTagName("status")[0]
                         .childNodes[0].nodeValue == "OK" ) {