Bug 5917 follow-up: Fix errors on OPAC results

This patch fixes the following problems with the OPAC search results:
* The facet links were constructed wrong following the change to
  Template::Toolkit

This patch also changes the OPAC sorting dropdown to work in the same way as the
staff dropdown. This seemed preferable to having the two use different variables
for deciding which option to select, and it is unclear why Search.pm was not
passing the appropriate variables to the staff client.

Signed-off-by: Jared Camins-Esakov <jcamins@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
This commit is contained in:
Jared Camins-Esakov 2011-04-10 16:12:30 -04:00 committed by Chris Cormack
parent f1e96f4590
commit 6e2260c739
2 changed files with 63 additions and 29 deletions

View file

@ -18,8 +18,8 @@
[% IF ( facets_loo.type_label_Libraries ) %]Libraries[% END %]
[% END %]
<ul>
[% FOREACH facet IN facets_loo.facets %]<li><a href="/cgi-bin/koha/opac-search.pl?[% facet.query_cgi %][% 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 |html %]">[% 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/opac-search.pl?[% facets_loo.query_cgi %][% facets_loo.limit_cgi |html %][% IF ( facets_loo.sort_by ) %]&amp;sort_by=[% facets_loo.sort_by %][% END %]&amp;offset=[% facets_loo.offset %]&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/opac-search.pl?[% query_cgi %][% 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 |html %]">[% 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/opac-search.pl?[% query_cgi %][% limit_cgi |html %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by %][% END %]&amp;offset=[% facets_loo.offset %]&amp;expand=[% facets_loo.expand %]#[% facets_loo.type_id %]">Show More</a></li>
[% END %]
</ul></li>
[% END %]

View file

@ -1,36 +1,70 @@
<option value="relevance">Relevance</option>
<optgroup label="Popularity">[% IF ( popularity_dsc ) %]
<optgroup label="Popularity">
[% 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 ) %]
<option value="popularity_dsc">Popularity (Most to Least)</option>
[% END %]
[% 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>[% END %]
<option value="popularity_asc">Popularity (Least to Most)</option>
[% END %]
</optgroup>
<optgroup label="Author">[% IF ( author_az ) %]
<option value="author_az" selected="selected">Author (A-Z)</option>[% ELSE %]
<option value="author_az">Author (A-Z)</option>[% END %][% IF ( author_za ) %]
<option value="author_za" selected="selected">Author (Z-A)</option>[% ELSE %]
<option value="author_za">Author (Z-A)</option>[% END %]
<optgroup label="Author">
[% 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 ( 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>
[% END %]
</optgroup>
<optgroup label="Call Number">[% IF ( 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 ) %]
<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>[% END %]
<optgroup label="Call Number">
[% 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 ( 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>
[% END %]
</optgroup>
<optgroup label="Dates">[% IF ( 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 ) %]
<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 ) %]
<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 ) %]
<option value="acqdate_asc" selected="selected">Acquisition Date: Oldest to Newest</option>[% ELSE %]
<option value="acqdate_asc">Acquisition Date: Oldest to Newest</option>[% END %]
<optgroup label="Dates">
[% 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 ( 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 ( 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 ( 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>
[% END %]
</optgroup>
<optgroup label="Title">[% IF ( title_az ) %]
<option value="title_az" selected="selected">Title (A-Z)</option>[% ELSE %]
<option value="title_az">Title (A-Z)</option>[% END %][% IF ( title_za ) %]
<option value="title_za" selected="selected">Title (Z-A)</option>[% ELSE %]
<option value="title_za">Title (Z-A)</option>[% END %]
<optgroup label="Title">
[% 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 ( 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>
[% END %]
</optgroup>