* Finish task#36357.

This commit is contained in:
leiyong
2021-03-25 18:00:10 +08:00
parent 65da8c5066
commit 17180656c7
10 changed files with 91 additions and 87 deletions
+11 -11
View File
@@ -47,21 +47,21 @@ class bug extends control
$this->loadModel('task');
$this->loadModel('qa');
/* Set bug menu group. */
$this->projectID = isset($_GET['PRJ']) ? $_GET['PRJ'] : 0;
if(!$this->projectID)
/* Get product data. */
$projectID = 0;
if($this->app->openApp == 'project')
{
$projectID = $this->session->project;
$products = $this->loadModel('project')->getProducts($projectID, false);
}
if($this->app->openApp == 'qa')
{
$products = $this->product->getPairs();
$this->app->loadConfig('qa');
foreach($this->config->qa->menuList as $module) $this->lang->navGroup->$module = 'qa';
}
else
{
$this->lang->bug->menu = $this->lang->projectQa->menu;
$this->lang->bug->subMenu = $this->lang->projectQa->subMenu;
}
$this->view->products = $this->products = $this->product->getProductPairsByProject($this->projectID);
if(empty($this->products)) die($this->locate($this->createLink('product', 'showErrorNone', 'fromModule=bug&moduleGroup=' . $this->lang->navGroup->bug . '&activeMenu=bug')));
$this->view->products = $this->products = $products;
if(empty($this->products)) die($this->locate($this->createLink('product', 'showErrorNone', "moduleName={$this->app->openApp}&activeMenu=bug&projectID=$projectID")));
}
/**
+12 -12
View File
@@ -1037,18 +1037,18 @@ class execution extends control
$tasks = $this->testtask->getExecutionTasks($executionID, $orderBy, $pager);
foreach($tasks as $key => $task) $productTasks[$task->product][] = $task;
$this->view->title = $this->executions[$executionID] . $this->lang->colon . $this->lang->testtask->common;
$this->view->position[] = html::a($this->createLink('execution', 'testtask', "executionID=$executionID"), $this->executions[$executionID]);
$this->view->position[] = $this->lang->testtask->common;
$this->view->execution = $execution;
$this->view->executionID = $executionID;
$this->view->executionName = $this->executions[$executionID];
$this->view->pager = $pager;
$this->view->orderBy = $orderBy;
$this->view->tasks = $productTasks;
$this->view->users = $this->loadModel('user')->getPairs('noclosed|noletter');
$this->view->products = $this->loadModel('product')->getPairs('', 0);
$this->view->canBeChanged = common::canModify('execution', $execution); // Determines whether an object is editable.
$this->view->title = $this->executions[$executionID] . $this->lang->colon . $this->lang->testtask->common;
$this->view->position[] = html::a($this->createLink('execution', 'testtask', "executionID=$executionID"), $this->executions[$executionID]);
$this->view->position[] = $this->lang->testtask->common;
$this->view->execution = $execution;
$this->view->executionID = $executionID;
$this->view->executionName = $this->executions[$executionID];
$this->view->pager = $pager;
$this->view->orderBy = $orderBy;
$this->view->tasks = $productTasks;
$this->view->users = $this->loadModel('user')->getPairs('noclosed|noletter');
$this->view->products = $this->loadModel('product')->getPairs('', 0);
$this->view->canBeChanged = common::canModify('execution', $execution); // Determines whether an object is editable.
$this->display();
}
+24 -27
View File
@@ -967,43 +967,40 @@ class product extends control
/**
* Show error no product when visit qa.
*
* @param string $fromModule
* @param string $moduleName
* @param string $activeMenu
* @param int $projectID
* @access public
* @return void
*/
public function showErrorNone($fromModule = 'bug', $moduleGroup = 'product', $activeMenu = '')
public function showErrorNone($moduleName = 'qa', $activeMenu = 'index', $projectID = 0)
{
/* The module in the test menu shows the created product. */
if($moduleGroup == 'qa')
$this->app->rawModule = $moduleName;
if($moduleName == 'project')
{
$this->loadModel('project')->setMenu($projectID);
$project = $this->project->getByID($projectID);
$this->lang->project->menu = $this->lang->{$project->model}->menu;
$this->lang->project->menuOrder = $this->lang->{$project->model}->menuOrder;
$this->app->rawModule = $activeMenu;
if($activeMenu == 'testcase') $this->lang->{$project->model}->menu->qa['subMenu']->testcase['subModule'] = 'product';
if($activeMenu == 'bug') $this->lang->{$project->model}->menu->qa['subMenu']->bug['subModule'] = 'product';
if($activeMenu == 'testcase') $this->lang->{$project->model}->menu->qa['subMenu']->testtask['subModule'] = 'product';
}
elseif($moduleName == 'qa')
{
$this->loadModel('qa')->setMenu(array(), 0);
$this->app->loadLang($fromModule);
foreach($this->config->qa->menuList as $module) $this->lang->navGroup->$module = 'qa';
$this->lang->product->menu = $this->lang->qa->menu;
$this->lang->product->menuOrder = $this->lang->qa->menuOrder;
if($activeMenu == 'testcase') $this->lang->qa->menu->testcase['subMenu']->case['subModule'] = 'product';
if($activeMenu == 'testsuite') $this->lang->qa->menu->testcase['subMenu']->testsuite['subModule'] = 'product';
if($activeMenu == 'testtask') $this->lang->qa->menu->testtask['subMenu']->testtask['subModule'] = 'product';
if($activeMenu == 'testreport') $this->lang->qa->menu->testtask['subMenu']->report['subModule'] = 'product';
}
/* The module in the project menu displays related products. */
if($moduleGroup == 'project')
{
$this->app->loadLang($fromModule);
/* The secondary test menu processing in the project. */
if(in_array($fromModule, array('qa', 'bug', 'testtask', 'testreport')))
{
$menu = $this->lang->qa->menu->$activeMenu;
$menu['subModule'] = 'product';
$this->lang->qa->menu->$activeMenu = $menu;
$this->app->rawModule = 'qa';
$this->loadModel('qa')->setMenu(array(), 0);
}
}
$this->view->title = $this->lang->$fromModule->common;
$this->view->fromModule = $fromModule;
$this->view->moduleGroup = $moduleGroup;
$this->view->title = $this->lang->$moduleName->common;
$this->view->projectID = $projectID;
$this->display();
}
+3 -4
View File
@@ -11,14 +11,13 @@
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php if($moduleGroup == 'project'):?>
<?php if($this->app->openApp == 'project'):?>
<div class="table-empty-tip">
<p><span class="text-muted"><?php echo $lang->product->noProduct;?></span> <?php common::printLink('project', 'manageProducts', "projectID={$this->session->project}", "<i class='icon icon-plus'></i> " . $lang->project->manageProducts, '', "class='btn btn-info'");?></p>
<p><span class="text-muted"><?php echo $lang->product->noProduct;?></span> <?php common::printLink('project', 'manageProducts', "projectID=$projectID", "<i class='icon icon-plus'></i> " . $lang->project->manageProducts, '', "class='btn btn-info' data-app='project'");?></p>
</div>
<script>$("#menuNav .nav li a[href*='product']").closest('li').removeClass('active');</script>
<?php else:?>
<div class="table-empty-tip">
<p><span class="text-muted"><?php echo $lang->product->noProduct;?></span> <?php common::printLink('product', 'create', '', "<i class='icon icon-plus'></i> " . $lang->product->create, '', "class='btn btn-info'");?></p>
<p><span class="text-muted"><?php echo $lang->product->noProduct;?></span> <?php common::printLink('product', 'create', '', "<i class='icon icon-plus'></i> " . $lang->product->create, '', "class='btn btn-info' data-app='product'");?></p>
</div>
<?php endif;?>
<?php include '../../common/view/footer.html.php';?>
+5 -12
View File
@@ -10,22 +10,13 @@
*/
class projectStory extends control
{
public $products = array();
/**
* Get the products associated with the project.
* All products.
*
* @param string $moduleName
* @param string $methodName
* @var array
* @access public
* @return void
*/
public function __construct($moduleName = '', $methodName = '')
{
parent::__construct($moduleName, $methodName);
$this->products = $this->loadModel('product')->getProductPairsByProject($this->session->project);
if(empty($this->products)) die($this->locate($this->createLink('product', 'showErrorNone', 'fromModule=projectstory&moduleGroup=' . $this->lang->navGroup->projectstory . '&activeMenu=projectstory')));
}
public $products = array();
/**
* Get software requirements from product.
@@ -45,6 +36,8 @@ class projectStory extends control
*/
public function story($projectID = 0, $productID = 0, $branch = 0, $browseType = '', $param = 0, $storyType = 'story', $orderBy = '', $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
$this->products = $this->loadModel('product')->getProductPairsByProject($projectID);
if(empty($this->products)) die($this->locate($this->createLink('product', 'showErrorNone', 'moduleName=project&activeMenu=story&projectID=' . $projectID)));
echo $this->fetch('product', 'browse', "productID=$productID&branch=$branch&browseType=$browseType&param=$param&storyType=$storyType&orderBy=$orderBy&recTotal=$recTotal&recPerPage=$recPerPage&pageID=$pageID&projectID=$projectID");
}
+1 -1
View File
@@ -20,7 +20,7 @@ class qa extends control
public function index($locate = 'auto', $productID = 0, $projectID = 0)
{
$products = $this->loadModel('product')->getProductPairsByProject($projectID, 'noclosed');
if(empty($products)) die($this->locate($this->createLink('product', 'showErrorNone', 'fromModule=qa&moduleGroup=' . $this->lang->navGroup->qa . '&activeMenu=index')));
if(empty($products)) die($this->locate($this->createLink('product', 'showErrorNone', "moduleName=qa&activeMenu=index")));
if($locate == 'yes') $this->locate($this->createLink('bug', 'browse'));
$productID = $this->product->saveState($productID, $products);
+10 -3
View File
@@ -41,9 +41,16 @@ class testcase extends control
$this->loadModel('user');
$this->loadModel('qa');
$this->view->products = $this->products = $this->product->getPairs();
if($this->app->openApp == 'project') $this->view->products = $this->products = $this->loadModel('project')->getProducts($this->session->project, false);
if(empty($this->products)) die($this->locate($this->createLink('product', 'showErrorNone', "fromModule=testcase")));
/* Get product data. */
$projectID = 0;
if($this->app->openApp == 'project')
{
$projectID = $this->session->project;
$products = $this->loadModel('project')->getProducts($projectID, false);
}
if($this->app->openApp == 'qa') $products = $this->product->getPairs();
$this->view->products = $this->products = $products;
if(empty($this->products)) die($this->locate($this->createLink('product', 'showErrorNone', "moduleName={$this->app->openApp}&activeMenu=testcase&projectID=$projectID")));
}
/**
+9 -1
View File
@@ -13,6 +13,14 @@ class testreport extends control
{
public $projectID = 0;
/**
* All products.
*
* @var array
* @access public
*/
public $products = array();
/**
* Construct
*
@@ -541,7 +549,7 @@ class testreport extends control
{
$projectID = $this->lang->navGroup->testreport == 'qa' ? 0 : $this->session->project;
$this->products = $this->product->getProductPairsByProject($projectID);
if(empty($this->products)) die($this->locate($this->createLink('product', 'showErrorNone', 'fromModule=testreport&moduleGroup=' . $this->lang->navGroup->bug . '&activeMenu=report')));
if(empty($this->products)) die($this->locate($this->createLink('product', 'showErrorNone', "moduleName=qa&activeMenu=testreport")));
$productID = $this->product->saveState($objectID, $this->products);
$this->loadModel('qa')->setMenu($this->products, $productID);
return $productID;
+6 -10
View File
@@ -29,10 +29,13 @@ class testsuite extends control
*/
public function __construct($moduleName = '', $methodName = '')
{
parent::__construct($moduleName, $methodName);
parent::__construct($moduleName, $methodName);
$this->app->loadConfig('qa');
foreach($this->config->qa->menuList as $module) $this->lang->navGroup->$module = 'qa';
$this->app->loadConfig('qa');
foreach($this->config->qa->menuList as $module) $this->lang->navGroup->$module = 'qa';
$this->view->products = $this->products = $this->loadModel('product')->getPairs();
if(empty($this->products)) die($this->locate($this->createLink('product', 'showErrorNone', "moduleName=qa&activeMenu=testsuite")));
}
/**
@@ -63,9 +66,6 @@ class testsuite extends control
$this->session->set('testsuiteList', $this->app->getURI(true), 'qa');
/* Set menu. */
$this->view->products = $this->products = $this->loadModel('product')->getPairs();
if(empty($this->products)) die($this->locate($this->createLink('product', 'showErrorNone', 'fromModule=testsuite&moduleGroup=' . $this->lang->navGroup->bug . '&activeMenu=testsuite')));
$productID = $this->product->saveState($productID, $this->products);
$this->loadModel('qa')->setMenu($this->products, $productID);
@@ -130,7 +130,6 @@ class testsuite extends control
}
/* Set menu. */
$this->view->products = $this->products = $this->loadModel('product')->getPairs();
$productID = $this->product->saveState($productID, $this->products);
$this->loadModel('qa')->setMenu($this->products, $productID);
@@ -164,7 +163,6 @@ class testsuite extends control
if($suite->type == 'private' and $suite->addedBy != $this->app->user->account and !$this->app->user->admin) die(js::error($this->lang->error->accessDenied) . js::locate('back'));
/* Set product session. */
$this->view->products = $this->products = $this->loadModel('product')->getPairs();
$productID = $this->product->saveState($suite->product, $this->products);
$this->loadModel('qa')->setMenu($this->products, $productID);
@@ -235,7 +233,6 @@ class testsuite extends control
if($suite->type == 'private' and $suite->addedBy != $this->app->user->account and !$this->app->user->admin) die(js::error($this->lang->error->accessDenied) . js::locate('back'));
/* Set product session. */
$this->view->products = $this->products = $this->loadModel('product')->getPairs();
$productID = $this->product->saveState($suite->product, $this->products);
$this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->testsuite->edit;
@@ -314,7 +311,6 @@ class testsuite extends control
$suite = $this->testsuite->getById($suiteID);
/* Set product session. */
$this->view->products = $this->products = $this->loadModel('product')->getPairs();
$productID = $this->product->saveState($suite->product, $this->products);
/* Load pager. */
+10 -6
View File
@@ -37,17 +37,21 @@ class testtask extends control
{
parent::__construct($moduleName, $methodName);
/* Set testtask menu group. */
$this->projectID = isset($_GET['project']) ? $_GET['project'] : 0;
/* Get product data. */
$projectID = 0;
if($this->app->openApp == 'project')
{
$projectID = $this->session->project;
$products = $this->loadModel('project')->getProducts($projectID, false);
}
if($this->app->openApp == 'qa')
{
$products = $this->product->getPairs();
$this->app->loadConfig('qa');
foreach($this->config->qa->menuList as $module) $this->lang->navGroup->$module = 'qa';
}
$this->loadModel('product');
$this->view->products = $this->products = $this->product->getProductPairsByProject($this->projectID);
if(empty($this->products)) die($this->locate($this->createLink('product', 'showErrorNone', 'fromModule=testtask&moduleGroup=' . $this->lang->navGroup->bug . '&activeMenu=testtask')));
$this->view->products = $this->products = $products;
if(empty($this->products)) die($this->locate($this->createLink('product', 'showErrorNone', "moduleName={$this->app->openApp}&activeMenu=testtask&projectID=$projectID")));
}
/**