TPac: propagate searches to advanced search page
authorBill Erickson <berick@esilibrary.com>
Fri, 30 Sep 2011 16:19:35 +0000 (12:19 -0400)
committerLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Fri, 30 Sep 2011 16:33:15 +0000 (12:33 -0400)
The link that takes users to the advanced searc page now propagates
any existing (well, all) search URL params.  The change required some
minor augmentation to the code that builds the advanced search form.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Open-ILS/src/templates/opac/parts/advanced/global_row.tt2
Open-ILS/src/templates/opac/parts/searchbar.tt2

index 1598b69..66ecea4 100644 (file)
@@ -9,6 +9,19 @@
     queries = CGI.param('query');
     bools = CGI.param('bool') || ['and' x 3];
     qtypes = CGI.param('qtype') || ['keyword' x 3];
+
+    IF !qtypes.0; # not an array
+        qtypes = [qtypes];
+        bools = [bools];
+        queries = [queries];
+    END;
+
+    WHILE qtypes.size < 3;
+        qtypes.push('keyword');
+        bools.push('and');
+        queries.push('');
+    END;
+
     FOR qtype IN qtypes;
         c = contains.shift;
         b = bools.shift;
index 1f1f0a8..79213d2 100644 (file)
@@ -7,7 +7,7 @@
         <tr>
             <td colspan="3">
                 <span class="search_catalog_lbl">[% l('Search the Catalog') %]</span>
-                <a href="[% ctx.opac_root %]/advanced"
+                <a href="[% mkurl(ctx.opac_root _ '/advanced') %]"
                     id="home_adv_search_link"><span
                     class="adv_search_font">[% l('Advanced Search') %]</span></a>
             </td>