Add detailed contents content to TPAC record summary
authorDan Scott <dscott@laurentian.ca>
Mon, 22 Oct 2012 19:46:20 +0000 (15:46 -0400)
committerDan Scott <dscott@laurentian.ca>
Tue, 23 Oct 2012 21:58:50 +0000 (17:58 -0400)
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 <dscott@laurentian.ca>
Signed-off-by: Ben Shum <bshum@biblio.org>
Open-ILS/src/templates/opac/css/style.css.tt2
Open-ILS/src/templates/opac/parts/record/contents.tt2 [new file with mode: 0644]
Open-ILS/src/templates/opac/parts/record/extras.tt2

index b5c7418..2c028c7 100644 (file)
@@ -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 (file)
index 0000000..f8778fc
--- /dev/null
@@ -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; "<br/>"; END;
+    END;
+END 
+%]
+
+[%  BLOCK render_all_contents;
+    FOREACH cont IN contents;
+        content = PROCESS render_contents(xpath=cont.xpath);
+        IF content.match('\S');
+%]
+        <table class='rdetail_content'>
+            <tbody>
+                <tr>
+                    <td class='rdetail_content_type'>[% cont.label %]</td>
+                    <td class='rdetail_content_value' itemprop='keywords'>[% content %]</td>
+                </tr>
+            </tbody>
+        </table>
+        [%- END; %]
+    [%- END; %]
+[%- END %]
+
+[%-  content_html = PROCESS render_all_contents;
+    IF content_html.length > 0;
+%]
+<h2 class='rdetail_contents'>[% l('Content descriptions') %]</h2>
+[%- content_html %]
+[%- END %]
index c031bc7..14d0d92 100644 (file)
@@ -36,7 +36,7 @@
 
         extras = [
             {name => 'summaryplus',  label => l('Summaries &amp; 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";