From 995b6c4ae0112ec7f4419af3ef3c230ca32f0ea3 Mon Sep 17 00:00:00 2001 From: Kathy Lussier Date: Tue, 26 Aug 2014 15:49:45 -0400 Subject: [PATCH] lp1271198 Strip browse and facet parameters from links Browse and facet parameters were sticking to links to author, subject and series links on record and result pages, as well as some other links where the search parameters were no longer necessary. This commit: 1. Adds browse_search_parms and facet_search_parms to header.tt2 as new classes of search parameters that one may want to remove. 2. Removes these parameters from the author and subject links on the record page. It also uses the same method for removing search parameters from the author link on the search results page and on the searchbar Browse link. 3. Fixes an issue where the advanced search links were inadvertently stripping general search parameters. 4. Adds more parameters to the general_search_parms group so that we can have cleaner URLs. Signed-off-by: Kathy Lussier Signed-off-by: Jason Stephenson --- Open-ILS/src/templates/opac/parts/header.tt2 | 5 ++++- Open-ILS/src/templates/opac/parts/record/authors.tt2 | 2 +- Open-ILS/src/templates/opac/parts/record/series.tt2 | 2 +- Open-ILS/src/templates/opac/parts/record/subjects.tt2 | 2 +- Open-ILS/src/templates/opac/parts/result/table.tt2 | 2 +- Open-ILS/src/templates/opac/parts/searchbar.tt2 | 4 ++-- Open-ILS/src/templates/opac/results.tt2 | 2 +- 7 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Open-ILS/src/templates/opac/parts/header.tt2 b/Open-ILS/src/templates/opac/parts/header.tt2 index 57c293c2bf..b0d68836d2 100644 --- a/Open-ILS/src/templates/opac/parts/header.tt2 +++ b/Open-ILS/src/templates/opac/parts/header.tt2 @@ -14,7 +14,10 @@ #variables to use to remove parameters via mkurk expert_search_parms = ['tag','subfield','term','_special']; - general_search_parms = ['page','sort','query']; + general_search_parms = ['page','sort','query','bool','contains','pubdate']; + browse_search_parms = ['fi:has_browse_entry','bterm','blimit','bpivot']; + facet_search_parms = ['facet']; + # ----------------------------------------------------------------------------- # mkurl( destination_page, params_to_set, params_to_clear ) diff --git a/Open-ILS/src/templates/opac/parts/record/authors.tt2 b/Open-ILS/src/templates/opac/parts/record/authors.tt2 index c8e56784d2..51fbe8febc 100644 --- a/Open-ILS/src/templates/opac/parts/record/authors.tt2 +++ b/Open-ILS/src/templates/opac/parts/record/authors.tt2 @@ -91,7 +91,7 @@ BLOCK build_author_links; supp_term = supp_term _ ' ' _ sf; END; END; - url = mkurl(ctx.opac_root _ '/results', {query => qterm.replace('^\s*(.*?)\s*$', '$1'), qtype => 'author'}, stop_parms.merge(expert_search_parms, general_search_parms)); + url = mkurl(ctx.opac_root _ '/results', {query => qterm.replace('^\s*(.*?)\s*$', '$1'), qtype => 'author'}, stop_parms.merge(expert_search_parms, general_search_parms, browse_search_parms, facet_search_parms)); author_type = (tlabel || label) | html; # schema.org changes diff --git a/Open-ILS/src/templates/opac/parts/record/series.tt2 b/Open-ILS/src/templates/opac/parts/record/series.tt2 index 0ddc378680..4be6b8326c 100644 --- a/Open-ILS/src/templates/opac/parts/record/series.tt2 +++ b/Open-ILS/src/templates/opac/parts/record/series.tt2 @@ -24,7 +24,7 @@ BLOCK render_series; total_term = all_terms.join(" ").replace('\s+$', ''); url = mkurl(ctx.opac_root _ '/results', - { qtype=>'series', query=>total_term }, stop_parms.merge(expert_search_parms, general_search_parms) + { qtype=>'series', query=>total_term }, stop_parms.merge(expert_search_parms, general_search_parms, browse_search_parms, facet_search_parms) ); series = series _ '' _ single_term _ ' '; END; diff --git a/Open-ILS/src/templates/opac/parts/record/subjects.tt2 b/Open-ILS/src/templates/opac/parts/record/subjects.tt2 index 68c421b648..e074f89158 100644 --- a/Open-ILS/src/templates/opac/parts/record/subjects.tt2 +++ b/Open-ILS/src/templates/opac/parts/record/subjects.tt2 @@ -47,7 +47,7 @@ all_terms.push(subfield.textContent.replace('\-', ' ').replace('[#"^$\+,\.:;&|\[\]()]', '')); total_term = all_terms.join(" ").replace('\s+$', ''); %] -[% single_term %] +[% single_term %] [%- END; IF all_terms.size; "
"; END; FOREACH link880 IN graphics; diff --git a/Open-ILS/src/templates/opac/parts/result/table.tt2 b/Open-ILS/src/templates/opac/parts/result/table.tt2 index ef3734bf56..ff9cda9611 100644 --- a/Open-ILS/src/templates/opac/parts/result/table.tt2 +++ b/Open-ILS/src/templates/opac/parts/result/table.tt2 @@ -114,7 +114,7 @@ END; class="record_author" href="[%- authorquery = attrs.author | replace('[#"^$\+\-,\.:;&|\[\]()]', ' '); - mkurl(ctx.opac_root _ '/results', {qtype => 'author', query => authorquery}, ['page']) + mkurl(ctx.opac_root _ '/results', {qtype => 'author', query => authorquery}, general_search_parms.merge(expert_search_parms, browse_search_parms, facet_search_parms)) -%]">[% attrs.author | html %] [%- FOR entry IN attrs.graphic_authors; diff --git a/Open-ILS/src/templates/opac/parts/searchbar.tt2 b/Open-ILS/src/templates/opac/parts/searchbar.tt2 index ac594eea76..5eb3873f6d 100644 --- a/Open-ILS/src/templates/opac/parts/searchbar.tt2 +++ b/Open-ILS/src/templates/opac/parts/searchbar.tt2 @@ -6,9 +6,9 @@ [%- END %] -- 2.11.0