]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/templates/kpac/parts/copy_table.tt2
Support linking to library info from copy display
[working/Evergreen.git] / Open-ILS / src / templates / kpac / parts / 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%" class="item_location_table">
16     <tbody>
17         <tr class="header">
18             <td class="location">[% l('Location') %]</td>
19             <td class="callnumber">[% l('Call Number') %]</td>
20             <td class="shelving_location">[% l('Shelving Location') %]</td>
21             <td class="status">[% l('Status') %]</td>
22         </tr>
23         [%- 
24         FOR copy_info IN ctx.copies;
25             callnum = copy_info.call_number_label;
26             NEXT IF callnum == '##URI##';
27
28             callnum_prefix = copy_info.call_number_prefix_label;
29             IF callnum_prefix != "";
30                 callnum = callnum_prefix _ " " _ callnum;
31             END;
32
33             callnum_suffix = copy_info.call_number_suffix_label;
34             IF callnum_suffix != "";
35                 callnum = callnum  _ " " _ callnum_suffix;
36             END;
37         -%]
38         <tr>
39             <td class="location">
40             [%-
41                 org_name = ctx.get_aou(copy_info.circ_lib).name;
42                 lib_url = ctx.get_org_setting(copy_info.circ_lib, 'lib.info_url');
43                 IF lib_url; '<a href="'; lib_url | url; '">'; END;
44                 org_name | html;
45                 IF lib_url; '</a>'; END;
46             -%]
47             </td>
48             [%- IF has_parts == 'true' %]
49             <td class="callnumber">[% l('[_1] ([_2])', callnum, copy_info.part_label) | html %]</td>
50             [% ELSE %]
51             <td class="callnumber">[% callnum | html %]</td>
52             [%- END %]
53             <td class="shelving_location">[% copy_info.copy_location | html %]</td>
54             <td class="status">[% copy_info.copy_status | html %]</td>
55         </tr>
56         [%- END %]
57
58         <!-- PAGING -->
59
60         <tr>
61
62             <td>
63             [%- IF ctx.copy_offset > 0;
64                 new_offset = ctx.copy_offset - ctx.copy_limit;
65                 IF new_offset < 0; new_offset = 0; END %]
66                     <a href="[% mkurl('', {copy_offset => new_offset, copy_limit => ctx.copy_limit}) %]">&laquo; [%
67                         l('Previous [_1]', ctx.copy_offset - new_offset) %]</a>
68             [%- END %]
69             </td>
70
71             <td>
72             [%- IF ctx.copies.size >= ctx.copy_limit %]
73                     <a href="[% mkurl('', {copy_offset => ctx.copy_offset + ctx.copy_limit, copy_limit => ctx.copy_limit}) %]">[%
74                         l('Next [_1]', ctx.copy_limit) %] &raquo;</a>
75             [%- END %]
76             </td>
77
78             [%- more_copies_limit = 50 %] [%# TODO: config %]
79             <td>
80             [%- IF  ctx.copy_limit != more_copies_limit AND ctx.copies.size >= ctx.copy_limit %]
81                 <a href="[% mkurl('', {copy_limit => more_copies_limit, copy_offset => 0}) %]">[% l('Show more copies') %]</a>
82             [%- ELSIF ctx.copy_limit == more_copies_limit %]
83                 <a href="[% mkurl('', {copy_limit => 0, copy_offset => 0}) %]">[% l('Show fewer copies') %]</a>
84             [%- END %]
85             </td>
86         </tr>
87     </tbody>
88 </table>
89 [% END %]
90