diff --git a/module/tree/lang/en.php b/module/tree/lang/en.php
index fb2662b3ae..127705ca0c 100644
--- a/module/tree/lang/en.php
+++ b/module/tree/lang/en.php
@@ -25,7 +25,10 @@ $lang->tree->manageCase = 'Manage case module';
$lang->tree->manageWebapp = 'Manage web app category';
$lang->tree->manageCustomDoc = 'Manage doc library type';
$lang->tree->updateOrder = 'Update order';
-$lang->tree->manageChild = 'Manage child';
+$lang->tree->manageStoryChild = 'Manage child';
+$lang->tree->manageBugChild = 'Manage bug child';
+$lang->tree->manageCaseChild = 'Manage case child';
+$lang->tree->manageTaskChild = 'Manage project child';
$lang->tree->syncFromProduct = 'Copy from product module';
$lang->tree->syncFromProject = 'Copy from project module';
$lang->tree->ajaxGetOptionMenu = 'API: Get select menu';
diff --git a/module/tree/lang/zh-cn.php b/module/tree/lang/zh-cn.php
index 980e252a4c..9a6579d3be 100644
--- a/module/tree/lang/zh-cn.php
+++ b/module/tree/lang/zh-cn.php
@@ -25,7 +25,10 @@ $lang->tree->manageCase = '维护用例视图模块';
$lang->tree->manageWebapp = '维护WEB应用分类';
$lang->tree->manageCustomDoc = '维护文档库分类';
$lang->tree->updateOrder = '更新排序';
-$lang->tree->manageChild = '维护子模块';
+$lang->tree->manageStoryChild = '维护子模块';
+$lang->tree->manageBugChild = '维护Bug子模块';
+$lang->tree->manageCaseChild = '维护用例子模块';
+$lang->tree->manageTaskChild = '维护项目子模块';
$lang->tree->syncFromProduct = '复制产品视图模块';
$lang->tree->syncFromProject = '复制项目视图模块';
$lang->tree->ajaxGetOptionMenu = '接口:获取下拉列表';
diff --git a/module/tree/model.php b/module/tree/model.php
index 76aef9bf58..2d57956fd7 100644
--- a/module/tree/model.php
+++ b/module/tree/model.php
@@ -44,12 +44,51 @@ class treeModel extends model
if($startModule) $startModulePath = $startModule->path . '%';
}
+ /* Get createdVersion. */
+ if($type == 'task')
+ {
+ $createdVersion = $this->dao->select('openedVersion')->from(TABLE_PROJECT)
+ ->where('id')->eq($rootID)
+ ->fetch('openedVersion');
+ }
+ else
+ {
+ $createdVersion = $this->dao->select('createdVersion')->from(TABLE_PRODUCT)
+ ->where('id')->eq($rootID)
+ ->fetch('createdVersion');
+ }
+
+ if($createdVersion and version_compare($createdVersion, '4.1', '>') and $type != 'story')
+ {
+ if($type == 'bug' or $type == 'case')
+ {
+ return $this->dao->select('*')->from(TABLE_MODULE)
+ ->where('root')->eq((int)$rootID)
+ ->andWhere('type')->in("story,$type")
+ ->beginIF($startModulePath)->andWhere('path')->like($startModulePath)->fi()
+ ->orderBy('grade desc, type desc, `order`')
+ ->get();
+ }
+
+ /* $type == 'task' */
+ $products = $this->dao->select('product')->from(TABLE_PROJECTPRODUCT)
+ ->where('project')->eq($rootID)
+ ->fetchPairs();
+ $products = implode(',', $products);
+ return $this->dao->select('*')->from(TABLE_MODULE)
+ ->where("(root = $rootID and type = 'task') or (root in('$products') and type = 'story')")
+ ->beginIF($startModulePath)->andWhere('path')->like($startModulePath)->fi()
+ ->orderBy('type, grade desc, `order`')
+ ->get();
+ }
+
+ /* $createdVersion > 4.1 or $type == 'story'*/
return $this->dao->select('*')->from(TABLE_MODULE)
->where('root')->eq((int)$rootID)
->andWhere('type')->eq($type)
->beginIF($startModulePath)->andWhere('path')->like($startModulePath)->fi()
->orderBy('grade desc, `order`')
- ->get();
+ ->get();
}
/**
@@ -134,13 +173,13 @@ class treeModel extends model
$stmt = $this->dbh->query($this->buildMenuQuery($rootID, $type, $startModule));
while($module = $stmt->fetch())
{
- $linkHtml = call_user_func($userFunc, $module, $extra);
+ $linkHtml = call_user_func($userFunc, $type, $module, $extra);
if(isset($treeMenu[$module->id]) and !empty($treeMenu[$module->id]))
{
if(!isset($treeMenu[$module->parent])) $treeMenu[$module->parent] = '';
$treeMenu[$module->parent] .= "
$linkHtml";
- $treeMenu[$module->parent] .= "".$treeMenu[$module->id]."
\n";
+ $treeMenu[$module->parent] .= "" . $treeMenu[$module->id] . "
\n";
}
else
{
@@ -151,7 +190,7 @@ class treeModel extends model
else
{
$treeMenu[$module->parent] = "$linkHtml\n";
- }
+ }
}
$treeMenu[$module->parent] .= "\n";
}
@@ -268,7 +307,7 @@ class treeModel extends model
* @access public
* @return string
*/
- public function createStoryLink($module)
+ public function createStoryLink($type, $module)
{
$linkHtml = html::a(helper::createLink('product', 'browse', "root={$module->root}&type=byModule¶m={$module->id}"), $module->name, '_self', "id='module{$module->id}'");
return $linkHtml;
@@ -281,7 +320,7 @@ class treeModel extends model
* @access public
* @return string
*/
- public function createTaskLink($module)
+ public function createTaskLink($type, $module)
{
$linkHtml = html::a(helper::createLink('project', 'task', "root={$module->root}&type=byModule¶m={$module->id}"), $module->name, '_self', "id='module{$module->id}'");
return $linkHtml;
@@ -294,7 +333,7 @@ class treeModel extends model
* @access public
* @return string
*/
- public function createDocLink($module)
+ public function createDocLink($type, $module)
{
$linkHtml = html::a(helper::createLink('doc', 'browse', "libID={$module->root}&&module={$module->id}"), $module->name, '_self', "id='module{$module->id}'");
return $linkHtml;
@@ -307,16 +346,23 @@ class treeModel extends model
* @access public
* @return string
*/
- public function createManageLink($module)
+ public function createManageLink($type, $module)
{
static $users;
if(empty($users)) $users = $this->loadModel('user')->getPairs('noletter');
$linkHtml = $module->name;
if($module->type == 'bug' and $module->owner) $linkHtml .= '[' . $users[$module->owner] . ']';
- if(common::hasPriv('tree', 'edit')) $linkHtml .= ' ' . html::a(helper::createLink('tree', 'edit', "module={$module->id}"), $this->lang->tree->edit, '', 'class="iframe"');
- if(common::hasPriv('tree', 'browse') and strpos('productdoc,projectdoc', $module->type) === false and $module->type != 'webapp') $linkHtml .= ' ' . html::a(helper::createLink('tree', 'browse', "root={$module->root}&type={$module->type}&module={$module->id}"), $this->lang->tree->child);
- if(common::hasPriv('tree', 'delete')) $linkHtml .= ' ' . html::a(helper::createLink('tree', 'delete', "root={$module->root}&module={$module->id}"), $this->lang->delete, 'hiddenwin');
- if(common::hasPriv('tree', 'updateorder')) $linkHtml .= ' ' . html::input("orders[$module->id]", $module->order, 'style="width:30px;text-align:center"');
+ if($type != 'story' and $module->type == 'story')
+ {
+ if(common::hasPriv('tree', 'browse')) $linkHtml .= ' ' . html::a(helper::createLink('tree', 'browse', "root={$module->root}&type=$type&module={$module->id}"), $this->lang->tree->child);
+ }
+ else
+ {
+ if(common::hasPriv('tree', 'edit')) $linkHtml .= ' ' . html::a(helper::createLink('tree', 'edit', "module={$module->id}"), $this->lang->tree->edit, '', 'class="iframe"');
+ if(common::hasPriv('tree', 'browse') and strpos('productdoc,projectdoc', $module->type) === false and $module->type != 'webapp') $linkHtml .= ' ' . html::a(helper::createLink('tree', 'browse', "root={$module->root}&type=$type&module={$module->id}"), $this->lang->tree->child);
+ if(common::hasPriv('tree', 'delete')) $linkHtml .= ' ' . html::a(helper::createLink('tree', 'delete', "root={$module->root}&module={$module->id}"), $this->lang->delete, 'hiddenwin');
+ if(common::hasPriv('tree', 'updateorder')) $linkHtml .= ' ' . html::input("orders[$module->id]", $module->order, 'style="width:30px;text-align:center"');
+ }
return $linkHtml;
}
@@ -327,7 +373,7 @@ class treeModel extends model
* @access public
* @return string
*/
- public function createBugLink($module)
+ public function createBugLink($type, $module)
{
$linkHtml = html::a(helper::createLink('bug', 'browse', "root={$module->root}&type=byModule¶m={$module->id}"), $module->name, '_self', "id='module{$module->id}'");
return $linkHtml;
@@ -340,7 +386,7 @@ class treeModel extends model
* @access public
* @return string
*/
- public function createCaseLink($module)
+ public function createCaseLink($type, $module)
{
$linkHtml = html::a(helper::createLink('testcase', 'browse', "root={$module->root}&type=byModule¶m={$module->id}"), $module->name, '_self', "id='module{$module->id}'");
return $linkHtml;
diff --git a/module/tree/view/browse.html.php b/module/tree/view/browse.html.php
index 4be662a9c3..d5911f8e5f 100644
--- a/module/tree/view/browse.html.php
+++ b/module/tree/view/browse.html.php
@@ -33,7 +33,8 @@
|