diff --git a/module/task/control.php b/module/task/control.php index 3a0da100d7..2019d920b1 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -221,11 +221,11 @@ class task extends control if(!empty($_POST)) { $mails = $this->task->batchCreate($projectID); - if(dao::isError()) die(js::error(dao::getError())); + if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError())); /* Locate the browser. */ - if(!empty($iframe)) die(js::reload('parent.parent')); - die(js::locate($storyLink, 'parent')); + if(!empty($iframe)) $this->send(array('result' => 'success', 'locate' => 'parent')); + $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $storyLink)); } /* Set Custom*/ diff --git a/module/task/js/batchcreate.js b/module/task/js/batchcreate.js index 57097f3bb5..b28697c1c4 100755 --- a/module/task/js/batchcreate.js +++ b/module/task/js/batchcreate.js @@ -3,6 +3,26 @@ $(function() { removeDitto(); if($('#batchCreateForm table thead tr th.c-name').width() < 200) $('#batchCreateForm table thead tr th.c-name').width(200); + + $('#batchCreateForm').ajaxForm( + { + finish:function(response) + { + if(response.locate) + { + if(response.locate == 'parent') + { + parent.$.cookie('selfClose', 1); + setTimeout(function(){parent.$.closeModal(null, 'this')}, 1200); + } + else + { + setTimeout(function(){window.location.href = response.locate;}, 1200); + } + } + return false; + } + }); }); /* Get select of stories.*/ diff --git a/module/task/view/batchcreate.html.php b/module/task/view/batchcreate.html.php index 556c5cce5b..2932725b38 100644 --- a/module/task/view/batchcreate.html.php +++ b/module/task/view/batchcreate.html.php @@ -52,7 +52,7 @@ $hiddenStory = ((isonlybody() and $storyID) || $config->global->flow == 'onlyTask') ? ' hidden' : ''; if($hiddenStory and isset($visibleFields['story'])) $colspan -= 1; ?> -
+