basic search classes work (except cn)
authorsenator <lebbeous@esilibrary.com>
Thu, 17 Feb 2011 20:15:33 +0000 (15:15 -0500)
committersenator <lebbeous@esilibrary.com>
Thu, 17 Feb 2011 20:15:33 +0000 (15:15 -0500)
Not sure what would happen on a KCLS environment. Need to test.
bibcn nor cn do what I mean in my dev environment.

Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm
Open-ILS/web/templates/default/opac/parts/advanced/global_row.tt2
Open-ILS/web/templates/default/opac/parts/stypes_selector.tt2

index ad9526a..2d826cd 100644 (file)
@@ -23,6 +23,7 @@ sub load_rresults {
     my $item_type = $cgi->param('item_type');
     my $facet = $cgi->param('facet');
     my $query = $cgi->param('query');
+    my $search_class = $cgi->param('class');
     my $limit = $cgi->param('limit') || 10; # TODO user settings
 
     my $loc = $cgi->param('loc') || $ctx->{aou_tree}->()->id;
@@ -35,6 +36,10 @@ sub load_rresults {
     };
 
     $query = "$query $facet" if $facet; # TODO
+    # XXX Since open-ils.search is a public service, it is responsible for
+    # being wary of injection/bad input, not us, right?
+    $query = $search_class . ':' . $query if $search_class;
+
     my $results;
 
     try {
index dd413b7..941cf7c 100644 (file)
@@ -1,15 +1,9 @@
-<!-- ****************** adv_global_row.xml ***************************** -->
 <tr id='adv_global_trow' type='input'>
     <td align='left' width='100%' nowrap='nowrap'>
         <!-- select the search class -->
-        <select name='type' style='margin-right: 7px;'>
-            <option value='keyword' selected='selected'>[% l("Keyword") %]</option>
-            <option value='title'>[% l("Title") %]</option>
-            <option value='author'>[% l("Author") %]</option>
-            <option value='subject'>[% l("Subject") %]</option>
-            <option value='series'>[% l("Series") %]</option>
-            <option value='bibcn'>Bibliographic call number:</option>
-            </select>
+        <span class="opac-auto-078">
+            [% INCLUDE "default/opac/parts/stypes_selector.tt2" %]
+        </span>
         <!-- select how to treat the text -->
         <select name='contains' style='margin-right: 7px;'>
             <option value='contains'>[% l("Contains") %]</option>
@@ -21,4 +15,3 @@
         <!-- Remove this row -->
     </td>
 </tr>
-<!-- ****************** end: adv_global_row.xml ***************************** -->
index a7c6326..f3e30ad 100644 (file)
@@ -1,10 +1,16 @@
-<!-- ****************** stypes_selector.xml ***************************** -->
-<select id='search_type_selector'>
-       <option value='keyword' selected='selected'>[% l("Keyword") %]</option>
-       <option value='title'>[% l("Title") %]</option>
-       <option value='author'>[% l("Author") %]</option>
-       <option value='subject'>[% l("Subject") %]</option>
-       <option value='series'>[% l("Series") %]</option>
-       <option value='cn'>Call Number</option>
+[%  search_classes = [
+    {value => "", label => l("Keyword")},
+    {value => "title", label => l("Title")},
+    {value => "author", label => l("Author")},
+    {value => "subject", label => l("Subject")},
+    {value => "series", label => l("Series")},
+    {value => "cn", label => l("Call Number")}  # XXX or should this be bibcn?
+] %]
+<select id='search_type_selector' name="class">
+    [%  search_class = CGI.param('class');
+        FOR sc IN search_classes -%]
+    <option value='[% sc.value %]'[%
+        search_class == sc.value ? ' selected="selected"' : ''
+    %]>[% sc.label %]</option>
+    [% END -%]
 </select>
-<!-- ****************** end: stypes_selector.xml ***************************** -->