make the zero-hits case work for search results
authorsenator <lebbeous@esilibrary.com>
Thu, 17 Feb 2011 14:18:53 +0000 (09:18 -0500)
committersenator <lebbeous@esilibrary.com>
Thu, 17 Feb 2011 14:18:53 +0000 (09:18 -0500)
Open-ILS/web/css/skin/default/opac/style.css
Open-ILS/web/templates/default/opac/parts/result/header.tt2 [deleted file]
Open-ILS/web/templates/default/opac/parts/result/lowhits.tt2
Open-ILS/web/templates/default/opac/parts/result/table.tt2
Open-ILS/web/templates/default/opac/results.tt2

index 5fcfe9d..3a8a94a 100644 (file)
@@ -720,6 +720,7 @@ div.select-wrapper:hover {
 
 #zero_hits_term {
        text-transform: uppercase;
+    font-weight: bold;
 }
 
 #zero_search_hits #spell_check_link {
diff --git a/Open-ILS/web/templates/default/opac/parts/result/header.tt2 b/Open-ILS/web/templates/default/opac/parts/result/header.tt2
deleted file mode 100644 (file)
index 67f6193..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-[%  q = query | url;
-    np_link = '?query=' _ q;
-    IF loc;
-        np_link = np_link _ "&loc=" _ loc;
-    END;
-    IF depth or depth == 0;
-        np_link = np_link _ "&depth=" _ depth;
-    END;
-    ctx.result_start = 1 + ctx.page_size * page;
-    ctx.result_stop = 1 + ctx.page_size * (page + 1);
-    IF ctx.result_stop > ctx.hit_count; ctx.result_stop = ctx.hit_count; END;
-%]
-<div style="height: 10px;"></div>
-[% BLOCK results_count_header %]
-<div class="results_header_nav1">
-    <table cellpadding="0" cellspacing="0" border="0" width="100%">
-        <tr>
-            <td class="h1" width="116">Search Results</td>
-            <td valign="bottom" nowrap="nowrap" class="result_number">
-                [% l("Results") %]
-                <strong>[% ctx.result_start %]</strong>
-                &nbsp;-
-                <strong>[% ctx.result_stop  %] </strong>
-                &nbsp;[% l("of") %]
-                <strong>[% ctx.hit_count %]</strong>
-                <span style='padding-left: 6px;'>
-                    (page
-                    <strong>[% page + 1 %]</strong>
-                    &nbsp;[% l("of") %]
-                    <strong>[% page_count %]</strong>)
-                </span>
-            </td>
-            <td align="right" valign="bottom">
-                <span class='start_end_links_span'>
-                    [% IF page > 0 %]
-                    <a class='search_page_nav_link'
-                        href="[% np_link _ '&page=' _ (page - 1) %]"
-                        title='[% l("Previous page") %]'>
-                        <span class="nav_arrow_fix">&#9668;</span> Previous
-                    </a>
-                    [% END %]
-                    <span class='hide_me'
-                        style='padding-left: 11px; padding-right:11px;'>
-                        <span></span>
-                    </span>
-                    [% IF (page + 1) < page_count %]
-                    <a class='search_page_nav_link'
-                        href="[% np_link _ '&page=' _ (page + 1) %]"
-                        title='[% l("Next page") %]'>
-                        Next <span class="nav_arrow_fix">&#9658;</span>
-                    </a>
-                    [% END %]
-                </span>
-            </td>
-        </tr>
-    </table>
-</div>
-[% END %]
-[% ctx.results_count_header = PROCESS results_count_header;
-    ctx.results_count_header %]
index a35876a..1afe8b0 100644 (file)
@@ -1,9 +1,8 @@
-<!-- ****************** result_lowhits.xml ***************************** -->
-<div id='result_low_hits' class='hide_me'>
-    <div id="zero_search_hits" class="hide_me">
+<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
-                <strong>&quot;<span id="zero_hits_term"></span>&quot;</strong><br />
+                <q id="zero_hits_term">[% query | html %]</q><br />
                 <span id="zero_hits_label1" class="hide_me">Did you mean
                     <strong><a id="spell_check_link" href="javascript:;"></a></strong>?</span>
             </p>
@@ -28,7 +27,8 @@
                 Change to <strong>Advanced Keyword Search.</strong>
             </p>
             <p>
-                Adjacency Multiple words are not searched together as a phrase. They will
+                <strong>Adjacency</strong><br />
+                Multiple words are not searched together as a phrase. They will
                 be found in various parts of the record. To search for a phrase, enclose your
                 search terms in quotation marks.<br />
                 (example:  <strong>&quot;garcia marquez&quot;</strong>)
@@ -90,4 +90,3 @@
         </div>
     </div>
 </div>
-<!-- ****************** end: result_lowhits.xml ***************************** -->
index b602af2..0e77bbb 100644 (file)
@@ -1,6 +1,67 @@
 [%  PROCESS "default/opac/parts/marc_misc.tt2";
-    SET result_count = ctx.result_start; %]
-<!-- ****************** result_table.xml ***************************** -->
+
+    q = query | url;
+    np_link = '?query=' _ q;
+    IF loc;
+        np_link = np_link _ "&loc=" _ loc;
+    END;
+    IF depth or depth == 0;
+        np_link = np_link _ "&depth=" _ depth;
+    END;
+    ctx.result_start = 1 + ctx.page_size * page;
+    ctx.result_stop = 1 + ctx.page_size * (page + 1);
+    IF ctx.result_stop > ctx.hit_count; ctx.result_stop = ctx.hit_count; END;
+
+    result_count = ctx.result_start;
+%]
+<div style="height: 10px;"></div>
+[% BLOCK results_count_header %]
+<div class="results_header_nav1">
+    <table cellpadding="0" cellspacing="0" border="0" width="100%">
+        <tr>
+            <td class="h1" width="116">Search Results</td>
+            <td valign="bottom" nowrap="nowrap" class="result_number">
+                [% l("Results") %]
+                <strong>[% ctx.result_start %]</strong>
+                &nbsp;-
+                <strong>[% ctx.result_stop  %] </strong>
+                &nbsp;[% l("of") %]
+                <strong>[% ctx.hit_count %]</strong>
+                <span style='padding-left: 6px;'>
+                    (page
+                    <strong>[% page + 1 %]</strong>
+                    &nbsp;[% l("of") %]
+                    <strong>[% page_count %]</strong>)
+                </span>
+            </td>
+            <td align="right" valign="bottom">
+                <span class='start_end_links_span'>
+                    [% IF page > 0 %]
+                    <a class='search_page_nav_link'
+                        href="[% np_link _ '&page=' _ (page - 1) %]"
+                        title='[% l("Previous page") %]'>
+                        <span class="nav_arrow_fix">&#9668;</span> Previous
+                    </a>
+                    [% END %]
+                    <span class='hide_me'
+                        style='padding-left: 11px; padding-right:11px;'>
+                        <span></span>
+                    </span>
+                    [% IF (page + 1) < page_count %]
+                    <a class='search_page_nav_link'
+                        href="[% np_link _ '&page=' _ (page + 1) %]"
+                        title='[% l("Next page") %]'>
+                        Next <span class="nav_arrow_fix">&#9658;</span>
+                    </a>
+                    [% END %]
+                </span>
+            </td>
+        </tr>
+    </table>
+</div>
+[% END %]
+[% ctx.results_count_header = PROCESS results_count_header;
+    ctx.results_count_header %]
 <div id="result_table_div">
     <table cellpadding="0" cellspacing="0" border="0" width="100%">
         <tr>
     [% ctx.results_count_header %]
     <!-- ChiliFresh XXX script TODO -->
 </div>
-<!-- ****************** end: result_table.xml ***************************** -->
index e698e87..3c99292 100644 (file)
         </div>
         <div id="main-content">
             <div id="tehResultsPage">
-                [% INCLUDE "default/opac/parts/result/header.tt2" %]
-                <div id="rresults_page">
-                    [% INCLUDE "default/opac/parts/result/table.tt2" %]
-                    [% INCLUDE "default/opac/parts/result/lowhits.tt2" %]
-                </div>
+                [% path = "default/opac/parts/result/" _
+                    (ctx.records.size ? "table.tt2" : "lowhits.tt2");
+                INCLUDE $path %]
             </div>
             <div class="common-full-pad"></div>    
         </div>