[%-
expand_path = CGI.param('sepath') || [];
expand_path = expand_path.list; # sic
seoffset_list = CGI.param('seoffset') || [];
seoffset_list = seoffset_list.list; # sic
IF expand_path.size == 0 AND seoffset_list.size == 0;
seoffset_list = [0,0]; # compensate for $auto_expand_first; see ML
END;
selimit = CGI.param('selimit') || 10;
ght_sepath = [];
ght_depth = 0;
VIEW grouped_holding_tree;
BLOCK list;
'
';
prev_seoffset_list = seoffset_list.slice(0, ght_depth);
next_seoffset_list = seoffset_list.slice(0, ght_depth);
prev_seoffset_list.$ght_depth = prev_seoffset_list.$ght_depth - selimit;
IF prev_seoffset_list.$ght_depth < 0;
prev_seoffset_list.$ght_depth = 0;
END;
next_seoffset_list.$ght_depth = next_seoffset_list.$ght_depth + selimit;
IF item.0.units.size;
INCLUDE "opac/parts/record/copy_table.tt2" serial_holdings=item;
"
";
"";
ELSE;
FOREACH node IN item;
IF NOT node.label;
has_more = 1;
LAST;
END;
IF node.value;
ght_sepath.push(node.value);
new_seoffsets = seoffset_list.slice(0, ght_depth);
new_seoffsets.push(0);
expand_link = mkurl(
'', {'sepath' => ght_sepath, 'seoffset' => new_seoffsets},
0, 'issues'
);
collapse_sepath = ght_sepath.slice(0, -2);
IF collapse_sepath.size == 0;
collapse_clear_params = ['sepath'];
ELSE;
collapse_clear_params = 0;
END;
collapse_link = mkurl(
'', {
'sepath' => collapse_sepath,
'seoffset' => new_seoffsets.slice(0, -2)
}, collapse_clear_params, 'issues'
);
"";
IF node.children.size;
# TODO: make images or figure out a CSS trick or
# something. I doubt we can count on all OPAC clients
# having adequate fonts to cover these Unicode glyphs.
"▼
"; node.label; " ";
IF node.children.size;
ght_depth = ght_depth + 1;
view.print(node.children);
ght_depth = ght_depth - 1;
END;
waste = ght_sepath.pop;
ELSE;
""; node.label; "
";
# XXX Hold placement link here? Maybe not if no units.
END;
END;
to_clear = 0;
new_sepath_end = ght_depth - 1;
IF new_sepath_end < 0;
to_clear = ['sepath'];
new_sepath = [];
ELSE;
new_sepath = expand_path.slice(0, ght_depth - 1);
END;
IF has_more;
'« '; l('Earlier holdings'); '';
END;
IF seoffset_list.$ght_depth > 0;
''; l('Later holdings'); ' » ';
END;
'';
END;
END;
END;
VIEW holding_summary_tree;
BLOCK hash;
'';
ctx.get_aou(item.org_unit).name; "
";
FOREACH summary IN item.holding_summaries;
IF summary.holdings;
twisty = '▼ ';
link = mkurl(
'', {},
['sid','stype','selimit','sepath','seoffset'], 'issues'
);
link_title = l('Collapse');
ELSE;
twisty = '► ';
link = mkurl(
'', {sid => summary.id, stype => summary.summary_type},
['selimit','sepath','seoffset'], 'issues'
);
link_title = l('Expand');
END;
'
'; twisty;
'';
summary.generated_coverage.join(", ");
'';
IF summary.holdings;
grouped_holding_tree.print(summary.holdings);
END;
END;
FOREACH child IN item.children;
view.print(child);
END;
'
';
END;
END %]
[% holding_summary_tree.print(ctx.holding_summary_tree) %]