This commit is contained in:
hufangzhou
2021-12-06 10:27:51 +08:00
parent e1b5dd4642
commit 145fc2a461
3 changed files with 22 additions and 8 deletions

View File

@@ -75,10 +75,10 @@ class productModel extends model
*/
public function select($products, $productID, $currentModule, $currentMethod, $extra = '', $branch = '', $module = 0, $moduleType = '', $withBranch = true)
{
$isBrowseBug = (strpos(',project,execution,', ",{$this->app->tab},") !== false and strpos(',bug,testcase,testtask,ajaxselectstory,', ",{$this->app->rawMethod},") !== false and isset($products[0])) ? true : false;
$isQaModule = (strpos(',project,execution,', ",{$this->app->tab},") !== false and strpos(',bug,testcase,testtask,ajaxselectstory,', ",{$this->app->rawMethod},") !== false and isset($products[0])) ? true : false;
$this->app->loadLang('product');
if(!$isBrowseBug and !$productID)
if(!$isQaModule and !$productID)
{
unset($this->lang->product->menu->settings['subMenu']->branch);
return;
@@ -88,10 +88,13 @@ class productModel extends model
setcookie("lastProduct", $productID, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, true);
if($productID) $currentProduct = $this->getById($productID);
if($isBrowseBug and $this->app->tab == 'project') $extra = $this->session->project;
if($isBrowseBug and $this->app->tab == 'execution') $extra = $this->session->execution;
if($isQaModule and $this->app->tab == 'project')
{
if($this->app->tab == 'project') $extra = $currentMethod == 'testcase' ? $extra : $this->session->project;
if($this->app->tab == 'execution') $extra = $this->session->execution;
}
if($isBrowseBug and !$productID)
if($isQaModule and !$productID)
{
$currentProduct = new stdclass();
$currentProduct->name = $products[$productID];
@@ -102,7 +105,7 @@ class productModel extends model
$output = '';
if(!empty($products))
{
$dropMenuLink = helper::createLink($isBrowseBug ? 'bug' : 'product', 'ajaxGetDropMenu', "objectID=$productID&module=$currentModule&method=$currentMethod&extra=$extra");
$dropMenuLink = helper::createLink($isQaModule ? 'bug' : 'product', 'ajaxGetDropMenu', "objectID=$productID&module=$currentModule&method=$currentMethod&extra=$extra");
$output = "<div class='btn-group angle-btn'><div class='btn-group'><button data-toggle='dropdown' type='button' class='btn btn-limit' id='currentItem' title='{$currentProduct->name}'><span class='text'>{$currentProduct->name}</span> <span class='caret'></span></button><div id='dropMenu' class='dropdown-menu search-list' data-ride='searchList' data-url='$dropMenuLink'>";
$output .= '<div class="input-control search-box has-icon-left has-icon-right search-example"><input type="search" class="form-control search-input" /><label class="input-control-icon-left search-icon"><i class="icon icon-search"></i></label><a class="input-control-icon-right search-clear-btn"><i class="icon icon-close icon-sm"></i></a></div>';
$output .= "</div></div>";
@@ -2006,6 +2009,10 @@ class productModel extends model
$projectID = isset($output['projectID']) ? $output['projectID'] : 0;
$link = helper::createLink($module, $method, "productID=%s&branch=" . ($branch ? "%s" : '') . "&groupBy=&projectID=$projectID") . "#app=project";
}
elseif($module == 'testcase' and $method == 'browse')
{
$link = helper::createLink('testcase', 'browse', "productID=%s" . ($branch ? "&branch=%s" : '&branch=all') . "&browseType=$extra");
}
elseif($module == 'testreport' and ($method == 'create' or $method == 'edit'))
{
$vars = $method == 'edit' ? "objectID=%s" : "objectID=&objectType=testtask&extra=%s";
@@ -2039,6 +2046,11 @@ class productModel extends model
{
return helper::createLink('design', 'browse', "productID=%s");
}
elseif($module == 'project' and $method == 'testcase')
{
$params = explode('|', $extra);
return helper::createLink('project', 'testcase', "projectID={$params[0]}&productID=%s&branch=all&browseType={$params[1]}");
}
elseif($module == 'project' or $module == 'execution')
{
$objectID = $module == 'project' ? 'projectID' : 'executionID';

View File

@@ -969,7 +969,9 @@ class project extends control
$this->session->set('bugList', $this->app->getURI(true), 'project');
$products = array('0' => $this->lang->product->all) + $this->product->getProducts($projectID, 'all', '', false);
$this->lang->modulePageNav = $this->product->select($products, $productID, 'project', 'testcase', '', $branch, 0, '', false);
$extra = "$projectID|$browseType";
$this->lang->modulePageNav = $this->product->select($products, $productID, 'project', 'testcase', $extra, $branch, 0, '', false);
echo $this->fetch('testcase', 'browse', "productID=$productID&branch=$branch&browseType=$browseType&param=$param&orderBy=$orderBy&recTotal=$orderBy&recPerPage=$recPerPage&pageID=$pageID&projectID=$projectID");
}

View File

@@ -131,7 +131,7 @@ class testcase extends control
}
else
{
$this->qa->setMenu($this->products, $productID, $branch);
$this->qa->setMenu($this->products, $productID, $branch, $browseType);
}
$uri = $this->app->getURI(true);