TPAC: Display additional levels of copy counts
authorDan Scott <dan@coffeecode.net>
Mon, 19 Dec 2011 04:54:15 +0000 (23:54 -0500)
committerThomas Berezansky <tsbere@mvlc.org>
Wed, 21 Dec 2011 20:17:23 +0000 (15:17 -0500)
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 <dan@coffeecode.net>
Signed-off-by: Thomas Berezansky <tsbere@mvlc.org>
Open-ILS/src/templates/opac/parts/misc_util.tt2
Open-ILS/src/templates/opac/parts/record/summary.tt2
Open-ILS/src/templates/opac/parts/result/table.tt2

index 6efc585..bb3857a 100644 (file)
 
         # 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;
 
index d2e7cd1..ca5f1ba 100644 (file)
@@ -92,13 +92,29 @@ IF num_uris > 0;
 [%- IF ctx.copy_summary.0.count %]
 <div id='rdetail_copies'>
 <h2>[% l('Copies') %]</h2>
-<div class="rdetail_copy_counts">
+<ul>
+<li class="rdetail_copy_counts">
     <span>
         [%- l("[quant,_1,current hold,current holds] with [quant,_2,total copy,total copies].", 
             ctx.record_hold_count, ctx.copy_summary.0.count) %]
     </span>
-    <span>[% l('[quant,_1,copy,copies] currently available.', ctx.copy_summary.0.available) %]</span>
-</div>
+    <span>[% 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 %]
+    </span>
+</li>
+[%- depths = ctx.copy_summary.size;
+    depth = 1;
+    WHILE depth < depths;
+%]
+<li class="rdetail_copy_counts">
+[% 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 %]
+</li>
+[%- depth = depth + 1; END %]
+</ul>
 <table cellpadding="0" cellspacing="0" border="0" width="100%" id="rdetails_status">
     <thead>
         <tr>
index a8a277e..4ac7929 100644 (file)
                                                         [% END %]
                                                         [% END %] <!-- END detail_record_view -->
                                                     </table>
-                                                    <div>
-                                                        [% 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;
+                                                    %]
+                                                    <div class="result_count">
+                                                        [% 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
                                                         %]
                                                     </div>
+                                                    [%- depth = depth + 1; END %]
                                                 </div>
                                             </td>