From e744fbb8d05cf8de850bd7b95dde8c1c5fc8763d Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Mon, 22 Oct 2012 15:46:20 -0400 Subject: [PATCH] Add detailed contents content to TPAC record summary Drawing from the LoC MARC definitions for the 500 field, display'em if you got'em. Given that many keyword searches are likely to draw upon this content, we should display the matches in the record summary. Signed-off-by: Dan Scott Signed-off-by: Ben Shum --- Open-ILS/src/templates/opac/css/style.css.tt2 | 2 +- .../src/templates/opac/parts/record/contents.tt2 | 194 +++++++++++++++++++++ .../src/templates/opac/parts/record/extras.tt2 | 4 +- 3 files changed, 196 insertions(+), 4 deletions(-) create mode 100644 Open-ILS/src/templates/opac/parts/record/contents.tt2 diff --git a/Open-ILS/src/templates/opac/css/style.css.tt2 b/Open-ILS/src/templates/opac/css/style.css.tt2 index b5c7418cfb..2c028c7d21 100644 --- a/Open-ILS/src/templates/opac/css/style.css.tt2 +++ b/Open-ILS/src/templates/opac/css/style.css.tt2 @@ -1200,7 +1200,7 @@ a.opac-button, input.opac-button { margin-top: 1em; } -.rdetail_subject_type { +.rdetail_content_type, .rdetail_subject_type { vertical-align: top; font-weight: bold; } diff --git a/Open-ILS/src/templates/opac/parts/record/contents.tt2 b/Open-ILS/src/templates/opac/parts/record/contents.tt2 new file mode 100644 index 0000000000..f8778fc169 --- /dev/null +++ b/Open-ILS/src/templates/opac/parts/record/contents.tt2 @@ -0,0 +1,194 @@ +[%- +contents = [ + { + label => l('General Note: '), + xpath => '//*[@tag="500"]' + }, { + label => l('With Note: '), + xpath => '//*[@tag="501"]' + }, { + label => l('Dissertation Note: '), + xpath => '//*[@tag="502"]' + }, { + label => l('Bibliography, etc. Note: '), + xpath => '//*[@tag="504"]' + }, { + label => l('Formatted Contents Note: '), + xpath => '//*[@tag="505"]' + }, { + label => l('Restrictions on Access Note: '), + xpath => '//*[@tag="506"]' + }, { + label => l('Scale Note for Graphic Material: '), + xpath => '//*[@tag="507"]' + }, { + label => l('Creation/Production Credits Note: '), + xpath => '//*[@tag="508"]' + }, { + label => l('Citation/References Note: '), + xpath => '//*[@tag="510"]' + }, { + label => l('Participant or Performer Note: '), + xpath => '//*[@tag="511"]' + }, { + label => l('Type of Report and Period Covered Note: '), + xpath => '//*[@tag="513"]' + }, { + label => l('Data Quality Note: '), + xpath => '//*[@tag="514"]' + }, { + label => l('Numbering Peculiarities Note: '), + xpath => '//*[@tag="515"]' + }, { + label => l('Type of Computer File or Data Note: '), + xpath => '//*[@tag="516"]' + }, { + label => l('Date/Time and Place of an Event Note: '), + xpath => '//*[@tag="518"]' + }, { + label => l('Summary, etc.: '), + xpath => '//*[@tag="520"]' + }, { + label => l('Target Audience Note: '), + xpath => '//*[@tag="521"]' + }, { + label => l('Geographic Coverage Note: '), + xpath => '//*[@tag="522"]' + }, { + label => l('Preferred Citation of Described Materials Note: '), + xpath => '//*[@tag="524"]' + }, { + label => l('Supplement Note: '), + xpath => '//*[@tag="525"]' + }, { + label => l('Study Program Information Note: '), + xpath => '//*[@tag="526"]' + }, { + label => l('Additional Physical Form available Note: '), + xpath => '//*[@tag="530"]' + }, { + label => l('Reproduction Note: '), + xpath => '//*[@tag="533"]' + }, { + label => l('Original Version Note: '), + xpath => '//*[@tag="534"]' + }, { + label => l('Location of Originals/Duplicates Note: '), + xpath => '//*[@tag="535"]' + }, { + label => l('Funding Information Note: '), + xpath => '//*[@tag="536"]' + }, { + label => l('System Details Note: '), + xpath => '//*[@tag="538"]' + }, { + label => l('Terms Governing Use and Reproduction Note: '), + xpath => '//*[@tag="540"]' + }, { + label => l('Immediate Source of Acquisition Note: '), + xpath => '//*[@tag="541"]' + }, { + label => l('Information Relating to Copyright Status: '), + xpath => '//*[@tag="542"]' + }, { + label => l('Location of Other Archival Materials Note: '), + xpath => '//*[@tag="544"]' + }, { + label => l('Biographical or Historical Data: '), + xpath => '//*[@tag="545"]' + }, { + label => l('Language Note: '), + xpath => '//*[@tag="546"]' + }, { + label => l('Former Title Complexity Note: '), + xpath => '//*[@tag="547"]' + }, { + label => l('Issuing Body Note: '), + xpath => '//*[@tag="550"]' + }, { + label => l('Entity and Attribute Information Note: '), + xpath => '//*[@tag="552"]' + }, { + label => l('Cumulative Index/Finding Aids Note: '), + xpath => '//*[@tag="555"]' + }, { + label => l('Information About Documentation Note: '), + xpath => '//*[@tag="556"]' + }, { + label => l('Ownership and Custodial History: '), + xpath => '//*[@tag="561"]' + }, { + label => l('Copy and Version Identification Note: '), + xpath => '//*[@tag="562"]' + }, { + label => l('Binding Information: '), + xpath => '//*[@tag="563"]' + }, { + label => l('Case File Characteristics Note: '), + xpath => '//*[@tag="565"]' + }, { + label => l('Methodology Note: '), + xpath => '//*[@tag="567"]' + }, { + label => l('Linking Entry Complexity Note: '), + xpath => '//*[@tag="580"]' + }, { + label => l('Publications About Described Materials Note: '), + xpath => '//*[@tag="581"]' + }, { + label => l('Action Note: '), + xpath => '//*[@tag="583"]' + }, { + label => l('Accumulation and Frequency of Use Note: '), + xpath => '//*[@tag="584"]' + }, { + label => l('Exhibitions Note: '), + xpath => '//*[@tag="585"]' + }, { + label => l('Awards Note: '), + xpath => '//*[@tag="586"]' + }, { + label => l('Source of Description Note: '), + xpath => '//*[@tag="588"]' + } +]; + +BLOCK render_contents; + xpath = xpath || '//*[starts-with(@tag,"5")]'; + FOR node IN ctx.marc_xml.findnodes(xpath); + all_content = []; + FOR subfield IN node.childNodes; + NEXT UNLESS subfield.nodeName == "subfield"; + code = subfield.getAttribute('code'); + NEXT UNLESS code.match('[a-z]'); + all_content.push(subfield.textContent); + total_contents = all_content.join(" ").replace('\s+$', ''); + %] [% total_contents %][%- END; + IF all_terms.size; "
"; END; + END; +END +%] + +[% BLOCK render_all_contents; + FOREACH cont IN contents; + content = PROCESS render_contents(xpath=cont.xpath); + IF content.match('\S'); +%] + + + + + + + +
[% cont.label %][% content %]
+ [%- END; %] + [%- END; %] +[%- END %] + +[%- content_html = PROCESS render_all_contents; + IF content_html.length > 0; +%] +

[% l('Content descriptions') %]

+[%- content_html %] +[%- END %] diff --git a/Open-ILS/src/templates/opac/parts/record/extras.tt2 b/Open-ILS/src/templates/opac/parts/record/extras.tt2 index c031bc7076..14d0d924ea 100644 --- a/Open-ILS/src/templates/opac/parts/record/extras.tt2 +++ b/Open-ILS/src/templates/opac/parts/record/extras.tt2 @@ -36,7 +36,7 @@ extras = [ {name => 'summaryplus', label => l('Summaries & More'), hide => hide_summary}, - {name => 'contents', label => l('Contents'), hide => !attrs.contents}, + {name => 'contents', label => l('Contents'), hide => !ctx.marc_xml.findnodes('//*[starts-with(@tag,"5")]')}, {name => 'annotation', label => l('Annotation'), hide => 1}, {name => 'awards', label => l('Awards, Reviews, & Suggested Reads')}, {name => 'excerpt', label => l('Excerpt'), hide => 1}, @@ -75,8 +75,6 @@ [% IF tab_is_active(name); IF name == 'marchtml'; ctx.marchtml; - ELSIF name == 'contents'; - attrs.contents; ELSE; # Load the template for the selected extra INCLUDE "opac/parts/record/${name}.tt2"; -- 2.11.0