From: Liam Whalen Date: Mon, 7 Oct 2013 07:17:37 +0000 (-0700) Subject: LP#1037171 Removed Expert Search paramters from subject links X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=refs%2Fheads%2Fuser%2Fldw%2Flp1037171_subject_links_after_expert_search_eg23;p=working%2FEvergreen.git LP#1037171 Removed Expert Search paramters from subject links After performing an Expert Search, if a user visits a record and then clicks on one of the author or subject search links within that record, then they are given the results of the Expert Search again instead of the relevant subject or author search. This is happening because the Expert Search parameters are retained in the URLs via the TT2 MACRO mkurl. In particular, the tag parameter is used to identify an Expert Search, so if it is present in a URL, than an Expert Search will be attempted regardless of which other paramaters are in the URL. To fix this, I created two varialbes within header.tt2 above the definition of mkurl. These variables group common URL paramters for Expert Searches and General Search parameters together. These variables can be used wherever mkurl is used to strip out unneeded search paramters. There is a third variable that is already present within many of these pages named stop_parms. While I initially tried to modify this variable, I found that there are some instances where the general search parameters should be retained while the Expert Search parameters must go. This commit uses these three variables togehter as input into the third arugment of the mkurl MACRO. The third arugment specifies which paramtes to remove from the previous URL before making a new URL based on the pervious URL. I also added the query parameter to the Place Hold's hold_source_page URL variable. I did this, so that the query terms would be preserved once the user is done placing the hold or decides to cancle the placing of the hold. As well, I used the new variables to remove Expert Search paramters from the Advanced Search links on the results and record pages. Signed-off-by: Liam Whalen --- diff --git a/Open-ILS/src/templates/opac/parts/header.tt2 b/Open-ILS/src/templates/opac/parts/header.tt2 index e069b6e31b..8a59a0309a 100644 --- a/Open-ILS/src/templates/opac/parts/header.tt2 +++ b/Open-ILS/src/templates/opac/parts/header.tt2 @@ -12,6 +12,10 @@ is_advanced = CGI.param("_adv").size; is_special = CGI.param("_special").size; + #variables to use to remove parameters via mkurk + expert_search_parms = ['tag','subfield','term','_special']; + general_search_parms = ['page','sort','query']; + # ----------------------------------------------------------------------------- # 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 448fdf8290..abf938b7bc 100644 --- a/Open-ILS/src/templates/opac/parts/record/authors.tt2 +++ b/Open-ILS/src/templates/opac/parts/record/authors.tt2 @@ -43,7 +43,7 @@ BLOCK build_author_links; qterm = qterm _ ' ' _ sf_raw; END; END; - url = mkurl(ctx.opac_root _ '/results', {query => qterm, qtype => 'author'}, ['page', 'expand']); + url = mkurl(ctx.opac_root _ '/results', {query => qterm, qtype => 'author'}, stop_parms.merge(expert_search_parms, general_search_parms)); author_type = (tlabel || label) | html; # schema.org changes diff --git a/Open-ILS/src/templates/opac/parts/record/subjects.tt2 b/Open-ILS/src/templates/opac/parts/record/subjects.tt2 index e92644d99b..9e3391351a 100644 --- a/Open-ILS/src/templates/opac/parts/record/subjects.tt2 +++ b/Open-ILS/src/templates/opac/parts/record/subjects.tt2 @@ -41,7 +41,7 @@ all_terms.push(subfield.textContent.replace('[#"^$\+\-,\.:;&|\[\]()]', '')); total_term = all_terms.join(" ").replace('\s+$', ''); %] -[% single_term %] +[% single_term %] [%- END; IF all_terms.size; "
"; END; END; diff --git a/Open-ILS/src/templates/opac/parts/result/table.tt2 b/Open-ILS/src/templates/opac/parts/result/table.tt2 index 852537703b..734bad85a0 100644 --- a/Open-ILS/src/templates/opac/parts/result/table.tt2 +++ b/Open-ILS/src/templates/opac/parts/result/table.tt2 @@ -227,8 +227,8 @@ ) %]
[% l('Place Hold') %] diff --git a/Open-ILS/src/templates/opac/parts/searchbar.tt2 b/Open-ILS/src/templates/opac/parts/searchbar.tt2 index b75752f19a..8c763590f1 100644 --- a/Open-ILS/src/templates/opac/parts/searchbar.tt2 +++ b/Open-ILS/src/templates/opac/parts/searchbar.tt2 @@ -5,7 +5,7 @@ [%- END %]
[% l('Search the Catalog') %] - [% l('Advanced Search') %]
diff --git a/Open-ILS/src/templates/opac/results.tt2 b/Open-ILS/src/templates/opac/results.tt2 index dfd72a6a68..bdfff81d4b 100644 --- a/Open-ILS/src/templates/opac/results.tt2 +++ b/Open-ILS/src/templates/opac/results.tt2 @@ -28,7 +28,7 @@ [% l('Another Search') %]
[% IF ctx.mylist.size %]