(re) patched up the cgi code to handle lists of params
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 3 Mar 2006 16:07:06 +0000 (16:07 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 3 Mar 2006 16:07:06 +0000 (16:07 +0000)
added record id list viewing in the rresult page via url params
added record search type of list and a param name for the list items

git-svn-id: svn://svn.open-ils.org/ILS/trunk@3246 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/opac/common/js/CGI.js
Open-ILS/web/opac/common/js/config.js
Open-ILS/web/opac/common/js/opac_utils.js
Open-ILS/web/opac/skin/default/js/result_common.js
Open-ILS/web/opac/skin/default/js/rresult.js
Open-ILS/web/opac/skin/default/xml/page_advanced.xml

index 5274e79..456ed2e 100644 (file)
@@ -24,7 +24,8 @@ function CGI() {
                if(c == "&" || c == ";") {
                        inkey = 1;
                        invalue = 0;
-                       this.data[key] = decodeURIComponent(value);
+                       if( ! this.data[key] ) this.data[key] = [];
+                       this.data[key].push(decodeURIComponent(value));
                        this._keys.push(key);
                        key = ""; value = "";
                        continue;
@@ -34,7 +35,8 @@ function CGI() {
                else if(invalue) value += c;
        }
 
-       this.data[key] = decodeURIComponent(value);
+       if( ! this.data[key] ) this.data[key] = [];
+       this.data[key].push(decodeURIComponent(value));
        this._keys.push(key);
 }
 
@@ -43,8 +45,8 @@ function CGI() {
  */
 CGI.prototype.param = function(p) {
        if(this.data[p] == null) return null;
-       //if(this.data[p].length == 1)
-               //return this.data[p][0];
+       if(this.data[p].length == 1)
+               return this.data[p][0];
        return this.data[p];
 }
 
index 51d7ab8..e6ce3ea 100644 (file)
@@ -11,6 +11,7 @@ var PARAM_COUNT               = "c";                  /* hits per page */
 var PARAM_HITCOUNT     = "hc";                 /* hits per page */
 var PARAM_MRID                 = "m";                  /* metarecord id */
 var PARAM_RID                  = "r";                  /* record id */
+var PARAM_RLIST                = "rl";
 var PARAM_ORIGLOC              = "ol";                 /* the original location */
 //var PARAM_TOPRANK            = "tr";                 /* this highest ranking rank */
 var PARAM_AUTHTIME     = "at";                 /* inactivity timeout in seconds */
@@ -32,7 +33,6 @@ var HITCOUNT;
 var RANKS; 
 var FONTSIZE;
 var ORIGLOC;
-//var TOPRANK;
 var AUTHTIME;
 var ADVTERM;
 var ADVTYPE;
@@ -41,6 +41,7 @@ var RID;
 var RTYPE;
 var SORT;
 var SORT_DIR;
+var RLIST;
 
 /* cookie values */
 var SBEXTRAS; 
@@ -80,6 +81,7 @@ var RTYPE_SUBJECT     = STYPE_SUBJECT;
 var RTYPE_TITLE        = STYPE_TITLE;
 var RTYPE_SERIES       = STYPE_SERIES;
 var RTYPE_KEYWORD      = STYPE_KEYWORD;
+var RTYPE_LIST         = "list";
 
 var SORT_TYPE_REL                      = "rel";
 var SORT_TYPE_AUTHOR           = STYPE_AUTHOR; 
index bff12a1..a6ec981 100644 (file)
@@ -182,7 +182,13 @@ function  buildOPACLink(args, slim, ssl) {
                if(x == PARAM_DEPTH && v == 0) continue;
                if(x == PARAM_COUNT && v == 10) continue;
                if(x == PARAM_FORM && v == 'all' ) continue;
-               string += "&" + x + "=" + encodeURIComponent(v);
+               if( instanceOf(v, Array) ) {
+                       for( var i = 0; i != v.length; i++ ) {
+                               string += "&" + x + "=" + encodeURIComponent(v[i]);
+                       }
+               } else {
+                       string += "&" + x + "=" + encodeURIComponent(v);
+               }
        }
 
        if(getOrigLocation() != 1) 
index 702b2c6..a2b6348 100644 (file)
@@ -197,6 +197,7 @@ function resultPaginate() {
                args[PARAM_OFFSET]      = o + getDisplayCount();
                args[PARAM_SORT]                = SORT;
                args[PARAM_SORT_DIR] = SORT_DIR;
+               args[PARAM_RLIST]               = new CGI().param(PARAM_RLIST);
 
                G.ui.result.next_link.setAttribute("href", buildOPACLink(args)); 
                addCSSClass(G.ui.result.next_link, config.css.result.nav_active);
@@ -211,6 +212,7 @@ function resultPaginate() {
                var args = {};
                args[PARAM_SORT]                = SORT;
                args[PARAM_SORT_DIR] = SORT_DIR;
+               args[PARAM_RLIST]               = new CGI().param(PARAM_RLIST);
 
                args[PARAM_OFFSET] = o - getDisplayCount();
                G.ui.result.prev_link.setAttribute( "href", buildOPACLink(args)); 
index af6187a..8732803 100644 (file)
@@ -35,6 +35,10 @@ function rresultCollectIds() {
                        rresultDoRecordSearch();
                        break;
 
+               case RTYPE_LIST :
+                       rresultHandleList();
+                       break;
+
                case RTYPE_MRID :
                defaut:
                        var form = (getForm() == "all") ? null : getForm();
@@ -44,6 +48,11 @@ function rresultCollectIds() {
        }
 }
 
+function rresultHandleList() {
+       var ids = new CGI().param(PARAM_RLIST);
+       if(ids) _rresultHandleIds(ids, ids.length);
+}
+
 function rresultHandleRIds(r) {
        var res = r.getResultObject();
        _rresultHandleIds(res.ids, res.count);
index f2f4487..4bc5128 100644 (file)
@@ -7,7 +7,6 @@
                        margin-top: 30px; margin-bottom: 30px; width: 95%; padding: 5px; }
        </style>
 
-
        <div class='advanced_div' style='border: 1px solid #000; padding-left: 15px'>
                <!--#include virtual="advanced/advanced_location.xml"-->
        </div>