From 2bd76fda07ec32b8102cef43a9b823c1cf683f15 Mon Sep 17 00:00:00 2001 From: erickson Date: Fri, 3 Apr 2009 18:26:58 +0000 Subject: [PATCH] added initial 'test circ event def by barcode' functionality git-svn-id: svn://svn.open-ils.org/ILS/trunk@12779 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/css/skin/default.css | 5 ++ .../global/action_trigger/event_definition.js | 57 +++++++++++++++++++ .../action_trigger/event_definition.tt2 | 34 +++++++++++ 3 files changed, 96 insertions(+) diff --git a/Open-ILS/web/css/skin/default.css b/Open-ILS/web/css/skin/default.css index e7fceb5717..fb9406ec0c 100644 --- a/Open-ILS/web/css/skin/default.css +++ b/Open-ILS/web/css/skin/default.css @@ -85,3 +85,8 @@ table { border-collapse: collapse; } text-align:right; float:right; } + + +.oils-progress-dialog { width: 300px; } + + diff --git a/Open-ILS/web/js/ui/default/conify/global/action_trigger/event_definition.js b/Open-ILS/web/js/ui/default/conify/global/action_trigger/event_definition.js index b4f585cfbf..ef1a42ba79 100644 --- a/Open-ILS/web/js/ui/default/conify/global/action_trigger/event_definition.js +++ b/Open-ILS/web/js/ui/default/conify/global/action_trigger/event_definition.js @@ -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); diff --git a/Open-ILS/web/templates/default/conify/global/action_trigger/event_definition.tt2 b/Open-ILS/web/templates/default/conify/global/action_trigger/event_definition.tt2 index d06fbe6554..47d93000e8 100644 --- a/Open-ILS/web/templates/default/conify/global/action_trigger/event_definition.tt2 +++ b/Open-ILS/web/templates/default/conify/global/action_trigger/event_definition.tt2 @@ -120,6 +120,40 @@ +
+
+
Event Definition Tests
+
+
+
+
+
+

Test Circulation

+ + + + + + + + + + + + + + + + +
Trigger Hook
Trigger Event Definition
Barcode of Circulating Copy
+
+ + +
+
+
+ [% END %] -- 2.43.2