From 6f82d035a6e446cb2610aa4f2deafea50848c1da Mon Sep 17 00:00:00 2001 From: hufangzhou <746775970@qq.com> Date: Mon, 22 Mar 2021 16:03:12 +0800 Subject: [PATCH] * Fix the related link of project story. --- module/action/model.php | 4 +- module/story/control.php | 6 +-- module/tree/model.php | 93 +++++++++++++++++++++++++++++++++++++--- 3 files changed, 93 insertions(+), 10 deletions(-) diff --git a/module/action/model.php b/module/action/model.php index 40a2f8e63b..d182353308 100755 --- a/module/action/model.php +++ b/module/action/model.php @@ -253,7 +253,7 @@ class actionModel extends model { $name = $this->dao->select('name')->from(TABLE_PROJECT)->where('id')->eq($action->extra)->fetch('name'); $productID = trim($action->product, ','); - if($name) $action->extra = common::hasPriv('projectstory', 'story') ? html::a(helper::createLink('projectstory', 'story', "productID=$productID"), $name) : $name; + if($name) $action->extra = common::hasPriv('projectstory', 'story') ? html::a(helper::createLink('projectstory', 'story', "projectID=$action->execution&productID=$productID"), $name) : $name; } elseif($actionName == 'linked2plan') { @@ -293,7 +293,7 @@ class actionModel extends model { $name = $this->dao->select('name')->from(TABLE_PROJECT)->where('id')->eq($action->extra)->fetch('name'); $productID = trim($action->product, ','); - if($name) $action->extra = common::hasPriv('projectstory', 'story') ? html::a(helper::createLink('projectstory', 'story', "productID=$productID"), "#$action->extra " . $name) : "#$action->extra " . $name; + if($name) $action->extra = common::hasPriv('projectstory', 'story') ? html::a(helper::createLink('projectstory', 'story', "projectID=$action->execution&productID=$productID"), "#$action->extra " . $name) : "#$action->extra " . $name; } elseif($actionName == 'unlinkedfrombuild') { diff --git a/module/story/control.php b/module/story/control.php index 3dd13d73cd..9180c37940 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -109,7 +109,7 @@ class story extends control { $execution = $this->dao->findById((int)$objectID)->from(TABLE_EXECUTION)->fetch(); $moduleName = $execution->type == 'project' ? 'projectstory' : 'execution'; - $param = $execution->type == 'project' ? "project=$objectID" : "executionID=$objectID"; + $param = $execution->type == 'project' ? "projectID=$objectID&productID=$productID" : "executionID=$objectID"; $response['locate'] = $this->createLink($moduleName, 'story', $param); } $this->send($response); @@ -163,7 +163,7 @@ class story extends control setcookie('storyModuleParam', 0, 0, $this->config->webRoot, '', false, true); $execution = $this->dao->findById((int)$objectID)->from(TABLE_EXECUTION)->fetch(); $moduleName = $execution->type == 'project' ? 'projectstory' : 'execution'; - $param = $execution->type == 'project' ? "productID=$productID" : "executionID=$objectID&orderBy=id_desc&browseType=unclosed"; + $param = $execution->type == 'project' ? "projectID=$objectID&productID=$productID" : "executionID=$objectID&orderBy=id_desc&browseType=unclosed"; $response['locate'] = $this->createLink($moduleName, 'story', $param); } if($this->app->getViewType() == 'xhtml') $response['locate'] = $this->createLink('story', 'view', "storyID=$storyID"); @@ -406,7 +406,7 @@ class story extends control { setcookie('storyModuleParam', 0, 0, $this->config->webRoot, '', false, false); $moduleName = $execution->type == 'project' ? 'projectstory' : 'execution'; - $param = $execution->type == 'project' ? "productID=$productID" : "executionID=$executionID&orderBy=id_desc&browseType=unclosed"; + $param = $execution->type == 'project' ? "projectID=$executionID&productID=$productID" : "executionID=$executionID&orderBy=id_desc&browseType=unclosed"; $link = $this->createLink($moduleName, 'story', $param); die(js::locate($link, 'parent')); } diff --git a/module/tree/model.php b/module/tree/model.php index 2b6ba00adf..707be62826 100644 --- a/module/tree/model.php +++ b/module/tree/model.php @@ -698,6 +698,89 @@ class treeModel extends model return $menu; } + /** + * Get the tree menu of case in html. + * + * @param int $rootID + * @param int $productID + * @param int $startModule + * @param int $userFunc + * @param string $extra + * @access public + * @return void + */ + public function getCaseTreeMenu($rootID, $productID = 0, $startModule = 0, $userFunc, $extra = '') + { + $extra = array('projectID' => $rootID, 'productID' => $productID, 'tip' => true, 'extra' => $extra); + + /* If createdVersion <= 4.1, go to getTreeMenu(). */ + $products = $this->loadModel('product')->getProductPairsByProject($rootID); + $branchGroups = $this->loadModel('branch')->getByProducts(array_keys($products)); + + /* createdVersion > 4.1. */ + $menu = "'; + return $menu; + } + /** * Get execution story tree menu. * @@ -731,8 +814,8 @@ class treeModel extends model $productNum = count($products); foreach($products as $id => $product) { - $extra['productID'] = $id; - $projectProductLink = helper::createLink('projectstory', 'story', "productID=$id"); + $extra['productID'] = $id; + $projectProductLink = helper::createLink('projectstory', 'story', "projectID=$rootID&productID=$id"); $executionProductLink = helper::createLink('execution', 'story', "executionID=$rootID&ordery=&status=byProduct&praram=$id"); $link = $this->app->rawModule == 'projectstory' ? $projectProductLink : $executionProductLink; if($productNum > 1) $menu .= "
  • " . html::a($link, $product, '_self', "id='product$id'"); @@ -761,7 +844,7 @@ class treeModel extends model if((isset($treeMenu[0]) and $branch) or isset($executionBranches[$branch])) { $childMenu = isset($treeMenu[0]) ? "" : ''; - $projectBranchLink = helper::createLink('projectstory', 'story', "productID=$id&branch=" . (empty($branch) ? 0 : $branch) . "&browseType=byBranch"); + $projectBranchLink = helper::createLink('projectstory', 'story', "projectID=$rootID&productID=$id&branch=" . (empty($branch) ? 0 : $branch) . "&browseType=byBranch"); $executionBranchLink = helper::createLink('execution', 'story', "executionID=$rootID&ordery=&status=byBranch&praram=" . (empty($branch) ? "{$id},0" : $branch)); $link = $this->app->rawModule == 'projectstory' ? $projectBranchLink : $executionBranchLink; if($branchName) $treeMenu[0] = "
  • " . html::a($link, $branchName, '_self', "id='branch" . (empty($branch) ? "{$id}_0" : $branch) . "'") . "{$childMenu}
  • "; @@ -979,7 +1062,7 @@ class treeModel extends model public function createProjectStoryLink($type, $module, $extra) { $productID = $extra['productID']; - return html::a(helper::createLink('projectstory', 'story', "productID=$productID&branch=&browseType=byModule¶m={$module->id}"), $module->name, '_self', "id='module{$module->id}'"); + return html::a(helper::createLink('projectstory', 'story', "projectID={$extra['executionID']}productID=$productID&branch=&browseType=byModule¶m={$module->id}"), $module->name, '_self', "id='module{$module->id}'"); } /** @@ -1104,7 +1187,7 @@ class treeModel extends model */ public function createCaseLink($type, $module) { - return html::a(helper::createLink('testcase', 'browse', "root={$module->root}&branch=&type=byModule¶m={$module->id}"), $module->name, '_self', "id='module{$module->id}'"); + return html::a(helper::createLink('testcase', 'browse', "root={$module->root}&branch=&type=byModule¶m={$module->id}"), $module->name, '_self', "id='module{$module->id}' data-app='{$this->app->openApp}'"); } /**