diff --git a/module/branch/view/ajaxgetdropmenu.html.php b/module/branch/view/ajaxgetdropmenu.html.php index e31ed3807b..472398d74c 100644 --- a/module/branch/view/ajaxgetdropmenu.html.php +++ b/module/branch/view/ajaxgetdropmenu.html.php @@ -13,11 +13,11 @@ foreach($branches as $branchID => $branch) if($branchID == 'all' or empty($branchID) or $statusList[$branchID] == 'active') { - $activeBranchesHtml .= html::a($linkHtml, $branch, '', "class='$selected' data-key='{$branchesPinyin[$branch]}'"); + $activeBranchesHtml .= html::a($linkHtml, $branch, '', "class='$selected' data-key='{$branchesPinyin[$branch]}' data-app='{$this->app->tab}'"); } else { - $closedBranchesHtml .= html::a($linkHtml, $branch, '', "class='$selected' data-key='{$branchesPinyin[$branch]}'"); + $closedBranchesHtml .= html::a($linkHtml, $branch, '', "class='$selected' data-key='{$branchesPinyin[$branch]}' data-app='{$this->app->tab}'"); } } ?> diff --git a/module/product/model.php b/module/product/model.php index 3d268bed7c..b7c7c80051 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -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 = "
"; @@ -539,7 +542,7 @@ class productModel extends model if($currentModule == 'tree' and $currentMethod == 'browse') $isShowBranch = true; if($currentModule == 'product' and strpos($this->config->product->showBranchMethod, $currentMethod) !== false) $isShowBranch = true; if($this->app->tab == 'qa' and strpos(',testsuite,testreport,testtask,', ",$currentModule,") === false) $isShowBranch = true; - if($this->app->tab == 'qa' and $currentModule == 'testtask' and strpos(',create,edit,', ",$currentMethod,") === false) $isShowBranch = true; + if($this->app->tab == 'qa' and $currentModule == 'testtask' and strpos(',create,edit,browseunits,importunitresult,unitcases,', ",$currentMethod,") === false) $isShowBranch = true; if($isShowBranch) { $this->lang->product->branch = sprintf($this->lang->product->branch, $this->lang->product->branchName[$currentProduct->type]); @@ -1978,7 +1981,19 @@ class productModel extends model elseif($module == 'testtask') { $extra = $method != 'browse' ? '' : "&extra=$extra"; - $link = helper::createLink($module, 'browse', "productID=%s" . ($branch ? "&branch=%s" : '&branch=0') . $extra); + if(strtolower($method) == 'browseunits') + { + $methodName = 'browseUnits'; + $param = '&browseType=newest&orderBy=id_desc&recTotal=0&recPerPage=0&pageID=1'; + $param .= $this->app->tab == 'project' ? "&projectID={$this->session->project}" : ''; + } + else + { + $methodName = 'browse'; + $param = ($branch ? "&branch=%s" : '&branch=0') . $extra; + } + + $link = helper::createLink($module, $methodName, "productID=%s" . $param); } elseif($module == 'bug' && $method == 'view') { @@ -1994,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"; @@ -2027,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'; diff --git a/module/product/view/ajaxgetdropmenu.html.php b/module/product/view/ajaxgetdropmenu.html.php index e5e4614385..7dacf4a174 100644 --- a/module/product/view/ajaxgetdropmenu.html.php +++ b/module/product/view/ajaxgetdropmenu.html.php @@ -82,7 +82,7 @@ foreach($products as $programID => $programProducts) if($product->status == 'normal' and $product->PO == $this->app->user->account) { - $myProductsHtml .= '
  • ' . html::a($linkHtml, $productName, '', "class='$selected productName' title='{$productName}' data-key='" . zget($productsPinYin, $product->name, '') . "' " . $locateTab) . '
  • '; + $myProductsHtml .= '
  • ' . html::a($linkHtml, $productName, '', "class='$selected productName' title='{$productName}' data-key='" . zget($productsPinYin, $product->name, '') . "' data-app='$app->tab'") . '
  • '; if($selected == 'selected') $tabActive = 'myProduct'; diff --git a/module/project/control.php b/module/project/control.php index 022f155e7d..fbfcdfef1d 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -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¶m=$param&orderBy=$orderBy&recTotal=$orderBy&recPerPage=$recPerPage&pageID=$pageID&projectID=$projectID"); } diff --git a/module/testcase/control.php b/module/testcase/control.php index 8817d56461..9fb683a8cf 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -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); diff --git a/module/testtask/control.php b/module/testtask/control.php index 581976b8af..43bf017e86 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -175,7 +175,7 @@ class testtask extends control } $this->loadModel('project')->setMenu($this->session->project); - $this->lang->modulePageNav = $this->product->select($this->products, $productID, 'testtask', 'browseUnits', "projectID=$projectID"); + $this->lang->modulePageNav = $this->product->select($this->products, $productID, 'testtask', 'browseUnits', "projectID=$projectID", '', 0, '', false); } else { @@ -365,7 +365,7 @@ class testtask extends control $this->lang->scrum->menu->qa['subMenu']->testcase['subModule'] = 'testtask'; $this->lang->scrum->menu->qa['subMenu']->testtask['subModule'] = ''; $this->loadModel('project')->setMenu($this->session->project); - $this->lang->modulePageNav = $this->product->select($this->products, $productID, 'testtask', 'browseUnits'); + $this->lang->modulePageNav = $this->product->select($this->products, $productID, 'testtask', 'browseUnits', '', '', 0, '', false); } else { @@ -1394,7 +1394,7 @@ class testtask extends control $this->lang->scrum->menu->qa['subMenu']->testcase['subModule'] = 'testtask'; $this->lang->scrum->menu->qa['subMenu']->testtask['subModule'] = ''; $this->loadModel('project')->setMenu($this->session->project); - $this->lang->modulePageNav = $this->product->select($this->products, $productID, 'testtask', 'browseUnits'); + $this->lang->modulePageNav = $this->product->select($this->products, $productID, 'testtask', 'browseUnits', '', '', 0, '', false); /* Replace language. */ $project = $this->project->getByID($this->session->project);