From 91a4256e9f2d91f2b93c9348f7c7877af4267627 Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Sun, 18 Dec 2011 23:54:15 -0500 Subject: [PATCH] TPAC: Display additional levels of copy counts In line with the MassLNC TPAC suggestion, display the copy counts for search results and record details not only at the consortial level, but also at up to two additional levels of the org unit hierarchy (but no deeper than the user has chosen to search). Signed-off-by: Dan Scott Signed-off-by: Thomas Berezansky --- .../src/templates/opac/parts/misc_util.tt2 | 9 +++++--- .../templates/opac/parts/record/summary.tt2 | 22 ++++++++++++++++--- .../src/templates/opac/parts/result/table.tt2 | 14 ++++++++---- 3 files changed, 35 insertions(+), 10 deletions(-) diff --git a/Open-ILS/src/templates/opac/parts/misc_util.tt2 b/Open-ILS/src/templates/opac/parts/misc_util.tt2 index 6efc585691..bb3857a26c 100644 --- a/Open-ILS/src/templates/opac/parts/misc_util.tt2 +++ b/Open-ILS/src/templates/opac/parts/misc_util.tt2 @@ -159,11 +159,14 @@ # Extract the copy count summary count_type = (ctx.is_staff) ? 'staff' : 'public'; + + # Consortial copy count summary first xpath = '//*[local-name()="counts"]/*[local-name()="count"][@type="' _ count_type _ '"]'; + args.copy_counts = {}; FOR node IN xml.findnodes(xpath); - args.copy_counts = {}; - FOR attr IN ['count', 'available', 'unshadow', 'transcendant']; - args.copy_counts.$attr = node.getAttribute(attr); + FOR attr IN ['count', 'available', 'unshadow', 'transcendant', 'org_unit']; + depth = node.getAttribute('depth'); + args.copy_counts.$depth.$attr = node.getAttribute(attr); END; END; diff --git a/Open-ILS/src/templates/opac/parts/record/summary.tt2 b/Open-ILS/src/templates/opac/parts/record/summary.tt2 index d2e7cd1703..ca5f1ba224 100644 --- a/Open-ILS/src/templates/opac/parts/record/summary.tt2 +++ b/Open-ILS/src/templates/opac/parts/record/summary.tt2 @@ -92,13 +92,29 @@ IF num_uris > 0; [%- IF ctx.copy_summary.0.count %]

[% l('Copies') %]

-
+
    +
  • [%- l("[quant,_1,current hold,current holds] with [quant,_2,total copy,total copies].", ctx.record_hold_count, ctx.copy_summary.0.count) %] - [% l('[quant,_1,copy,copies] currently available.', ctx.copy_summary.0.available) %] -
+ [% l('[quant,_1,copy,copies] currently available at [_2].', + ctx.copy_summary.0.available, + ctx.get_aou(ctx.copy_summary.$depth.org_unit).name) | html %] + + +[%- depths = ctx.copy_summary.size; + depth = 1; + WHILE depth < depths; +%] +
  • +[% l('[quant,_1,copy,copies] currently available at [_2].', + ctx.copy_summary.$depth.available, + ctx.get_aou(ctx.copy_summary.$depth.org_unit).name) + | html %] +
  • +[%- depth = depth + 1; END %] + diff --git a/Open-ILS/src/templates/opac/parts/result/table.tt2 b/Open-ILS/src/templates/opac/parts/result/table.tt2 index a8a277efe0..4ac7929af1 100644 --- a/Open-ILS/src/templates/opac/parts/result/table.tt2 +++ b/Open-ILS/src/templates/opac/parts/result/table.tt2 @@ -159,12 +159,18 @@ [% END %] [% END %]
    -
    - [% l('[_1] of [quant,_2,copy,copies] available', - attrs.copy_counts.available, attrs.copy_counts.count) # XXX s/count/nshadow/ ? - #rec.copy_counts.available, rec.copy_counts.visible) + [%- depths = attrs.copy_counts.size; + depth = 0; + WHILE depth < depths; + %] +
    + [% l('[_1] of [quant,_2,copy,copies] available at [_3].', + attrs.copy_counts.$depth.available, + attrs.copy_counts.$depth.count, + ctx.get_aou(attrs.copy_counts.$depth.org_unit).name) | html %]
    + [%- depth = depth + 1; END %]
    -- 2.43.2