* Task#3942

This commit is contained in:
滔哥
2018-05-08 23:12:49 +08:00
parent c4eb4ee453
commit a16a48a323
10 changed files with 399 additions and 363 deletions
+2 -2
View File
@@ -984,7 +984,7 @@ class project extends control
$acl = $copyProject->acl;
$whitelist = $copyProject->whitelist;
$products = $this->project->getProducts($copyProjectID);
}
}
if(!empty($planID))
{
@@ -1462,7 +1462,7 @@ class project extends control
$this->view->project = $project;
$this->view->projectID = $projectID;
$this->view->level = $type;
$this->view->tree = $tree;
$this->view->tree = $this->project->printTree($tree);
$this->display();
}
+47 -31
View File
@@ -1,35 +1,51 @@
.no-padding {padding: 0!important;}
#taskTree li {padding: 0 0 0 8px;}
#taskTree li.has-list {padding-left: 20px;}
#taskTree li > a {display: block; padding: 5px 0; border-radius: 2px; padding-left: 6px;}
#taskTree li > a > span {display: inline-block;}
#taskTree li > a > span + span {margin-left: 8px;}
#taskTree li.selected > a {background-color: #E8F3FC;}
#taskTree li.selected > a > span.title {color: #006AF1;}
.label-product, #taskTree .item-product > a > .label-type {background: #88DE8B;}
.label-story, #taskTree .item-story > a > .label-type {background: #00A9FC;}
.label-module, #taskTree .item-module > a > .label-type {background: #52CEDD;}
.label-task, #taskTree .item-task > a > .label-type {background: #006AF1;}
#taskTree li > a > span.title {color: #3C4353; white-space: nowrap; max-width: 60%; overflow: hidden; text-overflow: ellipsis; vertical-align: middle;}
#taskTree li > a > span.user {color: #A6AAB8;}
#taskTree li > a > span.user > .icon-person {font-size: 14px; position: relative; top: -1px;}
#taskTree li > .list-toggle {transform: rotate(0deg); width: 16px; height: 16px; border: 4px solid #CBD0DB; border-radius: 2px; top: 7px;}
#taskTree li > .list-toggle:before {content: ' '; display: block; position: absolute; border: 1px solid #CBD0DB; top: 2px; left: -3px; right: -3px; bottom: 2px; min-width: 0; transition: all .2s;}
#taskTree li > .list-toggle:hover:before,
#taskTree li > .list-toggle:hover {border-color: #006AF1;}
#taskTree li.open > .list-toggle {width: 12px; height: 12px; top: 9px; background-color: #CBD0DB; border-width: 3px; left: 3px;}
#taskTree li.open > .list-toggle:before {border: none; height: 2px; width: 6px; left: 0; top: 2px; background: #fff;}
#taskTree li.open > .list-toggle:hover {background: #006AF1;}
#projectTree {margin-bottom: 0}
#projectTree .tree-item-id {display: inline-block; font-size: 12px; border: 1px solid #aaa; line-height: 14px; color: #666; padding: 0 2px; margin-right: 5px; min-width: 16px; text-align: center; border-radius: 1px;}
#projectTree .label-story {line-height: 14px; padding: 0 2px; font-size: 12px; display: inline-flex; margin-right: 5px; position: relative; top: -1px; background: #8666b8; color: #fff; border: 1px solid #8666b8; border-radius: 1px;}
#projectTree > .tree-action-item {display: none!important}
#projectTree li > .tree-item-wrapper > .tree-toggle {display: block}
#projectTree li > .tree-item-wrapper:hover {background-color: #edf3fe; cursor: pointer; margin-left: -20px; padding-left: 20px;}
#projectTree li {line-height: 24px; padding-top: 0; padding-bottom: 0}
#projectTree > li.open > .tree-item-wrapper {border-bottom: none}
#projectTree.tree li.has-list.open > ul:after {top: -10px; bottom: 17px; display: none}
#projectTree.tree ul > li.has-list:after {top: 10px}
#projectTree.tree ul > li:after {top: 11px}
#projectTree.tree ul > li:before {display: block; content: ' '; border: none; border-left: 1px dotted #999; top: -8px; bottom: 9px; left: -11px; position: absolute; width: auto; height: auto}
#projectTree.tree ul > li:last-child:before {bottom: auto; height: 19px}
#projectTree.tree ul > li > .tree-item-wrapper:before {display: none;}
#projectTree.tree ul > li.has-list > .tree-item-wrapper:before {display: none;}
#projectTree.tree ul > li.item-type-task > .tree-item-wrapper {padding-left: 15px; margin-left: -15px;}
#projectTree.tree ul > li.item-type-task > .tree-item-wrapper:hover {background-color: #edf3fe}
#projectTree.tree ul > li.item-type-task > .tree-item-wrapper:before {left: 0; z-index: 2}
#projectTree.tree li>.list-toggle {top: -2px}
#projectTree.tree li:before {display: none}
#projectTree .item-type-story > ul > li {padding-left: 10px;}
#projectTree .item-type-tasks > .tree-item-wrapper:hover {background-color: #f5f5f5}
#projectTree .task-assignto {display: inline-block; margin-left: 10px; color: #808080}
#projectTree .task-info {display: none;}
#projectTree .task-info > div {display: inline-block; margin: 0 5px;}
#projectTree .task-info > div.buttons {position: relative; top: 2px}
#projectTree .item-type-task:hover .task-info {display: inline-block; margin-left:10px;}
#taskTree ul > li:after {display: block; position: absolute; content: ' '; border-top: 2px solid #EDEFF3; top: 14px; left: -12px; z-index: 1; width: 10px;}
#taskTree ul > li:before,
#taskTree ul > li.has-list:before {background: none; content: ' '; display: block; position: absolute; width: auto; height: auto; border: none; border-left: 2px solid #EDEFF3; top: -13px; bottom: 12px; left: -12px;}
#taskTree ul > li:last-child:before {bottom: auto; height: 29px;}
#taskTree ul > li:first-child:before {top: -9px;}
#taskTree ul > li.tree-single-item:before {height: 23px;}
#taskTree ul > li.has-list:after {width: 14px;}
.tree-view-btn {min-width: 36px;}
.main > .panel > .panel-heading > .panel-actions {margin-top: -8px; margin-right: -12px;}
.tree-show-root .btn-tree-view[data-type="root"],
.btn-tree-view[data-type="all"] {display: none;}
.tree-show-root .btn-tree-view[data-type="all"] {display: inline-block;}
.label-task-count {background: #ddd; color: #333}
#itemContent {min-height: 200px;}
#mainContent > .side-col {width: 460px; display: table-cell; overflow: hidden; transition: width .2s;}
#mainContent > .side-col > .cell {opacity: 1; transition: opacity .2s .1s;}
#mainContent.hide-side > .side-col {display: table-cell; width: 0px;}
#mainContent.hide-side > .side-col > .cell {opacity: 0;}
h2.detail-title {font-size: 16px;}
h2.detail-title .label-id, h2.detail-title .label {top: -1px}
#itemContent > .detail:first-child {padding-top: 10px;}
.detail-content > .btn-toolbar {margin-top: 15px;}
.detail-content > .infos > span {display: inline-block;}
.detail-content > .infos > span + span {margin-left: 15px;}
.detail-content > .infos + .infos {margin-top: 5px;}
.detail + .detail {padding-top: 10px;}
.btn-comment.pull-right {z-index: 10;}
details .btn-comment.pull-right {right: 30px;}
+100
View File
@@ -0,0 +1,100 @@
$(function()
{
var $taskTree = $('#taskTree').tree(
{
name: 'taskTree',
initialState: 'preserve'
});
var taskTree = $taskTree.data('zui.tree');
// 根据列表展开树形列表
var showTreeLevel = function(level)
{
if (level === 'root')
{
taskTree.collapse();
}
else if (level === 'all')
{
taskTree.collapse();
taskTree.expand($taskTree.find('li.has-list'), true);
}
else if (level === 'task')
{
taskTree.collapse();
taskTree.show($taskTree.find('li.item-task').parent().parent(), true);
}
else if (level === 'story')
{
taskTree.collapse();
taskTree.show($taskTree.find('li.item-story').parent().parent(), true);
}
$('#main').toggleClass('tree-show-root', level === 'root');
};
$(document).on('click', '.btn-tree-view', function()
{
showTreeLevel($(this).data('type'));
});
// 第一次访问时,展示所以节点
if (!$.zui.store.get('zui.tree::taskTree#taskTree')) showTreeLevel('all');
// 在右侧显示内容
var $itemContent = $('#itemContent');
var $mainContent = $('#mainContent');
var isItemLoading = false, lastAjaxRequest;
var showItem = function(url, loadingText)
{
$.zui.messager.hide();
$mainContent.toggleClass('hide-side', !url);
if (!url)
{
$taskTree.find('li.selected').removeClass('selected');
isItemLoading = false;
return;
}
if (lastAjaxRequest) lastAjaxRequest.abort();
$itemContent.empty().addClass('loading').attr('data-loading', loadingText || '');
isItemLoading = true;
lastAjaxRequest = $.ajax(
{
url: url,
success: function(data)
{
if (!isItemLoading) return;
$itemContent.html(data).removeClass('loading');
lastAjaxRequest = null;
isItemLoading = false;
$itemContent.find('.text-limit').textLimit();
$itemContent.find('.histories').histories();
},
error: function()
{
$mainContent.addClass('hide-side');
isItemLoading = false;
$.zui.messager.danger(window.lang.timeout);
}
});
};
var stopPropagation = function(e) {e.stopPropagation();};
$taskTree.on('click', '.tree-link', function(e)
{
var $link = $(this);
showItem($link.attr('href'), $link.find('.title').text());
$taskTree.find('li.selected').removeClass('selected');
$link.closest('li').addClass('selected');
e.preventDefault();
stopPropagation(e);
});
$itemContent.on('click', stopPropagation);
$taskTree.on('click', stopPropagation);
$(document).on('click', function()
{
showItem(false);
});
});
+1 -1
View File
@@ -297,10 +297,10 @@ $lang->project->featureBar['task']['needconfirm'] = 'StoryChanged';
$lang->project->featureBar['task']['status'] = $lang->project->statusSelects[''];
$lang->project->treeLevel = array();
$lang->project->treeLevel['all'] = 'Expand All';
$lang->project->treeLevel['root'] = 'Collapse All';
$lang->project->treeLevel['story'] = 'Show Story';
$lang->project->treeLevel['task'] = 'Show Task';
$lang->project->treeLevel['all'] = 'Expand All';
global $config;
if($config->global->flow == 'onlyTask')
+3 -3
View File
@@ -305,10 +305,10 @@ $lang->project->featureBar['task']['needconfirm'] = '需求变动';
$lang->project->featureBar['task']['status'] = $lang->project->statusSelects[''];
$lang->project->treeLevel = array();
$lang->project->treeLevel['root'] = '全部折叠';
$lang->project->treeLevel['story'] = '显示需求';
$lang->project->treeLevel['task'] = '显示任务';
$lang->project->treeLevel['all'] = '全部展开';
$lang->project->treeLevel['root'] = '全部折叠';
$lang->project->treeLevel['story'] = '只看需求';
$lang->project->treeLevel['task'] = '只看任务';
global $config;
if($config->global->flow == 'onlyTask')
+53 -3
View File
@@ -1381,8 +1381,8 @@ class projectModel extends model
/**
* Stat story, task, bug data for project.
*
* @param int $projectID
*
* @param int $projectID
* @access public
* @return void
*/
@@ -2545,7 +2545,7 @@ class projectModel extends model
$taskGroups[$task->module][$task->story][$task->id] = $task;
if(!empty($childTasks[$task->id]))
{
$taskGroups[$task->module][$task->story][$task->id]->children = $childTasks[$task->id];
$taskGroups[$task->module][$task->story][$task->id]->children = $childTasks[$task->id];
}
}
}
@@ -2581,6 +2581,8 @@ class projectModel extends model
$storyItem->color = $story->color;
$storyItem->pri = $story->pri;
$storyItem->storyId = $story->id;
$storyItem->openedBy = $story->openedBy;
$storyItem->assignedTo = $story->assignedTo;
$storyItem->url = helper::createLink('story', 'view', "storyID=$story->id&version=$story->version&from=project&param=$projectID");
$storyItem->taskCreateUrl = helper::createLink('task', 'batchCreate', "projectID={$projectID}&story={$story->id}");
@@ -2661,9 +2663,11 @@ class projectModel extends model
$taskItem->color = $task->color;
$taskItem->pri = (int)$task->pri;
$taskItem->status = $task->status;
$taskItem->parent = $task->parent;
$taskItem->estimate = $task->estimate;
$taskItem->consumed = $task->consumed;
$taskItem->left = $task->left;
$taskItem->openedBy = $users[$task->openedBy];
$taskItem->assignedTo = $users[$task->assignedTo];
$taskItem->url = helper::createLink('task', 'view', "task=$task->id");
$taskItem->storyChanged = $story and $story->status == 'active' and $story->version > $story->taskVersion;
@@ -2735,4 +2739,50 @@ class projectModel extends model
}
return $productPlans;
}
/**
* Print html for tree.
*
* @param object $trees
* @access pubic
* @return string
*/
public function printTree($trees)
{
$html = '';
foreach($trees as $tree)
{
if(is_array($tree)) $tree = (object)$tree;
switch($tree->type)
{
case 'module':
$this->app->loadLang('tree');
$html .= "<li class='item-module'>";
$html .= '<a class="tree-toggle"><span class="label label-type">' . (empty($tree->parent) ? $this->lang->tree->module : $this->lang->tree->child) . '</span><span class="title">' . $tree->name . '</span></a>';
break;
case 'task':
$html .= '<li class="item-task">';
$html .= '<a class="tree-toggle"><span class="label label-id">' . $tree->id . '</span><span class="label label-type">' . (empty($tree->parent) ? $this->lang->task->common : $this->lang->task->children) . '</span><span class="title">' . $tree->title . '</span> <span class="user"><i class="icon icon-person"></i> ' . (empty($tree->assignedTo) ? $tree->openedBy : $tree->assignedTo) . '</span></a>';
break;
case 'product':
$this->app->loadLang('product');
$html .= '<li class="item-product">';
$html .= '<a class="tree-toggle"><span class="label label-type">' . $this->lang->productCommon . '</span><span class="title">' . $tree->name . '</span></a>';
break;
case 'story':
$this->app->loadLang('story');
$html .= '<li class="item-story">';
$html .= '<a class="tree-toggle"><span class="label label-id">' . $tree->storyId . '</span><span class="label label-type">' . $this->lang->story->common . '</span><span class="title">' . $tree->title . '</span> <span class="user"><i class="icon icon-person"></i> ' . (empty($tree->assignedTo) ? $tree->openedBy : $tree->assignedTo) . '</span></a>';
break;
}
if(isset($tree->children))
{
$html .= '<ul>';
$html .= $this->printTree($tree->children);
$html .= '</ul>';
}
$html .= '</li>';
}
return $html;
}
}
+54 -186
View File
@@ -10,195 +10,63 @@
* @link http://www.zentao.net
*/
?>
<?php
include '../../common/view/header.html.php';
include './taskheader.html.php';
?>
<?php include '../../common/view/header.html.php';?>
<div id="mainMenu" class="clearfix">
<div class="btn-toolbar pull-left">
<?php foreach ($lang->project->treeLevel as $name => $btnLevel):?>
<?php
$icon = '';
if($name == 'root') $icon = ' <i class="icon-fold-all"></i>';
if($name == 'all') $icon = ' <i class="icon-unfold-all"></i>';
?>
<button type='button' class='btn btn-link btn-tree-view' data-type='<?php echo $name ?>'><?php echo $btnLevel . $icon;?></button>
<?php endforeach; ?>
</div>
<div class="btn-toolbar pull-right">
<?php
if(!isset($browseType)) $browseType = '';
if(!isset($orderBy)) $orderBy = '';
$link = common::hasPriv('task', 'report', $project) ? $this->createLink('task', 'report', "project=$projectID&browseType=$browseType") : '#';
echo html::a($link, "<i class='icon icon-bar-chart muted'></i> <span class='text'>{$lang->task->reportChart}</span>", '', 'class="btn btn-link"');
?>
<div class="btn-group">
<button class="btn btn-link" data-toggle="dropdown"><i class="icon icon-import muted"></i> <span class="text"><?php echo $lang->import ?></span> <span class="caret"></span></button>
<ul class="dropdown-menu">
<?php
$misc = common::hasPriv('project', 'importTask') ? '' : "class=disabled";
$link = common::hasPriv('project', 'importTask') ? $this->createLink('project', 'importTask', "project=$project->id") : '#';
echo "<li>" . html::a($link, $lang->project->importTask, '', $misc) . "</li>";
<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 class='panel-actions pull-right'>
<div class='btn-group'>
<?php foreach ($lang->project->treeLevel as $name => $btnLevel):?>
<?php if($name == 'all') continue;?>
<button type='button' class='btn btn-sm tree-view-btn' data-type='<?php echo $name ?>'><?php echo $btnLevel ?></button>
<?php endforeach; ?>
</div>
</div>
</div>
<div class='panel-body'>
<ul id='projectTree' class='tree-lines'></ul>
$misc = common::hasPriv('project', 'importBug') ? '' : "class=disabled";
$link = common::hasPriv('project', 'importBug') ? $this->createLink('project', 'importBug', "project=$project->id") : '#';
echo "<li>" . html::a($link, $lang->project->importBug, '', $misc) . "</li>";
?>
</ul>
</div>
<?php
$misc = common::hasPriv('task', 'export', $project) ? "class='btn btn-link'" : "class='btn btn-link disabled'";
$link = common::hasPriv('task', 'export') ? $this->createLink('task', 'export', "project=$projectID&orderBy=$orderBy&type=$browseType") : '#';
echo html::a($link, "<i class='icon icon-export muted'></i> <span class='text'>{$lang->export}</span>", '', $misc);
$misc = common::hasPriv('task', 'create', $project) ? "class='btn btn-primary'" : "class='btn btn-primary disabled'";
$link = common::hasPriv('task', 'create', $project) ? $this->createLink('task', 'create', "project=$projectID" . (isset($moduleID) ? "&storyID=&moduleID=$moduleID" : '')) : '#';
echo html::a($link, "<i class='icon icon-plus'></i>" . $lang->task->create, '', $misc);
?>
</div>
</div>
<script>
var projectID = <?php echo $projectID?>;
$('#project<?php echo $projectID;?>').addClass('active')
$('#treeTab').addClass('active');
function setModalInTree(tree)
{
setModal4List('iframe', null, function()
{
$.cancelReloadCloseModal();
$.getJSON('<?php echo inlink('tree', "projectID=$projectID&type=json") ?>', function(newData)
{
tree.reload(newData);
setModalInTree(tree);
});
});
}
$(function()
{
var hoursFormat = '<?php echo $lang->project->hours ?>';
var viewLevel = '<?php echo $level ?>' || 'custom';
var data = $.parseJSON('<?php echo helper::jsonEncode4Parse($tree, JSON_HEX_QUOT | JSON_HEX_APOS);?>');
var $tree = $('#projectTree');
var statusMap = $.parseJSON('<?php echo helper::jsonEncode4Parse($lang->task->statusList);?>');
var selectCustomLevel = function() {$('.tree-view-btn.active').removeClass('active').filter('[data-type="custom"]').addClass('active');};
$tree.tree(
{
name: 'projectTasksTree',
initialState: !viewLevel || viewLevel === 'custom' ? 'preserve' : 'collapse',
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: false,
linkTemplate: '<?php echo helper::createLink('tree', 'edit', "moduleID={0}&type=task"); ?>'
},
},
action: function(event)
{
var action = event.action, $target = $(event.target), item = event.item;
if(action.type === 'add')
{
window.open(item.taskCreateUrl);
}
},
itemCreator: function($li, item)
{
$li.toggleClass('tree-toggle', item.type !== 'task' && item.type !== 'story').closest('li').addClass('item-type-' + item.type);
var $liWrapper = $li.find('.tree-item-wrapper');
if(item.type === 'product')
{
$liWrapper.append($('<span><i class="icon icon-cube text-muted"></i> ' + item.title + '</span>'));
}
else if(item.type === 'story')
{
$liWrapper.append('<span class="tree-item-id">' + item.storyId + ' </span><span class="label label-story"><?php echo $lang->story->common ?></span>').append($('<a>').attr({href: item.url}).text(item.title).css('color', item.color));
if(item.children && item.children.length)
{
if(item.tasksCount) $liWrapper.append(' <span class="label label-task-count label-badge">' + item.tasksCount + '</span>');
}
}
else if(item.type === 'task')
{
$liWrapper.append('<span class="tree-item-id">' + item.id + ' </span>').append($('<a>').attr({href: item.url}).text(item.title).css('color', item.color));
if(item.assignedTo) $liWrapper.append($('<span class="task-assignto"/>').html(item.assignedTo ? ('<i class="icon icon-user text-muted"></i> ' + item.assignedTo) : ''));
var $info = $('<div class="task-info clearfix"/>');
$info.append($('<div/>').addClass('status-' + item.status).text(statusMap[item.status]));
$info.append($('<div/>').text(hoursFormat.replace('%s', item.estimate).replace('%s', item.consumed).replace('%s', item.left)));
$info.append($('<div class="buttons"/>').html(item.buttons));
$liWrapper.append($info);
}
else if(item.type === 'tasks')
{
if(item.tasks && item.tasks.length)
{
var $table = $('<table class="table table-tasks table-fixed table-bordered table-condensed table-hover table-striped"><tbody></tbody></table>');
var $tbody = $table.find('tbody');
$.each(item.tasks, function(idx, task)
{
var $tr = $('<tr class="text-center"/>');
$tr.append($('<td/>').addClass('text-left').append($('<a>').attr({href: task.url}).text('#' + task.id + ' ' + task.title).css('color', task.color)));
$tr.append($('<td class="td-extra" width="30"/>').append('<span class="pri' + task.pri + '">' + (task.pri || '') + '</span>'));
$tr.append($('<td class="td-extra" width="90"/>').html(task.assignedTo ? ('<i class="icon icon-user text-muted"></i> ' + task.assignedTo) : ''));
$tr.append($('<td class="td-extra" width="70"/>').addClass(task.status).text(statusMap[task.status]));
$tr.append($('<td class="td-extra" width="140"/>').text(hoursFormat.replace('%s', task.estimate).replace('%s', task.consumed).replace('%s', task.left)));
$tr.append($('<td class="td-extra" width="150"/>').html(task.buttons));
$tbody.append($tr);
});
$liWrapper.append($table);
}
}
else if(item.type === 'unlinkStory')
{
$li.append($('<span class="tree-item-title"><i class="icon icon-tasks text-muted"></i> ' + item.title + '</span>'));
if(item.tasksCount) $li.append(' <span class="label label-task-count label-badge">' + item.tasksCount + '</span>');
}
else
{
if(item.type === 'module' && (!item.children || !item.children.length))
{
$li.remove();
}
else
{
$li.append($('<span class="tree-toggle"><i class="icon icon-bookmark-empty text-muted"></i> ' + (item.title || item.name) + '</span>'));
}
}
return true;
}
});
$('[data-toggle="tooltip"]').tooltip({container: 'body'});
var $currentLevelBtn = $('.tree-view-btn[data-type="' + viewLevel + '"]').addClass('active');
if(!$currentLevelBtn.length) selectCustomLevel();
var tree = $tree.data('zui.tree');
// Expand all nodes when user visit at first time of this day.
if(!tree.store.time || tree.store.time < (new Date().getTime() - 24*40*60*1000))
{
tree.show($('.item-type-tasks, .item-type-task').parent().parent());
}
$(document).on('click', '.tree-view-btn', function()
{
var hasActive = $(this).hasClass('active');
$('.tree-view-btn.active').removeClass('active');
var level = $(this).addClass('active').data('type');
if(level === 'task')
{
tree.collapse();
tree.show($('.item-type-tasks, .item-type-task').parent().parent());
}
if(level === 'root')
{
tree.collapse();
$(this).html(treeLevel.all);
if(hasActive)
{
$(this).removeClass('active');
$(this).html(treeLevel.root);
tree.show($('.item-type-tasks, .item-type-task').parent().parent());
tree.show($('.item-type-module').parent().parent());
tree.show($('.item-type-story').parent().parent());
}
}
else if(level === 'module')
{
tree.collapse();
tree.show($('.item-type-module').parent().parent());
}
else if(level === 'story')
{
tree.collapse();
tree.show($('.item-type-story').parent().parent());
}
});
setModalInTree(tree);
});
</script>
<?php js::set('treeLevel', $lang->project->treeLevel);?>
<div id="mainContent" class="main-row hide-side">
<div class="main-col">
<div class="cell">
<ul class="tree" id="taskTree">
<?php echo $tree;?>
</ul>
</div>
</div>
<div class="side-col">
<div class="cell">
<div id="itemContent" class="load-indicator loading"></div>
</div>
</div>
</div>
<?php include '../../common/view/footer.html.php';?>
+1
View File
@@ -43,6 +43,7 @@ $lang->tree->successSave = 'Saved.';
$lang->tree->successFixed = 'Fixed.';
$lang->tree->repeatName = 'The name "%s" has existed!';
$lang->tree->module = 'Module';
$lang->tree->name = 'Name';
$lang->tree->line = 'Product Line';
$lang->tree->cate = 'Category Name';
+1
View File
@@ -43,6 +43,7 @@ $lang->tree->successSave = '成功保存';
$lang->tree->successFixed = '成功修正数据!';
$lang->tree->repeatName = '模块名“%s”已经存在!';
$lang->tree->module = '模块';
$lang->tree->name = '模块名称';
$lang->tree->line = '产品线名称';
$lang->tree->cate = '分类名称';
+137 -137
View File
@@ -15,8 +15,8 @@ class treeModel extends model
{
/**
* Get module by ID.
*
* @param int $moduleID
*
* @param int $moduleID
* @access public
* @return object
*/
@@ -27,10 +27,10 @@ class treeModel extends model
/**
* Build the sql query.
*
* @param int $rootID
* @param string $type
* @param int $startModule
*
* @param int $rootID
* @param string $type
* @param int $startModule
* @access public
* @return void
*/
@@ -67,15 +67,15 @@ class treeModel extends model
->beginIF((!empty($branch) and $branch != 'null'))->andWhere("branch")->eq($branch)->fi()
->andWhere('deleted')->eq(0)
->orderBy('grade desc, `order`')
->get();
->get();
}
/**
* Create an option menu in html.
*
* @param int $rootID
* @param string $type
* @param int $startModule
*
* @param int $rootID
* @param string $type
* @param int $startModule
* @access public
* @return string
*/
@@ -125,10 +125,10 @@ class treeModel extends model
/**
* Get module pairs.
*
* @param int $rootID
* @param string $viewType
* @param string $showModule
*
* @param int $rootID
* @param string $viewType
* @param string $showModule
* @access public
* @return array
*/
@@ -171,8 +171,8 @@ class treeModel extends model
}
/**
* Get line pairs.
*
* Get line pairs.
*
* @access public
* @return array
*/
@@ -183,9 +183,9 @@ class treeModel extends model
/**
* Create an option menu of task in html.
*
* @param int $rootID
* @param int $startModule
*
* @param int $rootID
* @param int $startModule
* @access public
* @return void
*/
@@ -195,14 +195,14 @@ class treeModel extends model
$products = $this->loadModel('product')->getProductsByProject($rootID);
$branchGroups = $this->loadModel('branch')->getByProducts(array_keys($products));
if(!$this->isMergeModule($rootID, 'task') or !$products) return $this->getOptionMenu($rootID, 'task', $startModule);
if(!$this->isMergeModule($rootID, 'task') or !$products) return $this->getOptionMenu($rootID, 'task', $startModule);
/* createdVersion > 4.1. */
$startModulePath = '';
if($startModule > 0)
{
$startModule = $this->getById($startModule);
if($startModule)
if($startModule)
{
$startModulePath = $startModule->path . '%';
$modulePaths = explode(",", $startModulePath);
@@ -258,7 +258,7 @@ class treeModel extends model
}
foreach($topMenu as $moduleID => $moduleName)
{
if(!isset($projectModules[$moduleID])) unset($treeMenu[$moduleID]);
if(!isset($projectModules[$moduleID])) unset($treeMenu[$moduleID]);
}
}
}
@@ -267,11 +267,11 @@ class treeModel extends model
/**
* Build tree array.
*
* @param $&treeMenu
* @param array $modules
* @param object $module
* @param string $moduleName
*
* @param $&treeMenu
* @param array $modules
* @param object $module
* @param string $moduleName
* @access public
* @return void
*/
@@ -398,7 +398,7 @@ class treeModel extends model
if(!$this->isMergeModule($rootID, 'task') or !$products)
{
$extra['tip'] = false;
return $this->getTreeMenu($rootID, 'task', $startModule, $userFunc, $extra);
return $this->getTreeMenu($rootID, 'task', $startModule, $userFunc, $extra);
}
/* createdVersion > 4.1. */
@@ -487,7 +487,7 @@ class treeModel extends model
* @access public
* @return object
*/
public function getTaskStructure($rootID, $productID = 0, $manage = true)
public function getTaskStructure($rootID, $productID = 0, $manage = true)
{
$extra = array('projectID' => $rootID, 'productID' => $productID, 'tip' => true);
@@ -542,9 +542,9 @@ class treeModel extends model
/**
* Get tree structure.
*
* @param int $rootID
* @param string $type
*
* @param int $rootID
* @param string $type
* @access public
* @return array
*/
@@ -556,10 +556,10 @@ class treeModel extends model
/**
* Get project story tree menu.
*
* @param int $rootID
* @param int $startModule
* @param array $userFunc
*
* @param int $rootID
* @param int $startModule
* @param array $userFunc
* @access public
* @return string
*/
@@ -627,13 +627,13 @@ class treeModel extends model
/**
* Build tree.
*
* @param & $&treeMenu
* @param object $module
* @param string $type
* @param array $userFunc
* @param array $extra
* @param int $branch
*
* @param & $&treeMenu
* @param object $module
* @param string $type
* @param array $userFunc
* @param array $extra
* @param int $branch
* @access public
* @return void
*/
@@ -693,21 +693,21 @@ class treeModel extends model
if(isset($treeMenu[$module->id]) and !empty($treeMenu[$module->id]))
{
if(!isset($treeMenu[$module->parent])) $treeMenu[$module->parent] = '';
$treeMenu[$module->parent] .= "<li class='closed'>$linkHtml";
$treeMenu[$module->parent] .= "<li class='closed'>$linkHtml";
$treeMenu[$module->parent] .= "<ul>" . $treeMenu[$module->id] . "</ul>\n";
}
else
{
if(!isset($treeMenu[$module->parent])) $treeMenu[$module->parent] = "";
$treeMenu[$module->parent] .= "<li>$linkHtml\n";
$treeMenu[$module->parent] .= "<li>$linkHtml\n";
}
$treeMenu[$module->parent] .= "</li>\n";
$treeMenu[$module->parent] .= "</li>\n";
}
/**
* Get project modules.
*
* @param int $projectID
* Get project modules.
*
* @param int $projectID
* @param bool $parent
* @param bool $linkStory
* @access public
@@ -765,7 +765,7 @@ class treeModel extends model
/* Get all modules from paths. */
foreach($paths as $path)
{
$modules = explode(',', $path);
$modules = explode(',', $path);
foreach($modules as $module) $projectModules[$module] = $module;
}
return $projectModules;
@@ -773,9 +773,9 @@ class treeModel extends model
/**
* Create link of a story.
*
*
* @param string $type
* @param object $module
* @param object $module
* @access public
* @return string
*/
@@ -786,9 +786,9 @@ class treeModel extends model
/**
* Create link of a product line.
*
*
* @param string $type
* @param object $module
* @param object $module
* @param array $extra
* @access public
* @return string
@@ -802,10 +802,10 @@ class treeModel extends model
/**
* Create link of a task.
*
* @param string $type
* @param object $module
* @param array $extra
*
* @param string $type
* @param object $module
* @param array $extra
* @access public
* @return string
*/
@@ -817,11 +817,11 @@ class treeModel extends model
}
/**
* Create link of project story.
*
* @param string $type
* @param object $module
* @param array $extra
* Create link of project story.
*
* @param string $type
* @param object $module
* @param array $extra
* @access public
* @return string
*/
@@ -834,8 +834,8 @@ class treeModel extends model
/**
* Create link of a doc.
*
* @param object $module
*
* @param object $module
* @access public
* @return string
*/
@@ -846,8 +846,8 @@ class treeModel extends model
/**
* Create the manage link of a module.
*
* @param object $module
*
* @param object $module
* @access public
* @return string
*/
@@ -877,9 +877,9 @@ class treeModel extends model
/**
* Create the task manage link of a module.
*
* @param int $productID
* @param int $module
*
* @param int $productID
* @param int $module
* @access public
* @return void
*/
@@ -906,8 +906,8 @@ class treeModel extends model
/**
* Create link of a bug.
*
* @param object $module
*
* @param object $module
* @access public
* @return string
*/
@@ -918,8 +918,8 @@ class treeModel extends model
/**
* Create link of a test case.
*
* @param object $module
*
* @param object $module
* @access public
* @return string
*/
@@ -930,8 +930,8 @@ class treeModel extends model
/**
* Create link of a test task.
*
* @param object $module
*
* @param object $module
* @access public
* @return string
*/
@@ -941,10 +941,10 @@ class treeModel extends model
}
/**
* Create case lib link
*
* @param string $type
* @param string $module
* Create case lib link
*
* @param string $type
* @param string $module
* @access public
* @return string
*/
@@ -954,12 +954,12 @@ class treeModel extends model
}
/**
* Create branch link
*
* @param string $type
* @param int $rootID
* @param int $branchID
* @param string $branch
* Create branch link
*
* @param string $type
* @param int $rootID
* @param int $branchID
* @param string $branch
* @access public
* @return string
*/
@@ -972,10 +972,10 @@ class treeModel extends model
/**
* Get sons of a module.
*
* @param int $rootID
* @param int $moduleID
* @param string $type
*
* @param int $rootID
* @param int $moduleID
* @param string $type
* @access public
* @return array
*/
@@ -1010,10 +1010,10 @@ class treeModel extends model
/**
* Get sons of a task module.
*
* @param int $rootID
* @param int $productID
* @param int $moduleID
*
* @param int $rootID
* @param int $productID
* @param int $moduleID
* @access public
* @return void
*/
@@ -1043,8 +1043,8 @@ class treeModel extends model
/**
* Get id list of a module's childs.
*
* @param int $moduleID
*
* @param int $moduleID
* @access public
* @return array
*/
@@ -1059,10 +1059,10 @@ class treeModel extends model
}
/**
* Get project module.
*
* @param int $projectID
* @param int $productID
* Get project module.
*
* @param int $projectID
* @param int $productID
* @access public
* @return void
*/
@@ -1087,8 +1087,8 @@ class treeModel extends model
/**
* Get parents of a module.
*
* @param int $moduleID
*
* @param int $moduleID
* @access public
* @return array
*/
@@ -1103,8 +1103,8 @@ class treeModel extends model
/**
* Get product by moduleID.
*
* @param int $moduleID
*
* @param int $moduleID
* @access public
* @return void
*/
@@ -1122,8 +1122,8 @@ class treeModel extends model
/**
* Get the module that its type == 'story'.
*
* @param int $moduleID
*
* @param int $moduleID
* @access public
* @return void
*/
@@ -1185,8 +1185,8 @@ class treeModel extends model
/**
* Update modules' order.
*
* @param array $orders
*
* @param array $orders
* @access public
* @return void
*/
@@ -1291,7 +1291,7 @@ class treeModel extends model
/**
* Update a module.
*
* @param int $moduleID
* @param int $moduleID
* @access public
* @return void
*/
@@ -1316,11 +1316,11 @@ class treeModel extends model
/**
* Change root.
*
* @param int $moduleID
* @param int $oldRoot
* @param int $newRoot
* @param string $type
*
* @param int $moduleID
* @param int $oldRoot
* @param int $newRoot
* @param string $type
* @access public
* @return void
*/
@@ -1373,8 +1373,8 @@ class treeModel extends model
/**
* Delete a module.
*
* @param int $moduleID
*
* @param int $moduleID
* @param null $null compatible with that of model::delete()
* @access public
* @return void
@@ -1400,7 +1400,7 @@ class treeModel extends model
if($module->type == 'task') $this->dao->update(TABLE_TASK)->set('module')->eq($module->parent)->where('module')->in($childs)->exec();
if($module->type == 'bug') $this->dao->update(TABLE_BUG)->set('module')->eq($module->parent)->where('module')->in($childs)->exec();
if($module->type == 'case') $this->dao->update(TABLE_CASE)->set('module')->eq($module->parent)->where('module')->in($childs)->exec();
if($module->type == 'story')
if($module->type == 'story')
{
$this->dao->update(TABLE_STORY)->set('module')->eq($module->parent)->where('module')->in($childs)->exec();
$this->dao->update(TABLE_TASK)->set('module')->eq($module->parent)->where('module')->in($childs)->exec();
@@ -1414,8 +1414,8 @@ class treeModel extends model
/**
* Fix the path, grade fields according to the id and parent fields.
*
* @param string $root
* @param string $type
* @param string $root
* @param string $type
* @access public
* @return void
*/
@@ -1464,12 +1464,12 @@ class treeModel extends model
/**
* Check unique module name.
*
* @param int $rootID
* @param string $viewType
* @param int $parentModuleID
* @param array $modules
* @param array $branches
*
* @param int $rootID
* @param string $viewType
* @param int $parentModuleID
* @param array $modules
* @param array $branches
* @access public
* @return bool
*/
@@ -1505,9 +1505,9 @@ class treeModel extends model
/**
* Check merge module version.
*
* @param int $rootID
* @param string $viewType
*
* @param int $rootID
* @param string $viewType
* @access public
* @return bool
*/
@@ -1530,11 +1530,11 @@ class treeModel extends model
/**
* Get full trees.
*
* @param int $rootID
* @param string $viewType
* @param int $branch
* @param int $currentModuleID
*
* @param int $rootID
* @param string $viewType
* @param int $branch
* @param int $currentModuleID
* @access public
* @return array
*/
@@ -1578,7 +1578,7 @@ class treeModel extends model
* @access public
* @return array
*/
public function getDataStructure($stmt, $viewType, $keepModules = array())
public function getDataStructure($stmt, $viewType, $keepModules = array())
{
$parent = array();
while($module = $stmt->fetch())
@@ -1610,11 +1610,11 @@ class treeModel extends model
/**
* Get all doc structure.
*
*
* @access public
* @return array
*/
public function getDocStructure()
public function getDocStructure()
{
$stmt = $this->dbh->query($this->dao->select('*')->from(TABLE_MODULE)->where('type')->eq('doc')->get());
$parent = array();