Can send additional parameters with the search command (connected to bug #2217)
authorJakub Skoczen <jakub@indexdata.dk>
Thu, 14 Aug 2008 16:59:00 +0000 (18:59 +0200)
committerJakub Skoczen <jakub@indexdata.dk>
Thu, 14 Aug 2008 16:59:00 +0000 (18:59 +0200)
js/pz2.js

index 6bad626..4e2702f 100644 (file)
--- a/js/pz2.js
+++ b/js/pz2.js
@@ -237,7 +237,7 @@ pz2.prototype =
             }
         );
     },
-    search: function (query, num, sort, filter, showfrom)
+    search: function (query, num, sort, filter, showfrom, addParamsArr)
     {
         clearTimeout(this.statTimer);
         clearTimeout(this.showTimer);
@@ -271,6 +271,14 @@ pz2.prototype =
        
         if (filter !== undefined)
            searchParams["filter"] = filter;
+
+        // copy additional parmeters, do not overwrite
+        if (addParamsArr != undefined) {
+            for (var prop in addParamsArr) {
+                if (!searchParams.hasOwnProperty(prop))
+                    searchParams[prop] = addParamsArr[prop];
+            }
+        }
         
         var context = this;
         var request = new pzHttpRequest(this.pz2String, this.errorHandler);