]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/templates/opac/parts/record/contents.tt2
LP2045292 Color contrast for AngularJS patron bills
[working/Evergreen.git] / Open-ILS / src / templates / opac / parts / record / contents.tt2
1 [% USE  Dumper %][%-
2 # You can supply a trunc_length parameter to override the default contents_truncate_length value
3 contents =  [
4     {
5         label => l('General Note: '),
6         trunc_length => 100,
7         xpath => '//*[@tag="500"]'
8     }, {
9         label => l('With Note: '),
10         xpath => '//*[@tag="501"]'
11     }, {
12         display_field => 'thesis',
13         label => l('Dissertation Note: '),
14         xpath => '//*[@tag="502"]'
15     }, {
16         display_field => 'bibliography',
17         label => l('Bibliography, etc. Note: '),
18         xpath => '//*[@tag="504"]'
19     }, {
20         display_field => 'toc',
21         label => l('Formatted Contents Note: '),
22         xpath => '//*[@tag="505"]'
23     }, {
24         label => l('Restrictions on Access Note: '),
25         xpath => '//*[@tag="506"]'
26     }, {
27         label => l('Scale Note for Graphic Material: '),
28         xpath => '//*[@tag="507"]'
29     }, {
30         display_field => 'production_credits',
31         label => l('Creation/Production Credits Note: '),
32         xpath => '//*[@tag="508"]'
33     }, {
34         label => l('Citation/References Note: '),
35         xpath => '//*[@tag="510"]'
36     }, {
37         display_field => 'performers',
38         label => l('Participant or Performer Note: '),
39         xpath => '//*[@tag="511"]'
40     }, {
41         label => l('Type of Report and Period Covered Note: '),
42         xpath => '//*[@tag="513"]'
43     }, {
44         label => l('Data Quality Note: '),
45         xpath => '//*[@tag="514"]'
46     }, {
47         label => l('Numbering Peculiarities Note: '),
48         xpath => '//*[@tag="515"]'
49     }, {
50         label => l('Type of Computer File or Data Note: '),
51         xpath => '//*[@tag="516"]'
52     }, {
53         label => l('Date/Time and Place of an Event Note: '),
54         xpath => '//*[@tag="518"]'
55     }, {
56         display_field => 'abstract',
57         label => l('Summary, etc.: '),
58         xpath => '//*[@tag="520"]'
59     }, {
60         label => l('Target Audience Note: '),
61         xpath => '//*[@tag="521"]'
62     }, {
63         label => l('Geographic Coverage Note: '),
64         xpath => '//*[@tag="522"]'
65     }, {
66         label => l('Preferred Citation of Described Materials Note: '),
67         xpath => '//*[@tag="524"]'
68     }, {
69         label => l('Supplement Note: '),
70         xpath => '//*[@tag="525"]'
71     }, {
72         label => l('Study Program Information Note: '),
73         xpath => '//*[@tag="526"]'
74     }, {
75         label => l('Additional Physical Form available Note: '),
76         xpath => '//*[@tag="530"]'
77     }, {
78         label => l('Reproduction Note: '),
79         xpath => '//*[@tag="533"]'
80     }, {
81         label => l('Original Version Note: '),
82         xpath => '//*[@tag="534"]'
83     }, {
84         label => l('Location of Originals/Duplicates Note: '),
85         xpath => '//*[@tag="535"]'
86     }, {
87         label => l('Funding Information Note: '),
88         xpath => '//*[@tag="536"]'
89     }, {
90         label => l('System Details Note: '),
91         xpath => '//*[@tag="538"]'
92     }, {
93         label => l('Terms Governing Use and Reproduction Note: '),
94         xpath => '//*[@tag="540"]'
95     }, {
96         label => l('Immediate Source of Acquisition Note: '),
97         xpath => '//*[@tag="541"]'
98     }, {
99         label => l('Information Relating to Copyright Status: '),
100         xpath => '//*[@tag="542"]'
101     }, {
102         label => l('Location of Other Archival Materials Note: '),
103         xpath => '//*[@tag="544"]'
104     }, {
105         label => l('Biographical or Historical Data: '),
106         xpath => '//*[@tag="545"]'
107     }, {
108         label => l('Language Note: '),
109         xpath => '//*[@tag="546"]'
110     }, {
111         label => l('Former Title Complexity Note: '),
112         xpath => '//*[@tag="547"]'
113     }, {
114         label => l('Issuing Body Note: '),
115         xpath => '//*[@tag="550"]'
116     }, {
117         label => l('Entity and Attribute Information Note: '),
118         xpath => '//*[@tag="552"]'
119     }, {
120         label => l('Cumulative Index/Finding Aids Note: '),
121         xpath => '//*[@tag="555"]'
122     }, {
123         label => l('Information About Documentation Note: '),
124         xpath => '//*[@tag="556"]'
125     }, {
126         label => l('Ownership and Custodial History: '),
127         xpath => '//*[@tag="561"]'
128     }, {
129         label => l('Copy and Version Identification Note: '),
130         xpath => '//*[@tag="562"]'
131     }, {
132         label => l('Binding Information: '),
133         xpath => '//*[@tag="563"]'
134     }, {
135         label => l('Case File Characteristics Note: '),
136         xpath => '//*[@tag="565"]'
137     }, {
138         label => l('Methodology Note: '),
139         xpath => '//*[@tag="567"]'
140     }, {
141         label => l('Linking Entry Complexity Note: '),
142         xpath => '//*[@tag="580"]'
143     }, {
144         label => l('Publications About Described Materials Note: '),
145         xpath => '//*[@tag="581"]'
146     }, {
147         label => l('Action Note: '),
148         xpath => '//*[@tag="583"]'
149     }, {
150         label => l('Accumulation and Frequency of Use Note: '),
151         xpath => '//*[@tag="584"]'
152     }, {
153         label => l('Exhibitions Note: '),
154         xpath => '//*[@tag="585"]'
155     }, {
156         label => l('Awards Note: '),
157         xpath => '//*[@tag="586"]'
158     }, {
159         label => l('Source of Description Note: '),
160         xpath => '//*[@tag="588"]'
161     } 
162 ];
163
164 BLOCK render_contents;
165     xpath = xpath || '//*[starts-with(@tag,"5")]';
166     FOR node IN ctx.marc_xml.findnodes(xpath);
167         all_content = [];
168         graphics = [];
169         FOR subfield IN node.childNodes;
170             NEXT UNLESS subfield.nodeName == "subfield";
171             code = subfield.getAttribute('code');
172             IF code == '6';
173                linked_fields = [subfield.textContent()];
174                target_field = node.getAttribute('tag');
175                get_linked_880s;
176             END;
177             NEXT UNLESS code.match('[a-z]');
178             all_content.push(subfield.textContent);
179         END;
180         total_contents = all_content.join(" ").replace('\s+$', '');
181         %] [% IF total_contents.size;
182             trunc_length = cont.trunc_length || contents_truncate_length || 100;
183             
184             "<div class='content_field'>"; accordion(total_contents, trunc_length); "</div>";
185         ELSE;
186             "<div class='content_field'>"; accordion(total_contents); "</div>";
187         END;
188         FOREACH link880 IN graphics;
189             '<div class="graphic880"' _ link880.dir _ '>';
190             accordion(link880.value);
191             '</div>';
192         END;
193     END;
194 END;
195
196 BLOCK render_all_contents;
197     FOREACH cont IN contents;
198         note_arr = [];
199         content = '';
200         df = cont.display_field;
201         trunc_length = cont.trunc_length || contents_truncate_length || 100;
202         IF df AND attrs.hl.$df.size; -%]
203             <tr>
204                 <td class='rdetail_content_type'>[% cont.label %]</td>
205                 <td class='rdetail_content_value' property='keywords'>
206             [%- FOREACH note IN attrs.hl.$df;
207                 "<div class='content_field'>"; accordion(note, trunc_length); "</div>";
208             END -%]
209             </td></tr>
210         [%- ELSE;
211             content = PROCESS render_contents(xpath=cont.xpath);
212             IF content.match('\S'); -%]                
213                 <tr>
214                     <td class='rdetail_content_type'>[% cont.label %]</td>
215                     <td class='rdetail_content_value' property='keywords'>[% content %]</td>
216                 </tr>
217             [%- END;
218         END;
219     END; %]
220 [%- END %]
221
222 [%-  content_html = PROCESS render_all_contents;
223     IF content_html.length > 0;
224 %]
225 <h2 class='rdetail_contents'>[% l('Content descriptions') %]</h2>
226 <table class='rdetail_content'>
227     <tbody>
228 [%- content_html %]
229     </tbody>
230 </table>
231 [%- END %]