From d268587e8df03d72f177ca98e413e1a3008d92f1 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Tue, 16 Nov 2021 15:07:18 +0800 Subject: [PATCH] * Finish task #44496. --- module/story/control.php | 35 ++++++++++++++++++++----- module/story/view/batchedit.html.php | 9 +++---- module/testcase/control.php | 30 ++++++++++++++++----- module/testcase/view/batchedit.html.php | 6 ++--- 4 files changed, 58 insertions(+), 22 deletions(-) diff --git a/module/story/control.php b/module/story/control.php index 9946bdcfa8..2c77f443e7 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -711,14 +711,35 @@ class story extends control $product = $this->product->getByID($productID); $branchProduct = $product->type == 'normal' ? false : true; - /* Set modules. */ - $modules = array('ditto' => $this->lang->story->ditto) + $this->tree->getOptionMenu($productID, $viewType = 'story', 0, $branch); + /* Set branches and modules. */ + $branches = array(); + $modules = array(); + if($product->type != 'normal') + { + $branches = $this->loadModel('branch')->getPairs($productID); + if($branch === 'all') + { + $modules[0] = $this->tree->getOptionMenu($productID, $viewType = 'story', 0, $branch); + foreach($branches as $branchID => $branchName) + { + $modules[$branchID] = $this->tree->getOptionMenu($productID, $viewType = 'story', 0, $branchID); + } + } + else + { + $modules[$branch] = $this->tree->getOptionMenu($productID, $viewType = 'story', 0, $branch); + } + } + else + { + $modules[0] = $this->tree->getOptionMenu($productID, $viewType = 'story', 0, $branch); + } - $this->view->modules = $modules; - $this->view->branches = $product->type == 'normal' ? array() : $this->loadModel('branch')->getPairs($product->id); - $this->view->plans = $this->productplan->getBranchPlanPairs($productID); - $this->view->position[] = html::a($this->createLink('product', 'browse', "product=$product->id&branch=$branch"), $product->name); - $this->view->title = $product->name . $this->lang->colon . $this->lang->story->batchEdit; + $this->view->modules = $modules; + $this->view->branches = $branches; + $this->view->plans = $this->productplan->getBranchPlanPairs($productID); + $this->view->position[] = html::a($this->createLink('product', 'browse', "product=$product->id&branch=$branch"), $product->name); + $this->view->title = $product->name . $this->lang->colon . $this->lang->story->batchEdit; } elseif($executionID) { diff --git a/module/story/view/batchedit.html.php b/module/story/view/batchedit.html.php index b789d3567e..5e3f65d5cb 100644 --- a/module/story/view/batchedit.html.php +++ b/module/story/view/batchedit.html.php @@ -76,15 +76,12 @@ foreach(explode(',', $showFields) as $field) if($product->type != 'normal') { foreach($branches as $branchID => $branchName) $branches[$branchID] = '/' . $product->name . '/' . $branchName; - $branches = array('ditto' => $this->lang->story->ditto) + $branches; } - $modules = $this->tree->getOptionMenu($story->product, $viewType = 'story', 0, $story->branch); - foreach($modules as $moduleID => $moduleName) $modules[$moduleID] = '/' . $product->name . $moduleName; - $modules = array('ditto' => $this->lang->story->ditto) + $modules; + if(!isset($modules[$story->branch])) $modules[$story->branch] = $this->tree->getOptionMenu($story->product, $viewType = 'story', 0, $story->branch); + foreach($modules[$story->branch] as $moduleID => $moduleName) $modules[$story->branch][$moduleID] = '/' . $product->name . $moduleName; $productPlans = $this->productplan->getPairs($story->product, $branch); - $productPlans = array('' => '', 'ditto' => $this->lang->story->ditto) + $productPlans; } ?> @@ -97,7 +94,7 @@ foreach(explode(',', $showFields) as $field) '> - module, "class='form-control chosen'");?> + branch], $story->module, "class='form-control chosen'");?> '> tree->getOptionMenu($libID, $viewType = 'caselib', $startModuleID = 0, $branch); - $modules = array('ditto' => $this->lang->testcase->ditto) + $modules; $this->view->modules = $modules; $this->view->title = $libraries[$libID] . $this->lang->colon . $this->lang->testcase->batchEdit; @@ -877,11 +876,31 @@ class testcase extends control if($product->type != 'normal') $branchProduct = true; - /* Set modules. */ - $modules = $this->tree->getOptionMenu($productID, $viewType = 'case', $startModuleID = 0, $branch); - $modules = array('ditto' => $this->lang->testcase->ditto) + $modules; + /* Set branches and modules. */ + $branches = array(); + $modules = array(); + if($product->type != 'normal') + { + $branches = $this->loadModel('branch')->getPairs($productID); + if($branch === 'all') + { + $modules[0] = $this->tree->getOptionMenu($productID, $viewType = 'case', 0, $branch); + foreach($branches as $branchID => $branchName) + { + $modules[$branchID] = $this->tree->getOptionMenu($productID, $viewType = 'case', 0, $branchID); + } + } + else + { + $modules[$branch] = $this->tree->getOptionMenu($productID, $viewType = 'case', 0, $branch); + } + } + else + { + $modules[0] = $this->tree->getOptionMenu($productID, $viewType = 'case', 0, $branch); + } - $this->view->branches = $product->type == 'normal' ? array() : $this->loadModel('branch')->getPairs($product->id); + $this->view->branches = $branches; $this->view->modules = $modules; $this->view->position[] = html::a($this->createLink('testcase', 'browse', "productID=$productID"), $this->products[$productID]); $this->view->title = $product->name . $this->lang->colon . $this->lang->testcase->batchEdit; @@ -906,7 +925,6 @@ class testcase extends control $this->view->position[] = html::a($this->server->http_referer, $this->lang->my->testCase); $this->view->title = $this->lang->testcase->batchEdit; - /* Set modules. */ $productIdList = array(); foreach($cases as $case) $productIdList[$case->product] = $case->product; diff --git a/module/testcase/view/batchedit.html.php b/module/testcase/view/batchedit.html.php index 4095b21ddf..88762552cf 100644 --- a/module/testcase/view/batchedit.html.php +++ b/module/testcase/view/batchedit.html.php @@ -67,6 +67,7 @@ branch; if((!$productID and !$cases[$caseID]->lib) or $app->tab != 'qa') { $product = $this->product->getByID($cases[$caseID]->product); @@ -74,10 +75,9 @@ if($product->type != 'normal') { foreach($branches as $branchID => $branchName) $branches[$branchID] = '/' . $product->name . '/' . $branchName; - $branches = array('ditto' => $this->lang->story->ditto) + $branches; } - $modules = $this->tree->getOptionMenu($cases[$caseID]->product, $viewType = 'case', 0, $cases[$caseID]->branch); + $modules[$caseBranch] = $this->tree->getOptionMenu($cases[$caseID]->product, $viewType = 'case', 0, $caseBranch); } ?> @@ -103,7 +103,7 @@ branch, "class='form-control chosen' onchange='loadBranches($branchProductID, this.value, $caseID)', $disabled");?> - ' style='overflow:visible'>module, "class='form-control chosen'");?> + ' style='overflow:visible'>module, "class='form-control chosen'");?> ' style='overflow:visible'>story, "class='form-control chosen'");?>