From f903f7e242a5a80733fb43e2acf277fdd3507223 Mon Sep 17 00:00:00 2001 From: erickson Date: Tue, 26 May 2009 16:44:25 +0000 Subject: [PATCH] action_trigger tables that link to a specific event def are now configured on a separate page where the event def is implied by the URL so that an event_def will not have to be chosen by the user when configuring params/environment. top-level action_trigger page shows event defs (which link to an event_def_data page), hooks, reactors, validators, etc. git-svn-id: svn://svn.open-ils.org/ILS/trunk@13233 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../global/action_trigger/event_definition.js | 82 ++++++++------------ .../global/action_trigger/event_definition.tt2 | 90 ++-------------------- .../action_trigger/event_definition_data.tt2 | 88 +++++++++++++++++++++ 3 files changed, 128 insertions(+), 132 deletions(-) create mode 100644 Open-ILS/web/templates/default/conify/global/action_trigger/event_definition_data.tt2 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 bd6a14f45a..ff4ad74d1a 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 @@ -7,9 +7,11 @@ dojo.require('openils.Util'); dojo.require('openils.PermaCrud'); dojo.require('openils.widget.Textarea'); dojo.require('openils.widget.ProgressDialog'); +dojo.require('dojox.string.sprintf'); dojo.requireLocalization('openils.conify', 'conify'); var localeStrings = dojo.i18n.getLocalization('openils.conify', 'conify'); +var eventDef = null; function loadEventDef() { edGrid.loadAll({order_by:{atevdef : 'hook'}}); @@ -19,6 +21,24 @@ function loadEventDef() { dojo.connect(eventDefTabs,'selectChild', tabLoader); } +function loadEventDefData() { + var pcrud = new openils.PermaCrud(); + eventDef = pcrud.retrieve('atevdef', eventDefId); + var hook = pcrud.retrieve('ath', eventDef.hook()); + + if(hook.core_type() == 'circ') { + openils.Util.hide('at-test-none'); + openils.Util.show('at-test-circ'); + } + + dojo.byId('at-event-def-name').innerHTML = eventDef.name(); + teeGrid.loadAll({order_by:{atenv : 'path'}}, {event_def : eventDefId}); + dojo.connect(eventDefTabs,'selectChild', tabLoader); + + teeGrid.overrideEditWidgets.event_def = new dijit.form.TextBox({value: eventDefId, disabled : true}); + tepGrid.overrideEditWidgets.event_def = new dijit.form.TextBox({value: eventDefId, disabled : true}); +} + var loadedTabs = {'tab-atevdef' : true}; function tabLoader(child) { if(loadedTabs[child.id]) return; @@ -26,75 +46,42 @@ function tabLoader(child) { switch(child.id) { case 'tab-atevparam': - tepGrid.loadAll({order_by:{atevparam : 'event_def'}}); + tepGrid.loadAll({order_by:{atevparam : 'param'}}, {event_def : eventDefId}); break; case 'tab-ath': thGrid.loadAll({order_by:{ath : 'key'}}); break; - case 'tab-atenv': - teeGrid.loadAll({order_by:{atenv : 'event_def'}}); - break; case 'tab-atreact': trGrid.loadAll({order_by:{atreact : 'module'}}); break; 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()})}); - var defData = atevdef.toStoreData(defs); - circTestDefSelector.store = new dojo.data.ItemFileReadStore({data : defData}); - circTestDefSelector.searchAttr = 'name'; - circTestDefSelector.startup(); - - dojo.connect(circTestHookSelector, 'onChange', - function() { - circTestDefSelector.query = {hook : this.attr('value')}; - } - ); -} - - -function eventDefGetter(rowIdx, item) { - if(!item) return ''; - var def = this.grid.store.getValue(item, 'event_def'); - return getDefName(def); +function getEventDefNameLink(rowIdx, item) { + if(!item) return + return this.grid.store.getValue(item, 'id') + ':' + this.grid.store.getValue(item, 'name'); } -function getDefName(def) { - - if(typeof def != 'object') { - edGrid.store.fetchItemByIdentity({ - identity : def, - onItem : function(item) { def = new fieldmapper.atevdef().fromStoreItem(item); } - }); - } - - return dojo.string.substitute( - localeStrings.EVENT_DEF_LABEL, [ - fieldmapper.aou.findOrgUnit(def.owner()).shortname(), - def.name() - ]); +function formatEventDefNameLink(data) { + if(!data) return; + var parts = data.split(/:/); + return dojox.string.sprintf( + '%s', + oilsBasePath, parts[0], parts[1]); } function evtTestCirc() { - var def = circTestDefSelector.attr('value'); var barcode = circTestBarcode.attr('value'); - if(!(def && barcode)) return; + if(!barcode) return; progressDialog.show(); @@ -114,10 +101,9 @@ function evtTestCirc() { fieldmapper.standardRequest( ['open-ils.circ', 'open-ils.circ.trigger_event_by_def_and_barcode.fire'], { async: true, - params: [openils.User.authtoken, def, barcode], + params: [openils.User.authtoken, eventDefId, 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 85d2f537e8..91038230f3 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 @@ -1,10 +1,11 @@ [% WRAPPER default/base.tt2 %] +
-
-
+
+
Trigger Event Definitions
@@ -22,58 +23,14 @@ defaultCellWidth='"auto"' editStyle='pane' editOnEnter='true'> - -
-
- -
-
-
Trigger Event Parameters
-
- - -
-
-
- - +
-
-
-
Trigger Event Environment
-
- - -
-
-
- - - - -
-
-
- - -
+
Trigger Hooks
@@ -83,6 +40,7 @@
-
-
-
Event Definition Tests
-
-
-
-
-
-

Test Circulation

-
- - - - - - - - - - - - - - - -
Trigger Hook
Trigger Event Definition
Barcode of Circulating Copy
-
- - -
-
-
- -
[% END %] - diff --git a/Open-ILS/web/templates/default/conify/global/action_trigger/event_definition_data.tt2 b/Open-ILS/web/templates/default/conify/global/action_trigger/event_definition_data.tt2 new file mode 100644 index 0000000000..c585d3f17d --- /dev/null +++ b/Open-ILS/web/templates/default/conify/global/action_trigger/event_definition_data.tt2 @@ -0,0 +1,88 @@ +[% WRAPPER default/base.tt2 %] + + + +
+

+

+ +
+ +
+
+
Trigger Event Environment
+
+ + +
+
+
+ +
+
+
+ + +
+
+
Trigger Event Parameters
+
+ + +
+
+
+ +
+
+
+ +
+
+
Event Definition Tests
+
+
+
+
+
+ No tests for this type of event definition hook +
+ + + +
+
+
+ +
+ +[% END %] + + -- 2.11.0