[Koha-patches] [PATCH 2/3] Bug 5917 follow-up: Fix staff client results display

Jared Camins-Esakov jcamins at bywatersolutions.com
Sun Apr 10 22:12:29 CEST 2011


The change to Template::Toolkit broke a number of things on the Staff Client
results display. This patch:
* Fixes the formatting of the results table, which had an unnecessary colspan=2
* Enables the display of the "Edit record" and "Edit items" links
* Corrects the display of item counts, so that labels for "Available,"
  "On loan," and "Unavailable" only appear when appropriate
* Corrects facet links, which were starting new searches rather than limiting
  due to a variable scoping error
* Changes the resort dropdown so that it will show the currently-selected
  sorting

Signed-off-by: Jared Camins-Esakov <jcamins at bywatersolutions.com>
---
 .../intranet-tmpl/prog/en/includes/facets.inc      |    4 +-
 .../intranet-tmpl/prog/en/includes/resort_form.inc |   24 ++++++++++----------
 .../prog/en/modules/catalogue/results.tt           |   22 +++++++++---------
 3 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc
index 292339e..bdeadde 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc
@@ -17,8 +17,8 @@
 [% IF ( facets_loo.type_label_Series ) %]Series[% END %]
 [% IF ( facets_loo.type_label_Libraries ) %]Libraries[% END %]
 <ul>
-        [% FOREACH facet IN facets_loo.facets %]<li><a href="/cgi-bin/koha/catalogue/search.pl?[% facet.query_cgi |html %][% facet.limit_cgi |html %][% IF ( facet.sort_by ) %]&amp;sort_by=[% facet.sort_by %][% END %]&amp;limit=[% facet.type_link_value %]:[% facet.facet_link_value %]" title="[% facet.facet_title_value %]">[% facet.facet_label_value %]</a> [% IF ( facet.displayFacetCount ) %]([% facet.facet_count %])[% END %]</li>[% END %][% IF ( facets_loo.expandable ) %]
-        <li class="showmore"><a href="/cgi-bin/koha/catalogue/search.pl?[% facets_loo.query_cgi |html %][% facets_loo.limit_cgi |html %][% IF ( facets_loo.sort_by ) %]&amp;sort_by=[% facets_loo.sort_by %][% END %]&amp;expand=[% facets_loo.expand %]#[% facets_loo.type_id %]">Show More</a></li>
+        [% FOREACH facet IN facets_loo.facets %]<li><a href="/cgi-bin/koha/catalogue/search.pl?[% query_cgi |html %][% limit_cgi |html %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by %][% END %]&amp;limit=[% facet.type_link_value %]:[% facet.facet_link_value %]" title="[% facet.facet_title_value %]">[% facet.facet_label_value %]</a> [% IF ( facet.displayFacetCount ) %]([% facet.facet_count %])[% END %]</li>[% END %][% IF ( facets_loo.expandable ) %]
+        <li class="showmore"><a href="/cgi-bin/koha/catalogue/search.pl?[% query_cgi |html %][% limit_cgi |html %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by %][% END %]&amp;expand=[% facets_loo.expand %]#[% facets_loo.type_id %]">Show More</a></li>
 [% END %]
 </ul></li>
 [% END %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/resort_form.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/resort_form.inc
index 87b763a..9f52aca 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/resort_form.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/resort_form.inc
@@ -2,12 +2,12 @@
 
 <optgroup label="Popularity">
 	
-	[% IF ( popularity_dsc ) %]
+	[% IF ( sort_by == "popularity_dsc" ) %]
 <option value="popularity_dsc" selected="selected">Popularity (Most to Least)</option>
 [% ELSE %]
 	<option value="popularity_dsc">Popularity (Most to Least)</option>
  [% END %]
-[% IF ( popularity_asc ) %]
+[% IF ( sort_by == "popularity_asc" ) %]
 <option value="popularity_asc" selected="selected">Popularity (Least to Most)</option>
 [% ELSE %]
 	<option value="popularity_asc">Popularity (Least to Most)</option>
@@ -17,12 +17,12 @@
 
 <optgroup label="Author">
 	
-	[% IF ( author_az ) %]
+	[% IF ( sort_by == "author_az" || sort_by == "author_asc" ) %]
 <option value="author_az" selected="selected">Author (A-Z)</option>	
 [% ELSE %]
 <option value="author_az">Author (A-Z)</option>
  [% END %]
-[% IF ( author_za ) %]
+[% IF ( sort_by == "author_za" || sort_by == "author_dsc" ) %]
 <option value="author_za" selected="selected">Author (Z-A)</option>
 [% ELSE %]
 <option value="author_za">Author (Z-A)</option>
@@ -32,13 +32,13 @@
 
 <optgroup label="Call Number">
 	
-	[% IF ( call_number_asc ) %]
+	[% IF ( sort_by == "call_number_asc" ) %]
 <option value="call_number_asc" selected="selected">Call Number (Non-fiction 0-9 to Fiction A-Z)</option>
 [% ELSE %]
 	<option value="call_number_asc">Call Number (Non-fiction 0-9 to Fiction A-Z)</option>
 [% END %]
 
-[% IF ( call_number_dsc ) %]
+[% IF ( sort_by == "call_number_dsc" ) %]
 <option value="call_number_dsc" selected="selected">Call Number (Fiction Z-A to Non-fiction 9-0)</option>
 [% ELSE %]
 	<option value="call_number_dsc">Call Number (Fiction Z-A to Non-fiction 9-0)</option>
@@ -47,25 +47,25 @@
 </optgroup>
 
 <optgroup label="Dates">
-	[% IF ( pubdate_dsc ) %]
+	[% IF ( sort_by == "pubdate_dsc" ) %]
 <option value="pubdate_dsc" selected="selected" >Publication/Copyright Date: Newest to Oldest</option>
 	[% ELSE %]
 <option value="pubdate_dsc">Publication/Copyright Date: Newest to Oldest</option>
 [% END %]
 
-[% IF ( pubdate_asc ) %]
+[% IF ( sort_by == "pubdate_asc" ) %]
 <option value="pubdate_asc" selected="selected" >Publication/Copyright Date: Oldest to Newest</option>
 [% ELSE %]
 <option value="pubdate_asc">Publication/Copyright Date: Oldest to Newest</option>
 [% END %]
 
-[% IF ( acqdate_dsc ) %]
+[% IF ( sort_by == "acqdate_dsc" ) %]
 <option value="acqdate_dsc" selected="selected">Acquisition Date: Newest to Oldest</option>
 [% ELSE %]
 <option value="acqdate_dsc">Acquisition Date: Newest to Oldest</option>
  [% END %]
 
- [% IF ( acqdate_asc ) %]
+ [% IF ( sort_by == "acqdate_asc" ) %]
 <option value="acqdate_asc" selected="selected">Acquisition Date: Oldest to Newest</option>
 [% ELSE %]
 <option value="acqdate_asc">Acquisition Date: Oldest to Newest</option>
@@ -73,12 +73,12 @@
 </optgroup>
 
 <optgroup label="Title">
-	[% IF ( title_az ) %]
+	[% IF ( sort_by == "title_az" || sort_by == "title_asc" ) %]
 <option value="title_az" selected="selected">Title (A-Z)</option>
 	[% ELSE %]
 <option value="title_az">Title (A-Z)</option>
 	 [% END %]
-	[% IF ( title_za ) %]
+	[% IF ( sort_by == "title_za" || sort_by == "title_dsc" ) %]
 <option value="title_za" selected="selected">Title (Z-A)</option>	
 	[% ELSE %]
 <option value="title_za">Title (Z-A)</option>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt
index 8031470..b9e269d 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt
@@ -412,7 +412,7 @@ YAHOO.util.Event.onContentReady("searchheader", function () {
                 <table>
                     <tr>
                         [% IF ( AmazonEnabled ) %][% IF ( AmazonCoverImages ) %]<th>&nbsp;</th>[% END %][% END %]
-                        <th colspan="2">Results</th>
+                        <th>Results</th>
                         <th>Location</th>
                     </tr>
                         <!-- Actual Search Results -->
@@ -491,20 +491,20 @@ YAHOO.util.Event.onContentReady("searchheader", function () {
                                   <a id="reserve_[% SEARCH_RESULT.biblionumber %]" href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">Holds</a>
                                   [% IF ( SEARCH_RESULT.holdfor ) %] | <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]&amp;findborrower=[% SEARCH_RESULT.holdfor_cardnumber %]">Hold for [% SEARCH_RESULT.holdfor_firstname %] [% SEARCH_RESULT.holdfor_surname %] ([% SEARCH_RESULT.holdfor_cardnumber %])</a>[% END %]
                               [% END %]
-                          [% IF ( SEARCH_RESULT.CAN_user_editcatalogue_edit_catalogue ) %]
+                          [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
                           | <a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">Edit record</a>
                           [% END %]
-                          [% IF ( SEARCH_RESULT.CAN_user_editcatalogue_edit_items ) %]
+                          [% IF ( CAN_user_editcatalogue_edit_items ) %]
                           | <a href="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">Edit items</a>
                           [% END %]</p>
                                 </td>
 
                                 <td><div class="availability">
                                     [% IF ( SEARCH_RESULT.items_count ) %]<strong>[% SEARCH_RESULT.items_count %]
-                                    [% IF ( SEARCH_RESULT.itemsplural ) %]items[% ELSE %]item[% END %][% IF ( SEARCH_RESULT.available_items_loop ) %], [% IF ( SEARCH_RESULT.availablecount ) %][% SEARCH_RESULT.availablecount %] available:[% END %][% ELSE %], None available[% END %]</strong>
+                                    [% IF ( SEARCH_RESULT.itemsplural ) %]items[% ELSE %]item[% END %][% IF ( SEARCH_RESULT.availablecount ) %], [% SEARCH_RESULT.availablecount %] available:[% ELSE %], None available[% END %]</strong>
 
-                                    [% IF ( SEARCH_RESULT.available_items_loop ) %]
-                                    [% IF ( SEARCH_RESULT.availablecount ) %][% SEARCH_RESULT.availablecount %][% END %] available:
+                                    [% IF ( SEARCH_RESULT.availablecount ) %]
+                                    [% SEARCH_RESULT.availablecount %] available:
                                     <ul>
                                     [% FOREACH available_items_loo IN SEARCH_RESULT.available_items_loop %]
 
@@ -516,8 +516,8 @@ YAHOO.util.Event.onContentReady("searchheader", function () {
                                     [% END %]</ul>
                                     [% END %]
 
-                                   [% IF ( SEARCH_RESULT.onloan_items_loop ) %]
-                                   <span class="status">[% IF ( SEARCH_RESULT.onloancount ) %][% SEARCH_RESULT.onloancount %][% END %] on loan:</span>
+                                   [% IF ( SEARCH_RESULT.onloancount ) %]
+                                   <span class="status">[% SEARCH_RESULT.onloancount %] on loan:</span>
                                     <ul>
                                     [% FOREACH onloan_items_loo IN SEARCH_RESULT.onloan_items_loop %]
                                        [% IF ( noItemTypeImages ) %]<li>[% ELSE %][% IF ( item_level_itypes ) %]
@@ -533,8 +533,8 @@ YAHOO.util.Event.onContentReady("searchheader", function () {
                                     [% END %]</ul>
                                     [% END %]
 
-                                    [% IF ( SEARCH_RESULT.other_items_loop ) %]
-                                    <span class="unavailable">[% IF ( SEARCH_RESULT.othercount ) %][% SEARCH_RESULT.othercount %][% END %] unavailable:</span>
+                                    [% IF ( SEARCH_RESULT.othercount ) %]
+                                    <span class="unavailable">[% SEARCH_RESULT.othercount %] unavailable:</span>
                                     <ul>
                                     [% FOREACH other_items_loo IN SEARCH_RESULT.other_items_loop %]
                                         [% IF ( noItemTypeImages ) %]<li>[% ELSE %][% IF ( item_level_itypes ) %]
@@ -556,7 +556,7 @@ YAHOO.util.Event.onContentReady("searchheader", function () {
                                     [% END %]</ul>
                                     [% END %]
                                     [% ELSE %]
-                                    [% IF ( SEARCH_RESULT.ALTERNATEHOLDINGS ) %]
+                                    [% IF ( SEARCH_RESULT.ALTERNATEHOLDINGS.count ) %]
                                     <strong id="altholdings_heading">Other holdings:</strong>
                                     <ul>
                                     [% FOREACH ALTERNATEHOLDING IN SEARCH_RESULT.ALTERNATEHOLDINGS %]
-- 
1.7.2.3



More information about the Koha-patches mailing list