]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/templates/opac/parts/record/summary.tt2
LP#1673870: Add ebook transaction links to search results and record details
[working/Evergreen.git] / Open-ILS / src / templates / opac / parts / record / summary.tt2
1 [%  PROCESS "opac/parts/misc_util.tt2";
2     USE ResolverResolver;
3     ctx.page_title = attrs.title | html
4     ctx.metalinks.push('<meta property="og:image" content="' _ ctx.media_prefix _ '/opac/extras/ac/jacket/large/r/' _ ctx.bre_id _ '" />');
5 %]
6 <!-- ****************** rdetail_summary.xml ***************************** -->
7 <abbr class="unapi-id" title='tag:[% ctx.hostname %],[% date.format(date.now, '%Y') %]:biblio-record_entry/[% ctx.bre_id %]'></abbr>
8
9 <hr />
10
11 [%-# This holds the record summary information %]
12 <div id="rdetail_summary_header">
13     <div id='rdetail_title_div'>
14         <h1 id='rdetail_title' property="name">[% attrs.title_extended | html %]</h1>
15         [%-
16             FOR link880 IN attrs.graphic_titles;
17                 FOR alt IN link880.graphic;
18                     '<h2 class="graphic880"';
19                     IF alt.dir;
20                         ' dir="' _ alt.dir _ '"';
21                     END;
22                     '>'; alt.value | html; '</h2>';
23                 END;
24             END;
25         -%]
26         [%- INCLUDE "opac/parts/record/authors.tt2" %]
27     </div>
28     <div id="rdetail_image_div">
29         [%- IF obalkyknih_cz.enabled == 'true' %]
30         [%- 
31             isbnissn = '';
32             IF attrs.isbns.0;
33                     isbnissn = attrs.isbns.0;
34                     IF (matches = isbnissn.match('^(.+?)(\s.+)$'));
35                         isbnissn = matches.0;
36                     END;
37                 END;
38             IF attrs.issns.0;
39                 isbnissn=attrs.issns.0;
40             END;
41         %]
42         <a href='http://obalkyknih.cz/view?isbn=[% isbnissn %]'>
43             <img
44               alt="[% l('Image of item') %]" id='rdetail_image'
45               src='[% ctx.media_prefix %]/opac/extras/ac/jacket/[% record.summary.jacket_size %]/r/[% ctx.bre_id | uri %]' />
46         </a>
47         [%  ELSE %]
48             <a href='[% ctx.media_prefix %]/opac/extras/ac/jacket/large/r/[% ctx.bre_id | uri %]'><img
49                     alt="[% l('Image of item') %]" id='rdetail_image'
50                     src='[% ctx.media_prefix %]/opac/extras/ac/jacket/[% record.summary.jacket_size %]/r/[% ctx.bre_id | uri %]' />
51             </a>
52         [%- END %]
53         <br />
54     </div>
55     <div id="format_actions">
56
57
58         [%- IF attrs.format_label %]
59           [% FOR format IN attrs.all_formats %]
60               <img title="[% format.label | html %]" 
61                   alt="[% format.label | html %]" 
62                   src="[% format.icon %]" /> 
63               [% format.label | html %]
64           [% END %]
65         [%- END %]
66
67         <div id="rdetail_actions_div">
68             [%- search_ou = ctx.search_ou;
69                 IF ctx.place_unfillable ||
70                     ( attrs.marc_xml.findnodes('//*[local-name()="holdings" and @has_holdable="true"]').size
71                         && (ctx.holds_block.enabled != 'true' || !attrs.org_copy_counts.$search_ou.available)
72                     )
73              %]
74             <div class="rdetail_aux_utils place_hold">
75                 <a href="[% mkurl(ctx.opac_root _ '/place_hold', 
76                     {hold_target => ctx.bre_id, hold_type => 'T', hold_source_page => mkurl()}, stop_parms) %]" 
77                 class="no-dec" rel="nofollow" vocab=""><img src="[% ctx.media_prefix %]/images/green_check.png[% ctx.cache_key %]"
78                     [% img_alt(l('Place Hold on [_1]', attrs.title)) %]/>
79                 <span class="place_hold">[% l('Place Hold') %]</span></a>
80             </div>
81             [%- END -%]
82
83             [%- IF ebook_api.enabled == 'true' && args.ebook %]
84             <div id="[%- ctx.bre_id -%]_ebook_checkout" class="rdetail_aux_utils ebook_action hidden">
85                 <a href="[% mkurl(ctx.opac_root _ '/myopac/ebook_circs',
86                     {title => args.ebook.ebook_id, vendor => args.ebook.vendor, action => 'checkout'}, stop_parms) %]"
87                 class="no-dec" rel="nofollow" vocab=""><img src="[% ctx.media_prefix %]/images/green_check.png"
88                     [% img_alt(l('Check Out [_1]', attrs.title)) %]/>
89                 <span class="place_hold">[% l('Check Out E-Item') %]</span></a>
90             </div>
91             <div id="[%- ctx.bre_id -%]_ebook_place_hold" class="rdetail_aux_utils ebook_action hidden">
92                 <a href="[% mkurl(ctx.opac_root _ '/myopac/ebook_holds',
93                     {title => args.ebook.ebook_id, vendor => args.ebook.vendor, action => 'place_hold'}, stop_parms) %]"
94                 class="no-dec" rel="nofollow" vocab=""><img src="[% ctx.media_prefix %]/images/green_check.png"
95                     [% img_alt(l('Place Hold on [_1]', attrs.title)) %]/>
96                 <span class="place_hold">[% l('Place Hold on E-Item') %]</span></a>
97             </div>
98             [%- END -%]
99
100             <div class="rdetail_aux_utils toggle_list">
101         [% IF !ctx.is_staff %]
102             [%  IF ctx.user;
103                 INCLUDE "opac/parts/bookbag_actions.tt2";
104             %]
105             [%  ELSE;
106                 operation = ctx.mylist.grep(ctx.bre_id).size ? "delete" : "add";
107                 label = (operation == "add") ? l("Add to my list") : l("Remove from my list");
108             %]
109                 <a href="[% mkurl(ctx.opac_root _ '/mylist/' _ operation, {record => ctx.bre_id}, stop_parms) %]" class="no-dec" rel="nofollow" vocab="">
110                     <img src="[% ctx.media_prefix %]/images/clipboard.png[% ctx.cache_key %]" alt="" />
111                     [% label %]
112                 </a>
113             [% END %]
114         [% END %]
115             </div>
116             <div class="rdetail_aux_utils toggle_list">
117                      [% IF ctx.mylist.size %]
118                         [%- IF ctx.user; %]
119                         <a href="[% mkurl(ctx.opac_root _ '/myopac/lists') %]" class="no-dec" rel="nofollow" vocab=""><img src="[% ctx.media_prefix %]/images/clipboard.png[% ctx.cache_key %]" alt="[% l('View My Lists') %]" />[% l(' View My Lists') %]</a>
120                         [%- ELSE %]
121                         <a href="[% mkurl(ctx.opac_root _ '/mylist') %]" class="no-dec" rel="nofollow" vocab=""><img src="[% ctx.media_prefix %]/images/clipboard.png[% ctx.cache_key %]" alt="[% l('View My Temporary List') %]" />[% l(' View My Temporary List') %]</a>
122                         [%- END %]
123                     [% END %]
124                 </div>
125                 <div class="rdetail_aux_utils">
126                     <img src="[% ctx.media_prefix %]/images/clipboard.png[% ctx.cache_key %]" alt="[% l('Print / Email Actions Image') %]" />
127                     <a href="[% mkurl(ctx.opac_root _ '/record/print/' _ ctx.bre_id) %]" class="no-dec" rel="nofollow" vocab="">[% l('Print') %]</a> /
128                     <a href="[% mkurl(ctx.opac_root _ '/record/email/' _ ctx.bre_id) %]" class="no-dec" rel="nofollow" vocab="">[% l('Email') %]</a>
129                 </div>
130                 [%- IF ctx.refworks.enabled == 'true' %]
131                     [%- INCLUDE 'opac/parts/record/refworks.tt2' %]
132                 [%- END %]
133             [% IF !ctx.is_staff %]
134                 <div class="rdetail_aux_utils share_record">
135                     <a href="[% mkurl('', {locg =>CGI.param('locg'), copy_depth =>CGI.param('copy_depth')}, 1) %]" class="no-dec">
136                          <img src="[% ctx.media_prefix %]/images/link.png[% ctx.cache_key %]" alt="[% l('Permalink') %]" />
137                          [% l('Permalink') %]
138                     </a>
139                 </div>
140             [% END %]
141             [%- IF ctx.is_staff %]
142             <div class="rdetail_aux_utils clear_addedcontent_cache">
143                 <a href="[% ctx.media_prefix %]/opac/extras/ac/clearcache/all/r/[% ctx.bre_id | uri %]" class="no-dec" target="_blank">
144                      [% l('Clear AddedContent Cache') %]
145                 </a>
146             </div>
147             [%- END %]
148         </div>
149     </div>
150 </div>
151
152 [%- IF openurl.enabled == 'true';
153     openurls = [];
154     FOREACH issn IN args.issns;
155         NEXT IF issn == '';
156         openurls = openurls.import(ResolverResolver.resolve_issn(issn, openurl.baseurl));
157     END;
158     IF openurls.size && openurls.0 != '';
159 %]
160     <div id='rdetail_openurl'>
161         <strong class='rdetail_openurl_title'>[% l("Electronic resources") %]</strong>
162         <table><tbody>
163 [%-
164         FOREACH res IN openurls;
165 %]
166         <tr>
167             <td class='rdetail_openurl_entry'><a href="[% res.target_url %]">[% res.public_name | html %]</a></td>
168             <td>[% res.target_coverage | html %]
169             [%- IF res.target_embargo != '';
170                     ' - ';
171                     res.target_embargo | html;
172                 END;
173             -%]
174             </td>
175         </tr>
176     [%- END %]
177     </tbody></table>
178     </div>    
179 [%- END %]
180 [%- END %]
181 [%- merged_uris = args.uris.merge(args.online_res);
182 num_uris = merged_uris.size;
183 IF num_uris > 0;
184 -%]
185 <h2 class="rdetail_uris">[% l("Electronic resources") %]</h2>
186 <div class="rdetail_uris">
187     [%- IF num_uris > 1 %]<ul>[% END %]
188     [%- FOR uri IN merged_uris %]
189         [%- IF num_uris == 1 -%]
190             <p class="rdetail_uri" property="offers" vocab="http://schema.org/" typeof="Offer">
191         [%- ELSE -%]
192             <li class="rdetail_uri" property="offers" vocab="http://schema.org/" typeof="Offer">
193         [%- END -%]
194         <a href="[% uri.href %]" class="uri_link" property="url">
195         [%- IF uri.href != uri.link;
196                 '<span property="description">' _ uri.link _ '</span>';
197             ELSE;
198                 uri.link;
199             END;
200         -%]
201         </a>
202         [%- ' - <span property="description">' _ uri.note _ '</span>' IF uri.note %]
203         <link property="availability" href="http://schema.org/OnlineOnly" />
204         [%- IF attrs.gtin13; '<meta property="gtin13" content="' _ attrs.gtin13 _ '" />'; END; %]
205         [%- IF num_uris == 1 %]</p>[% ELSE %]</li>[% END %]
206     [%- END %]
207     [%- IF num_uris > 1 %]</ul>[% END %]
208 </div>
209 [%
210 IF ebook_api.enabled == 'true';
211     INCLUDE "opac/parts/ebook_api/avail.tt2";
212 END;
213 %]
214 [%- END %]
215 <div id="copy_hold_counts">
216 [%-
217 # Hold/copy summary
218 IF ctx.copy_summary.0.count;
219 INCLUDE "opac/parts/record/copy_counts.tt2";
220 %]
221     <span id="rdetail_hold_counts">
222         <h2>[% l('Current holds') %]</h2>
223         <p>
224             [% 
225                 # If org hiding is enabled/relevant, only show 
226                 # counts for copies within the hiding scope.
227                 count_entry = 0;
228                 FOR count_chunk IN ctx.copy_summary;
229                     IF ctx.org_within_hiding_scope(count_chunk.org_unit);
230                         # always true when hiding is disabled
231                         LAST;
232                     END;
233                     count_entry = count_entry + 1;
234                 END;
235                 l("[quant,_1,current hold,current holds] with [quant,_2,total copy,total copies].", 
236                     ctx.record_hold_count, ctx.copy_summary.$count_entry.count) 
237             %]
238         </p>
239     </span>
240 [%- END %]
241 <div id="metarecord_population">
242 [%-
243 # l( 'mmr id = ' _ ctx.mmr_id );
244 # l( 'mmr data = ' _ ctx.mmr_data );
245 mmr_attrs = {marc_xml => ctx.mmr_data.marc_xml};
246 PROCESS get_marc_attrs args=mmr_attrs;
247
248 IF args.mmr_unique_bib.size > 1;
249 %]
250 <h3>[% l("View other formats and editions") %]</h3>
251 <span class="metarecord_population_format">
252 [%- IF mmr_attrs.format_label;
253     FOR format IN mmr_attrs.all_formats;
254
255         link = mkurl(ctx.opac_root _ '/record/' _ format.source_bibs.0);
256         IF format.source_bibs.size > 1;
257             link = mkurl( ctx.opac_root _ '/results', { modifier => 'metabib', metarecord => ctx.mmr_id, 'fi:icon_format' => format.search_format, 'fi:from_metarecord' => ctx.mmr_id }, stop_parms.merge(expert_search_parms, general_search_parms, browse_search_parms, facet_search_parms, ['qtype','fi:search_format','fi:icon_format','fi:item_lang','fi:from_metarecord']) );
258         END; -%]
259         <span class="metarecord_population_span_link">
260             <a href="[%- l( link ) %]">
261         [% format.label | html %]
262         ([%- l( format.source_bibs.size ) %])
263         </a></span><br />
264
265     [%- END %]
266     </span>
267     [%- IF mmr_attrs.all_lang.size > 0 %]
268     <span class="metarecord_population_item_lang">
269     [% FOR lang IN mmr_attrs.all_lang;
270         link = mkurl(ctx.opac_root _ '/record/' _ lang.source_bibs.0);
271         IF lang.source_bibs.size > 1;
272             USE url(ctx.opac_root _ '/results');
273             link = mkurl( ctx.opac_root _ '/results', { modifier => 'metabib', metarecord => ctx.mmr_id, 'fi:item_lang' => lang.search_format, 'fi:from_metarecord' => ctx.mmr_id }, stop_parms.merge(expert_search_parms, general_search_parms, browse_search_parms, facet_search_parms, ['qtype','fi:search_format','fi:icon_format','fi:item_lang','fi:from_metarecord']) );
274         END; -%]
275         <span class="metarecord_population_span_link">
276             <a href="[%- l( link ) %]">
277         [% lang.label | html %]
278         ([%- l( lang.source_bibs.size ) %])
279         </a></span><br />
280     [%- END %]
281     </span> <!-- metarecord_population_item_lang -->
282 [%- END %]
283 <div class="metarecord_population_all">
284     [%
285     link = mkurl( ctx.opac_root _ '/results', { modifier => 'metabib', metarecord => ctx.mmr_id, 'fi:from_metarecord' => ctx.mmr_id }, stop_parms.merge(expert_search_parms, general_search_parms, browse_search_parms, facet_search_parms, ['qtype','fi:search_format','fi:icon_format','fi:item_lang','fi:from_metarecord'] ) );
286     %]
287     <span class="metarecord_population_span_link">
288         <a href="[%- l( link ) %]">[% l("View all formats and editions ") %] ([%- args.mmr_unique_bib.size %]) 
289         </a></span><br />
290 </div>
291 [%- END;
292 END # ending tag for IF args.mmr_unique_bib.size > 1; %]
293 </div> <!-- metarecord_population -->
294 [%-
295 IF ctx.copy_summary.0.count;
296 INCLUDE "opac/parts/record/copy_table.tt2" copies=ctx.copies;
297 END;
298  %]
299 </div>
300
301 <h2 id='rdetail_record_details'>[% l("Record details") %]</h2>
302 <ul>
303     [%- IF attrs.isbns.0;
304           FOR isbn IN attrs.isbns;
305             isbn_extra = '';
306             IF (matches = isbn.match('^(.+?)(\s.+)$'));
307               isbn = matches.0;
308               isbn_extra = matches.1;
309             END;
310     %]
311     <li class='rdetail_isbns'>
312         <strong class='rdetail_label'>[% l('ISBN:'); %]</strong>
313         <span class='rdetail_value' property='isbn'>[% isbn | html  %]</span>[% isbn_extra | html %]
314     </li>
315         [%- END %]
316     [%- END %]
317     [%- IF attrs.issns.0; FOR issn IN attrs.issns %]
318     <li class='rdetail_issns'>
319         <strong class='rdetail_label'>[% l('ISSN:'); %]</strong>
320         <span class='rdetail_value'>[% issn | html  %]</span>
321     </li>
322         [%- END %]
323     [%- END %]
324     [%- IF attrs.phys_desc %]
325     <li id='rdetail_phys_desc'>
326         <strong class='rdetail_label'>[% l("Physical Description:") %]</strong>
327         <span class='rdetail_value'>[% attrs.phys_desc | html %]</span>
328     </li>
329     [%- END %]
330     [%- IF attrs.edition %]
331     <li id='rdetail_edition'>
332         <strong class='rdetail_label'>[% l("Edition:") %]</strong>
333         <span class='rdetail_value'>[% attrs.edition | html %]</span>
334         [%-
335         FOR entry IN attrs.graphic_editions;
336             FOR alt IN entry.graphic;
337                 diratt = "";
338                 IF alt.dir;
339                     diratt = ' dir="' _ alt.dir _ '"';
340                 END;
341         -%]
342         <div class="graphic880 rdetail_value"[% diratt %]>
343             [% alt.value | html %]
344         </div>
345         [%-
346             END;
347         END;
348         -%]
349     </li>
350     [%- END %]
351     [%- IF attrs.publisher %]
352     <li id='rdetail_publisher'>
353         <strong class='rdetail_label'>[% l("Publisher:") %]</strong>
354         <span class='rdetail_value' property="publisher" typeof="Organization">
355         [%- IF attrs.pubplace; %]
356             <span property="location">[% attrs.pubplace | html; %]</span>
357         [%- END; %]
358             <span property="name">[% attrs.publisher | html; %]</span>
359         </span>
360         [%- IF attrs.pubdate; %]
361             <span property="datePublished">[% attrs.pubdate | html; %]</span>
362         [%- END; %]
363         [%-
364         IF attrs.graphic_pubinfos.size > 0;
365             FOR entry IN attrs.graphic_pubinfos;
366                 FOR alt IN entry.graphic;
367                     diratt = "";
368                     IF alt.dir;
369                         diratt = ' dir="' _ alt.dir _ '"';
370                     END;
371         -%]
372         <div class="graphic880"[% diratt %]>
373             [% alt.value | html %]
374         </div>
375         [%-
376                 END;
377             END;
378         END
379         -%]
380     </li>
381     [%- END %]
382     [%- IF attrs.producer %]
383         <li id='rdetail_producer'>
384             <strong class='rdetail_label'>[% l("Producer:") %]</strong>
385             <span class='rdetail_value'>
386             [%- IF attrs.prodplace; %]
387                 <span>[% attrs.prodplace | html; %]</span>
388             [%- END; %]
389                 <span>[% attrs.producer | html; %]</span>
390             [%- IF attrs.proddate; %]
391                 <span>[% attrs.proddate | html; %]</span>
392             [%- END; %]
393             </span>
394         </li>
395     [%- END %]
396     [%- IF attrs.distributor %]
397         <li id='rdetail_distributor'>
398             <strong class='rdetail_label'>[% l("Distributor:") %]</strong>
399             <span class='rdetail_value'>
400             [%- IF attrs.distplace; %]
401                 <span>[% attrs.distplace | html; %]</span>
402             [%- END; %]
403                 <span>[% attrs.distributor | html; %]</span>
404             [%- IF attrs.distdate; %]
405                 <span>[% attrs.distdate | html; %]</span>
406             [%- END; %]
407             </span>
408         </li>
409     [%- END %]
410     [%- IF attrs.manufacturer %]
411         <li id='rdetail_manufacturer'>
412             <strong class='rdetail_label'>[% l("Manufacturer:") %]</strong>
413             <span class='rdetail_value' property="manufacturer" typeof="Organization">
414             [%- IF attrs.manplace; %]
415                 <span property="location">[% attrs.manplace | html; %]</span>
416             [%- END; %]
417                 <span property="name">[% attrs.manufacturer | html; %]</span>
418             [%- IF attrs.mandate; %]
419                 <span>[% attrs.mandate | html; %]</span>
420             [%- END; %]
421             </span>
422         </li>
423     [%- END %]
424     [%- IF attrs.copyright %]
425     <li id='rdetail_copyright'>
426         <strong class='rdetail_label'>[% l("Copyright:") %]</strong>
427         <span class='rdetail_value'>[% attrs.copyright | html_entity; %]
428         [%-# Provide the 4-digit year, cleansed of '@' and other junk %]
429         [%- IF attrs.copyrightYear -%]
430             <meta property='copyrightYear' content='[% attrs.copyrightYear | html; %]'>
431         [%- END -%]
432         </span>
433     </li>
434     [%- END %]
435     [%- IF (ctx.badge_scores.size > 0) %]
436     <li id='rdetail_badges'>
437         <strong class='rdetail_label'>[% l("Badges:") %]</strong>
438         <ul>
439           [% FOR bscore IN ctx.badge_scores; %]
440             <li><strong>[% bscore.badge.name | html %]</strong>: [% bscore.score %] / 5.0</li>
441         [%- END -%]
442         </ul>
443     </li>
444     [%- END %]
445 </ul>
446 [%- INCLUDE "opac/parts/record/contents.tt2" %]
447 [%- INCLUDE "opac/parts/record/subjects.tt2" %]
448 [%- INCLUDE "opac/parts/record/series.tt2" %]
449 [%- INCLUDE "opac/parts/record/extras.tt2" %]