]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/templates/opac/parts/record/copy_counts.tt2
Merge branch 'master' of git.evergreen-ils.org:Evergreen-DocBook into doc_consolidati...
[working/Evergreen.git] / Open-ILS / src / templates / opac / parts / record / copy_counts.tt2
1 <span id="rdetail_copy_counts">
2     <h2>[% l('Available copies') %]</h2>
3     <ul>
4     [%- depths = ctx.copy_summary.size;
5         depth = 0;
6         displayed_ous = {};
7         WHILE depth < depths;
8             ou_avail = ctx.copy_summary.$depth.available;
9             ou_id = ctx.copy_summary.$depth.org_unit;
10             cp_org_unit = ctx.get_aou(ou_id);
11             IF cp_org_unit.opac_visible == 'f' AND !ctx.is_staff;
12                 depth = depth + 1;
13                 NEXT;
14             END;
15             ou_name = cp_org_unit.name;
16             displayed_ous.$ou_name = 1;
17     %]
18     <li>
19     [% l('[quant,_1,copy,copies] at [_2].', ou_avail, ou_name) | html %]
20     [%- this_depth = ctx.get_aou(ou_id).ou_type.depth;
21         IF ou_avail > 0 && this_depth != ctx.copy_depth %]
22     <a href="[% mkurl('', {copy_depth => this_depth}, ['copy_offset']); %]"
23        title="[% l('Show copies at [_1]', ou_name); %]">
24        [%- l('(Show)'); %]</a>
25     [%- END; %]
26     </li>
27     [%- depth = depth + 1;
28         END;
29
30         depth = attrs.plib_copy_counts.size - 1;
31         ou_name = ctx.get_aou(attrs.plib_copy_counts.$depth.org_unit).name;
32         ou_id = attrs.plib_copy_counts.$depth.org_unit;
33         UNLESS depth < 0 || displayed_ous.exists(ou_name);
34     %]
35     [%- IF attrs.plib_copy_counts.$depth.count > 0; %]
36     <li class="preferred">[%
37         l('[_1] of [quant,_2,copy,copies] available at [_3].',
38             attrs.plib_copy_counts.$depth.available,
39             attrs.plib_copy_counts.$depth.count,
40             ou_name) | html
41     %] <a href="[% mkurl('', {locg => ou_id}, ['copy_offset']); %]"
42        title="[% l('Show copies at [_1]', ou_name); %]">[%
43        l('(Show preferred library)');
44     %]</a></li>
45     [%- END %]
46     [%- END %]
47     </ul>
48 </span>