From 47dea27cabe7b3a1188487a8a9feca76bc661d16 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Tue, 24 Oct 2023 14:22:13 +0800 Subject: [PATCH] + Add 2.5 level menu for the project bug list. --- config/zentaopms.php | 2 +- module/bug/model.php | 2 +- module/project/control.php | 17 ++++++ module/project/ui/ajaxswitchermenu.html.php | 61 +++++++++++++++++++++ module/project/ui/bug.html.php | 2 +- module/project/zen.php | 39 +++++++------ 6 files changed, 102 insertions(+), 21 deletions(-) create mode 100644 module/project/ui/ajaxswitchermenu.html.php diff --git a/config/zentaopms.php b/config/zentaopms.php index 94f97d41d2..aaf2fe9714 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(); +$config->hasSwitcherMethods = array('project-bug'); $config->excludeSwitcherList = array(); diff --git a/module/bug/model.php b/module/bug/model.php index 1293b4dbd4..675b4ce7ac 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -916,7 +916,7 @@ class bugModel extends model if($type == 'bysearch') { - $bugs = $this->getBySearch('project', $productID, $branchID, $projectID, $param, $excludeBugs, $orderBy, $pager); + $bugs = $this->getBySearch('project', $productID, $branchID, $projectID, 0, $param, $excludeBugs, $orderBy, $pager); } else { diff --git a/module/project/control.php b/module/project/control.php index c9208889a7..2007cdf9c9 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -1544,4 +1544,21 @@ class project extends control return print(html::select('project', $projectPairs, $execution->project, "class='form-control' onchange='loadProductExecutions({$execution->project}, this.value)'")); } } + + /** + * Ajax get product drop menu. + * + * @param int $projectID + * @param int $productID + * @access public + * @return void + */ + public function ajaxSwitcherMenu(int $projectID, int $productID, string $currentMethod = '') + { + $this->view->link = helper::createLink('project', $currentMethod, "projectID=$projectID&productID={id}"); + $this->view->productID = $productID; + $this->view->products = $this->loadModel('product')->getProducts($projectID); + $this->view->projectID = $projectID; + $this->display(); + } } diff --git a/module/project/ui/ajaxswitchermenu.html.php b/module/project/ui/ajaxswitchermenu.html.php new file mode 100644 index 0000000000..aa514f8783 --- /dev/null +++ b/module/project/ui/ajaxswitchermenu.html.php @@ -0,0 +1,61 @@ + + * @package project + * @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/project/ui/bug.html.php b/module/project/ui/bug.html.php index 5af1e3af4c..a8eca255c2 100644 --- a/module/project/ui/bug.html.php +++ b/module/project/ui/bug.html.php @@ -15,7 +15,7 @@ featureBar ( set::current($type), set::linkParams($linkParams), - li(searchToggle()) + li(searchToggle(set::module('projectBug'), set::open($type == 'bysearch'))) ); toolbar diff --git a/module/project/zen.php b/module/project/zen.php index b233ed99ec..96daf61661 100644 --- a/module/project/zen.php +++ b/module/project/zen.php @@ -718,24 +718,27 @@ class projectZen extends project $storyList = $storyIdList ? $this->loadModel('story')->getByList($storyIdList) : array(); $taskList = $taskIdList ? $this->loadModel('task')->getByIdList($taskIdList) : array(); - $this->view->title = $project->name . $this->lang->colon . $this->lang->bug->common; - $this->view->bugs = $bugs; - $this->view->build = $this->loadModel('build')->getById($build); - $this->view->buildID = $this->view->build ? $this->view->build->id : 0; - $this->view->pager = $pager; - $this->view->orderBy = $orderBy; - $this->view->type = $type; - $this->view->param = $param; - $this->view->productID = $productID; - $this->view->project = $project; - $this->view->branchID = empty($this->view->build->branch) ? $branchID : $this->view->build->branch; - $this->view->builds = $this->loadModel('build')->getBuildPairs(array($productID)); - $this->view->users = $this->user->getPairs('noletter'); - $this->view->executions = $this->loadModel('execution')->getPairs($projectID, 'all', 'empty|withdelete'); - $this->view->plans = $this->loadModel('productplan')->getPairs($productID ? $productID : array_keys($products)); - $this->view->stories = $storyList; - $this->view->tasks = $taskList; - $this->view->projectPairs = $this->project->getPairsByProgram(); + $this->view->title = $project->name . $this->lang->colon . $this->lang->bug->common; + $this->view->bugs = $bugs; + $this->view->build = $this->loadModel('build')->getById($build); + $this->view->buildID = $this->view->build ? $this->view->build->id : 0; + $this->view->pager = $pager; + $this->view->orderBy = $orderBy; + $this->view->type = $type; + $this->view->param = $param; + $this->view->productID = $productID; + $this->view->project = $project; + $this->view->branchID = empty($this->view->build->branch) ? $branchID : $this->view->build->branch; + $this->view->builds = $this->loadModel('build')->getBuildPairs(array($productID)); + $this->view->users = $this->user->getPairs('noletter'); + $this->view->executions = $this->loadModel('execution')->getPairs($projectID, 'all', 'empty|withdelete'); + $this->view->plans = $this->loadModel('productplan')->getPairs($productID ? $productID : array_keys($products)); + $this->view->stories = $storyList; + $this->view->tasks = $taskList; + $this->view->projectPairs = $this->project->getPairsByProgram(); + $this->view->switcherParams = "projectID={$projectID}&productID={$productID}¤tMethod=bug"; + $this->view->switcherText = isset($products[$productID]) ? $products[$productID]->name : $this->lang->product->all; + $this->display(); }