From 9e7ebe354abecede6399f8b9b042ceab6f39f014 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Thu, 29 Jun 2023 14:24:05 +0800 Subject: [PATCH] * Refactor style of the edit execution. --- module/execution/config.php | 9 +++++---- module/execution/control.php | 17 ++++++++++------- module/execution/css/edit.ui.css | 1 + module/execution/ui/edit.html.php | 3 ++- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/module/execution/config.php b/module/execution/config.php index fb189d24ea..b7633f62c0 100644 --- a/module/execution/config.php +++ b/module/execution/config.php @@ -193,10 +193,11 @@ $config->execution->actionList['createChildStage']['text'] = $lang->programplan- $config->execution->actionList['createChildStage']['hint'] = $lang->programplan->createSubPlan; $config->execution->actionList['createChildStage']['url'] = helper::createLink('programplan', 'create', "executionID={rawID}"); -$config->execution->actionList['edit']['icon'] = 'edit'; -$config->execution->actionList['edit']['text'] = $lang->execution->edit; -$config->execution->actionList['edit']['hint'] = $lang->execution->edit; -$config->execution->actionList['edit']['url'] = helper::createLink('execution', 'edit', "executionID={rawID}"); +$config->execution->actionList['edit']['icon'] = 'edit'; +$config->execution->actionList['edit']['text'] = $lang->execution->edit; +$config->execution->actionList['edit']['hint'] = $lang->execution->edit; +$config->execution->actionList['edit']['url'] = helper::createLink('execution', 'edit', "executionID={rawID}"); +$config->execution->actionList['edit']['data-toggle'] = 'modal'; $config->execution->actionList['close']['icon'] = 'off'; $config->execution->actionList['close']['text'] = $lang->execution->close; diff --git a/module/execution/control.php b/module/execution/control.php index 37848dd0b7..959efca8a2 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -1842,11 +1842,12 @@ class execution extends control * @param int $executionID * @param string $action * @param string $extra - * + * @param string $newPlans + * @param string $confirm * @access public * @return void */ - public function edit($executionID, $action = 'edit', $extra = '', $newPlans = '', $confirm = 'no') + public function edit(int $executionID, string $action = 'edit', string $extra = '', string $newPlans = '', string $confirm = 'no') { /* Load language files and get browseExecutionLink. */ $this->loadModel('product'); @@ -1864,7 +1865,7 @@ class execution extends control $projectID = $this->dao->select('project')->from(TABLE_EXECUTION)->where('id')->eq($executionID)->fetch('project'); $this->loadModel('productplan')->linkProject($executionID, $newPlans); $this->productplan->linkProject($projectID, $newPlans); - return $this->send(array('result' => 'success', 'locate' => inlink('view', "executionID=$executionID"))); + return $this->send(array('result' => 'success', 'load' => inlink('view', "executionID=$executionID"))); } elseif(!empty($newPlans)) { @@ -1881,7 +1882,9 @@ class execution extends control $importEditPlanStoryTips = $multiBranchProduct ? $this->lang->execution->importBranchEditPlanStory : $this->lang->execution->importEditPlanStory; - return print(js::confirm($importEditPlanStoryTips, inlink('edit', "executionID=$executionID&action=edit&extra=&newPlans=$newPlans&confirm=yes"), inlink('view', "executionID=$executionID"))); + $confirmURL = inlink('edit', "executionID=$executionID&action=edit&extra=&newPlans=$newPlans&confirm=yes"); + $cancelURL = inlink('view', "executionID=$executionID"); + return $this->send(array('result' => 'success', 'load' => array('confirm' => $importEditPlanStoryTips, 'confirmed' => $confirmURL, 'canceled' => $cancelURL))); } /* Set menu. */ @@ -1937,7 +1940,7 @@ class execution extends control if(!empty($newPlans)) { $newPlans = implode(',', $newPlans); - return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('edit', "executionID=$executionID&action=edit&extra=&newPlans=$newPlans&confirm=no"))); + return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'load' => inlink('edit', "executionID=$executionID&action=edit&extra=&newPlans=$newPlans&confirm=no"))); } $message = $this->executeHooks($executionID); @@ -1946,9 +1949,9 @@ class execution extends control if($_POST['status'] == 'doing') $this->loadModel('common')->syncPPEStatus($executionID); /* If link from no head then reload. */ - if(isonlybody()) return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent')); + if(isonlybody()) return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'load' => 'parent')); - return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('view', "executionID=$executionID"))); + return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'load' => inlink('view', "executionID=$executionID"))); } $executions = array('' => '') + $this->executions; diff --git a/module/execution/css/edit.ui.css b/module/execution/css/edit.ui.css index 92b372b28f..9bb5416dcd 100644 --- a/module/execution/css/edit.ui.css +++ b/module/execution/css/edit.ui.css @@ -2,3 +2,4 @@ .items-center {align-items: center !important;} #lifeTimeTips {padding-left: 1rem; align-items: center;} .productsBox .line-btn {width: 48px; margin-right: 32px;} +.productsBox div[id^=plan] {flex: 1 1;} diff --git a/module/execution/ui/edit.html.php b/module/execution/ui/edit.html.php index 4f9567d52b..c0391c8fe5 100644 --- a/module/execution/ui/edit.html.php +++ b/module/execution/ui/edit.html.php @@ -406,10 +406,11 @@ else $productsBox[] = formHidden('branch', json_encode(array_values($linkedBranches))); } +if(helper::isAjaxRequest('modal')) modalHeader(set::title($lang->execution->edit)); formPanel ( set::class('editPanel'), - modalHeader(set::title($lang->execution->edit)), + !helper::isAjaxRequest('modal') ? modalHeader(set::title($lang->execution->edit)) : null, $projectBox, formGroup (