diff --git a/module/product/view/ajaxgetdropmenu.html.php b/module/product/view/ajaxgetdropmenu.html.php
index 6a5d10b94b..f63a46f97b 100644
--- a/module/product/view/ajaxgetdropmenu.html.php
+++ b/module/product/view/ajaxgetdropmenu.html.php
@@ -20,6 +20,12 @@ $myProductsHtml = '';
$normalProductsHtml = '';
$closedProductsHtml = '';
+if($this->app->openApp == 'project' and $this->app->rawModule == 'testcase')
+{
+ $linkHtml = $this->product->setParamsForLink($module, $link, $projectID, 0);
+ $myProductsHtml .= html::a($linkHtml, $this->lang->product->all, '', "class='text-important' title='{$this->lang->product->all}' data-key='" . zget($productsPinYin, $this->lang->product->all, '') . "' data-app='project'");
+}
+
foreach($products as $product)
{
$selected = $product->id == $productID ? 'selected' : '';
diff --git a/module/program/view/browsebylist.html.php b/module/program/view/browsebylist.html.php
index 810b60bcf5..e94f95c7fd 100644
--- a/module/program/view/browsebylist.html.php
+++ b/module/program/view/browsebylist.html.php
@@ -45,7 +45,8 @@
>
| ' title='name?>'>
-
+ type == 'program' ? ' table-nest-toggle' : '';?>
+
type == 'program'):?>
createLink('program', 'product', "programID=$program->id"), $program->name);?>
@@ -122,7 +123,6 @@
#programList .c-actions {overflow: visible;}
#programTableList > tr:last-child .c-actions .dropdown-menu {top: auto; bottom: 100%; margin-bottom: -5px;}
#programTableList .icon-project:before {content: '\e99c'; width: 22px; height: 22px; background: none; color: #16a8f8; top: 0; line-height: 22px; margin-right: 2px; font-size: 14px}
-#programTableList .no-nest .icon-program:before, #programTableList .is-nest-child .icon-program:before {width: 10px; min-width: 10px; height: 10px; top: 1px}
diff --git a/module/story/control.php b/module/story/control.php
index 39e2993cc0..fd280e6b9e 100644
--- a/module/story/control.php
+++ b/module/story/control.php
@@ -1458,9 +1458,16 @@ class story extends control
$products = $this->product->getPairs();
$this->loadModel('testcase');
- $this->app->rawModule = 'testcase';
- $this->loadModel('qa')->setMenu($products, $productID);
- foreach($this->config->qa->menuList as $module) $this->lang->navGroup->$module = 'qa';
+ if($this->app->openApp == 'project')
+ {
+ $this->loadModel('project')->setMenu($this->session->project);
+ }
+ else
+ {
+ $this->app->rawModule = 'testcase';
+ $this->loadModel('qa')->setMenu($products, $productID);
+ foreach($this->config->qa->menuList as $module) $this->lang->navGroup->$module = 'qa';
+ }
/* Append id for secend sort. */
$sort = $this->loadModel('common')->appendOrder($orderBy);
diff --git a/module/testcase/control.php b/module/testcase/control.php
index 010bece620..3c3f60f5bb 100644
--- a/module/testcase/control.php
+++ b/module/testcase/control.php
@@ -40,9 +40,7 @@ class testcase extends control
$this->loadModel('tree');
$this->loadModel('user');
- /* Set test case menu group. */
- $this->projectID = isset($_GET['PRJ']) ? $_GET['PRJ'] : 0;
- $this->view->products = $this->products = $this->product->getProductPairsByProject($this->projectID);
+ $this->view->products = $this->products = $this->product->getPairs();
if(empty($this->products)) die($this->locate($this->createLink('product', 'showErrorNone', "fromModule=testcase")));
}
@@ -67,10 +65,11 @@ class testcase extends control
* @param int $recTotal
* @param int $recPerPage
* @param int $pageID
+ * @param int $projectID
* @access public
* @return void
*/
- public function browse($productID = 0, $branch = '', $browseType = 'all', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
+ public function browse($productID = 0, $branch = '', $browseType = 'all', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1, $projectID = 0)
{
$this->loadModel('datatable');
@@ -78,7 +77,7 @@ class testcase extends control
$browseType = strtolower($browseType);
/* Set browseType, productID, moduleID and queryID. */
- $productID = $this->product->saveState($productID, $this->products);
+ $productID = $this->app->openApp != 'project' ? $this->product->saveState($productID, $this->products) : $productID;
$branch = ($branch === '') ? (int)$this->cookie->preBranch : (int)$branch;
setcookie('preProductID', $productID, $this->config->cookieLife, $this->config->webRoot, '', false, true);
setcookie('preBranch', (int)$branch, $this->config->cookieLife, $this->config->webRoot, '', false, true);
@@ -97,7 +96,8 @@ class testcase extends control
$queryID = ($browseType == 'bysearch') ? (int)$param : 0;
/* Set menu, save session. */
- $this->testcase->setMenu($this->products, $productID, $branch, $moduleID, $suiteID, $orderBy);
+ if($this->app->openApp == 'project') $this->products = array('0' => $this->lang->product->all) + $this->products;
+ $this->app->openApp == 'project' ? $this->loadModel('project')->setMenu($projectID) : $this->testcase->setMenu($this->products, $productID, $branch, $moduleID, $suiteID, $orderBy);
$this->session->set('caseList', $this->app->getURI(true));
$this->session->set('productID', $productID);
$this->session->set('moduleID', $moduleID);
@@ -136,6 +136,16 @@ class testcase extends control
$showModule = !empty($this->config->datatable->testcaseBrowse->showModule) ? $this->config->datatable->testcaseBrowse->showModule : '';
$this->view->modulePairs = $showModule ? $this->tree->getModulePairs($productID, 'case', $showModule) : array();
+ /* Get module tree.*/
+ if($projectID and empty($productID))
+ {
+ $moduleTree = $this->tree->getCaseTreeMenu($projectID, $productID, 0, array('treeModel', 'createCaseLink'));
+ }
+ else
+ {
+ $moduleTree = $this->tree->getTreeMenu($productID, $viewType = 'case', $startModuleID = 0, array('treeModel', 'createCaseLink'), '', $branch);
+ }
+
/* Assign. */
$tree = $moduleID ? $this->tree->getByID($moduleID) : '';
$this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->testcase->common;
@@ -145,7 +155,7 @@ class testcase extends control
$this->view->product = $this->product->getById($productID);
$this->view->productName = $this->products[$productID];
$this->view->modules = $this->tree->getOptionMenu($productID, $viewType = 'case', $startModuleID = 0, $branch);
- $this->view->moduleTree = $this->tree->getTreeMenu($productID, $viewType = 'case', $startModuleID = 0, array('treeModel', 'createCaseLink'), '', $branch);
+ $this->view->moduleTree = $moduleTree;
$this->view->moduleName = $moduleID ? $tree->name : $this->lang->tree->all;
$this->view->moduleID = $moduleID;
$this->view->summary = $this->testcase->summary($cases);
@@ -180,7 +190,7 @@ class testcase extends control
$this->app->loadLang('testtask');
- $this->testcase->setMenu($this->products, $productID, $branch);
+ $this->app->openApp == 'project' ? $this->loadModel('project')->setMenu($this->session->project) : $this->testcase->setMenu($this->products, $productID, $branch);
$this->session->set('caseList', $this->app->getURI(true));
$cases = $this->testcase->getModuleCases($productID, $branch, 0, $groupBy);
@@ -268,6 +278,8 @@ class testcase extends control
$this->loadModel('action');
$this->action->create('case', $caseID, 'Opened');
+ if($this->app->openApp == 'project') $this->action->create('case', $caseID, 'linked2project', '', $this->session->PRJ);
+ if($this->app->openApp == 'execution') $this->action->create('case', $caseID, 'linked2execution', '', $this->session->execution);
$this->executeHooks($caseID);
@@ -286,7 +298,7 @@ class testcase extends control
if($branch === '') $branch = (int)$this->cookie->preBranch;
/* Set menu. */
- $this->testcase->setMenu($this->products, $productID, $branch);
+ $this->app->openApp == 'project' ? $this->loadModel('project')->setMenu($this->session->project) : $this->testcase->setMenu($this->products, $productID, $branch);
/* Init vars. */
$type = 'feature';
@@ -430,7 +442,7 @@ class testcase extends control
$currentModuleID = (int)$moduleID;
/* Set menu. */
- $this->testcase->setMenu($this->products, $productID, $branch);
+ $this->app->openApp == 'project' ? $this->loadModel('project')->setMenu($this->session->project) : $this->testcase->setMenu($this->products, $productID, $branch);
/* Set story list. */
$story = $storyID ? $this->story->getByID($storyID) : '';
@@ -678,7 +690,7 @@ class testcase extends control
$position[] = html::a($this->createLink('testcase', 'browse', "productID=$productID"), $this->products[$productID]);
/* Set menu. */
- $this->testcase->setMenu($this->products, $productID, $case->branch);
+ $this->app->openApp == 'project' ? $this->loadModel('project')->setMenu($this->session->project) : $this->testcase->setMenu($this->products, $productID, $case->branch);
$moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'case', $startModuleID = 0, $case->branch);
if($case->lib and $case->fromCaseID)
@@ -745,6 +757,7 @@ class testcase extends control
$caseIDList = array_unique($caseIDList);
$branchProduct = false;
+ if($this->app->openApp == 'project') $this->loadModel('project')->setMenu($this->session->project);
/* The cases of a product. */
if($productID)
{
@@ -769,7 +782,7 @@ class testcase extends control
else
{
$product = $this->product->getByID($productID);
- $this->testcase->setMenu($this->products, $productID, $branch);
+ $this->app->openApp == 'project' ? $this->loadModel('project')->setMenu($this->session->project) : $this->testcase->setMenu($this->products, $productID, $branch);
if($product->type != 'normal') $branchProduct = true;
@@ -788,7 +801,9 @@ class testcase extends control
/* Get the edited cases. */
$cases = $this->dao->select('t1.*,t2.id as runID')->from(TABLE_CASE)->alias('t1')
->leftJoin(TABLE_TESTRUN)->alias('t2')->on('t1.id = t2.case')
- ->where('t2.id')->in($caseIDList)
+ ->where('t1.deleted')->eq(0)
+ ->beginIF($this->app->openApp == 'my')->andWhere('t2.id')->in($caseIDList)->fi()
+ ->beginIF($this->app->openApp != 'my')->andWhere('t1.id')->in($caseIDList)->fi()
->fetchAll('id');
$caseIDList = array_keys($cases);
@@ -818,7 +833,7 @@ class testcase extends control
// if(!$this->testcase->forceNotReview()) unset($this->lang->testcase->statusList['wait']); /* Bug#1343 */
/* Judge whether the editedCases is too large and set session. */
- $countInputVars = count($cases) * (count(explode(',', $this->config->testcase->custom->batchEditFields)) + 3);
+ $countInputVars = count($cases) * (count(explode(',', $this->config->testcase->custom->batchEditFields)) + 3);
$showSuhosinInfo = common::judgeSuhosinSetting($countInputVars);
if($showSuhosinInfo) $this->view->suhosinInfo = extension_loaded('suhosin') ? sprintf($this->lang->suhosinInfo, $countInputVars) : sprintf($this->lang->maxVarsInfo, $countInputVars);
diff --git a/module/testcase/model.php b/module/testcase/model.php
index b8f4f1ce1b..026eb169e9 100644
--- a/module/testcase/model.php
+++ b/module/testcase/model.php
@@ -202,6 +202,8 @@ class testcaseModel extends model
$this->loadModel('score')->create('testcase', 'create', $caseID);
$actionID = $this->loadModel('action')->create('case', $caseID, 'Opened');
+ if($this->app->openApp == 'project') $this->action->create('case', $caseID, 'linked2project', '', $this->session->PRJ);
+ if($this->app->openApp == 'execution') $this->action->create('case', $caseID, 'linked2execution', '', $this->session->execution);
}
if(!dao::isError()) $this->loadModel('score')->create('ajax', 'batchCreate');
}
@@ -251,7 +253,8 @@ class testcaseModel extends model
->leftJoin(TABLE_CASE)->alias('t2')->on('t1.case=t2.id')
->leftJoin(TABLE_PROJECTSTORY)->alias('t3')->on('t3.story=t2.story')
->leftJoin(TABLE_STORY)->alias('t4')->on('t3.story=t4.id')
- ->where('t2.product')->eq((int)$productID)
+ ->where('1=1')
+ ->beginIF(!empty((int)$productID))->andWhere('t2.product')->eq((int)$productID)->fi()
->beginIF($this->app->openApp == 'project')->andWhere('t1.project')->eq($this->session->project)->fi()
->beginIF($branch)->andWhere('t2.branch')->eq($branch)->fi()
->beginIF($moduleIdList)->andWhere('t2.module')->in($moduleIdList)->fi()
@@ -411,7 +414,7 @@ class testcaseModel extends model
$cases = array();
if($browseType == 'bymodule' or $browseType == 'all' or $browseType == 'wait')
{
- if($group == 'project')
+ if($this->app->openApp == 'project')
{
$cases = $this->getModuleProjectCases($productID, $branch, $modules, $sort, $pager, $browseType, $auto);
}
@@ -423,12 +426,14 @@ class testcaseModel extends model
/* Cases need confirmed. */
elseif($browseType == 'needconfirm')
{
- $cases = $this->dao->select('t1.*, t2.title AS storyTitle')->from(TABLE_CASE)->alias('t1')->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story = t2.id')
+ $cases = $this->dao->select('t1.*, t2.title AS storyTitle')->from(TABLE_CASE)->alias('t1')
+ ->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story = t2.id')
+ ->leftJoin(TABLE_PROJECTCASE)->alias('t3')->on('t1.id = t3.case')
->where("t2.status = 'active'")
->andWhere('t1.deleted')->eq(0)
->andWhere('t2.version > t1.storyVersion')
- ->andWhere('t1.product')->eq($productID)
- ->beginIF($this->lang->navGroup->testcase != 'qa')->andWhere('t1.project')->eq($this->session->project)->fi()
+ ->beginIF(!empty($productID))->andWhere('t1.product')->eq($productID)->fi()
+ ->beginIF($this->app->openApp == 'project')->andWhere('t3.project')->eq($this->session->project)->fi()
->beginIF($branch)->andWhere('t1.branch')->eq($branch)->fi()
->beginIF($modules)->andWhere('t1.module')->in($modules)->fi()
->beginIF($auto != 'unit')->andWhere('t1.auto')->ne('unit')->fi()
@@ -1353,9 +1358,18 @@ class testcaseModel extends model
*/
public function buildSearchForm($productID, $products, $queryID, $actionURL)
{
- $this->config->testcase->search['params']['product']['values'] = array($productID => $products[$productID], 'all' => $this->lang->testcase->allProduct);
- $this->config->testcase->search['params']['module']['values'] = $this->loadModel('tree')->getOptionMenu($productID, $viewType = 'case');
- $this->config->testcase->search['params']['lib']['values'] = $this->loadModel('caselib')->getLibraries();
+ $product = ($this->app->openApp == 'project' and empty($productID)) ? $products : array($productID => $products[$productID]);
+ $this->config->testcase->search['params']['product']['values'] = $product + array('all' => $this->lang->testcase->allProduct);
+
+ $module = $this->loadModel('tree')->getOptionMenu($productID, 'case', 0);
+ if(!$productID)
+ {
+ $module = array();
+ foreach($products as $id => $product) $module += $this->loadModel('tree')->getOptionMenu($id, 'case', 0);
+ }
+ $this->config->testcase->search['params']['module']['values'] = $module;
+
+ $this->config->testcase->search['params']['lib']['values'] = $this->loadModel('caselib')->getLibraries();
if($this->session->currentProductType == 'normal')
{
@@ -1429,7 +1443,7 @@ class testcaseModel extends model
if($canBatchAction)
{
$disabled = $canBeChanged ? '' : 'disabled';
- echo html::checkbox('caseIDList', array($case->id => ''), '', $disabled) . html::a(helper::createLink('testcase', 'view', "caseID=$case->id"), sprintf('%03d', $case->id));
+ echo html::checkbox('caseIDList', array($case->id => ''), '', $disabled) . html::a(helper::createLink('testcase', 'view', "caseID=$case->id"), sprintf('%03d', $case->id), '', "data-app='{$this->app->openApp}'");
}
else
{
@@ -1444,7 +1458,7 @@ class testcaseModel extends model
case 'title':
if($case->branch) echo "{$branches[$case->branch]} ";
if($modulePairs and $case->module) echo "{$modulePairs[$case->module]} ";
- echo $canView ? ($fromCaseID ? html::a($caseLink, $case->title, null, "style='color: $case->color'") . html::a(helper::createLink('testcase', 'view', "caseID=$fromCaseID"), "[#$fromCaseID]") : html::a($caseLink, $case->title, null, "style='color: $case->color'")) : "$case->title";
+ echo $canView ? ($fromCaseID ? html::a($caseLink, $case->title, null, "style='color: $case->color' data-app='{$this->app->openApp}'") . html::a(helper::createLink('testcase', 'view', "caseID=$fromCaseID"), "[#$fromCaseID]", '', "data-app='{$this->app->openApp}'") : html::a($caseLink, $case->title, null, "style='color: $case->color' data-app='{$this->app->openApp}'")) : "$case->title";
break;
case 'branch':
echo $branches[$case->branch];
@@ -1534,7 +1548,7 @@ class testcaseModel extends model
}
common::printIcon('testtask', 'results', "runID=0&caseID=$case->id", $case, 'list', '', '', 'iframe', true, "data-width='95%'");
- common::printIcon('testtask', 'runCase', "runID=0&caseID=$case->id&version=$case->version", $case, 'list', 'run', '', 'runCase iframe', false, "data-width='95%'");
+ common::printIcon('testtask', 'runCase', "runID=0&caseID=$case->id&version=$case->version", $case, 'list', 'play', '', 'runCase iframe', false, "data-width='95%'");
common::printIcon('testcase', 'edit', "caseID=$case->id", $case, 'list');
if($this->config->testcase->needReview or !empty($this->config->testcase->forceReview)) common::printIcon('testcase', 'review', "caseID=$case->id", $case, 'list', 'glasses', '', 'iframe');
common::printIcon('testcase', 'createBug', "product=$case->product&branch=$case->branch&extra=caseID=$case->id,version=$case->version,runID=", $case, 'list', 'bug', '', 'iframe', '', "data-width='90%'");
@@ -1678,7 +1692,6 @@ class testcaseModel extends model
}
}
-
/**
* Deal with the relationship between the case and project when edit the case.
*
@@ -1707,8 +1720,10 @@ class testcaseModel extends model
{
/* If the new related story isn't linked the project, unlink the case. */
$projects = $this->dao->select('project')->from(TABLE_PROJECTSTORY)->where('story')->eq($oldCase->story)->fetchAll('project');
+
+ $projectIdList = array_keys($projects);
$this->dao->delete()->from(TABLE_PROJECTCASE)
- ->where('project')->in(array_keys($projects))
+ ->where('project')->in()
->andWhere('`case`')->eq($oldCase->id)
->exec();
diff --git a/module/testcase/view/caseheader.html.php b/module/testcase/view/caseheader.html.php
index e522faa650..fe9d7a8078 100644
--- a/module/testcase/view/caseheader.html.php
+++ b/module/testcase/view/caseheader.html.php
@@ -1,4 +1,8 @@
global->flow);?>
+app->openApp == 'project'?>
+
+
+session->project}&" : '';?>
global->flow == 'full'):?>
|