refining advanced search now preserves qtype/contains/query combos. also,
authorsenator <lebbeous@esilibrary.com>
Fri, 25 Feb 2011 16:42:30 +0000 (11:42 -0500)
committersenator <lebbeous@esilibrary.com>
Fri, 25 Feb 2011 16:42:30 +0000 (11:42 -0500)
also, show something better for empty search results

Open-ILS/web/css/skin/default/opac/semiauto.css
Open-ILS/web/css/skin/default/opac/style.css
Open-ILS/web/templates/default/opac/parts/advanced/global_row.tt2
Open-ILS/web/templates/default/opac/parts/qtype_selector.tt2 [new file with mode: 0644]
Open-ILS/web/templates/default/opac/parts/result/lowhits.tt2
Open-ILS/web/templates/default/opac/parts/searchbar.tt2
Open-ILS/web/templates/default/opac/parts/stypes_selector.tt2 [deleted file]

index 68edb5e..f652eaa 100644 (file)
@@ -27,7 +27,6 @@
 .opac-auto-039 { float: left; font-weight: bold; padding-top: 5px; }
 .opac-auto-040 { float: left; padding: 5px 0px 0px 10px; }
 .left-corner { float: left; width: 163px; height: 30px; background: url('/images/utils-corner-mid.png') repeat-x top; }
-.opac-auto-043 { float: left; width: 300px; margin-top: 20px; }
 .float-right { float: right; }
 .opac-auto-045 { float: right; margin-right: 17px; }
 .opac-auto-046 { float: right; width: 214px; }
index 0366017..6780de3 100644 (file)
@@ -714,6 +714,8 @@ div.select-wrapper:hover {
        padding-bottom:5px;
 }
 
+#zero_search_hits div { float:left;width:300px;margin-top:20px; }
+
 #zero_search_hits p {
        margin-top:0;
 }
@@ -937,3 +939,4 @@ div.select-wrapper:hover {
 #adv_search_refine {
     padding-left: 5em; background-color: #d7d7d7; margin: 2ex 0;
 }
+.row-remover { position: relative; top: 1px; vertical-align: middle; }
index f553218..afa97ff 100644 (file)
@@ -1,21 +1,26 @@
-<tr id="adv_global_row" type='input'>
+[%
+    contains = CGI.param('contains');
+    queries = CGI.param('query');
+    qtypes = CGI.param('qtype') || ['keyword'];
+    FOR qtype IN qtypes;
+        c = contains.shift;
+        q = queries.shift; %]
+<tr[% IF loop.first %] id="adv_global_row"[% END %]>
     <td align='left' width='100%' nowrap='nowrap'>
-        <!-- select the search class -->
         <span class="opac-auto-078">
-            [% INCLUDE "default/opac/parts/stypes_selector.tt2" %]
+            [% INCLUDE "default/opac/parts/qtype_selector.tt2"
+                query_type=qtype %]
         </span>
-        <!-- select how to treat the text -->
         <select name='contains' style='margin-right: 7px;'>
-            <option value='contains'>[% l("Contains") %]</option>
-            <option value='nocontains'>[% l("Does not contain") %]</option>
-            <option value='exact'>[% l("Matches Exactly") %]</option>
+            <option value='contains'[% c == 'contains' ? ' selected="selected"' : '' %]>[% l("Contains") %]</option>
+            <option value='nocontains'[% c == 'nocontains' ? ' selected="selected"' : '' %]>[% l("Does not contain") %]</option>
+            <option value='exact'[% c == 'exact' ? ' selected="selected"' : '' %]>[% l("Matches Exactly") %]</option>
         </select>
-        <!-- search term -->
-        <input type='text' size='18' name='query' />
-        <!-- Remove this row -->
-        <a href="javascript:;"
-            style="position:relative;top:1px; vertical-align: middle;"
+        <input type='text' size='18' name='query' value="[% q | html %]" />
+        <a href="javascript:;" class="row-remover"
             title="[% l('Remove row') %]" alt="[% l('Remove row') %]"
             onclick='var row = this.parentNode.parentNode;var tbody = row.parentNode; if( tbody.getElementsByTagName("tr").length > 2 ) row.parentNode.removeChild(row);'><img src="[% ctx.media_prefix %]/images/adv_row_close_btn.png" /></a>
     </td>
 </tr>
+[%      i = i + 1;
+    END %]
diff --git a/Open-ILS/web/templates/default/opac/parts/qtype_selector.tt2 b/Open-ILS/web/templates/default/opac/parts/qtype_selector.tt2
new file mode 100644 (file)
index 0000000..8c31f0d
--- /dev/null
@@ -0,0 +1,16 @@
+[%  query_types = [
+    {value => "keyword", label => l("Keyword")},
+    {value => "title", label => l("Title")},
+    {value => "author", label => l("Author")},
+    {value => "subject", label => l("Subject")},
+    {value => "series", label => l("Series")},
+    {value => "id|bibcn", label => l("Call Number")}
+] %]
+<select name="qtype">
+    [%  query_type = query_type || CGI.param('qtype');
+        FOR qt IN query_types -%]
+    <option value='[% qt.value %]'[%
+        query_type == qt.value ? ' selected="selected"' : ''
+    %]>[% qt.label %]</option>
+    [% END -%]
+</select>
index 1afe8b0..9393c49 100644 (file)
@@ -1,8 +1,11 @@
 <div id='result_low_hits'>
     <div id="zero_search_hits">
-        <div style="float:left;width:300px;margin-top:20px;">
-            <p>Sorry, no entries were found for
-                <q id="zero_hits_term">[% query | html %]</q><br />
+        <div>
+            <p>[% l('Sorry, no entries were found for') %]
+                [% IF is_advanced; l('your search'); ELSE %]
+                <q>[% CGI.param('query') | html %]</q>
+                [% END %]
+                <br />
                 <span id="zero_hits_label1" class="hide_me">Did you mean
                     <strong><a id="spell_check_link" href="javascript:;"></a></strong>?</span>
             </p>
index 7a83aea..8e9d787 100644 (file)
@@ -18,7 +18,7 @@
                 <input type="hidden" name="_adv" value="1" />
             [% ELSE %]
             <td>
-            [% INCLUDE "default/opac/parts/stypes_selector.tt2" %]
+            [% INCLUDE "default/opac/parts/qtype_selector.tt2" %]
             </td>
             <td>
             [% END %]
diff --git a/Open-ILS/web/templates/default/opac/parts/stypes_selector.tt2 b/Open-ILS/web/templates/default/opac/parts/stypes_selector.tt2
deleted file mode 100644 (file)
index b139791..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-[%  search_classes = [
-    {value => "keyword", label => l("Keyword")},
-    {value => "title", label => l("Title")},
-    {value => "author", label => l("Author")},
-    {value => "subject", label => l("Subject")},
-    {value => "series", label => l("Series")},
-    {value => "id|bibcn", label => l("Call Number")}
-] %]
-<select name="qtype">
-    [%  search_class = CGI.param('qtype');
-        FOR sc IN search_classes -%]
-    <option value='[% sc.value %]'[%
-        search_class == sc.value ? ' selected="selected"' : ''
-    %]>[% sc.label %]</option>
-    [% END -%]
-</select>