From: Mike Rylander Date: Fri, 16 Feb 2018 17:27:24 +0000 (-0500) Subject: LP#1744385: Use series_title highlighting in OPAC X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=7edd82750b408c8f1eb5ebcb66a2de16d71cd46e;p=Evergreen.git LP#1744385: Use series_title highlighting in OPAC Here we replace the series title link generation based directly on the MARCXML with the Display Field equivalent. Note, the previous method created broken links in many cases, because it included more in the search terms than were being indexed by the stock series title definition. Signed-off-by: Mike Rylander Starting # ../../../../multi-source-attrs.sql Signed-off-by: Kathy Lussier Signed-off-by: Dan Wells --- diff --git a/Open-ILS/src/templates/opac/parts/record/series.tt2 b/Open-ILS/src/templates/opac/parts/record/series.tt2 index 4be6b8326c..4c42baf142 100644 --- a/Open-ILS/src/templates/opac/parts/record/series.tt2 +++ b/Open-ILS/src/templates/opac/parts/record/series.tt2 @@ -4,37 +4,49 @@ BLOCK render_series; results = []; - FOR tag IN series_tags; - FOR node IN ctx.marc_xml.findnodes('//*[@tag="' _ tag _ '"]'); - all_terms = []; - graphics = []; - series = ''; - FOR subfield IN node.childNodes; - NEXT UNLESS subfield.nodeName == "subfield"; - code = subfield.getAttribute('code'); - IF code == '6'; - linked_fields = [subfield.textContent()]; - target_field = node.getAttribute('tag'); - get_linked_880s; - END; - NEXT UNLESS code.match('[a-z]'); - # at this point, we actually have a partial term to use. - single_term = subfield.textContent | html; - all_terms.push(subfield.textContent.replace('[#"^$\+\-,\.:;&|\[\]()]', ' ')); - 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, browse_search_parms, facet_search_parms) - ); - series = series _ '' _ single_term _ ' '; - END; - FOREACH link880 IN graphics; - link = link880.value | html; - series = series _ '
' _ link _ '
'; - END; + IF attrs.hl_display_fields.series_title.size; + FOREACH s IN attrs.hl_display_fields.series_title; + search_term = s.value.replace('[#"^$\+\-,\.:;&|\[\]()]', ' ').replace('\s+$', '') | html; + + url = mkurl(ctx.opac_root _ '/results', + { qtype=>'series', query=>search_term }, stop_parms.merge(expert_search_parms, general_search_parms, browse_search_parms, facet_search_parms) + ); + series = '' _ s.highlight _ ' '; results.push(series); END; - END; + ELSE; + FOR tag IN series_tags; + FOR node IN ctx.marc_xml.findnodes('//*[@tag="' _ tag _ '"]'); + all_terms = []; + graphics = []; + series = ''; + FOR subfield IN node.childNodes; + NEXT UNLESS subfield.nodeName == "subfield"; + code = subfield.getAttribute('code'); + IF code == '6'; + linked_fields = [subfield.textContent()]; + target_field = node.getAttribute('tag'); + get_linked_880s; + END; + NEXT UNLESS code.match('[a-z]'); + # at this point, we actually have a partial term to use. + single_term = subfield.textContent | html; + all_terms.push(subfield.textContent.replace('[#"^$\+\-,\.:;&|\[\]()]', ' ')); + 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, browse_search_parms, facet_search_parms) + ); + series = series _ '' _ single_term _ ' '; + END; + FOREACH link880 IN graphics; + link = link880.value | html; + series = series _ '
' _ link _ '
'; + END; + results.push(series); + END; + END; + END; FOR entry IN results; -%]
  • [% entry %]