added initial 'test circ event def by barcode' functionality
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 3 Apr 2009 18:26:58 +0000 (18:26 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 3 Apr 2009 18:26:58 +0000 (18:26 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@12779 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/css/skin/default.css
Open-ILS/web/js/ui/default/conify/global/action_trigger/event_definition.js
Open-ILS/web/templates/default/conify/global/action_trigger/event_definition.tt2

index e7fceb5..fb9406e 100644 (file)
@@ -85,3 +85,8 @@ table { border-collapse: collapse; }
     text-align:right;
     float:right;
 }
+
+
+.oils-progress-dialog { width: 300px; }
+
+
index b4f585c..ef1a42b 100644 (file)
@@ -1,7 +1,12 @@
 dojo.require('dijit.layout.TabContainer');
 dojo.require('dijit.form.Textarea');
+dojo.require('dijit.form.FilteringSelect');
+dojo.require('dijit.form.TextBox');
+dojo.require('dojo.data.ItemFileReadStore');
 dojo.require('openils.widget.AutoGrid');
 dojo.require('openils.Util');
+dojo.require('openils.PermaCrud');
+dojo.require('openils.widget.ProgressDialog');
 
 
 function loadEventDef() { 
@@ -30,7 +35,59 @@ function tabLoader(child) {
         case 'tab-atval': 
             tvGrid.loadAll({order_by:{atval : 'module'}}); 
             break;
+        case 'tab-test': 
+            loadTestTab();
+            break;
+    }
+}
+
+function loadTestTab() {
+    var pcrud = new openils.PermaCrud();
+    var hooks = pcrud.search('ath', {core_type : 'circ'});
+
+    circTestHookSelector.store = new dojo.data.ItemFileReadStore({data : ath.toStoreData(hooks, 'key', {identifier:'key'})});
+    circTestHookSelector.searchAttr = 'key';
+    circTestHookSelector.startup();
+
+    var defs = pcrud.search('atevdef', {hook : hooks.map(function(i){return i.key()})});
+    circTestDefSelector.store = new dojo.data.ItemFileReadStore({data : atevdef.toStoreData(defs)});
+    circTestDefSelector.searchAttr = 'id';
+    circTestDefSelector.startup();
+
+    dojo.connect(circTestHookSelector, 'onChange',
+        function() {
+            circTestDefSelector.query = {hook : this.attr('value')};
+        }
+    );
+}
+
+function evtTestCirc() {
+    var def = circTestDefSelector.attr('value');
+    var barcode = circTestBarcode.attr('value');
+    if(!(def && barcode)) return;
+
+    progressDialog.show();
+
+    function handleResponse(r) {
+        var evt = openils.Util.readResponse(r);
+        progressDialog.hide();
+        if(evt && evt != '0') {
+            var output = evt.template_output();
+            if(!output) output = evt.error_output();
+            var pre = document.createElement('pre');
+            pre.innerHTML = output.data();
+            dojo.byId('test-event-output').appendChild(pre);
+            openils.Util.show('test-event-output');
+        }
     }
+
+    fieldmapper.standardRequest(
+        ['open-ils.circ', 'open-ils.circ.trigger_event_by_def_and_barcode.fire'],
+        {   async: true,
+            params: [openils.User.authtoken, def, barcode],
+            oncomplete: handleResponse
+        }
+    );
 }
 
 openils.Util.addOnLoad(loadEventDef);
index d06fbe6..47d9300 100644 (file)
         </div>
     </div>
 
+    <div dojoType="dijit.layout.ContentPane" title='Test' id='tab-test'>
+        <div dojoType="dijit.layout.ContentPane" layoutAlign="top" class='oils-header-panel'>
+            <div>Event Definition Tests</div>
+            <div></div>
+        </div>
+        <br/>
+        <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:90%'>
+            <div style='border:1px solid #aaa;'>
+                <h2>Test Circulation</h2>
+                <table class='oils-generic-table'>
+                    <tr>
+                        <td>Trigger Hook</td>
+                        <td><div dojoType='dijit.form.FilteringSelect' jsId='circTestHookSelector'/></td>
+                    </tr>
+                    <tr>
+                        <td>Trigger Event Definition</td>
+                        <td><div dojoType='dijit.form.FilteringSelect' jsId='circTestDefSelector'/></td>
+                    </tr>
+                    <tr>
+                        <td>Barcode of Circulating Copy</td>
+                        <td><div dojoType='dijit.form.TextBox' jsId='circTestBarcode'/></td>
+                    </tr>
+                    <tr>
+                        <td colspan='2'><button dojoType='dijit.form.Button' onclick='evtTestCirc'>Go</button></td>
+                    </tr>
+                </table>
+            </div>
+
+            <div id='test-event-output' style='width:90%;margin:20px;border:1px solid #aaa;' class='hidden'>
+            </div>
+            <div jsId='progressDialog' dojoType='openils.widget.ProgressDialog' indeterminate='true'></div>
+        </div>
+    </div>
+
 </div>
 
 [% END %]