From: erickson Date: Tue, 1 Sep 2009 18:40:37 +0000 (+0000) Subject: added ability to clone event_def environment when an event_def is cloned X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=093e24a66066718fe19c75e5e5284b97a8efae18;p=evergreen%2Fbjwebb.git added ability to clone event_def environment when an event_def is cloned git-svn-id: svn://svn.open-ils.org/ILS/trunk@13941 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- 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 ff4ad74d1..f869cc44d 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 @@ -21,6 +21,37 @@ function loadEventDef() { dojo.connect(eventDefTabs,'selectChild', tabLoader); } +/** + * After an event def is cloned, see if the user wants to also clone the event def environment + * @param {Object} oldItem Grid store item that was cloned + * @param {Object} newObject Newly created fieldmapper object + */ +function cloneEventEnv(oldItem, newObject) { + if(!confirm('Clone event definition environment as well?')) return; // TODO i18n + progressDialog.show(true); + var pcrud = new openils.PermaCrud(); + + // fetch the env list for the cloned object + var env_list = pcrud.search('atenv', {event_def : edGrid.store.getValue(oldItem, 'id')}); + + if(env_list && env_list.length) { + + // clone the environment + env_list = env_list.map( + function(item) { + item.id(null); + item.event_def(newObject.id()); + return item; + } + ); + + // create the cloned environment list + pcrud.create(env_list); + } + + progressDialog.hide(); +} + function loadEventDefData() { var pcrud = new openils.PermaCrud(); eventDef = pcrud.retrieve('atevdef', eventDefId); 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 1d04b8144..55da5c272 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,7 +1,9 @@ [% WRAPPER default/base.tt2 %] +[% ctx.page_title = 'Event Definitions' %] +
@@ -9,7 +11,7 @@
Trigger Event Definitions
- +
@@ -99,6 +101,9 @@
+ + +
[% END %]