]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/templates/opac/parts/record/copy_counts.tt2
fd97eabc6f5e6e7d7e5b1b0399114d2acb7a5520
[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_id = ctx.copy_summary.$depth.org_unit;
11             cp_org_unit = ctx.get_aou(ou_id);
12             skip_me = !ou_hiding_disabled AND !ctx.org_within_hiding_scope(ou_id);
13             IF (cp_org_unit.opac_visible == 'f' AND !ctx.is_staff) OR skip_me;
14                 depth = depth + 1;
15                 NEXT;
16             END;
17             ou_name = cp_org_unit.name;
18             displayed_ous.$ou_name = 1;
19     %]
20     <li property="offers" typeof="AggregateOffer">
21         <meta property="offerCount" content="[% ou_avail %]">
22         <meta property="seller" content="[% ou_name | html %]">
23     [% l('[quant,_1,copy,copies] at [_2].', ou_avail, ou_name) | html %]
24     [%- this_depth = ctx.get_aou(ou_id).ou_type.depth;
25         IF ou_avail > 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); %]">
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" property="offers" typeof="AggregateOffer">
41         <meta property="offerCount" content="[% ou_avail %]">
42         <meta property="seller" content="[% ou_name | html %]">
43     [%-
44         l('[_1] of [quant,_2,copy,copies] available at [_3].',
45             attrs.plib_copy_counts.$depth.available,
46             attrs.plib_copy_counts.$depth.count,
47             ou_name) | html
48     %] <a href="[% mkurl('', {locg => ou_id}, ['copy_offset']); %]"
49        title="[% l('Show copies at [_1]', ou_name); %]">[%
50        l('(Show preferred library)');
51     %]</a></li>
52     [%- END %]
53     [%- END %]
54     </ul>
55 </span>