From a95730e04908deec637fb99aa596667c8286df67 Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Wed, 19 Jun 2013 11:48:40 -0400 Subject: [PATCH] 659 stands for "garbage", not "genre", in our MARC Hide the display of 659 fields in Laurentian records. They appear to have been used for some sort of identifiers, not genres, and are meaningless to users. Signed-off-by: Dan Scott --- .../opac/parts/record/subjects.tt2 | 84 ++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 Open-ILS/src/templates_laurentian/opac/parts/record/subjects.tt2 diff --git a/Open-ILS/src/templates_laurentian/opac/parts/record/subjects.tt2 b/Open-ILS/src/templates_laurentian/opac/parts/record/subjects.tt2 new file mode 100644 index 0000000000..ea70647582 --- /dev/null +++ b/Open-ILS/src/templates_laurentian/opac/parts/record/subjects.tt2 @@ -0,0 +1,84 @@ +[% + subjects = [ + { + label => l('Subject: '), + xpath => '//*[@tag="600" or @tag="610" or @tag="611" or @tag="630" or @tag="650" or @tag="651"]' + }, { + label => l('Genre: '), + xpath => '//*[@tag="655"]' + }, { + label => l('Topic Heading: '), + xpath => '//*[@tag="690"]' + }, { + label => l('Geographic Setting: '), + xpath => '//*[@tag="691"]' + }, { + label => l('Biographical Subject: '), + xpath => '//*[@tag="692"]' + }, { + label => l('Character Attributes: '), + xpath => '//*[@tag="693"]' + }, { + label => l('Setting: '), + xpath => '//*[@tag="698"]' + }, { + label => l('Time Period: '), + xpath => '//*[@tag="699"]' + } + ]; + + BLOCK render_subject; + xpath = xpath || '//*[starts-with(@tag,"6")]'; + FOR node IN ctx.marc_xml.findnodes(xpath); + all_terms = []; + graphics = []; + 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]'); + 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.replace('\-', ' ').replace('[#"^$\+,\.:;&|\[\]()]', '')); + total_term = all_terms.join(" ").replace('\s+$', ''); + %] +[% single_term %] + [%- END; + IF all_terms.size; "
"; END; + FOREACH link880 IN graphics; + '
'; + link880.value | html; + '
'; + END; + END; + END +%] + +[% BLOCK render_all_subjects; + FOREACH subj IN subjects; + content = PROCESS render_subject(xpath=subj.xpath); + IF content.match('\S'); +%] + + + + + + + +
[% subj.label %][% content %]
+ [%- END; %] + [%- END; %] +[%- END %] + +[%- subject_html = PROCESS render_all_subjects; + IF subject_html.length > 0; +%] + +[%- subject_html %] +[%- END %] -- 2.11.0