* code for task #2552.
This commit is contained in:
@@ -206,7 +206,7 @@ $lang->project->menu = new stdclass();
|
||||
|
||||
$lang->project->menu->list = '%s';
|
||||
$lang->project->menu->index = '首页|project|index|locate=no';
|
||||
$lang->project->menu->task = array('link' => '任务|project|task|projectID=%s', 'subModule' => 'task,tree', 'alias' => 'grouptask,importtask,burn,importbug,kanban,printkanban');
|
||||
$lang->project->menu->task = array('link' => '任务|project|task|projectID=%s', 'subModule' => 'task,tree', 'alias' => 'grouptask,importtask,burn,importbug,kanban,printkanban,tree');
|
||||
$lang->project->menu->story = array('link' => '需求|project|story|projectID=%s', 'subModule' => 'story', 'alias' => 'linkstory');
|
||||
$lang->project->menu->bug = 'Bug|project|bug|projectID=%s';
|
||||
$lang->project->menu->dynamic = '动态|project|dynamic|projectID=%s';
|
||||
|
||||
@@ -1208,6 +1208,28 @@ class project extends control
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->projectID = $projectID;
|
||||
$this->view->project = $project;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tree view.
|
||||
* Product
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param string $level
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function tree($projectID, $level = 'pri_asc')
|
||||
{
|
||||
$this->project->setMenu($this->projects, $projectID);
|
||||
$project = $this->loadModel('project')->getById($projectID);
|
||||
|
||||
$this->view->title = $this->lang->project->tree;
|
||||
$this->view->project = $project;
|
||||
$this->view->projectID = $projectID;
|
||||
$this->view->level = $level;
|
||||
$this->view->tree = $this->project->getProjectTree($projectID);
|
||||
$this->display();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
.no-padding {padding: 0!important;}
|
||||
|
||||
#projectTree {margin-bottom: 0}
|
||||
#projectTree > .tree-action-item {display: none!important}
|
||||
#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.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}
|
||||
@@ -121,6 +121,7 @@ $lang->project->batchUnlinkStory = 'Batch remove story';
|
||||
$lang->project->importTask = 'Transfer task';
|
||||
$lang->project->importBug = 'Import bug';
|
||||
$lang->project->updateOrder = 'Order';
|
||||
$lang->project->tree = 'Tree';
|
||||
|
||||
/* Browse. */
|
||||
$lang->project->allTasks = 'All';
|
||||
|
||||
@@ -121,6 +121,7 @@ $lang->project->batchUnlinkStory = '批量移除需求';
|
||||
$lang->project->importTask = '转入任务';
|
||||
$lang->project->importBug = '导入Bug';
|
||||
$lang->project->updateOrder = '排序';
|
||||
$lang->project->tree = '树视图';
|
||||
|
||||
/* 分组浏览。*/
|
||||
$lang->project->allTasks = '所有';
|
||||
|
||||
@@ -1940,4 +1940,92 @@ class projectModel extends model
|
||||
|
||||
return $chartData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build product task tree item
|
||||
* @param object $tree
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function buildProductTaskTree($node, $projectID)
|
||||
{
|
||||
$this->loadModel('story');
|
||||
$this->loadModel('task');
|
||||
|
||||
if($node->children)
|
||||
{
|
||||
foreach ($node->children as $child)
|
||||
{
|
||||
$child = $this->buildProductTaskTree($child, $projectID);
|
||||
}
|
||||
}
|
||||
|
||||
if($node->type === 'product')
|
||||
{
|
||||
$node->actions = false;
|
||||
// TODO: get product root storys and appent to children
|
||||
}
|
||||
else if($node->type === 'story')
|
||||
{
|
||||
$node->type = 'module';
|
||||
$node->actions = false;
|
||||
$stories = $this->story->getProjectStories($projectID, 'pri_asc,id_desc', 'byModule', $node->id);
|
||||
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");
|
||||
|
||||
$storyTasks = $this->task->getStoryTasks($story->id, $projectID);
|
||||
if(!empty($storyTasks))
|
||||
{
|
||||
$taskItems = array();
|
||||
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");
|
||||
$taskItems[] = $taskItem;
|
||||
}
|
||||
|
||||
$storyItem->children = $taskItems;
|
||||
}
|
||||
|
||||
$node->children[] = $storyItem;
|
||||
}
|
||||
}
|
||||
return $node;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get projects tree data
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getProjectTree($projectID)
|
||||
{
|
||||
$tree = array();
|
||||
$products = $this->getProducts($projectID);
|
||||
foreach ($products as $product)
|
||||
{
|
||||
$productItem = new stdclass();
|
||||
$productItem->type = 'product';
|
||||
$productItem->id = 'product' . $product->id;
|
||||
$productItem->title = $product->name;
|
||||
$productItem->children = $this->loadModel('tree')->getFullTree($product->id, 'story');
|
||||
|
||||
$tree[] = $this->buildProductTaskTree($productItem, $projectID);
|
||||
}
|
||||
return $tree;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
echo "<li id='unclosedTab'>"; common::printLink('project', 'task', "project=$projectID&type=unclosed", $lang->project->unclosed); echo '</li>' ;
|
||||
echo "<li id='allTab'>"; common::printLink('project', 'task', "project=$projectID&type=all", $lang->project->allTasks); echo '</li>' ;
|
||||
echo "<li id='kanbanTab'>"; common::printLink('project', 'kanban', "projectID=$projectID", $lang->project->kanban, '', '', false); echo '</li>';
|
||||
echo "<li id='treeTab'>"; common::printLink('project', 'tree', "projectID=$projectID", $lang->project->tree, '', '', false); echo '</li>';
|
||||
if($project->type == 'sprint' or $project->type == 'waterfall') print "<li id='burnTab'>" and common::printLink('project', 'burn', "project=$projectID", $lang->project->burn); print '</li>' ;
|
||||
echo "<li id='assignedtomeTab'>"; common::printLink('project', 'task', "project=$projectID&type=assignedtome", $lang->project->assignedToMe); echo '</li>' ;
|
||||
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
/**
|
||||
* The task view file of project module of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
|
||||
* @license ZPL (http://zpl.pub/page/zplv12.html)
|
||||
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
|
||||
* @package project
|
||||
* @version $Id: task.html.php 4894 2013-06-25 01:28:39Z wyd621@gmail.com $
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
?>
|
||||
<?php
|
||||
include '../../common/view/header.html.php';
|
||||
include './taskheader.html.php';
|
||||
js::set('moduleID', $moduleID);
|
||||
js::set('productID', $productID);
|
||||
?>
|
||||
|
||||
<div class='main'>
|
||||
<div class='panel'>
|
||||
<div class='panel-heading'>
|
||||
<i class="icon icon-folder-close-alt"></i> <strong><?php echo $project->name ?></strong>
|
||||
</div>
|
||||
<div class='panel-body no-padding'>
|
||||
<ul id='projectTree'></ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php js::set('replaceID', 'taskList')?>
|
||||
<script
|
||||
var projectID = <?php echo $projectID?>;>
|
||||
$('#project<?php echo $projectID;?>').addClass('active')
|
||||
$('#treeTab').addClass('active');
|
||||
|
||||
$(function()
|
||||
{
|
||||
var data = $.parseJSON('<?php echo json_encode($tree);?>');
|
||||
console.log('DATA', data);
|
||||
var $tree = $('#projectTree');
|
||||
$tree.tree(
|
||||
{
|
||||
initialState: 'preserve',
|
||||
data: data,
|
||||
itemWrapper: true,
|
||||
actions:
|
||||
{
|
||||
add:
|
||||
{
|
||||
title: '<?php echo $lang->project->batchWBS ?>',
|
||||
template: '<a data-toggle="tooltip" href="javascript:;"><i class="icon icon-sitemap"></i>',
|
||||
templateInList: '<a href="javascript:;"><i class="icon icon-sitemap"></i> <?php echo $lang->project->batchWBS ?></a>'
|
||||
},
|
||||
},
|
||||
itemCreator: function($li, item)
|
||||
{
|
||||
$li.closest('li').addClass('item-type-' + item.type);
|
||||
if(item.type === 'product')
|
||||
{
|
||||
$li.append($('<span class="tree-toggle"><i class="icon icon-cube text-muted"></i> ' + item.title + '</span>'));
|
||||
}
|
||||
else if(item.type === 'story')
|
||||
{
|
||||
$li.append('<span class="tree-toggle"><i class="icon icon-lightbulb text-muted"></i> </span>').append($('<a>').attr({href: item.url}).text('#' + item.storyId + ' ' + item.title).css('color', item.color));
|
||||
}
|
||||
else if(item.type === 'task')
|
||||
{
|
||||
$li.append('<span class="pri' + item.pri + '">' + item.pri + '</span> ').append($('<a>').attr({href: item.url}).text('#' + item.id + ' ' + item.title).css('color', item.color));
|
||||
}
|
||||
else
|
||||
{
|
||||
$li.append($('<span class="tree-toggle"><i class="icon icon-bookmark-empty text-muted"></i> ' + (item.title || item.name) + '</span>'));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$tree.find('[data-toggle="tooltip"]').tooltip();
|
||||
});
|
||||
</script>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
@@ -979,6 +979,24 @@ class taskModel extends model
|
||||
->fetchPairs();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tasks a story.
|
||||
*
|
||||
* @param int $storyID
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getStoryTasks($storyID, $projectID = 0)
|
||||
{
|
||||
return $this->dao->select('*')
|
||||
->from(TABLE_TASK)
|
||||
->where('story')->eq((int)$storyID)
|
||||
->andWhere('deleted')->eq(0)
|
||||
->beginIF($projectID)->andWhere('project')->eq($projectID)->fi()
|
||||
->fetchAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get counts of some stories' tasks.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user