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