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