From 73fe07dd49186ff8d4019c4cb98e92c5cd11f017 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Wed, 6 Jul 2022 16:18:44 +0800 Subject: [PATCH] * Finish task #59482. --- module/execution/control.php | 29 +++- module/execution/view/testcase.html.php | 176 ++++++++++++++---------- module/testcase/model.php | 10 +- module/tree/model.php | 39 ++++-- 4 files changed, 161 insertions(+), 93 deletions(-) diff --git a/module/execution/control.php b/module/execution/control.php index e81ff05f8b..76c872448f 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -1043,6 +1043,7 @@ class execution extends control * * @param int $executionID * @param string $type + * @param int $moduleID * @param string $orderBy * @param int $recTotal * @param int $recPerPage @@ -1050,28 +1051,44 @@ class execution extends control * @access public * @return void */ - public function testcase($executionID = 0, $type = 'all', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) + public function testcase($executionID = 0, $productID = 0, $type = 'all', $moduleID = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) { $this->loadModel('testcase'); $this->loadModel('testtask'); + $this->loadModel('tree'); $this->commonAction($executionID); $uri = $this->app->getURI(true); $this->session->set('caseList', $uri, 'execution'); $this->session->set('bugList', $uri, 'execution'); - $products = $this->product->getProducts($executionID); - $productID = key($products); // Get the first product for creating testcase. + $products = array('0' => $this->lang->product->all) + $this->product->getProducts($executionID, 'all', '', false); + + $extra = $executionID; + $this->lang->modulePageNav = $this->product->select($products, $productID, 'execution', 'testcase', $extra, 0, 0, '', false); /* Load pager. */ $this->app->loadClass('pager', $static = true); $pager = pager::init($recTotal, $recPerPage, $pageID); - $cases = $this->loadModel('testcase')->getExecutionCases($executionID, $orderBy, $pager, $type); + $cases = $this->loadModel('testcase')->getExecutionCases($executionID, $productID, $moduleID, $orderBy, $pager, $type); $this->loadModel('common')->saveQueryCondition($this->dao->get(), 'testcase', false); $cases = $this->testcase->appendData($cases, 'case'); $cases = $this->loadModel('story')->checkNeedConfirm($cases); + $modules = $this->tree->getAllModulePairs('case'); + + /* Get module tree.*/ + if($executionID and empty($productID)) + { + $moduleTree = $this->tree->getCaseTreeMenu($executionID, $productID, 0, array('treeModel', 'createCaseLink')); + } + else + { + $moduleTree = $this->tree->getTreeMenu($productID, 'case', 0, array('treeModel', 'createCaseLink'), array('executionID' => $executionID, 'productID' => $productID), 'all'); + } + $tree = $moduleID ? $this->tree->getByID($moduleID) : ''; + $this->view->title = $this->lang->execution->testcase; $this->view->executionID = $executionID; $this->view->productID = $productID; @@ -1081,6 +1098,10 @@ class execution extends control $this->view->type = $type; $this->view->users = $this->loadModel('user')->getPairs('noletter'); $this->view->execution = $this->execution->getByID($executionID); + $this->view->moduleTree = $moduleTree; + $this->view->modules = $modules; + $this->view->moduleID = $moduleID; + $this->view->moduleName = $moduleID ? $tree->name : $this->lang->tree->all; $this->display(); } diff --git a/module/execution/view/testcase.html.php b/module/execution/view/testcase.html.php index 908ad4c967..dd8d2aca0f 100644 --- a/module/execution/view/testcase.html.php +++ b/module/execution/view/testcase.html.php @@ -1,87 +1,119 @@ -