From 4fff2173fc575749aa96f376c218e547dd85852c Mon Sep 17 00:00:00 2001 From: tianshujie Date: Fri, 9 Jun 2023 09:37:26 +0800 Subject: [PATCH] + Add Product Level 2.5 drop-down menu. --- module/execution/control.php | 54 ++++++++++++++------------------ module/execution/ui/bug.html.php | 25 +++++++++++++++ 2 files changed, 49 insertions(+), 30 deletions(-) diff --git a/module/execution/control.php b/module/execution/control.php index 7ebc0daf33..ab95a3488c 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -976,8 +976,15 @@ class execution extends control $products = $this->product->getProducts($execution->id); if(count($products) === 1) $productID = current($products)->id; + /* Set the product drop-down and search fields. */ + $productOption = array(); + $branchOption = array(); + $showBranch = false; if($execution->hasProduct) { + if(count($products) > 1) $productOption[0] = $this->lang->product->all; + foreach($products as $productData) $productOption[$productData->id] = $productData->name; + unset($this->config->bug->search['fields']['product']); unset($this->config->bug->search['params']['product']); if($project->model != 'scrum') @@ -985,17 +992,22 @@ class execution extends control unset($this->config->bug->search['fields']['plan']); unset($this->config->bug->search['params']['plan']); } + + $product = $this->product->getById((int)$productID); + if($product and $product->type != 'normal') + { + /* Display of branch label. */ + $showBranch = $this->loadModel('branch')->showBranch($productID); + + /* Display status of branch. */ + $branches = $this->branch->getList($productID, $executionID, 'all'); + foreach($branches as $branchInfo) + { + $branchOption[$branchInfo->id] = $branchInfo->name . ($branchInfo->status == 'closed' ? ' (' . $this->lang->branch->statusList['closed'] . ')' : ''); + } + } } - $productPairs = array('0' => $this->lang->product->all); - foreach($products as $productData) $productPairs[$productData->id] = $productData->name; - if($execution->hasProduct) $this->lang->modulePageNav = $this->product->select($productPairs, (int)$productID, 'execution', 'bug', $executionID, $branch); - - /* Header and position. */ - $title = $execution->name . $this->lang->colon . $this->lang->execution->bug; - $position[] = html::a($this->createLink('execution', 'browse', "executionID=$executionID"), $execution->name); - $position[] = $this->lang->execution->bug; - /* Load pager and get bugs, user. */ $this->app->loadClass('pager', true); if($this->app->getViewType() == 'xhtml') $recPerPage = 10; @@ -1018,24 +1030,6 @@ class execution extends control $actionURL = $this->createLink('execution', 'bug', "executionID=$executionID&productID=$productID&branch=$branch&orderBy=$orderBy&build=$build&type=bysearch&queryID=myQueryID"); $this->execution->buildBugSearchForm($products, $queryID, $actionURL); - $product = $this->product->getById((int)$productID); - $showBranch = false; - $branchOption = array(); - $branchTagOption = array(); - if($product and $product->type != 'normal') - { - /* Display of branch label. */ - $showBranch = $this->loadModel('branch')->showBranch($productID); - - /* Display status of branch. */ - $branches = $this->branch->getList($productID, $executionID, 'all'); - foreach($branches as $branchInfo) - { - $branchOption[$branchInfo->id] = $branchInfo->name; - $branchTagOption[$branchInfo->id] = $branchInfo->name . ($branchInfo->status == 'closed' ? ' (' . $this->lang->branch->statusList['closed'] . ')' : ''); - } - } - /* Get story and task id list. */ $storyIdList = $taskIdList = array(); foreach($bugs as $bug) @@ -1073,7 +1067,7 @@ class execution extends control $showModule = !empty($this->config->datatable->executionBug->showModule) ? $this->config->datatable->executionBug->showModule : ''; /* Assign. */ - $this->view->title = $title; + $this->view->title = $execution->name . $this->lang->colon . $this->lang->execution->bug; $this->view->position = $position; $this->view->bugs = $bugs; $this->view->tabID = 'bug'; @@ -1091,8 +1085,6 @@ class execution extends control $this->view->param = $param; $this->view->defaultProduct = (empty($productID) and !empty($products)) ? current(array_keys($products)) : $productID; $this->view->builds = $this->build->getBuildPairs($productID); - $this->view->branchOption = $branchOption; - $this->view->branchTagOption = $branchTagOption; $this->view->plans = $this->loadModel('productplan')->getPairs($productID ? $productID : array_keys($products)); $this->view->stories = $storyList; $this->view->tasks = $taskList; @@ -1105,6 +1097,8 @@ class execution extends control $this->view->setModule = true; $this->view->showBranch = $showBranch; $this->view->recTotal = $pager->recTotal; + $this->view->productOption = $productOption; + $this->view->branchOption = $branchOption; $this->display(); } diff --git a/module/execution/ui/bug.html.php b/module/execution/ui/bug.html.php index c86f0d2656..8e9d2f68a0 100644 --- a/module/execution/ui/bug.html.php +++ b/module/execution/ui/bug.html.php @@ -10,9 +10,34 @@ declare(strict_types=1); */ namespace zin; +/* zin: Define the productMenu on main menu. */ +$productDropdown = ''; +if($execution->hasProduct) +{ + $productDropdown = productMenu( + set::title($productOption[$productID]), + set::items($productOption), + set::activeKey($productID), + set::link(helper::createLink('execution', 'bug', "executionID={$execution->id}&productID=%s")), + ); +} + +$branchDropdown = ''; +if($showBranch) +{ + $branchDropdown = productMenu( + set::title($branchOption[$branch]), + set::items($branchOption), + set::activeKey($branch), + set::link(helper::createLink('execution', 'bug', "executionID={$execution->id}&productID={$productID}&branch=%s")), + ); +} + /* zin: Define the set::module('bug') feature bar on main menu. */ featureBar ( + to::before($productDropdown), + to::before($branchDropdown), set::current($type), set::linkParams("executionID={$execution->id}&productID={$productID}&branch={$branchID}&orderBy={$orderBy}&build={$buildID}&type={key}¶m=$param&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}"), li(searchToggle(set::module('executionBug')))