initial interface for managing pending notification events
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 26 Mar 2009 16:10:40 +0000 (16:10 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 26 Mar 2009 16:10:40 +0000 (16:10 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@12688 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/ui/default/actor/user/trigger_events.js [new file with mode: 0644]
Open-ILS/web/templates/default/actor/user/trigger_events.tt2 [new file with mode: 0644]

diff --git a/Open-ILS/web/js/ui/default/actor/user/trigger_events.js b/Open-ILS/web/js/ui/default/actor/user/trigger_events.js
new file mode 100644 (file)
index 0000000..19376e4
--- /dev/null
@@ -0,0 +1,65 @@
+dojo.require('dojox.grid.DataGrid');
+dojo.require('dojo.data.ItemFileWriteStore');
+dojo.require('openils.Util');
+dojo.require('openils.User');
+
+var evtCache = {};
+
+function init() {
+    var store = new dojo.data.ItemFileWriteStore({data:acqf.initStoreData()});
+    evtGrid.setStore(store);
+    evtGrid.render();
+
+    function onResponse(r) {
+        var evt = openils.Util.readResponse(r);
+        evtCache[evt.id()] = evt;
+        evtGrid.store.newItem(evt.toStoreItem()); 
+    }
+
+    fieldmapper.standardRequest(
+        ['open-ils.actor', 'open-ils.actor.user.events.circ'],
+        {   async: true,
+            params: [openils.User.authtoken, patronId],
+            onresponse : onResponse
+        }
+    );
+
+    fieldmapper.standardRequest(
+        ['open-ils.actor', 'open-ils.actor.user.events.ahr'],
+        {   async: true,
+            params: [openils.User.authtoken, patronId],
+            onresponse : onResponse
+        }
+    );
+}
+
+function getField(rowIdx, item) {
+    if(!item) return '';
+    var evt = evtCache[this.grid.store.getValue(item, 'id')];
+
+    switch(this.field) {
+        case 'reactor':
+            return evt.event_def().reactor().module();
+        case 'validator':
+            return evt.event_def().validator().module();
+        case 'hook':
+            return evt.event_def().hook();
+        case 'target':
+            switch(evt.target().classname) {
+                case 'circ':
+                    return evt.target().target_copy().barcode();
+                case 'ahr':
+                    if(evt.target().currrent_copy())
+                        return evt.target().currrent_copy().barcode();
+            }
+            
+    }
+
+    return this.grid.store.getValue(item, this.field) || '';
+}
+
+function evtCancelSelected() {
+}
+
+openils.Util.addOnLoad(init);
+
diff --git a/Open-ILS/web/templates/default/actor/user/trigger_events.tt2 b/Open-ILS/web/templates/default/actor/user/trigger_events.tt2
new file mode 100644 (file)
index 0000000..7ebc924
--- /dev/null
@@ -0,0 +1,28 @@
+[% ctx.page_title = 'Events' %]
+[% WRAPPER default/base.tt2 %]
+<script src='[% ctx.media_prefix %]/js/ui/default/actor/user/trigger_events.js'> </script>
+<script>patronId = '[% ctx.page_args.0 %]'</script>
+
+<div dojoType="dijit.layout.ContentPane" layoutAlign="top" class='oils-header-panel'>
+    <div>User Events</div>
+    <div>
+        <button dojoType='dijit.form.Button' onClick='evtCancelSelected()'>Cancel Selected Events</button>
+    </div>
+</div>
+
+
+<div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:100%;'> 
+    <table jsId="evtGrid" dojoType="dojox.grid.DataGrid" query="{id: '*'}">
+        <thead> 
+            <tr> 
+                <th field="state" get='getField' width='12em'>State</th> 
+                <th field="hook" get='getField' width='12em'>Hook</th> 
+                <th field="reactor" get='getField' width='12em'>Reactor</th> 
+                <th field="validator" get='getField' width='12em'>Validator</th> 
+                <th field="target" get='getField' width='12em'>Target</th> 
+            </tr> 
+        </thead> 
+    </table>     
+</div>
+
+[% END %]