LP#1971745 - speed up open-ils.storage.action.live_holds.wide_hash
[working/Evergreen.git] / Open-ILS / src / templates / actor / user / event_log.tt2
index 9f745ca..de1afa1 100644 (file)
@@ -1,5 +1,5 @@
 [% WRAPPER base.tt2 %]
-[% ctx.page_title = "Triggered Event Log" %]
+[% ctx.page_title = l("Triggered Event Log") %]
 <script type="text/javascript">
     dojo.require("dijit.form.Button");
     dojo.require("dojo.data.ItemFileReadStore");
@@ -51,6 +51,8 @@
         grid.filterUi.doApply();
     }
 
+    var _reactors_cache;
+
     /* This and its subclasses exist because *FilterPane expect things that
        act like AutoFieldWidget, which is a widget /builder/.  */
     dojo.declare(
@@ -66,7 +68,7 @@
             "build": function() {
                 var dijitArgs = dojo.mixin(
                     {
-                        "store": this.store,
+                        "store": this.store || this.storeBuilder(),
                         "query": {},
                         "labelAttr": "label",
                         "searchAttr": "label",
     );
 
     dojo.declare(
+        "openils.widget._FSBuilder.Reactor",
+        [openils.widget._FSBuilder], {
+            "storeBuilder": function() {
+                _reactors_cache = _reactors_cache ||
+                    fieldmapper.standardRequest(
+                        ["open-ils.actor", "open-ils.actor.action_trigger.reactors.all_in_use"],
+                        { "params": [openils.User.authtoken] }
+                    ).sort();
+                return new dojo.data.ItemFileReadStore({
+                    "data": {
+                        "identifier": "name",
+                        "items": _reactors_cache.map(
+                            function(o) { return {"name": o, "label": o}; }
+                        )
+                    }
+                });
+            }
+        }
+    );
+
+    dojo.declare(
         "openils.widget._FSBuilder.CoreType",
         [openils.widget._FSBuilder], {
             "store": new dojo.data.ItemFileReadStore({
                 "data": {
                     "identifier": "name",
                     "items": [  /* XXX i18n */
-                        {"name": "circ", "label": "Circulation"},
-                        {"name": "ahr", "label": "Hold"}
+                        {"name": "circ", "label": "[% l('Circulation') %]"},
+                        {"name": "ahr", "label": "[% l('Hold') %]"}
                     ]
                 }
             })
                 "data": {
                     "identifier": "name",
                     "items": [  /* XXX i18n */
-                        {"name": "found", "label": "Found"},
-                        {"name": "collected", "label": "Collected"},
-                        {"name": "invalid", "label": "Invalid"},
-                        {"name": "pending", "label": "Pending"},
-                        {"name": "reacting", "label": "Reacting"},
-                        {"name": "complete", "label": "Complete"},
-                        {"name": "error", "label": "Error"}
+                        {"name": "found", "label": "[% l('Found') %]"},
+                        {"name": "collected", "label": "[% l('Collected') %]"},
+                        {"name": "invalid", "label": "[% l('Invalid') %]"},
+                        {"name": "pending", "label": "[% l('Pending') %]"},
+                        {"name": "reacting", "label": "[% l('Reacting') %]"},
+                        {"name": "complete", "label": "[% l('Complete') %]"},
+                        {"name": "error", "label": "[% l('Error') %]"}
                     ]
                 }
             })
     var filter_widget_builders = {
         "ath:core_type": openils.widget._FSBuilder.CoreType,
         "atul:state": openils.widget._FSBuilder.EventState,
+        "atul:reactor": openils.widget._FSBuilder.Reactor,
     };
 
     function print_all() {
 
     /* The callback fired when the OrgUnitFilteringSelect is changed */
     function set_grid_query_from_org_selector() {
-        /* Naughty: shouldn't use _baseQuery like this, but need to rethink
-           multiple competing filtering mechanisms. */
-        grid._baseQuery.perm_lib = aou.descendantNodeList(
+        grid.baseQuery.perm_lib = aou.descendantNodeList(
             org_selector.attr("value"), /* as id */ true
         );
 
-        /* But for the persistent filter UI, this would be grid.refresh() */
+        /* But for the persistent filter UI, this would be grid.filter()
+           and grid.refresh() */
         if (filter_semaphore())   /* avoid race between ou selector and other
                                      filter thing */
             filter_semaphore_callback();
                 query="initial_query">
                 <thead>
                     <tr>
-                        <th field="name" fpath="name" ffilter="true">Event Name</th>
+                        <th field="name" fpath="name" ffilter="true">[% l('Event Name') %]</th>
                         <th field="reactor" fpath="reactor" ffilter="true"></th>
                         <th field="run_time" fpath="run_time" ffilter="true"></th><!-- XXX TODO formatters for *_time -->
                         <th field="add_time" fpath="add_time" ffilter="true" _visible="false"></th>
                         <th field="complete_time" fpath="complete_time" ffilter="true" _visible="false"></th>
                         <th field="id" fpath="id" ffilter="true" _visible="false"></th>
                         <th field="state" fpath="state" ffilter="true"></th>
-                        <th field="target_circ_copy_barcode" fpath="target_circ.target_copy.barcode" ffilter="true">Target Circulation - Copy Barcode</th>
-                        <th field="target_circ_copy_title" fpath="target_circ.target_copy.call_number.record.simple_record.title">Target Circulation - Title</th>
-                        <th field="target_circ_copy_author" fpath="target_circ.target_copy.call_number.record.simple_record.author">Target Circulation - Author</th>
-                        <th field="target_circ_patron_barcode" fpath="target_circ.usr.card.barcode" ffilter="true">Target Circulation - Patron Barcode</th>
-                        <th field="target_hold_copy_title" fpath="target_hold.current_copy.call_number.record.simple_record.title">Target Hold - Title</th>
-                        <th field="target_hold_copy_author" fpath="target_hold.current_copy.call_number.record.simple_record.author">Target Hold - Author</th>
-                        <th field="target_hold_patron_barcode" fpath="target_hold.usr.card.barcode" ffilter="true">Target Hold - Patron Barcode</th>
+                        <th field="target_circ_copy_barcode" fpath="target_circ.target_copy.barcode" ffilter="true">[% l('Target Circulation - Copy Barcode') %]</th>
+                        <th field="target_circ_copy_title" fpath="target_circ.target_copy.call_number.record.simple_record.title">[% l('Target Circulation - Title') %]</th>
+                        <th field="target_circ_copy_author" fpath="target_circ.target_copy.call_number.record.simple_record.author">[% l('Target Circulation - Author') %]</th>
+                        <th field="target_circ_patron_barcode" fpath="target_circ.usr.card.barcode" ffilter="true">[% l('Target Circulation - Patron Barcode') %]</th>
+                        <th field="target_hold_copy_title" fpath="target_hold.current_copy.call_number.record.simple_record.title">[% l('Target Hold - Title') %]</th>
+                        <th field="target_hold_copy_author" fpath="target_hold.current_copy.call_number.record.simple_record.author">[% l('Target Hold - Author') %]</th>
+                        <th field="target_hold_patron_barcode" fpath="target_hold.usr.card.barcode" ffilter="true">[% l('Target Hold - Patron Barcode') %]</th>
                     </tr>
                 </thead>
             </table>