2 expand_path = CGI.param('sepath') || [];
3 expand_path = expand_path.list; # sic
5 seoffset_list = CGI.param('seoffset') || [];
6 seoffset_list = seoffset_list.list; # sic
8 IF expand_path.size == 0 AND seoffset_list.size == 0;
9 seoffset_list = [0,0]; # compensate for $auto_expand_first; see ML
12 selimit = CGI.param('selimit') || 10;
16 VIEW grouped_holding_tree;
18 level_description = item.shift;
19 level_description.caption =
20 level_description.caption.replace('[\(\)]', '');
22 '<div class="rdetail-holding-group">';
23 prev_seoffset_list = seoffset_list.slice(0, ght_depth);
24 next_seoffset_list = seoffset_list.slice(0, ght_depth);
26 prev_seoffset_list.$ght_depth = prev_seoffset_list.$ght_depth - selimit;
27 IF prev_seoffset_list.$ght_depth < 0;
28 prev_seoffset_list.$ght_depth = 0;
34 next_seoffset_list.$ght_depth = next_seoffset_list.$ght_depth + selimit;
36 INCLUDE "opac/parts/record/copy_table.tt2" serial_holdings=item;
40 IF NOT item.last.label;
51 ght_sepath.push(node.value);
52 new_seoffsets = seoffset_list.slice(0, ght_depth);
53 new_seoffsets.push(0);
56 '', {'sepath' => ght_sepath, 'seoffset' => new_seoffsets},
60 collapse_sepath = ght_sepath.slice(0, -2);
61 IF collapse_sepath.size == 0;
62 collapse_clear_params = ['sepath'];
64 collapse_clear_params = 0;
67 collapse_link = mkurl(
69 'sepath' => collapse_sepath,
70 'seoffset' => new_seoffsets.slice(0, -2)
71 }, collapse_clear_params, 'issues'
74 "<div class='rdetail-holding-group'>";
75 IF node.children.size;
76 # TODO: make images or figure out a CSS trick or
77 # something. I doubt we can count on all OPAC clients
78 # having adequate fonts to cover these Unicode glyphs.
79 "▼ <a href='"; collapse_link;
81 "► <a href='"; expand_link;
83 "'>"; node.label; "</a></div>";
85 IF node.children.size;
86 ght_depth = ght_depth + 1;
87 view.print(node.children);
88 ght_depth = ght_depth - 1;
91 waste = ght_sepath.pop;
93 "<div class='rdetail-holding-group'>"; node.label; "</div>";
100 new_sepath_end = ght_depth - 1;
101 IF new_sepath_end < 0;
102 to_clear = ['sepath'];
105 new_sepath = expand_path.slice(0, ght_depth - 1);
108 # So the "holdings" level of the tree is sorted ascending, while all
109 # the higher levels are sorted descending. This seems weird until you
110 # look at it. I dunno. I think it feels right. It could be changed I
111 # guess. Anyway, this means we have to be careful about which
112 # paging link we label "earlier" and which one we label "later."
114 next_link = ''; prev_link = '';
116 next_link = '<a class="paging" href="' _
117 mkurl('',{seoffset => next_seoffset_list, sepath => new_sepath},to_clear,'issues') _ '">LABEL_HERE</a> ';
119 IF seoffset_list.$ght_depth > 0;
120 prev_link = '<a class="paging" href="' _
121 mkurl('',{seoffset => prev_seoffset_list, sepath => new_sepath},to_clear,'issues') _ '">LABEL_HERE</a> ';
125 prev_link.replace('LABEL_HERE', '« ' _ l('Earlier issues'));
126 next_link.replace('LABEL_HERE', l('Later issues') _ ' »');
128 # XXX this is really bad for i18n (notice the sloppy pluralization),
129 # but then the middle layer for serials only knows English names
130 # for things like "month". There's a bigger problem to solve
132 caption = level_description.caption;
133 IF level_description.display_grouping == 'chron';
134 caption = caption _ 's';
138 '« ' _ l('Earlier') _ ' ' _ caption
142 l('Later') _ ' ' _ caption _ ' »'
149 VIEW holding_summary_tree;
151 '<div class="rdetail-holding-group">';
152 ctx.get_aou(item.org_unit).name; "<br />";
153 FOREACH summary IN item.holding_summaries;
155 twisty = '▼ ';
158 ['sid','stype','selimit','sepath','seoffset'], 'issues'
160 link_title = l('Collapse');
162 twisty = '► ';
164 '', {sid => summary.id, stype => summary.summary_type},
165 ['selimit','sepath','seoffset'], 'issues'
167 link_title = l('Expand');
170 '<a href="' _ link _ '" title="' _ link_title _ '">';
171 summary.generated_coverage.join(", ");
174 grouped_holding_tree.print(summary.holdings);
177 FOREACH child IN item.children;
183 <div class="holding-summary-tree">
184 [% holding_summary_tree.print(ctx.holding_summary_tree) %]
186 <div class="holding-summary-tree-pager">
187 [% slimit = CGI.param('slimit') || 10;
188 soffset = CGI.param('soffset') || 0;
189 soffset_prev = soffset - slimit;
190 IF soffset_prev < 0; soffset_prev = 0; END;
191 soffset_next = soffset + slimit;
194 <a href="[% mkurl('', {soffset => soffset_prev}, ['sid','stype','sepath','selimit','seoffset'], 'issues') %]>[% l('Previous') %]</a>
196 [% IF ctx.holding_summary_tree.more %]
197 <a href="[% mkurl('', {soffset => soffset_next}, ['sid','stype','sepath','selimit','seoffset'], 'issues') %]">[% l('Next') %]</a>