TPac: MFHD staff client actions integration
authorBill Erickson <berick@esilibrary.com>
Mon, 26 Sep 2011 16:56:17 +0000 (12:56 -0400)
committerDan Scott <dscott@laurentian.ca>
Mon, 26 Sep 2011 17:41:19 +0000 (13:41 -0400)
Populdate the necessary window.mfhdDetails data for the staff client and
fire the mfhdDrawn event

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Dan Scott <dscott@laurentian.ca>
Open-ILS/src/templates/opac/parts/js.tt2
Open-ILS/web/js/ui/default/opac/staff.js

index c0b2e70..6eaf150 100644 (file)
@@ -5,17 +5,33 @@
 
 [%- IF ctx.is_staff %]
 <script type="text/javascript" src="[% ctx.media_prefix %]/js/ui/default/opac/staff.js"></script>
-    [% IF ctx.page == 'record' AND ctx.search_result_index >= 0 %]
-    <script>
-        rdetail_next_prev_actions(
-            "[% ctx.search_result_index %]",
-            "[% ctx.hit_count %]",
-            "[% ctx.prev_rec_url || '' %]",
-            "[% ctx.next_rec_url || '' %]",
-            "[% mkurl(ctx.first_search_record, {page => 0}) %]",
-            "[% mkurl(ctx.last_search_record, {page => POSIX.floor(ctx.hit_count / ctx.page_size)}) %]"
-        );
-    </script>
+    [% IF ctx.page == 'record' %]
+        [% IF ctx.search_result_index >= 0 %]
+        <script>
+            rdetail_next_prev_actions(
+                "[% ctx.search_result_index %]",
+                "[% ctx.hit_count %]",
+                "[% ctx.prev_rec_url || '' %]",
+                "[% ctx.next_rec_url || '' %]",
+                "[% mkurl(ctx.first_search_record, {page => 0}) %]",
+                "[% mkurl(ctx.last_search_record, {page => POSIX.floor(ctx.hit_count / ctx.page_size)}) %]"
+            );
+        </script>
+        [% END %]
+        [% IF ctx.mfhd_summaries.size %]
+        <script>
+            window.mfhdDetails = [
+                [% FOR summary IN ctx.mfhd_summaries %]
+                {
+                    'id' : '[% summary.sre_id %]', 
+                    'label' : '[% summary.location %]',
+                    'entryNum' : '[% loop.index %]',
+                    'owning_lib' : '[% summary.owning_lib %]'
+                }
+                [% END %]
+            ];
+        </script>
+        [% END %]
     [% END %]
 [%- END %]
 
index 5521e50..b952cef 100644 (file)
@@ -21,8 +21,10 @@ function staff_hold_usr_input_disabler(input) {
 window.onload = function() {
     // record details page events
     var rec = location.href.match(/\/opac\/record\/(\d+)/);
-    if(rec && rec[1]) { runEvt('rdetail', 'recordRetrieved', rec[1]); }
-    // fire other events the staff client is expecting...
+    if(rec && rec[1]) { 
+        runEvt('rdetail', 'recordRetrieved', rec[1]); 
+        runEvt('rdetail', 'MFHDDrawn');
+    }
 }
 
 function rdetail_next_prev_actions(index, count, prev, next, start, end) {