From 09a31edb96a035a443a896fc9a2aa972bedf5d70 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Mon, 19 Jun 2023 09:39:51 +0800 Subject: [PATCH] * Refactor, suspend execution page. --- module/execution/control.php | 17 ++++------ module/execution/ui/suspend.html.php | 49 ++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 10 deletions(-) create mode 100644 module/execution/ui/suspend.html.php diff --git a/module/execution/control.php b/module/execution/control.php index 149b84c629..fb3c2f2fc1 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -2283,7 +2283,7 @@ class execution extends control * @access public * @return void */ - public function suspend($executionID, $from = 'execution') + public function suspend(int $executionID, string $from = 'execution') { $execution = $this->commonAction($executionID); $executionID = $execution->id; @@ -2294,7 +2294,7 @@ class execution extends control $this->loadModel('action'); $this->execution->computeBurn($executionID); $changes = $this->execution->suspend($executionID); - if(dao::isError()) return print(js::error(dao::getError())); + if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); if($this->post->comment != '' or !empty($changes)) { @@ -2306,14 +2306,11 @@ class execution extends control if($project->model == 'waterfall' or $project->model == 'waterfallplus') $this->loadModel('programplan')->computeProgress($executionID, 'suspend'); $this->executeHooks($executionID); - if(isonlybody() and $from == 'kanban') - { - return print(js::closeModal('parent.parent', '', "parent.parent.changeStatus('suspended')")); - } - else - { - return print(js::reload('parent.parent')); - } + + $response['closeModal'] = true; + $response['load'] = true; + if($from == 'kanban') $response['callback'] = "changeStatus('doing')"; + return $this->sendSuccess($response); } $this->view->title = $this->view->execution->name . $this->lang->colon .$this->lang->execution->suspend; diff --git a/module/execution/ui/suspend.html.php b/module/execution/ui/suspend.html.php new file mode 100644 index 0000000000..1105031d1f --- /dev/null +++ b/module/execution/ui/suspend.html.php @@ -0,0 +1,49 @@ + + * @package execution + * @link https://www.zentao.net + */ +namespace zin; + +$space = common::checkNotCN() ? ' ' : ''; +formPanel +( + set::title($lang->execution->suspend . $space . $lang->executionCommon), + set::headingClass('status-heading'), + set::titleClass('form-label .form-grid'), + set::shadow(false), + set::actions(array('submit')), + set::submitBtnText($lang->execution->suspend . $space . $lang->executionCommon), + to::headingActions + ( + entityLabel + ( + setClass('my-3 gap-x-3'), + set::level(1), + set::text($execution->name), + set::entityID($execution->id), + set::reverse(true), + ) + ), + formGroup + ( + set::label($lang->comment), + editor + ( + set::name('comment'), + set::rows('6'), + ) + ), +); + +h::hr(set::class('mt-6')); + +history(); + +/* ====== Render page ====== */ +render('modalDialog');