[open-ils-commits] r13233 - in trunk/Open-ILS/web: js/ui/default/conify/global/action_trigger templates/default/conify/global/action_trigger (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue May 26 12:44:27 EDT 2009
Author: erickson
Date: 2009-05-26 12:44:25 -0400 (Tue, 26 May 2009)
New Revision: 13233
Added:
trunk/Open-ILS/web/templates/default/conify/global/action_trigger/event_definition_data.tt2
Modified:
trunk/Open-ILS/web/js/ui/default/conify/global/action_trigger/event_definition.js
trunk/Open-ILS/web/templates/default/conify/global/action_trigger/event_definition.tt2
Log:
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.
Modified: trunk/Open-ILS/web/js/ui/default/conify/global/action_trigger/event_definition.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/conify/global/action_trigger/event_definition.js 2009-05-26 16:42:01 UTC (rev 13232)
+++ trunk/Open-ILS/web/js/ui/default/conify/global/action_trigger/event_definition.js 2009-05-26 16:44:25 UTC (rev 13233)
@@ -7,9 +7,11 @@
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 @@
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 @@
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 getEventDefNameLink(rowIdx, item) {
+ if(!item) return
+ return this.grid.store.getValue(item, 'id') + ':' + this.grid.store.getValue(item, 'name');
}
-
-function eventDefGetter(rowIdx, item) {
- if(!item) return '';
- var def = this.grid.store.getValue(item, 'event_def');
- return getDefName(def);
+function formatEventDefNameLink(data) {
+ if(!data) return;
+ var parts = data.split(/:/);
+ return dojox.string.sprintf(
+ '<a href="%s/conify/global/action_trigger/event_definition_data/%s">%s</a>',
+ oilsBasePath, parts[0], parts[1]);
}
-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 evtTestCirc() {
- var def = circTestDefSelector.attr('value');
var barcode = circTestBarcode.attr('value');
- if(!(def && barcode)) return;
+ if(!barcode) return;
progressDialog.show();
@@ -114,10 +101,9 @@
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);
Modified: trunk/Open-ILS/web/templates/default/conify/global/action_trigger/event_definition.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/conify/global/action_trigger/event_definition.tt2 2009-05-26 16:42:01 UTC (rev 13232)
+++ trunk/Open-ILS/web/templates/default/conify/global/action_trigger/event_definition.tt2 2009-05-26 16:44:25 UTC (rev 13233)
@@ -1,10 +1,11 @@
[% WRAPPER default/base.tt2 %]
<script src='[% ctx.media_prefix %]/js/ui/default/conify/global/action_trigger/event_definition.js'> </script>
+<script>openils.Util.addOnLoad(loadEventDef)</script>
<div dojoType="dijit.layout.TabContainer" style='height:100%;' jsId='eventDefTabs'>
- <div dojoType="dijit.layout.ContentPane" title='Event Definitions' selected='true' id='tab-atevdef'>
- <div dojoType="dijit.layout.ContentPane" layoutAlign="top" class='oils-header-panel'>
+ <div dojoType="dijit.layout.ContentPane" title='Event Parameters' id='tab-atevdef'>
+ <div dojoType="dijit.layout.ContentPane" layoutAlign="client" class='oils-header-panel'>
<div>Trigger Event Definitions</div>
<div>
<button dojoType='dijit.form.Button' onClick='edGrid.showCreatePane()'>New</button>
@@ -22,59 +23,15 @@
defaultCellWidth='"auto"'
editStyle='pane'
editOnEnter='true'>
- </table>
- </div>
- </div>
-
- <div dojoType="dijit.layout.ContentPane" title='Event Parameters' id='tab-atevparam'>
- <div dojoType="dijit.layout.ContentPane" layoutAlign="top" class='oils-header-panel'>
- <div>Trigger Event Parameters</div>
- <div>
- <button dojoType='dijit.form.Button' onClick='tepGrid.showCreateDialog()'>New</button>
- <button dojoType='dijit.form.Button' onClick='tepGrid.deleteSelected()'>Delete Selected</button>
- </div>
- </div>
- <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:600px'>
- <table jsId="tepGrid"
- dojoType="openils.widget.AutoGrid"
- fieldOrder="['id', 'event_def', 'param', 'value']"
- query="{id: '*'}"
- fmClass='atevparam'
- defaultCellWidth='20'
- editOnEnter='true'>
<thead>
- <tr><th field='event_def' get='eventDefGetter'/></tr>
+ <tr><th field='name' get='getEventDefNameLink' formatter='formatEventDefNameLink'/></tr>
</thead>
</table>
</div>
</div>
- <div dojoType="dijit.layout.ContentPane" title='Event Environment' id='tab-atenv'>
+ <div dojoType="dijit.layout.ContentPane" title='Hooks' id='tab-ath' style='height:100%;'>
<div dojoType="dijit.layout.ContentPane" layoutAlign="top" class='oils-header-panel'>
- <div>Trigger Event Environment</div>
- <div>
- <button dojoType='dijit.form.Button' onClick='teeGrid.showCreateDialog()'>New</button>
- <button dojoType='dijit.form.Button' onClick='teeGrid.deleteSelected()'>Delete Selected</button>
- </div>
- </div>
- <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:600px'>
- <table jsId="teeGrid"
- dojoType="openils.widget.AutoGrid"
- fieldOrder="['id', 'event_def', 'path', 'collector', 'label']"
- query="{id: '*'}"
- fmClass='atenv'
- defaultCellWidth='20'
- editOnEnter='true'>
- <thead>
- <tr><th field='event_def' get='eventDefGetter'/></tr>
- </thead>
- </table>
- </div>
- </div>
-
-
- <div dojoType="dijit.layout.ContentPane" title='Hooks' id='tab-ath'>
- <div dojoType="dijit.layout.ContentPane" layoutAlign="top" class='oils-header-panel'>
<div>Trigger Hooks</div>
<div>
<button dojoType='dijit.form.Button' onClick='thGrid.showCreateDialog()'>New</button>
@@ -83,6 +40,7 @@
</div>
<div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:600px'>
<table jsId="thGrid"
+ autoHeight='true'
dojoType="openils.widget.AutoGrid"
fieldOrder="['key', 'core_type', 'description', 'passive']"
query="{key: '*'}"
@@ -141,42 +99,6 @@
</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:600px'>
- <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 %]
-
Added: trunk/Open-ILS/web/templates/default/conify/global/action_trigger/event_definition_data.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/conify/global/action_trigger/event_definition_data.tt2 (rev 0)
+++ trunk/Open-ILS/web/templates/default/conify/global/action_trigger/event_definition_data.tt2 2009-05-26 16:44:25 UTC (rev 13233)
@@ -0,0 +1,88 @@
+[% WRAPPER default/base.tt2 %]
+<script src='[% ctx.media_prefix %]/js/ui/default/conify/global/action_trigger/event_definition.js'> </script>
+<script>
+ eventDefId = [% ctx.page_args.0 %];
+ openils.Util.addOnLoad(loadEventDefData)
+</script>
+
+<div dojoType="dijit.layout.ContentPane" layoutAlign='client'>
+ <h2 id='at-event-def-name'/>
+</div>
+
+<div dojoType="dijit.layout.TabContainer" style='height:100%;' jsId='eventDefTabs'>
+
+ <div dojoType="dijit.layout.ContentPane" title='Event Environment' id='tab-atenv'>
+ <div dojoType="dijit.layout.ContentPane" layoutAlign="top" class='oils-header-panel'>
+ <div>Trigger Event Environment</div>
+ <div>
+ <button dojoType='dijit.form.Button' onClick='teeGrid.showCreateDialog()'>New</button>
+ <button dojoType='dijit.form.Button' onClick='teeGrid.deleteSelected()'>Delete Selected</button>
+ </div>
+ </div>
+ <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:600px'>
+ <table jsId="teeGrid"
+ dojoType="openils.widget.AutoGrid"
+ fieldOrder="['id', 'event_def', 'path', 'collector', 'label']"
+ query="{id: '*'}"
+ fmClass='atenv'
+ defaultCellWidth='20'
+ editOnEnter='true'>
+ </table>
+ </div>
+ </div>
+
+
+ <div dojoType="dijit.layout.ContentPane" title='Event Parameters' id='tab-atevparam'>
+ <div dojoType="dijit.layout.ContentPane" layoutAlign="top" class='oils-header-panel'>
+ <div>Trigger Event Parameters</div>
+ <div>
+ <button dojoType='dijit.form.Button' onClick='tepGrid.showCreateDialog()'>New</button>
+ <button dojoType='dijit.form.Button' onClick='tepGrid.deleteSelected()'>Delete Selected</button>
+ </div>
+ </div>
+ <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:600px'>
+ <table jsId="tepGrid"
+ dojoType="openils.widget.AutoGrid"
+ fieldOrder="['id', 'event_def', 'param', 'value']"
+ query="{id: '*'}"
+ fmClass='atevparam'
+ defaultCellWidth='20'
+ editOnEnter='true'>
+ </table>
+ </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:600px'>
+ <div style='border:1px solid #aaa;' id='at-test-none'>
+ No tests for this type of event definition hook
+ </div>
+ <div style='border:1px solid #aaa;' id='at-test-circ' class='hidden'>
+ <h2>Test Circulation</h2>
+ <table class='oils-generic-table'>
+ <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 %]
+
+
More information about the open-ils-commits
mailing list