]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/templates/opac/parts/record/summary.tt2
TPAC: Display additional levels of copy counts
[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 %]
5 <!-- ****************** rdetail_summary.xml ***************************** -->
6 <abbr class="unapi-id" title='tag:[% ctx.hostname %],[% date.format(date.now, '%Y') %]:biblio-record_entry/[% ctx.bre_id %]'></abbr>
7
8 [%- IF ctx.refworks.enabled == 'true' %]
9     [% INCLUDE 'opac/parts/record/refworks.tt2' %]
10 [%- END %]
11
12 <hr />
13
14 [%- # This holds the record summary information %]
15 <div id="rdetail_image_div">
16     [% ident = attrs.isbn_clean || attrs.upc; IF ident; %]
17     <a href='[% ctx.media_prefix %]/opac/extras/ac/jacket/large/[% ident | uri %]'><img
18         alt="[% l('Image of item') %]" id='rdetail_image'
19         src='[% ctx.media_prefix %]/opac/extras/ac/jacket/[% record.summary.jacket_size %]/[% ident | uri %]' /></a>
20     [% END %]
21     <br />
22 </div>
23  
24 <div id="rdetail_actions_div">
25     <div class="rdetail_aux_utils place_hold">
26         <a href="[% mkurl(ctx.opac_root _ '/place_hold', 
27             {hold_target => ctx.bre_id, hold_type => 'T', hold_source_page => mkurl()}) %]" 
28         class="no-dec"><img src="[% ctx.media_prefix %]/images/green_check.png" alt="[% l('place hold') %]" /><span 
29         class="place_hold">[% l('Place Hold') %]</span></a>
30     </div>
31     <div class="rdetail_aux_utils toggle_list">
32     [%-  
33         operation = ctx.mylist.grep(ctx.bre_id).size ? "delete" : "add";
34         label = (operation == "add") ? l("Add to my list") : l("Remove from my list"); 
35     %]
36         <a href="[% ctx.opac_root %]/mylist/[% operation %]?record=[% ctx.bre_id %]" class="no-dec">
37             <img src="[% ctx.media_prefix %]/images/clipboard.png" alt="" />
38             [% label %]
39         </a>
40     </div>
41 </div>
42
43 <div id='rdetail_title_div'>
44     [%- IF attrs.format_icon %]
45     <div class="format_icon">
46         <img alt="[% attrs.format_label %]" title="[% attrs.format_label | html %]" src="[% attrs.format_icon %]" />
47     </div>
48     [%- END %]
49     <h1 id='rdetail_title'>[% attrs.title_extended | html %]</h1>
50     [%- INCLUDE "opac/parts/record/authors.tt2" %]
51 </div>
52
53 [%- IF openurl.enabled == 'true';
54     sfx = []
55     FOR issn IN args.issns;
56         sfx = sfx.import(ResolverResolver.resolve_issn(issn, openurl.baseurl));
57     END;
58     IF sfx.size && sfx.0 != '';
59 %]
60     <div id='rdetail_openurl'>
61         <strong class='rdetail_openurl_title'>[% l("Electronic resources") %]</strong>
62         <table><tbody>
63 [%-
64         FOR res IN sfx;
65 %]
66         <tr>
67             <td class='rdetail_openurl_entry'><a href="[% res.target_url %]">[% res.public_name %]</a></td>
68             <td>[% res.target_coverage %]</td>
69         </tr>
70     [%- END %]
71     </tbody></table>
72 [%- END %]
73 [%- IF sfx.size && sfx.0 != '' %]
74     </div>    
75 [%- END %]
76 [%- merged_uris = args.uris.merge(args.online_res);
77 num_uris = merged_uris.size;
78 IF num_uris > 0;
79 -%]
80 <h2 class="rdetail_uris">[% l("Electronic resources") %]</h2>
81 <div class="rdetail_uris">
82     [%- IF num_uris > 1 %]<ul>[% END %]
83     [%- FOR uri IN merged_uris %]
84         [%- IF num_uris == 1 %]<p class="rdetail_uri">[% ELSE %]<li class="rdetail_uri">[% END %]
85         <a href="[% uri.href %]">[% uri.link %]</a>[% ' - ' _ uri.note IF uri.note %]
86         [%- IF num_uris == 1 %]</p>[% ELSE %]</li>[% END %]
87     [%- END %]
88     [%- IF num_uris > 1 %]</ul>[% END %]
89 </div>
90 [%- END %]
91 [%- # hold/copy summary %]
92 [%- IF ctx.copy_summary.0.count %]
93 <div id='rdetail_copies'>
94 <h2>[% l('Copies') %]</h2>
95 <ul>
96 <li class="rdetail_copy_counts">
97     <span>
98         [%- l("[quant,_1,current hold,current holds] with [quant,_2,total copy,total copies].", 
99             ctx.record_hold_count, ctx.copy_summary.0.count) %]
100     </span>
101     <span>[% l('[quant,_1,copy,copies] currently available at [_2].',
102              ctx.copy_summary.0.available,
103              ctx.get_aou(ctx.copy_summary.$depth.org_unit).name) | html %]
104     </span>
105 </li>
106 [%- depths = ctx.copy_summary.size;
107     depth = 1;
108     WHILE depth < depths;
109 %]
110 <li class="rdetail_copy_counts">
111 [% l('[quant,_1,copy,copies] currently available at [_2].', 
112     ctx.copy_summary.$depth.available,
113     ctx.get_aou(ctx.copy_summary.$depth.org_unit).name)
114     | html %]
115 </li>
116 [%- depth = depth + 1; END %]
117 </ul>
118 <table cellpadding="0" cellspacing="0" border="0" width="100%" id="rdetails_status">
119     <thead>
120         <tr>
121             <th id='copy_header_library'>[% l("Location") %]</th>
122             <th id='copy_header_callnmber'>[% l("Call Number") %]</th>
123             <th id='copy_header_barcode'>[% l("Barcode") %]</th>
124             <th id='copy_header_shelfloc'>[% l("Shelving Location") %]</th>
125             [%- IF ctx.is_staff %]
126             <th id='copy_header_age_hold'>[% l("Age Hold Protection") %]</th>
127             <th id='copy_header_create_date'>[% l("Create Date") %]</th>
128             <th id='copy_header_holdable'>[% l("Holdable?") %]</th>
129             [%- END %]
130             <th id='copy_header_status'>[% l("Status") %]</th>
131             <th id='copy_header_due_date'>[% l("Due Date") %]</th>
132         </tr>
133     </thead>
134     <tbody class="copy_details_table">
135         [%- last_cn = 0;
136         FOR copy_info IN ctx.copies;
137             callnum = copy_info.call_number_label;
138             NEXT IF callnum == '##URI##';
139
140             callnum_prefix = copy_info.call_number_prefix_label;
141             IF callnum_prefix != "";
142                 callnum = callnum_prefix _ " " _ callnum;
143             END;
144
145             callnum_suffix = copy_info.call_number_suffix_label;
146             IF callnum_suffix != "";
147                 callnum = callnum  _ " " _ callnum_suffix;
148             END;
149         -%]
150         <tr>
151             <td header='copy_header_library'>
152             [%-
153                 org_name = ctx.get_aou(copy_info.circ_lib).name;
154                 org_name | html
155             -%]
156             </td>
157             <td header='copy_header_callnumber'>[% callnum | html %]</td>
158             <td header='copy_header_barcode'>[% copy_info.barcode | html %]</td>
159             <td header='copy_header_shelfloc'>[% copy_info.copy_location | html %]</td>
160             [%- IF ctx.is_staff %]
161             <td header='copy_header_age_hold'>
162                 [% copy_info.age_protect ?
163                     ctx.get_crahp(copy_info.age_protect).name : l('None') | html %]
164             </td>
165             <td header='copy_header_date_format'>[% date.format(
166                 ctx.parse_datetime(copy_info.create_date),
167                 DATE_FORMAT
168             ) %]</td>
169             <td header='copy_header_holdable'>[%  # Show copy/volume hold links to staff (without
170                     # checking whether they have permissions to do those).
171                     overall_holdable = (copy_info.holdable == 't' AND
172                         copy_info.location_holdable == 't' AND
173                         copy_info.status_holdable == 't');
174                     IF overall_holdable;
175                         l("Place on"); %]
176                 <a href="[% mkurl(ctx.opac_root _ '/place_hold', 
177                     {hold_target => copy_info.id, hold_type => 'C', hold_source_page => mkurl()}) %]">[% l("copy") %]</a>
178                 [%-      IF copy_info.call_number != last_cn;
179                             last_cn = copy_info.call_number;
180                             l(" / "); %]
181                 <a href="[% mkurl(ctx.opac_root _ '/place_hold', 
182                     {hold_target => copy_info.call_number, hold_type => 'V', hold_source_page => mkurl()}) %]">[% l("volume") %]</a>
183                 [%-      END;
184                     ELSE;
185                         l("No");
186                     END %]</td>
187             [%- END %]
188             <td header='copy_header_status'>[% copy_info.copy_status | html %]</td>
189             <td header='due_date'>[%
190                 IF copy_info.due_date;
191                     date.format(
192                         ctx.parse_datetime(copy_info.due_date),
193                         DATE_FORMAT
194                     );
195                 ELSE;
196                     '-';
197                 END %]</td>
198         </tr>
199         [%- END %]
200         <tr>
201         [%- IF ctx.copy_offset > 0;
202             new_offset = ctx.copy_offset - ctx.copy_limit;
203             IF new_offset < 0; new_offset = 0; END %]
204             <td>
205                 <a href="[% mkurl('', {copy_offset => new_offset, copy_limit => ctx.copy_limit}) %]">&laquo; [%
206                     l('Previous [_1]', ctx.copy_offset - new_offset) %]</a>
207             </td>
208         [%- END %]
209         [%- IF ctx.copies.size >= ctx.copy_limit %]
210             <td>
211                 <a href="[% mkurl('', {copy_offset => ctx.copy_offset + ctx.copy_limit, copy_limit => ctx.copy_limit}) %]">[%
212                     l('Next [_1]', ctx.copy_limit) %] &raquo;</a>
213             </td>
214         [%- END %]
215         </tr>
216         <tr>
217             <td>
218                 [%- more_copies_limit = 50 %] [%# TODO: config %]
219                 [%- IF  ctx.copy_limit != more_copies_limit AND ctx.copies.size >= ctx.copy_limit %]
220                     <div class="rdetail_show_copies">
221                         <img src="[% ctx.media_prefix %]/images/plus_sign.png" />
222                         <a href="[% mkurl('', {copy_limit => more_copies_limit, copy_offset => 0}) %]">[% l('Show more copies') %]</a>
223                     </div>
224                 [%- ELSIF ctx.copy_limit == more_copies_limit %]
225                     <div  class="rdetail_show_copies">
226                         <img src="[% ctx.media_prefix %]/images/minus_sign.png" />
227                         <a href="[% mkurl('', {copy_limit => 0, copy_offset => 0}) %]">[% l('Show fewer copies') %]</a>
228                     </div>
229                 [%- END %]
230             </td>
231         </tr>
232     </tbody>
233 </table>
234 </div>
235 [%- END %]
236
237 <h2 id='rdetail_record_details'>[% l("Record details") %]</h2>
238 <ul>
239     [%- IF attrs.isbns.0; FOR isbn IN attrs.isbns %]
240     <li class='rdetail_isbns'>
241         <strong class='rdetail_label'>[% l('ISBN:'); %]</strong>
242         <span class='rdetail_value'>[% isbn | html  %]</span>
243     </li>
244         [%- END %]
245     [%- END %]
246     [%- IF attrs.issns.0; FOR issn IN attrs.issns %]
247     <li class='rdetail_issns'>
248         <strong class='rdetail_label'>[% l('ISSN:'); %]</strong>
249         <span class='rdetail_value'>[% issn | html  %]</span>
250     </li>
251         [%- END %]
252     [%- END %]
253     [%- IF attrs.phys_desc %]
254     <li id='rdetail_phys_desc'>
255         <strong class='rdetail_label'>[% l("Physical Description:") %]</strong>
256         <span class='rdetail_value'>[% attrs.phys_desc | html %]</span>
257     </li>
258     [%- END %]
259     [%- IF attrs.edition %]
260     <li id='rdetail_edition'>
261         <strong class='rdetail_label'>[% l("Edition:") %]</strong>
262         <span class='rdetail_value'>[% attrs.edition | html %]</span>
263     </li>
264     [%- END %]
265     [%- IF attrs.publisher %]
266     <li id='rdetail_publisher'>
267         <strong class='rdetail_label'>[% l("Publisher:") %]</strong>
268         <span class='rdetail_value'>[% attrs.publisher | html %] [% IF attrs.pubdate; attrs.pubdate | html; END %]</span>
269     </li>
270     [%- END %]
271 </ul>
272
273 [%- INCLUDE "opac/parts/record/subjects.tt2" %]
274 [%- INCLUDE "opac/parts/record/series.tt2" %]
275 [%- INCLUDE "opac/parts/record/extras.tt2" %]