+ id;?> + createLink('testtask', 'view', 'taskID=' . $testtask->id), $testtask->name, '_blank');?> + arrow . $lang->testtask->close;?> +
+
diff --git a/module/testtask/control.php b/module/testtask/control.php index e106b7eb9a..b5fb5c2968 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -484,7 +484,7 @@ class testtask extends control if(!empty($_POST)) { $changes = $this->testtask->start($taskID); - if(dao::isError()) die(js::error(dao::getError())); + if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError())); if($this->post->comment != '' or !empty($changes)) { @@ -492,8 +492,8 @@ class testtask extends control $this->action->logHistory($actionID, $changes); } - if(isonlybody()) die(js::reload('parent.parent')); - die(js::locate($this->createLink('testtask', 'view', "taskID=$taskID"), 'parent')); + if(isonlybody()) $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent')); + $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('testtask', 'view', "taskID=$taskID"))); } /* Get task info. */ @@ -566,7 +566,7 @@ class testtask extends control if(!empty($_POST)) { $changes = $this->testtask->close($taskID); - if(dao::isError()) die(js::error(dao::getError())); + if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError())); if($this->post->comment != '' or !empty($changes)) { @@ -574,8 +574,8 @@ class testtask extends control $this->action->logHistory($actionID, $changes); } - if(isonlybody()) die(js::reload('parent.parent')); - die(js::locate($this->createLink('testtask', 'view', "taskID=$taskID"), 'parent')); + if(isonlybody()) $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent')); + $this->send(array('result' => 'success', 'message' => $this->lang->success, 'locate' => $this->createLink('testtask', 'view', "taskID=$taskID"))); } /* Get task info. */ diff --git a/module/testtask/js/common.js b/module/testtask/js/common.js new file mode 100644 index 0000000000..31d2bf42c6 --- /dev/null +++ b/module/testtask/js/common.js @@ -0,0 +1,22 @@ +$(document).ready(function() +{ + $('#startForm, #closeForm').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; + } + }); +}) diff --git a/module/testtask/view/close.html.php b/module/testtask/view/close.html.php index abf2971040..e85658900c 100644 --- a/module/testtask/view/close.html.php +++ b/module/testtask/view/close.html.php @@ -11,38 +11,38 @@ */ ?> - -