diff --git a/module/common/model.php b/module/common/model.php index 1dead13842..b2ba66621d 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -687,7 +687,7 @@ class commonModel extends model } /** - * Print link icon. + * Build icon button. * * @param string $module * @param string $method @@ -703,7 +703,7 @@ class commonModel extends model * @access public * @return void */ - public static function printIcon($module, $method, $vars = '', $object = '', $type = 'button', $icon = '', $target = '', $extraClass = '', $onlyBody = false, $misc = '') + public static function buildIconButton($module, $method, $vars = '', $object = '', $type = 'button', $icon = '', $target = '', $extraClass = '', $onlyBody = false, $misc = '') { if(isonlybody() and strpos($extraClass, 'showinonlybody') === false) return false; @@ -755,34 +755,55 @@ class commonModel extends model { if($app->getViewType() == 'mhtml') { - echo html::a($link, $title, $target, "class='$extraClass' data-role='button' data-mini='true' data-inline='true' data-theme='b'", true); - return; + return html::a($link, $title, $target, "class='$extraClass' data-role='button' data-mini='true' data-inline='true' data-theme='b'", true); } if($type == 'button') { if($method != 'edit' and $method != 'copy' and $method != 'delete') { - echo html::a($link, " " . $title, $target, "class='btn $extraClass' $misc", true); + return html::a($link, " " . $title, $target, "class='btn $extraClass' $misc", true); } else { - echo html::a($link, "", $target, "class='btn $extraClass' title='$title' $misc", false); + return html::a($link, "", $target, "class='btn $extraClass' title='$title' $misc", false); } } else { - echo html::a($link, "", $target, "class='btn-icon $extraClass' title='$title' $misc", false); + return html::a($link, "", $target, "class='btn-icon $extraClass' title='$title' $misc", false); } } else { if($type == 'list') { - echo ""; + return ""; } } } + /** + * Print link icon. + * + * @param string $module + * @param string $method + * @param string $vars + * @param object $object + * @param string $type button|list + * @param string $icon + * @param string $target + * @param string $extraClass + * @param bool $onlyBody + * @param string $misc + * @static + * @access public + * @return void + */ + public static function printIcon($module, $method, $vars = '', $object = '', $type = 'button', $icon = '', $target = '', $extraClass = '', $onlyBody = false, $misc = '') + { + echo common::buildIconButton($module, $method, $vars, $object, $type, $icon, $target, $extraClass, $onlyBody, $misc); + } + /** * Print backLink and preLink and nextLink. * diff --git a/module/project/control.php b/module/project/control.php index b44d2400ee..0fe1b95d17 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -1220,7 +1220,7 @@ class project extends control * @access public * @return void */ - public function tree($projectID, $level = 'pri_asc') + public function tree($projectID, $level = '') { $this->project->setMenu($this->projects, $projectID); $project = $this->loadModel('project')->getById($projectID); diff --git a/module/project/css/tree.css b/module/project/css/tree.css index c3e8764747..69efbce00f 100644 --- a/module/project/css/tree.css +++ b/module/project/css/tree.css @@ -2,14 +2,19 @@ #projectTree {margin-bottom: 0} #projectTree > .tree-action-item {display: none!important} +#projectTree li > .tree-item-wrapper > .tree-toggle {display: block} +#projectTree li > .tree-item-wrapper:hover {display: block; background-color: #edf3fe; cursor: pointer; margin-left: -20px; padding-left: 20px;} #projectTree li {line-height: 30px; padding-top: 0; padding-bottom: 0} -#projectTree .item-type-product > .tree-toggle {display: block; background-color: #edf3fe; margin-left: -20px; padding-left: 20px; border-bottom: 1px solid #ddd; cursor: pointer} -#projectTree .item-type-product > .tree-toggle:hover {background-color: #eee} -#projectTree .item-type-product.open > .tree-toggle {border-bottom: none} -#projectTree .item-type-module > .tree-toggle {display: block} -#projectTree .item-type-module > .tree-toggle:hover {display: block; background-color: #edf3fe; cursor: pointer; margin-left: -20px; padding-left: 20px;} +#projectTree .item-type-product > .tree-item-wrapper {display: block; background-color: #edf3fe; margin-left: -20px; padding-left: 20px; border-bottom: 1px solid #ddd; cursor: pointer} +#projectTree .item-type-product > .tree-item-wrapper:hover {background-color: #eee} +#projectTree .item-type-product.open > .tree-item-wrapper {border-bottom: none} #projectTree.tree li>.list-toggle:before {content: '\e6bb'} #projectTree.tree li.open>.list-toggle:before {content: '\e6b8';} #projectTree.tree li>.list-toggle {top: 2px} #projectTree .item-type-story > ul > li {padding-left: 10px;} #projectTree.tree li:before {display: none} +#projectTree .table-bordered tr > td:first-child, #projectTree .table-bordered tr > th:first-child {border-left: 1px solid #ddd; padding-left: 0; padding-right: 0} +#projectTree .item-type-tasks .tree-item-wrapper:hover {background-color: #fff} + +.tree-view-btn {min-width: 36px;} +.main > .panel > .panel-heading > .panel-actions {margin-top: -8px; margin-right: -12px;} diff --git a/module/project/lang/en.php b/module/project/lang/en.php index 9be9a8527f..3d5887d3c2 100644 --- a/module/project/lang/en.php +++ b/module/project/lang/en.php @@ -249,3 +249,10 @@ $lang->project->featurebar['task']['group'] = $lang->project->groups['']; $lang->project->featurebar['grouptask'] = $lang->project->featurebar['task']; $lang->project->featurebar['kanban'] = $lang->project->featurebar['task']; $lang->project->featurebar['burn'] = $lang->project->featurebar['task']; + +$lang->project->treeLevel = array(); +$lang->project->treeLevel['product'] = array('icon' => 'icon-cube', 'text' => 'Products view'); +$lang->project->treeLevel['module'] = array('icon' => 'icon-bookmark-empty', 'text' => 'Modules view'); +$lang->project->treeLevel['story'] = array('icon' => 'icon-lightbulb', 'text' => 'Stories view'); +$lang->project->treeLevel['task'] = array('icon' => 'icon-tasks', 'text' => 'Tasks view'); +$lang->project->treeLevel['custom'] = array('icon' => 'icon-align-left', 'text' => 'Custom view'); diff --git a/module/project/lang/zh-cn.php b/module/project/lang/zh-cn.php index 185238d582..48e5ee74f7 100644 --- a/module/project/lang/zh-cn.php +++ b/module/project/lang/zh-cn.php @@ -260,3 +260,10 @@ $lang->project->featurebar['task']['group'] = $lang->project->groups['']; $lang->project->featurebar['grouptask'] = $lang->project->featurebar['task']; $lang->project->featurebar['kanban'] = $lang->project->featurebar['task']; $lang->project->featurebar['burn'] = $lang->project->featurebar['task']; + +$lang->project->treeLevel = array(); +$lang->project->treeLevel['product'] = array('icon' => 'icon-cube', 'text' => '产品视图'); +$lang->project->treeLevel['module'] = array('icon' => 'icon-bookmark-empty', 'text' => '模块视图'); +$lang->project->treeLevel['story'] = array('icon' => 'icon-lightbulb', 'text' => '需求视图'); +$lang->project->treeLevel['task'] = array('icon' => 'icon-tasks', 'text' => '任务视图'); +$lang->project->treeLevel['custom'] = array('icon' => 'icon-align-left', 'text' => '自定义'); diff --git a/module/project/model.php b/module/project/model.php index a61cba8a70..b917f90f63 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -1973,13 +1973,14 @@ class projectModel extends model foreach ($stories as $story) { $storyItem = new stdclass(); - $storyItem->type = 'story'; - $storyItem->id = 'story' . $story->id; - $storyItem->title = $story->title; - $storyItem->color = $story->color; - $storyItem->pri = $story->pri; - $storyItem->storyId = $story->id; - $storyItem->url = helper::createLink('story', 'view', "storyID=$story->id&version=$story->version&from=project¶m=$projectID"); + $storyItem->type = 'story'; + $storyItem->id = 'story' . $story->id; + $storyItem->title = $story->title; + $storyItem->color = $story->color; + $storyItem->pri = $story->pri; + $storyItem->storyId = $story->id; + $storyItem->url = helper::createLink('story', 'view', "storyID=$story->id&version=$story->version&from=project¶m=$projectID"); + $storyItem->taskCreateUrl = helper::createLink('task', 'batchCreate', "projectID={$projectID}&story={$story->id}"); $storyTasks = $this->task->getStoryTasks($story->id, $projectID); if(!empty($storyTasks)) @@ -1988,16 +1989,35 @@ class projectModel extends model foreach ($storyTasks as $task) { $taskItem = new stdclass(); - $taskItem->type = 'task'; - $taskItem->id = $task->id; - $taskItem->title = $task->name; - $taskItem->color = $task->color; - $taskItem->pri = $task->pri; - $taskItem->url = helper::createLink('task', 'view', "task=$task->id"); + $taskItem->type = 'task'; + $taskItem->id = $task->id; + $taskItem->title = $task->name; + $taskItem->color = $task->color; + $taskItem->pri = $task->pri; + $taskItem->status = $task->status; + $taskItem->url = helper::createLink('task', 'view', "task=$task->id"); + $taskItem->storyChanged = $task->storyStatus == 'active' and $task->latestStoryVersion > $task->storyVersion; + + $buttons = ''; + $buttons .= common::buildIconButton('task', 'assignTo', "projectID=$task->project&taskID=$task->id", $task, 'list', '', '', 'iframe', true); + $buttons .= common::buildIconButton('task', 'start', "taskID=$task->id", $task, 'list', '', '', 'iframe', true); + + $buttons .= common::buildIconButton('task', 'recordEstimate', "taskID=$task->id", $task, 'list', 'time', '', 'iframe', true); + if($browseType == 'needconfirm') + { + $lang->task->confirmStoryChange = $lang->confirm; + $buttons .= common::buildIconButton('task', 'confirmStoryChange', "taskid=$task->id", '', 'list', '', 'hiddenwin'); + } + $buttons .= common::buildIconButton('task', 'finish', "taskID=$task->id", $task, 'list', '', '', 'iframe', true); + $buttons .= common::buildIconButton('task', 'close', "taskID=$task->id", $task, 'list', '', '', 'iframe', true); + $buttons .= common::buildIconButton('task', 'edit', "taskID=$task->id", '', 'list'); + + $taskItem->buttons = $buttons; $taskItems[] = $taskItem; } - $storyItem->children = $taskItems; + $storyItem->children = array(); + $storyItem->children[] = array('id' => 'tasks' . $story->id, 'tasks' => $taskItems, 'type' => 'tasks', 'actions' => false); } $node->children[] = $storyItem; diff --git a/module/project/view/taskdata.html.php b/module/project/view/taskdata.html.php index b86ee533db..cc2c985ef5 100644 --- a/module/project/view/taskdata.html.php +++ b/module/project/view/taskdata.html.php @@ -98,9 +98,9 @@ $lang->task->confirmStoryChange = $lang->confirm; common::printIcon('task', 'confirmStoryChange', "taskid=$task->id", '', 'list', '', 'hiddenwin'); } - common::printIcon('task', 'finish', "taskID=$task->id", $task, 'list', '', '', 'iframe', true); - common::printIcon('task', 'close', "taskID=$task->id", $task, 'list', '', '', 'iframe', true); - common::printIcon('task', 'edit',"taskID=$task->id", '', 'list'); + common::printIcon('task', 'finish', "taskID=$task->id", $task, 'list', '', '', 'iframe', true); + common::printIcon('task', 'close', "taskID=$task->id", $task, 'list', '', '', 'iframe', true); + common::printIcon('task', 'edit', "taskID=$task->id", '', 'list'); ?> diff --git a/module/project/view/taskheader.html.php b/module/project/view/taskheader.html.php index 710d8d4d14..83a8b8132b 100644 --- a/module/project/view/taskheader.html.php +++ b/module/project/view/taskheader.html.php @@ -20,6 +20,7 @@ $hasKanbanPriv = common::hasPriv('project', 'kanban'); $hasBurnPriv = common::hasPriv('project', 'burn'); $hasGroupTaskPriv = common::hasPriv('project', 'groupTask'); + $hasTreePriv = common::hasPriv('project', 'tree'); ?> customMenu['featurebar'] as $type => $featurebar):?> " . html::a(inlink('task', "project=$projectID&type=$type"), $featurebar['link']) . '' ; if($hasKanbanPriv and $type == 'kanban') echo "