From 78dce8ba1bedb4ea2bb914fe70113faa46520d7e Mon Sep 17 00:00:00 2001 From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Date: Mon, 5 Oct 2015 11:17:23 +0100 Subject: [PATCH] Bug 14955: Don't double encode chars in the "Show more" link MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug 13789 has fixed this issue for the facet links (select/unselect) but not for the "Show more" facets link. This patch reuses the "url" variable, generated for the facets, for these links. A new "local_url" variable is used to build links for each entry. Test plan (for OPAC and intranet): - Search for a very common term - Filter the results using facets - You should get more than 5 entries for a facet and 1 selected: Author author 1 author 2 [x] # Selected author 3 author 4 author 5 Show more # you see this link if there is 5+ values for this facet - Click on the Show more link Without this patch, the url contains double-encoded characters and you will certainly don't get any results With this patch, you should get results. Signed-off-by: Marc Véron <veron@veron.ch> --- koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc | 19 +++++++++---------- .../opac-tmpl/bootstrap/en/includes/opac-facets.inc | 19 +++++++++---------- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc index 157366e..d0abde9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc @@ -21,19 +21,19 @@ [% IF ( facets_loo.type_label_HoldingLibrary ) %]<span id="facet-holding-libraries">Holding libraries</span>[% END %] [% IF facets_loo.type_label_Location %]<span id="facet-locations">Locations</span>[% END %] <ul> + [% SET url = "/cgi-bin/koha/catalogue/search.pl?" _ query_cgi _ limit_cgi %] + [% IF ( sort_by ) %] + [% url = BLOCK %][% url %][% "&sort_by=" _ sort_by |url %][% END %] + [% END %] [% FOREACH facet IN facets_loo.facets %] <li> - [% SET url = "/cgi-bin/koha/catalogue/search.pl?" _ query_cgi _ limit_cgi %] - [% IF ( sort_by ) %] - [% url = BLOCK %][% url %][% "&sort_by=" _ sort_by |url %][% END %] - [% END %] [% IF facet.active %] - [% SET url = url _ "&nolimit=" _ facet.type_link_value _ ":" _ facet.facet_link_value %] + [% SET local_url = url _ "&nolimit=" _ facet.type_link_value _ ":" _ facet.facet_link_value %] <span class="facet-label">[% facet.facet_label_value %]</span> - [<a href="[% url %]" title="Remove facet [% facet.facet_link_value | html %]">x</a>] + [<a href="[% local_url %]" title="Remove facet [% facet.facet_link_value | html %]">x</a>] [% ELSE %] - [% SET url = url _ "&limit=" _ facet.type_link_value _ ":" _ facet.facet_link_value %] - <span class="facet-label"><a href="[% url %]" title="[% facet.facet_title_value |html %]">[% facet.facet_label_value %]</a></span> + [% SET local_url = url _ "&limit=" _ facet.type_link_value _ ":" _ facet.facet_link_value %] + <span class="facet-label"><a href="[% local_url %]" title="[% facet.facet_title_value |html %]">[% facet.facet_label_value %]</a></span> [% IF ( displayFacetCount ) %] <span class="facet-count"> ([% facet.facet_count %])</span> [% END %] @@ -42,8 +42,7 @@ [% END %] [% IF ( facets_loo.expandable ) %] <li class="showmore"> - <a href="/cgi-bin/koha/catalogue/search.pl?[% query_cgi %][% limit_cgi |url %][% IF ( sort_by ) %]&sort_by=[% sort_by |url %][% END %][% IF ( offset ) %] - &offset=[% offset |url %][% END %]&expand=[% facets_loo.expand |url %]#[% facets_loo.type_id |url %]">Show more</a> + <a href="[% url %][% IF offset %]&offset=[% offset |url %][% END %]&expand=[% facets_loo.expand |url %]#[% facets_loo.type_id |url %]">Show more</a> </li> [% END %] </ul></li> diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-facets.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-facets.inc index 958d571..3d503aa 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-facets.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-facets.inc @@ -30,19 +30,19 @@ [% END %] [% IF facets_loo.type_label_Location %]<h5 id="facet-locations">Locations</h5>[% END %] <ul> + [% SET url = "/cgi-bin/koha/opac-search.pl?" _ query_cgi _ limit_cgi %] + [% IF ( sort_by ) %] + [% url = BLOCK %][% url %][% "&sort_by=" _ sort_by |url %][% END %] + [% END %] [% FOREACH facet IN facets_loo.facets %] <li> - [% SET url = "/cgi-bin/koha/opac-search.pl?" _ query_cgi _ limit_cgi %] - [% IF ( sort_by ) %] - [% url = BLOCK %][% url %][% "&sort_by=" _ sort_by |url %][% END %] - [% END %] [% IF facet.active %] - [% SET url = url _ "&nolimit=" _ facet.type_link_value _ ":" _ facet.facet_link_value %] + [% SET local_url = url _ "&nolimit=" _ facet.type_link_value _ ":" _ facet.facet_link_value %] <span class="facet-label">[% facet.facet_label_value %]</span> - [<a href="[% url %]" title="Remove facet [% facet.facet_link_value | html %]">x</a>] + [<a href="[% local_url %]" title="Remove facet [% facet.facet_link_value | html %]">x</a>] [% ELSE %] - [% SET url = url _ "&limit=" _ facet.type_link_value _ ":" _ facet.facet_link_value %] - <span class="facet-label"><a href="[% url %]" title="[% facet.facet_title_value |html %]">[% facet.facet_label_value %]</a></span> + [% SET local_url = url _ "&limit=" _ facet.type_link_value _ ":" _ facet.facet_link_value %] + <span class="facet-label"><a href="[% local_url %]" title="[% facet.facet_title_value |html %]">[% facet.facet_label_value %]</a></span> [% IF ( displayFacetCount ) %] <span class="facet-count"> ([% facet.facet_count %])</span> [% END %] @@ -51,8 +51,7 @@ [% END %] [% IF ( facets_loo.expandable ) %] <li class="showmore"> - <a href="/cgi-bin/koha/opac-search.pl?[% query_cgi %][% limit_cgi |url %][% IF ( sort_by ) %]&sort_by=[% sort_by |url %][% END %][% IF ( offset ) %] - &offset=[% offset |url %][% END %]&expand=[% facets_loo.expand |url %]#[% facets_loo.type_id |url %]">Show more</a> + <a href="[% url %][% IF offset %]&offset=[% offset |url %][% END %]&expand=[% facets_loo.expand |url %]#[% facets_loo.type_id |url %]">Show more</a> </li> [% END %] </ul> -- 1.7.10.4