* Fix the related link of project story.
This commit is contained in:
@@ -253,7 +253,7 @@ class actionModel extends model
|
||||
{
|
||||
$name = $this->dao->select('name')->from(TABLE_PROJECT)->where('id')->eq($action->extra)->fetch('name');
|
||||
$productID = trim($action->product, ',');
|
||||
if($name) $action->extra = common::hasPriv('projectstory', 'story') ? html::a(helper::createLink('projectstory', 'story', "productID=$productID"), $name) : $name;
|
||||
if($name) $action->extra = common::hasPriv('projectstory', 'story') ? html::a(helper::createLink('projectstory', 'story', "projectID=$action->execution&productID=$productID"), $name) : $name;
|
||||
}
|
||||
elseif($actionName == 'linked2plan')
|
||||
{
|
||||
@@ -293,7 +293,7 @@ class actionModel extends model
|
||||
{
|
||||
$name = $this->dao->select('name')->from(TABLE_PROJECT)->where('id')->eq($action->extra)->fetch('name');
|
||||
$productID = trim($action->product, ',');
|
||||
if($name) $action->extra = common::hasPriv('projectstory', 'story') ? html::a(helper::createLink('projectstory', 'story', "productID=$productID"), "#$action->extra " . $name) : "#$action->extra " . $name;
|
||||
if($name) $action->extra = common::hasPriv('projectstory', 'story') ? html::a(helper::createLink('projectstory', 'story', "projectID=$action->execution&productID=$productID"), "#$action->extra " . $name) : "#$action->extra " . $name;
|
||||
}
|
||||
elseif($actionName == 'unlinkedfrombuild')
|
||||
{
|
||||
|
||||
@@ -109,7 +109,7 @@ class story extends control
|
||||
{
|
||||
$execution = $this->dao->findById((int)$objectID)->from(TABLE_EXECUTION)->fetch();
|
||||
$moduleName = $execution->type == 'project' ? 'projectstory' : 'execution';
|
||||
$param = $execution->type == 'project' ? "project=$objectID" : "executionID=$objectID";
|
||||
$param = $execution->type == 'project' ? "projectID=$objectID&productID=$productID" : "executionID=$objectID";
|
||||
$response['locate'] = $this->createLink($moduleName, 'story', $param);
|
||||
}
|
||||
$this->send($response);
|
||||
@@ -163,7 +163,7 @@ class story extends control
|
||||
setcookie('storyModuleParam', 0, 0, $this->config->webRoot, '', false, true);
|
||||
$execution = $this->dao->findById((int)$objectID)->from(TABLE_EXECUTION)->fetch();
|
||||
$moduleName = $execution->type == 'project' ? 'projectstory' : 'execution';
|
||||
$param = $execution->type == 'project' ? "productID=$productID" : "executionID=$objectID&orderBy=id_desc&browseType=unclosed";
|
||||
$param = $execution->type == 'project' ? "projectID=$objectID&productID=$productID" : "executionID=$objectID&orderBy=id_desc&browseType=unclosed";
|
||||
$response['locate'] = $this->createLink($moduleName, 'story', $param);
|
||||
}
|
||||
if($this->app->getViewType() == 'xhtml') $response['locate'] = $this->createLink('story', 'view', "storyID=$storyID");
|
||||
@@ -406,7 +406,7 @@ class story extends control
|
||||
{
|
||||
setcookie('storyModuleParam', 0, 0, $this->config->webRoot, '', false, false);
|
||||
$moduleName = $execution->type == 'project' ? 'projectstory' : 'execution';
|
||||
$param = $execution->type == 'project' ? "productID=$productID" : "executionID=$executionID&orderBy=id_desc&browseType=unclosed";
|
||||
$param = $execution->type == 'project' ? "projectID=$executionID&productID=$productID" : "executionID=$executionID&orderBy=id_desc&browseType=unclosed";
|
||||
$link = $this->createLink($moduleName, 'story', $param);
|
||||
die(js::locate($link, 'parent'));
|
||||
}
|
||||
|
||||
+88
-5
@@ -698,6 +698,89 @@ class treeModel extends model
|
||||
return $menu;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the tree menu of case in html.
|
||||
*
|
||||
* @param int $rootID
|
||||
* @param int $productID
|
||||
* @param int $startModule
|
||||
* @param int $userFunc
|
||||
* @param string $extra
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getCaseTreeMenu($rootID, $productID = 0, $startModule = 0, $userFunc, $extra = '')
|
||||
{
|
||||
$extra = array('projectID' => $rootID, 'productID' => $productID, 'tip' => true, 'extra' => $extra);
|
||||
|
||||
/* If createdVersion <= 4.1, go to getTreeMenu(). */
|
||||
$products = $this->loadModel('product')->getProductPairsByProject($rootID);
|
||||
$branchGroups = $this->loadModel('branch')->getByProducts(array_keys($products));
|
||||
|
||||
/* createdVersion > 4.1. */
|
||||
$menu = "<ul id='modules' class='tree' data-ride='tree' data-name='tree-case'>";
|
||||
|
||||
/* Set the start module. */
|
||||
$startModulePath = '';
|
||||
if($startModule > 0)
|
||||
{
|
||||
$startModule = $this->getById($startModule);
|
||||
if($startModule) $startModulePath = $startModule->path . '%';
|
||||
}
|
||||
|
||||
/* Get module according to product. */
|
||||
$productNum = count($products);
|
||||
foreach($products as $id => $product)
|
||||
{
|
||||
$extra['productID'] = $id;
|
||||
$link = helper::createLink('testcase', 'browse', "productID=$id");
|
||||
$menu .= "<li>" . html::a($link, $product, '_self', "id='product$id' data-app='project'");
|
||||
|
||||
/* tree menu. */
|
||||
$tree = '';
|
||||
if(empty($branchGroups[$id])) $branchGroups[$id]['0'] = '';
|
||||
foreach($branchGroups[$id] as $branch => $branchName)
|
||||
{
|
||||
$treeMenu = array();
|
||||
$query = $this->dao->select('*')->from(TABLE_MODULE)->where("((root = $id and type = 'case') OR (root = $id and type = 'story' and branch ='$branch'))")
|
||||
->beginIF($startModulePath)->andWhere('path')->like($startModulePath)->fi()
|
||||
->andWhere('deleted')->eq(0)
|
||||
->orderBy('grade desc, `order`, type')
|
||||
->get();
|
||||
$stmt = $this->dbh->query($query);
|
||||
while($module = $stmt->fetch())
|
||||
{
|
||||
$this->buildTree($treeMenu, $module, 'case', $userFunc, $extra);
|
||||
}
|
||||
if(isset($treeMenu[0]) and $branch) $treeMenu[0] = "<li><a>$branchName</a><ul>{$treeMenu[0]}</ul></li>";
|
||||
$tree .= isset($treeMenu[0]) ? $treeMenu[0] : '';
|
||||
}
|
||||
|
||||
if($tree) $tree = "<ul>" . $tree . "</ul>\n</li>";
|
||||
$menu .= $tree;
|
||||
}
|
||||
|
||||
/* Get case module. */
|
||||
if($startModule == 0)
|
||||
{
|
||||
/* tree menu. */
|
||||
$treeMenu = array();
|
||||
$query = $this->dao->select('*')->from(TABLE_MODULE)
|
||||
->where('root')->eq((int)$rootID)
|
||||
->andWhere('type')->eq('case')
|
||||
->andWhere('deleted')->eq(0)
|
||||
->orderBy('grade desc, `order`, type')
|
||||
->get();
|
||||
$stmt = $this->dbh->query($query);
|
||||
while($module = $stmt->fetch()) $this->buildTree($treeMenu, $module, 'case', $userFunc, $extra);
|
||||
|
||||
$tree = isset($treeMenu[0]) ? $treeMenu[0] : '';
|
||||
$menu .= $tree . '</li>';
|
||||
}
|
||||
$menu .= '</ul>';
|
||||
return $menu;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get execution story tree menu.
|
||||
*
|
||||
@@ -731,8 +814,8 @@ class treeModel extends model
|
||||
$productNum = count($products);
|
||||
foreach($products as $id => $product)
|
||||
{
|
||||
$extra['productID'] = $id;
|
||||
$projectProductLink = helper::createLink('projectstory', 'story', "productID=$id");
|
||||
$extra['productID'] = $id;
|
||||
$projectProductLink = helper::createLink('projectstory', 'story', "projectID=$rootID&productID=$id");
|
||||
$executionProductLink = helper::createLink('execution', 'story', "executionID=$rootID&ordery=&status=byProduct&praram=$id");
|
||||
$link = $this->app->rawModule == 'projectstory' ? $projectProductLink : $executionProductLink;
|
||||
if($productNum > 1) $menu .= "<li>" . html::a($link, $product, '_self', "id='product$id'");
|
||||
@@ -761,7 +844,7 @@ class treeModel extends model
|
||||
if((isset($treeMenu[0]) and $branch) or isset($executionBranches[$branch]))
|
||||
{
|
||||
$childMenu = isset($treeMenu[0]) ? "<ul>{$treeMenu[0]}</ul>" : '';
|
||||
$projectBranchLink = helper::createLink('projectstory', 'story', "productID=$id&branch=" . (empty($branch) ? 0 : $branch) . "&browseType=byBranch");
|
||||
$projectBranchLink = helper::createLink('projectstory', 'story', "projectID=$rootID&productID=$id&branch=" . (empty($branch) ? 0 : $branch) . "&browseType=byBranch");
|
||||
$executionBranchLink = helper::createLink('execution', 'story', "executionID=$rootID&ordery=&status=byBranch&praram=" . (empty($branch) ? "{$id},0" : $branch));
|
||||
$link = $this->app->rawModule == 'projectstory' ? $projectBranchLink : $executionBranchLink;
|
||||
if($branchName) $treeMenu[0] = "<li>" . html::a($link, $branchName, '_self', "id='branch" . (empty($branch) ? "{$id}_0" : $branch) . "'") . "{$childMenu}</li>";
|
||||
@@ -979,7 +1062,7 @@ class treeModel extends model
|
||||
public function createProjectStoryLink($type, $module, $extra)
|
||||
{
|
||||
$productID = $extra['productID'];
|
||||
return html::a(helper::createLink('projectstory', 'story', "productID=$productID&branch=&browseType=byModule¶m={$module->id}"), $module->name, '_self', "id='module{$module->id}'");
|
||||
return html::a(helper::createLink('projectstory', 'story', "projectID={$extra['executionID']}productID=$productID&branch=&browseType=byModule¶m={$module->id}"), $module->name, '_self', "id='module{$module->id}'");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1104,7 +1187,7 @@ class treeModel extends model
|
||||
*/
|
||||
public function createCaseLink($type, $module)
|
||||
{
|
||||
return html::a(helper::createLink('testcase', 'browse', "root={$module->root}&branch=&type=byModule¶m={$module->id}"), $module->name, '_self', "id='module{$module->id}'");
|
||||
return html::a(helper::createLink('testcase', 'browse', "root={$module->root}&branch=&type=byModule¶m={$module->id}"), $module->name, '_self', "id='module{$module->id}' data-app='{$this->app->openApp}'");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user