From 7c873d78ed31db2a6cb7bd3b7e992407076561a5 Mon Sep 17 00:00:00 2001 From: senator Date: Tue, 15 Mar 2011 15:16:23 -0400 Subject: [PATCH] bib record subject search terms: painstaking translation of BibTemplate to TT the reference implementation I used is in Open-ILS/web/opac/skin/default/xml/rdetail/rdetail_summary.xml starting at line 93 as of this commit. Only now that I've imitated the default skin's behavior exactly, I note that the subject search links produced don't actually work on my test server. Seems to be a local configuration issue though; will investigate. --- .../default/opac/parts/record/summary.tt2 | 38 ++++++++++++------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/Open-ILS/web/templates/default/opac/parts/record/summary.tt2 b/Open-ILS/web/templates/default/opac/parts/record/summary.tt2 index 9a6ed0ba9a..ab4da6455c 100644 --- a/Open-ILS/web/templates/default/opac/parts/record/summary.tt2 +++ b/Open-ILS/web/templates/default/opac/parts/record/summary.tt2 @@ -105,19 +105,31 @@ [% attrs.publisher %] [% BLOCK render_subject; - FOR node IN ctx.marc_xml.findnodes('//*[@tag="650"]'); - s0 = node.childNodes.0.textContent; - s1 = node.childNodes.1.textContent; - IF s0; - IF s0.match('\S') %] - [% s0 %] - — - [% END; IF s1 %] - [% s1 %] -
- [% END %] - [% END %] - [% END %] + loc = CGI.param('loc') | uri; + FOR node IN ctx.marc_xml.findnodes('//*[starts-with(@tag,"6")]'); + all_terms = []; + FOR subfield IN node.childNodes; + NEXT UNLESS subfield.nodeName == "subfield"; + code = 0; + FOR a IN subfield.attributes; + IF a.nodeName == "code"; + code = a.nodeValue; + END; + END; + NEXT UNLESS code.match('[a-z]'); + + IF code.match('[vxyz]'); + " — "; + END; + # at this point, we actually have a partial + # term to use. + single_term = subfield.textContent | html; + all_terms.push(subfield.textContent); + total_term = all_terms.join(" ").replace('\s+$', '') ; # XXX need to take care of any &'s, right? + '' _ single_term _ ''; + END; + "
"; + END %] [% END %] [% s = PROCESS render_subject; IF s.match('\S') %] -- 2.43.2