From 76f2c77cf974b22959333442d851be179fd8660a Mon Sep 17 00:00:00 2001 From: zhujinyong Date: Thu, 6 Jun 2013 02:21:59 +0000 Subject: [PATCH] * code for task#1368. --- module/tree/model.php | 10 ++++++---- module/tree/view/browse.html.php | 3 ++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/module/tree/model.php b/module/tree/model.php index f3d18afa87..d2d1084782 100644 --- a/module/tree/model.php +++ b/module/tree/model.php @@ -78,7 +78,7 @@ class treeModel extends model 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`') + ->orderBy('grade desc, type, `order`') ->get(); } @@ -351,10 +351,11 @@ class treeModel extends model static $users; if(empty($users)) $users = $this->loadModel('user')->getPairs('noletter'); $linkHtml = $module->name; + $linkHtml .= $module->type != 'story' ? ' [' . strtoupper(substr($module->type, 0, 1)) . ']' : ''; if($type == 'bug' and $module->owner) $linkHtml .= '[' . $users[$module->owner] . ']'; if($type != 'story' and $module->type == 'story') { - if(common::hasPriv('tree', 'edit')) $linkHtml .= ' ' . html::a(helper::createLink('tree', 'edit', "module={$module->id}&type=$type"), $this->lang->tree->edit, '', 'class="iframe"'); + if(common::hasPriv('tree', 'edit') and $type == 'bug') $linkHtml .= ' ' . html::a(helper::createLink('tree', 'edit', "module={$module->id}&type=$type"), $this->lang->tree->edit, '', 'class="iframe"'); 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 @@ -434,8 +435,9 @@ class treeModel extends model return $this->dao->select('*')->from(TABLE_MODULE) ->where('root')->eq((int)$rootID) ->andWhere('parent')->eq((int)$moduleID) - ->andWhere('type')->eq($type) - ->orderBy('`order`') + ->beginIF($type == 'story')->andWhere('type')->eq($type)->fi() + ->beginIF($type != 'story')->andWhere('type')->in("$type,story")->fi() + ->orderBy('type,`order`') ->fetchAll(); } diff --git a/module/tree/view/browse.html.php b/module/tree/view/browse.html.php index d5911f8e5f..4a5953e02d 100644 --- a/module/tree/view/browse.html.php +++ b/module/tree/view/browse.html.php @@ -76,7 +76,8 @@ foreach($sons as $sonModule) { if($sonModule->order > $maxOrder) $maxOrder = $sonModule->order; - echo '' . html::input("modules[id$sonModule->id]", $sonModule->name, 'class=text-3 style="margin-bottom:5px"') . '
'; + $disabled = $sonModule->type == $viewType ? '' : 'disabled="true"'; + echo '' . html::input("modules[id$sonModule->id]", $sonModule->name, 'class=text-3 style="margin-bottom:5px" ' . $disabled) . '
'; } for($i = 0; $i < TREE::NEW_CHILD_COUNT ; $i ++) echo '' . html::input("modules[]", '', 'class=text-3 style="margin-bottom:5px"') . '
'; ?>