* Finish task#36038.

This commit is contained in:
leiyong
2021-02-23 14:36:54 +08:00
parent 151760b145
commit 20075135ab
19 changed files with 147 additions and 29 deletions
+22 -13
View File
@@ -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,
+12 -2
View File
@@ -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")));
}
+2
View File
@@ -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;
}
/**
+15
View File
@@ -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.
*
+2
View File
@@ -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 = "<a class='querybox-toggle' id='bysearchTab'><i class='icon icon-search muted'> </i>{$this->lang->testcase->bySearch}</a>";
if($this->lang->navGroup->caselib == 'qa') $this->lang->qa->menu = $this->lang->caselib->menu;
}
/**
+1 -1
View File
@@ -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();
+5
View File
@@ -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;
+2 -2
View File
@@ -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');
+2
View File
@@ -0,0 +1,2 @@
<?php
$config->qa->menuList = array('caselib', 'testreport', 'testsuite', 'testtask', 'testcase', 'bug', 'qa');
+22 -1
View File
@@ -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'));
+13 -2
View File
@@ -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")));
}
+2
View File
@@ -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;
}
/**
+11
View File
@@ -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;
}
}
/**
+2
View File
@@ -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;
}
/**
+14
View File
@@ -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.
*
+2
View File
@@ -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;
}
/**
+13 -2
View File
@@ -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")));
}
+5
View File
@@ -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;
}
/**
@@ -89,12 +89,6 @@
$(function()
{
$('#<?php echo $browseType?>Tab').addClass('btn-active-text').append(" <span class='label label-light label-badge'><?php echo ($browseType == 'newest' and $pager->recTotal >= $pager->recPerPage) ? $pager->recPerPage : $pager->recTotal;?></span>");
<?php if($this->config->global->flow == 'full'):?>
$('#subNavbar [data-id=testcase]').addClass('active');
<?php else:?>
$('#navbar li.active').removeClass('active');
$('#navbar li[data-id=unit]').addClass('active');
<?php endif;?>
})
</script>
<?php include '../../common/view/footer.html.php';?>