diff --git a/module/block/control.php b/module/block/control.php
index 7522f3e703..665b2212aa 100644
--- a/module/block/control.php
+++ b/module/block/control.php
@@ -609,7 +609,8 @@ class block extends control
$this->session->set('bugList', $this->app->getURI(true));
if(preg_match('/[^a-zA-Z0-9_]/', $this->params->type)) die();
- $projectID = $this->view->block->module == 'my' ? 0 : (int)$this->session->PRJ;
+ $projectID = $this->lang->navGroup->qa == 'project' ? $this->session->PRJ : 0;
+ $projectID = $this->view->block->module == 'my' ? 0 : $projectID;
$this->view->bugs = $this->loadModel('bug')->getUserBugs($this->app->user->account, $this->params->type, $this->params->orderBy, $this->viewType == 'json' ? 0 : (int)$this->params->count, null, $projectID);
}
@@ -625,6 +626,9 @@ class block extends control
$this->app->loadLang('testcase');
$this->app->loadLang('testtask');
+ $projectID = $this->lang->navGroup->qa == 'project' ? $this->session->PRJ : 0;
+ $projectID = $this->view->block->module == 'my' ? 0 : $projectID;
+
$cases = array();
if($this->params->type == 'assigntome')
{
@@ -636,7 +640,7 @@ class block extends control
->andWhere('t3.status')->ne('done')
->andWhere('t3.deleted')->eq(0)
->andWhere('t2.deleted')->eq(0)
- ->beginIF($this->view->block->module != 'my' and $this->session->PRJ)->andWhere('t2.PRJ')->eq((int)$this->session->PRJ)->fi()
+ ->beginIF($projectID)->andWhere('t2.PRJ')->eq($projectID)->fi()
->orderBy($this->params->orderBy)
->beginIF($this->viewType != 'json')->limit((int)$this->params->count)->fi()
->fetchAll();
@@ -645,12 +649,12 @@ class block extends control
{
$cases = $this->dao->findByOpenedBy($this->app->user->account)->from(TABLE_CASE)
->andWhere('deleted')->eq(0)
- ->beginIF($this->view->block->module != 'my' and $this->session->PRJ)->andWhere('PRJ')->eq((int)$this->session->PRJ)->fi()
+ ->beginIF($projectID)->andWhere('PRJ')->eq($projectID)->fi()
->orderBy($this->params->orderBy)
->beginIF($this->viewType != 'json')->limit((int)$this->params->count)->fi()
->fetchAll();
}
- $this->view->cases = $cases;
+ $this->view->cases = $cases;
}
/**
@@ -661,16 +665,21 @@ class block extends control
*/
public function printTesttaskBlock()
{
+ $this->app->loadLang('testtask');
+
$this->session->set('testtaskList', $this->app->getURI(true));
if(preg_match('/[^a-zA-Z0-9_]/', $this->params->type)) die();
- $this->app->loadLang('testtask');
+
+ $projectID = $this->lang->navGroup->qa == 'project' ? $this->session->PRJ : 0;
+ $projectID = $this->view->block->module == 'my' ? 0 : $projectID;
+
$this->view->testtasks = $this->dao->select('t1.*,t2.name as productName,t3.name as buildName,t4.name as projectName')->from(TABLE_TESTTASK)->alias('t1')
->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product=t2.id')
->leftJoin(TABLE_BUILD)->alias('t3')->on('t1.build=t3.id')
->leftJoin(TABLE_PROJECT)->alias('t4')->on('t1.project=t4.id')
->leftJoin(TABLE_PROJECTPRODUCT)->alias('t5')->on('t1.project=t5.project')
->where('t1.deleted')->eq('0')
- ->beginIF($this->view->block->module != 'my' and $this->session->PRJ)->andWhere('t1.PRJ')->eq((int)$this->session->PRJ)->fi()
+ ->beginIF($projectID)->andWhere('t1.PRJ')->eq($projectID)->fi()
->beginIF(!$this->app->user->admin)->andWhere('t1.product')->in($this->app->user->view->products)->fi()
->andWhere('t1.product = t5.product')
->beginIF($this->params->type != 'all')->andWhere('t1.status')->eq($this->params->type)->fi()
@@ -1474,19 +1483,19 @@ class block extends control
$status = isset($this->params->type) ? $this->params->type : '';
$count = isset($this->params->count) ? (int)$this->params->count : 0;
- $products = $this->loadModel('product')->getOrderedProducts($status, $count, $this->session->PRJ);
- $productIdList = array_keys($products);
-
+ $projectID = $this->lang->navGroup->qa == 'project' ? $this->session->PRJ : 0;
+ $products = $this->loadModel('product')->getOrderedProducts($status, $count, $projectID);
if(empty($products))
{
$this->view->products = $products;
return false;
}
- $today = date(DT_DATE1);
- $yesterday = date(DT_DATE1, strtotime('yesterday'));
- $testtasks = $this->dao->select('*')->from(TABLE_TESTTASK)->where('product')->in($productIdList)->andWhere('project')->ne(0)->andWhere('deleted')->eq(0)->orderBy('id')->fetchAll('product');
- $bugs = $this->dao->select("product, count(id) as total,
+ $productIdList = array_keys($products);
+ $today = date(DT_DATE1);
+ $yesterday = date(DT_DATE1, strtotime('yesterday'));
+ $testtasks = $this->dao->select('*')->from(TABLE_TESTTASK)->where('product')->in($productIdList)->andWhere('project')->ne(0)->andWhere('deleted')->eq(0)->orderBy('id')->fetchAll('product');
+ $bugs = $this->dao->select("product, count(id) as total,
count(assignedTo = '{$this->app->user->account}' or null) as assignedToMe,
count(status != 'closed' or null) as unclosed,
count((status != 'closed' and status != 'resolved') or null) as unresolved,
diff --git a/module/bug/control.php b/module/bug/control.php
index 3e955b5d63..e37c108aec 100644
--- a/module/bug/control.php
+++ b/module/bug/control.php
@@ -11,7 +11,8 @@
*/
class bug extends control
{
- public $products = array();
+ public $products = array();
+ public $projectID = 0;
/**
* Construct function, load some modules auto.
@@ -32,7 +33,16 @@ class bug extends control
$this->loadModel('story');
$this->loadModel('task');
- $this->view->products = $this->products = $this->product->getProductPairsByProject($this->session->PRJ);
+ /* Set bug menu group. */
+ $this->projectID = isset($_GET['PRJ']) ? $_GET['PRJ'] : 0;
+ if(!$this->projectID)
+ {
+ $this->app->loadConfig('qa');
+ foreach($this->config->qa->menuList as $module) $this->lang->navGroup->$module = 'qa';
+ $this->lang->noMenuModule[] = $this->app->rawModule;
+ }
+
+ $this->view->products = $this->products = $this->product->getProductPairsByProject($this->projectID);
if($this->session->PRJ and empty($this->products)) die($this->locate($this->createLink('product', 'showErrorNone', "fromModule=bug")));
}
diff --git a/module/bug/model.php b/module/bug/model.php
index 406280e446..fc69eec36c 100644
--- a/module/bug/model.php
+++ b/module/bug/model.php
@@ -48,6 +48,8 @@ class bugModel extends model
$replace = $productID;
common::setMenuVars($this->lang->bug->menu, $key, $replace);
}
+
+ if($this->lang->navGroup->bug == 'qa') $this->lang->qa->menu = $this->lang->bug->menu;
}
/**
diff --git a/module/caselib/control.php b/module/caselib/control.php
index 5f842dcc3a..c2ff20a916 100644
--- a/module/caselib/control.php
+++ b/module/caselib/control.php
@@ -13,6 +13,21 @@ class caselib extends control
{
public $products = array();
+ public function __construct($moduleName = '', $methodName = '')
+ {
+ parent::__construct($moduleName, $methodName);
+
+ /* Set testtask menu group. */
+ $this->projectID = isset($_GET['PRJ']) ? $_GET['PRJ'] : 0;
+ if(!$this->projectID)
+ {
+ $this->app->loadConfig('qa');
+ foreach($this->config->qa->menuList as $module) $this->lang->navGroup->$module = 'qa';
+ $this->lang->noMenuModule[] = $this->app->rawModule;
+ }
+ }
+
+
/**
* Index page, header to browse.
*
diff --git a/module/caselib/model.php b/module/caselib/model.php
index fc6db0159c..7da3933270 100644
--- a/module/caselib/model.php
+++ b/module/caselib/model.php
@@ -104,7 +104,9 @@ class caselibModel extends model
$replace = $libID;
common::setMenuVars($this->lang->caselib->menu, $key, $replace);
}
+
if($this->config->global->flow != 'full' && $this->app->getMethodName() != 'view') $this->lang->caselib->menu->bysearch = " {$this->lang->testcase->bySearch}";
+ if($this->lang->navGroup->caselib == 'qa') $this->lang->qa->menu = $this->lang->caselib->menu;
}
/**
diff --git a/module/common/lang/zh-cn.php b/module/common/lang/zh-cn.php
index ca80803aa6..37a2b69439 100644
--- a/module/common/lang/zh-cn.php
+++ b/module/common/lang/zh-cn.php
@@ -409,7 +409,7 @@ $lang->qa->menu->caselib = array('link' => '用例库|caselib|browse', 'alias'
$lang->qa->subMenu = new stdclass();
$lang->qa->subMenu->testcase = new stdclass();
$lang->qa->subMenu->testcase->feature = array('link' => '功能测试|testcase|browse|productID=%s', 'alias' => 'view,create,batchcreate,edit,batchedit,showimport,groupcase,importfromlib', 'subModule' => 'tree,story');
-$lang->qa->subMenu->testcase->unit = array('link' => '单元测试|testtask|browseUnits|productID=%s');
+$lang->qa->subMenu->testcase->unit = array('link' => '单元测试|testtask|browseUnits|productID=%s', 'alias' => 'browseunits');
$lang->bug = new stdclass();
$lang->bug->menu = new stdclass();
diff --git a/module/common/model.php b/module/common/model.php
index c2b105220d..e814eccf88 100644
--- a/module/common/model.php
+++ b/module/common/model.php
@@ -2312,6 +2312,11 @@ EOD;
$lang->menu = $lang->report->menu;
$lang->menuOrder = $lang->report->menuOrder;
}
+ if($group == 'qa')
+ {
+ $lang->menu = $lang->qa->menu;
+ $lang->menuOrder = $lang->qa->menuOrder;
+ }
if($group == 'attend')
{
$lang->menu = $lang->attend->menu;
diff --git a/module/product/model.php b/module/product/model.php
index 70ec4b0f19..ab012d7a34 100644
--- a/module/product/model.php
+++ b/module/product/model.php
@@ -328,8 +328,8 @@ class productModel extends model
->leftJoin(TABLE_PRODUCT)->alias('t2')
->on('t1.product = t2.id')
->where('t2.deleted')->eq(0)
- ->andWhere('t2.id')->in($this->app->user->view->products)
- ->beginIF($projectID)->andWhere('t1.project')->eq($projectID)->fi()
+ ->beginIF(!empty($projectID))->andWhere('t1.project')->eq($projectID)->fi()
+ ->beginIF(!$this->app->user->admin)->andWhere('t2.id')->in($this->app->user->view->products)->fi()
->beginIF(strpos($status, 'noclosed') !== false)->andWhere('status')->ne('closed')->fi()
->orderBy('t2.order desc')
->fetchAll('id');
diff --git a/module/qa/config.php b/module/qa/config.php
index e69de29bb2..12593ff1d2 100644
--- a/module/qa/config.php
+++ b/module/qa/config.php
@@ -0,0 +1,2 @@
+qa->menuList = array('caselib', 'testreport', 'testsuite', 'testtask', 'testcase', 'bug', 'qa');
diff --git a/module/qa/control.php b/module/qa/control.php
index afa0522863..ac590e1aeb 100644
--- a/module/qa/control.php
+++ b/module/qa/control.php
@@ -11,6 +11,27 @@
*/
class qa extends control
{
+ public $projectID;
+
+ /**
+ * Construct.
+ *
+ * @access public
+ * @return void
+ */
+ public function __construct()
+ {
+ parent::__construct();
+
+ /* Set report menu group. */
+ $this->projectID = isset($_GET['PRJ']) ? $_GET['PRJ'] : 0;
+ if(!$this->projectID)
+ {
+ foreach($this->config->qa->menuList as $module) $this->lang->navGroup->$module = 'qa';
+ $this->lang->noMenuModule[] = $this->app->rawModule;
+ }
+ }
+
/**
* The index of qa, go to bug's browse page.
*
@@ -19,7 +40,7 @@ class qa extends control
*/
public function index($locate = 'auto', $productID = 0)
{
- $this->products = $this->loadModel('product')->getProductPairsByProject($this->session->PRJ);
+ $this->products = $this->loadModel('product')->getProductPairsByProject($this->projectID, 'noclosed');
if(empty($this->products)) die($this->locate($this->createLink('product', 'showErrorNone', "fromModule=qa")));
if($locate == 'yes') $this->locate($this->createLink('bug', 'browse'));
diff --git a/module/testcase/control.php b/module/testcase/control.php
index 803d34e1a4..d19b37b627 100644
--- a/module/testcase/control.php
+++ b/module/testcase/control.php
@@ -11,7 +11,8 @@
*/
class testcase extends control
{
- public $products = array();
+ public $products = array();
+ public $projectID = 0;
/**
* Construct function, load product, tree, user auto.
@@ -25,7 +26,17 @@ class testcase extends control
$this->loadModel('product');
$this->loadModel('tree');
$this->loadModel('user');
- $this->view->products = $this->products = $this->product->getProductPairsByProject($this->session->PRJ);
+
+ /* Set test case menu group. */
+ $this->projectID = isset($_GET['PRJ']) ? $_GET['PRJ'] : 0;
+ if(!$this->projectID)
+ {
+ $this->app->loadConfig('qa');
+ foreach($this->config->qa->menuList as $module) $this->lang->navGroup->$module = 'qa';
+ $this->lang->noMenuModule[] = $this->app->rawModule;
+ }
+
+ $this->view->products = $this->products = $this->product->getProductPairsByProject($this->projectID);
if(empty($this->products)) die($this->locate($this->createLink('product', 'showErrorNone', "fromModule=testcase")));
}
diff --git a/module/testcase/model.php b/module/testcase/model.php
index ed48b2c70e..bd48e6f3b1 100644
--- a/module/testcase/model.php
+++ b/module/testcase/model.php
@@ -48,6 +48,8 @@ class testcaseModel extends model
$replace = $productID;
common::setMenuVars($this->lang->testcase->menu, $key, $replace);
}
+
+ if($this->lang->navGroup->testcase == 'qa') $this->lang->qa->menu = $this->lang->testcase->menu;
}
/**
diff --git a/module/testreport/control.php b/module/testreport/control.php
index dd9fb7838f..53315a26f9 100644
--- a/module/testreport/control.php
+++ b/module/testreport/control.php
@@ -11,6 +11,8 @@
*/
class testreport extends control
{
+ public $projectID = 0;
+
/**
* Construct
*
@@ -32,6 +34,15 @@ class testreport extends control
$this->loadModel('testtask');
$this->loadModel('user');
$this->app->loadLang('report');
+
+ /* Set testreport menu group. */
+ $this->projectID = isset($_GET['PRJ']) ? $_GET['PRJ'] : 0;
+ if(!$this->projectID)
+ {
+ $this->app->loadConfig('qa');
+ foreach($this->config->qa->menuList as $module) $this->lang->navGroup->$module = 'qa';
+ $this->lang->noMenuModule[] = $this->app->rawModule;
+ }
}
/**
diff --git a/module/testreport/model.php b/module/testreport/model.php
index cbe33daaf0..9a38f5a879 100644
--- a/module/testreport/model.php
+++ b/module/testreport/model.php
@@ -39,6 +39,8 @@ class testreportModel extends model
$replace = $productID;
common::setMenuVars($this->lang->testreport->menu, $key, $replace);
}
+
+ if($this->lang->navGroup->testreport == 'qa') $this->lang->qa->menu = $this->lang->testreport->menu;
}
/**
diff --git a/module/testsuite/control.php b/module/testsuite/control.php
index 565e563474..07ad32b04f 100644
--- a/module/testsuite/control.php
+++ b/module/testsuite/control.php
@@ -13,6 +13,20 @@ class testsuite extends control
{
public $products = array();
+ public function __construct($moduleName = '', $methodName = '')
+ {
+ parent::__construct($moduleName, $methodName);
+
+ /* Set testtask menu group. */
+ $this->projectID = isset($_GET['PRJ']) ? $_GET['PRJ'] : 0;
+ if(!$this->projectID)
+ {
+ $this->app->loadConfig('qa');
+ foreach($this->config->qa->menuList as $module) $this->lang->navGroup->$module = 'qa';
+ $this->lang->noMenuModule[] = $this->app->rawModule;
+ }
+ }
+
/**
* Index page, header to browse.
*
diff --git a/module/testsuite/model.php b/module/testsuite/model.php
index 2eb799854d..c7a9a3087c 100644
--- a/module/testsuite/model.php
+++ b/module/testsuite/model.php
@@ -45,6 +45,8 @@ class testsuiteModel extends model
$replace = $productID;
common::setMenuVars($this->lang->testsuite->menu, $key, $replace);
}
+
+ if($this->lang->navGroup->testsuite == 'qa') $this->lang->qa->menu = $this->lang->testsuite->menu;
}
/**
diff --git a/module/testtask/control.php b/module/testtask/control.php
index 100d179fc0..c3c27f09b5 100644
--- a/module/testtask/control.php
+++ b/module/testtask/control.php
@@ -11,7 +11,8 @@
*/
class testtask extends control
{
- public $products = array();
+ public $products = array();
+ public $projectID = 0;
/**
* Construct function, load product module, assign products to view auto.
@@ -22,8 +23,18 @@ class testtask extends control
public function __construct($moduleName = '', $methodName = '')
{
parent::__construct($moduleName, $methodName);
+
+ /* Set testtask menu group. */
+ $this->projectID = isset($_GET['PRJ']) ? $_GET['PRJ'] : 0;
+ if(!$this->projectID)
+ {
+ $this->app->loadConfig('qa');
+ foreach($this->config->qa->menuList as $module) $this->lang->navGroup->$module = 'qa';
+ $this->lang->noMenuModule[] = $this->app->rawModule;
+ }
+
$this->loadModel('product');
- $this->view->products = $this->products = $this->product->getProductPairsByProject($this->session->PRJ);
+ $this->view->products = $this->products = $this->product->getProductPairsByProject($this->projectID);
if(empty($this->products)) die($this->locate($this->createLink('product', 'showErrorNone', "fromModule=testtask")));
}
diff --git a/module/testtask/model.php b/module/testtask/model.php
index 8e8d7f8cd2..4b36961c50 100644
--- a/module/testtask/model.php
+++ b/module/testtask/model.php
@@ -66,6 +66,8 @@ class testtaskModel extends model
$replace = ($key == 'product') ? $selectHtml : $productID;
common::setMenuVars($this->lang->testtask->menu, $key, $replace);
}
+
+ if($this->lang->navGroup->testtask == 'qa') $this->lang->qa->menu = $this->lang->testtask->menu;
}
/**
@@ -129,6 +131,9 @@ class testtaskModel extends model
$replace = ($key == 'product') ? $selectHtml : $productID;
common::setMenuVars($this->lang->testtask->menu, $key, $replace);
}
+
+ $this->lang->testtask->menu->testcase['subModule'] = 'testtask';
+ if($this->lang->navGroup->testtask == 'qa') $this->lang->qa->menu = $this->lang->testtask->menu;
}
/**
diff --git a/module/testtask/view/browseunits.html.php b/module/testtask/view/browseunits.html.php
index a3c400d304..0a8767252a 100644
--- a/module/testtask/view/browseunits.html.php
+++ b/module/testtask/view/browseunits.html.php
@@ -89,12 +89,6 @@
$(function()
{
$('#Tab').addClass('btn-active-text').append(" recTotal >= $pager->recPerPage) ? $pager->recPerPage : $pager->recTotal;?>");
- config->global->flow == 'full'):?>
- $('#subNavbar [data-id=testcase]').addClass('active');
-
- $('#navbar li.active').removeClass('active');
- $('#navbar li[data-id=unit]').addClass('active');
-
})