]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/templates/opac/parts/record/copy_table.tt2
Merge remote branch 'working/user/dbs/fix-nonfiling-titles'
[Evergreen.git] / Open-ILS / src / templates / opac / parts / record / copy_table.tt2
1 [%-
2 FOREACH copy_info IN ctx.copies;
3     IF copy_info.call_number_label != '##URI##';
4         has_copies = 'true';
5     END;
6     IF copy_info.part_label != '';
7         has_parts = 'true';
8     END;
9     IF has_parts && has_copies;
10         LAST;
11     END;
12 END;
13 %]
14 [%- IF has_copies; %]
15 <table cellpadding="0" cellspacing="0" border="0" width="100%" id="rdetails_status">
16     <thead>
17         <tr>
18             <th id='copy_header_library'>[% l("Location") %]</th>
19             <th id='copy_header_callnmber'>[% l("Call Number") %]</th>
20             [%- IF has_parts == 'true' %]
21             <th id='copy_header_part'>[% l("Part") %]</th>
22             [%- END %]
23             <th id='copy_header_barcode'>[% l("Barcode") %]</th>
24             <th id='copy_header_shelfloc'>[% l("Shelving Location") %]</th>
25             [%- IF ctx.is_staff %]
26             <th id='copy_header_age_hold'>[% l("Age Hold Protection") %]</th>
27             <th id='copy_header_create_date'>[% l("Create Date") %]</th>
28             <th id='copy_header_holdable'>[% l("Holdable?") %]</th>
29             [%- END %]
30             <th id='copy_header_status'>[% l("Status") %]</th>
31             <th id='copy_header_due_date'>[% l("Due Date") %]</th>
32         </tr>
33     </thead>
34     <tbody class="copy_details_table">
35         [%- last_cn = 0;
36         FOR copy_info IN ctx.copies;
37             callnum = copy_info.call_number_label;
38             NEXT IF callnum == '##URI##';
39
40             callnum_prefix = copy_info.call_number_prefix_label;
41             IF callnum_prefix != "";
42                 callnum = callnum_prefix _ " " _ callnum;
43             END;
44
45             callnum_suffix = copy_info.call_number_suffix_label;
46             IF callnum_suffix != "";
47                 callnum = callnum  _ " " _ callnum_suffix;
48             END;
49         -%]
50         <tr>
51             <td header='copy_header_library'>
52             [%-
53                 org_name = ctx.get_aou(copy_info.circ_lib).name;
54                 org_name | html
55             -%]
56             </td>
57             <td header='copy_header_callnumber'>[% callnum | html %] [% IF ctx.get_org_setting(CGI.param('loc') OR ctx.aou_tree.id, 'sms.enable') == 1 %](<a href="[% mkurl(ctx.opac_root _ '/sms_cn', {copy_id => copy_info.id}) %]">Text</a>)[% END %]</td>
58             [%- IF has_parts == 'true' %]
59             <td header='copy_header_part'>[% copy_info.part_label | html %]</td>
60             [%- END %]
61             <td header='copy_header_barcode'>
62                 [%- IF ctx.is_staff -%]
63                     <a href="javascript:void(0)" onclick="xulG.new_tab(xulG.urls.XUL_COPY_STATUS, {}, {'from_item_details_new': true, 'barcodes': ['[%- copy_info.barcode | html | replace('\'', '\\\'') -%]']})">[% copy_info.barcode | html %]</a>
64                 [%- ELSE -%][% copy_info.barcode | html %]
65                 [%- END -%]</td>
66             <td header='copy_header_shelfloc'>[% copy_info.copy_location | html %]</td>
67             [%- IF ctx.is_staff %]
68             <td header='copy_header_age_hold'>
69                 [% copy_info.age_protect ?
70                     ctx.get_crahp(copy_info.age_protect).name : l('None') | html %]
71             </td>
72             <td header='copy_header_date_format'>[% date.format(
73                 ctx.parse_datetime(copy_info.create_date),
74                 DATE_FORMAT
75             ) %]</td>
76             <td header='copy_header_holdable'>[%  # Show copy/volume hold links to staff (without
77                     # checking whether they have permissions to do those).
78                     overall_holdable = (copy_info.holdable == 't' AND
79                         copy_info.location_holdable == 't' AND
80                         copy_info.status_holdable == 't');
81                     IF overall_holdable;
82                         l("Place on"); %]
83                 <a href="[% mkurl(ctx.opac_root _ '/place_hold', 
84                     {hold_target => copy_info.id, hold_type => 'C', hold_source_page => mkurl()}) %]">[% l("copy") %]</a>
85                 [%-      IF copy_info.call_number != last_cn;
86                             last_cn = copy_info.call_number;
87                             l(" / "); %]
88                 <a href="[% mkurl(ctx.opac_root _ '/place_hold', 
89                     {hold_target => copy_info.call_number, hold_type => 'V', hold_source_page => mkurl()}) %]">[% l("volume") %]</a>
90                 [%-      END;
91                     ELSE;
92                         l("No");
93                     END %]</td>
94             [%- END %]
95             <td header='copy_header_status'>[% copy_info.copy_status | html %]</td>
96             <td header='due_date'>[%
97                 IF copy_info.due_date;
98                     date.format(
99                         ctx.parse_datetime(copy_info.due_date),
100                         DATE_FORMAT
101                     );
102                 ELSE;
103                     '-';
104                 END %]</td>
105         </tr>
106         [%- END %]
107         <tr>
108         [%- IF ctx.copy_offset > 0;
109             new_offset = ctx.copy_offset - ctx.copy_limit;
110             IF new_offset < 0; new_offset = 0; END %]
111             <td>
112                 <a href="[% mkurl('', {copy_offset => new_offset, copy_limit => ctx.copy_limit}) %]">&laquo; [%
113                     l('Previous [_1]', ctx.copy_offset - new_offset) %]</a>
114             </td>
115         [%- END %]
116         [%- IF ctx.copies.size >= ctx.copy_limit %]
117             <td>
118                 <a href="[% mkurl('', {copy_offset => ctx.copy_offset + ctx.copy_limit, copy_limit => ctx.copy_limit}) %]">[%
119                     l('Next [_1]', ctx.copy_limit) %] &raquo;</a>
120             </td>
121         [%- END %]
122         </tr>
123         <tr>
124             <td>
125                 [%- more_copies_limit = 50 %] [%# TODO: config %]
126                 [%- IF  ctx.copy_limit != more_copies_limit AND ctx.copies.size >= ctx.copy_limit %]
127                     <div class="rdetail_show_copies">
128                         <img src="[% ctx.media_prefix %]/images/plus_sign.png" />
129                         <a href="[% mkurl('', {copy_limit => more_copies_limit, copy_offset => 0}) %]">[% l('Show more copies') %]</a>
130                     </div>
131                 [%- ELSIF ctx.copy_limit == more_copies_limit %]
132                     <div  class="rdetail_show_copies">
133                         <img src="[% ctx.media_prefix %]/images/minus_sign.png" />
134                         <a href="[% mkurl('', {copy_limit => 0, copy_offset => 0}) %]">[% l('Show fewer copies') %]</a>
135                     </div>
136                 [%- END %]
137             </td>
138         </tr>
139     </tbody>
140 </table>
141 [% END; %]