From 9b7fe73bf828d0ddca207c2a5e6a3028429300a3 Mon Sep 17 00:00:00 2001 From: zhouxin Date: Wed, 25 Oct 2023 13:47:40 +0800 Subject: [PATCH] * Add product menu for execution-bug. --- config/zentaopms.php | 2 +- module/execution/control.php | 25 +++++++- module/execution/ui/ajaxswitchermenu.html.php | 61 +++++++++++++++++++ module/execution/ui/bug.html.php | 2 +- 4 files changed, 85 insertions(+), 5 deletions(-) create mode 100644 module/execution/ui/ajaxswitchermenu.html.php diff --git a/config/zentaopms.php b/config/zentaopms.php index 89512f783a..8ec68508f3 100644 --- a/config/zentaopms.php +++ b/config/zentaopms.php @@ -663,5 +663,5 @@ $config->hasDropmenuApps = array('program', 'project', 'product', 'executio $config->hasBranchMenuModules = array('product', 'story', 'release', 'bug', 'testcase', 'testtask'); $config->excludeDropmenuList = array('program-browse', 'program-productview', 'product-all', 'product-index', 'execution-all', 'project-browse', 'project-batchedit', 'product-batchedit', 'admin-index', 'product-create', 'project-create', 'execution-create', 'program-create', 'execution-batchedit'); $config->hasSwitcherModules = array('design'); -$config->hasSwitcherMethods = array('project-bug', 'project-testcase'); +$config->hasSwitcherMethods = array('project-bug', 'project-testcase', 'execution-bug'); $config->excludeSwitcherList = array(); diff --git a/module/execution/control.php b/module/execution/control.php index a2d3cc9d1b..09fb33c819 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -518,9 +518,11 @@ class execution extends control $bugs = $this->bug->processBuildForBugs($bugs); $this->executionZen->assignBugVars($execution, $project, $productID, $branch, $products, $orderBy, $type, $param, $build, $bugs, $pager); - $this->view->showBranch = $showBranch; - $this->view->productOption = $productOption; - $this->view->branchOption = $branchOption; + $this->view->showBranch = $showBranch; + $this->view->productOption = $productOption; + $this->view->branchOption = $branchOption; + $this->view->switcherParams = "executionID={$executionID}&productID={$productID}¤tMethod=bug"; + $this->view->switcherText = isset($products[$productID]) ? $products[$productID]->name : $this->lang->product->all; $this->display(); } @@ -3101,4 +3103,21 @@ class execution extends control $this->display(); } + + /** + * Ajax get product drop menu. + * + * @param int $executionID + * @param int $productID + * @access public + * @return void + */ + public function ajaxSwitcherMenu(int $executionID, int $productID, string $currentMethod = '') + { + $this->view->link = helper::createLink('execution', $currentMethod, "executionID=$executionID&productID={id}"); + $this->view->productID = $productID; + $this->view->products = $this->loadModel('product')->getProducts($executionID); + $this->view->executionID = $executionID; + $this->display(); + } } diff --git a/module/execution/ui/ajaxswitchermenu.html.php b/module/execution/ui/ajaxswitchermenu.html.php new file mode 100644 index 0000000000..9a4ec6ee30 --- /dev/null +++ b/module/execution/ui/ajaxswitchermenu.html.php @@ -0,0 +1,61 @@ + + * @package execution + * @link https://www.zentao.net + */ +namespace zin; + +/** + * 定义每个分组下的选项数据列表。 + * Define the grouped data list. + */ + +$defaultItem = array(); +$defaultItem['id'] = 0; +$defaultItem['text'] = $lang->product->all; +$defaultItem['active'] = $productID == 0; +$defaultItem['type'] = 'product'; + +$data = array('normal' => array($defaultItem), 'closed' => array()); + +foreach($products as $product) +{ + $item = array(); + $item['id'] = $product->id; + $item['text'] = $product->name; + $item['active'] = $productID == $product->id; + $item['type'] = 'product'; + $item['keys'] = zget(common::convert2Pinyin(array($product->name)), $product->name, ''); + + if($product->status == 'closed') + { + $data['closed'][] = $item; + } + else + { + $data['normal'][] = $item; + } +} + +/** + * 定义每个分组名称信息,包括可展开的已关闭分组。 + * Define every group name, include expanded group. + */ +$tabs = array(); +$tabs[] = array('name' => 'closed', 'text' => $lang->product->closedProduct); +$tabs[] = array('name' => 'normal', 'text' => ''); + +$json = array(); +$json['data'] = $data; +$json['tabs'] = $tabs; +$json['searchHint'] = $lang->searchAB; +$json['expandName'] = 'closed'; +$json['itemType'] = 'product'; +$json['link'] = array('product' => sprintf($link, '{id}')); + +renderJson($json); diff --git a/module/execution/ui/bug.html.php b/module/execution/ui/bug.html.php index 3cb424ec07..0e5eee480f 100644 --- a/module/execution/ui/bug.html.php +++ b/module/execution/ui/bug.html.php @@ -40,7 +40,7 @@ featureBar 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'))) + li(searchToggle(set::module('executionBug'), set::open($type == 'bysearch'))) ); /* zin: Define the toolbar on main menu. */