diff --git a/trunk/module/common/lang/zh-cn.php b/trunk/module/common/lang/zh-cn.php index bbea9cf6fb..f302a1049e 100644 --- a/trunk/module/common/lang/zh-cn.php +++ b/trunk/module/common/lang/zh-cn.php @@ -94,7 +94,7 @@ $lang->release->menu = $lang->product->menu; /* 项目视图菜单设置。*/ $lang->project->menu->list = '%s'; -$lang->project->menu->task = array('link' => '任务列表|project|task|projectID=%s', 'subModule' => 'task'); +$lang->project->menu->task = array('link' => '任务列表|project|task|projectID=%s', 'subModule' => 'task', 'alias' => 'grouptask'); $lang->project->menu->story = array('link' => '需求列表|project|story|projectID=%s', 'alias' => 'linkstory'); $lang->project->menu->bug = 'Bug列表|project|bug|projectID=%s'; $lang->project->menu->build = array('link' => 'Build列表|project|build|projectID=%s', 'subModule' => 'build'); diff --git a/trunk/module/common/treetable.html.php b/trunk/module/common/treetable.html.php new file mode 100644 index 0000000000..fe80162f27 --- /dev/null +++ b/trunk/module/common/treetable.html.php @@ -0,0 +1,3 @@ + + + diff --git a/trunk/module/project/control.php b/trunk/module/project/control.php index c3eb2a9cb4..28e14fe222 100644 --- a/trunk/module/project/control.php +++ b/trunk/module/project/control.php @@ -75,9 +75,6 @@ class project extends control /* 浏览某一个项目下面的任务。*/ public function task($projectID = 0, $orderBy = 'status|asc,id|desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) { - /* 加载任务模块。*/ - $this->loadModel('task'); - /* 公共的操作。*/ $project = $this->commonAction($projectID); $projectID = $project->id; @@ -87,28 +84,81 @@ class project extends control $this->app->session->set('storyList', $this->app->getURI(true)); /* 设定header和position信息。*/ - $header['title'] = $project->name . $this->lang->colon . $this->lang->project->task; - $position[] = html::a($this->createLink('project', 'browse', "projectID=$projectID"), $project->name); - $position[] = $this->lang->project->task; + $this->view->header->title = $project->name . $this->lang->colon . $this->lang->project->task; + $this->view->position[] = html::a($this->createLink('project', 'browse', "projectID=$projectID"), $project->name); + $this->view->position[] = $this->lang->project->task; /* 分页操作。*/ $this->app->loadClass('pager', $static = true); $pager = new pager($recTotal, $recPerPage, $pageID); - $tasks = $this->task->getProjectTasks($projectID, $orderBy, $pager); + $tasks = $this->loadModel('task')->getProjectTasks($projectID, $orderBy, $pager); /* 赋值。*/ - $this->assign('header', $header); - $this->assign('position', $position); - $this->assign('tasks', $tasks); - $this->assign('tabID', 'task'); - $this->assign('pager', $pager->get()); - $this->assign('recTotal', $pager->recTotal); - $this->assign('recPerPage', $pager->recPerPage); - $this->assign('orderBy', $orderBy); + $this->view->tasks = $tasks; + $this->view->tabID = 'task'; + $this->view->pager = $pager->get(); + $this->view->recTotal = $pager->recTotal; + $this->view->recPerPage = $pager->recPerPage; + $this->view->orderBy = $orderBy; + $this->view->browseType = 'list'; $this->display(); } + /* 按照tree的方式查看任务。*/ + public function grouptask($projectID = 0, $groupBy = 'story') + { + /* 公共的操作。*/ + $project = $this->commonAction($projectID); + $projectID = $project->id; + + /* 记录用户当前选择的列表。*/ + $this->app->session->set('taskList', $this->app->getURI(true)); + $this->app->session->set('storyList', $this->app->getURI(true)); + + /* 设定header和position信息。*/ + $this->view->header['title'] = $project->name . $this->lang->colon . $this->lang->project->task; + $this->view->position[] = html::a($this->createLink('project', 'browse', "projectID=$projectID"), $project->name); + $this->view->position[] = $this->lang->project->task; + + /* 获得任务列表,并将其分组。*/ + $tasks = $this->loadModel('task')->getProjectTasks($projectID, $groupBy); + $groupBy = strtolower(str_replace('`', '', $groupBy)); + $taskLang = $this->lang->task; + $groupByList = array(); + foreach($tasks as $task) + { + if($groupBy == 'story') + { + $groupTasks[$task->story][] = $task; + $groupByList[$task->story] = $task->storyTitle; + } + elseif($groupBy == 'status') + { + $groupTasks[$taskLang->statusList[$task->status]][] = $task; + } + elseif($groupBy == 'owner') + { + $groupTasks[$task->ownerRealName][] = $task; + } + elseif($groupBy == 'type') + { + $groupTasks[$taskLang->typeList[$task->type]][] = $task; + } + else + { + $groupTasks[$task->$groupBy][] = $task; + } + } + + /* 赋值。*/ + $this->view->tasks = $groupTasks; + $this->view->tabID = 'task'; + $this->view->groupByList = $groupByList; + $this->view->browseType = $groupBy; + $this->display(); + } + /* 浏览某一个项目下面的需求。*/ public function story($projectID = 0, $orderBy = 'status|desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) { diff --git a/trunk/module/project/lang/zh-cn.php b/trunk/module/project/lang/zh-cn.php index d22875837d..38f664e9e1 100644 --- a/trunk/module/project/lang/zh-cn.php +++ b/trunk/module/project/lang/zh-cn.php @@ -78,6 +78,16 @@ $lang->project->bug = 'Bug列表'; $lang->project->build = 'Build列表'; $lang->project->burn = '燃烧图'; $lang->project->burnData = '燃烧图数据'; +$lang->project->listTask = '列表方式'; +$lang->project->groupTaskByStory = '按需求分组'; +$lang->project->groupTaskByStatus = '按状态分组'; +$lang->project->groupTaskByPri = '按优先级分组'; +$lang->project->groupTaskByOwner = '按指派给分组'; +$lang->project->groupTaskByEstimate = '按预计工时分组'; +$lang->project->groupTaskByConsumed = '按已消耗分组'; +$lang->project->groupTaskByLeft = '按剩余工时分组'; +$lang->project->groupTaskByType = '按任务类型分组'; +$lang->project->groupTaskByDeadline = '按截止日期分组'; $lang->project->beginAndEnd = '起止时间'; $lang->project->lblStats = '工时统计'; diff --git a/trunk/module/project/view/grouptask.html.php b/trunk/module/project/view/grouptask.html.php new file mode 100644 index 0000000000..2f4329113c --- /dev/null +++ b/trunk/module/project/view/grouptask.html.php @@ -0,0 +1,74 @@ +. + * + * @copyright Copyright 2009-2010 Chunsheng Wang + * @author Chunsheng Wang + * @package project + * @version $Id$ + * @link http://www.zentao.cn + */ +?> + + + +
+ + + + + + + + + + + + + + + + $groupTasks):?> + + + + + + + owner == $app->user->account ? 'style=color:red' : '';?> + + + + + + + + + + + + + + + + +
task->name;?>task->pri;?>task->owner;?>task->estimate;?>task->consumed;?>task->left;?>task->type;?>task->deadline;?>task->status;?>
 id . $lang->colon; if(common::hasPriv('task', 'view')) echo html::a($this->createLink('task', 'view', "task=$task->id"), $task->name); else echo $task->name;?>pri;?>>ownerRealName;?>estimate;?>consumed;?>left;?>task->typeList[$task->type];?>delay)) echo 'delayed';?>>deadline, 0, 4) > 0) echo $task->deadline;?>status;?> >task->statusList[$task->status];?> + createLink('task', 'edit', "taskid=$task->id"), $lang->edit);?> + createLink('task', 'delete', "projectID=$task->project&taskid=$task->id"), $lang->delete, 'hiddenwin');?> +
+
+ + diff --git a/trunk/module/project/view/task.html.php b/trunk/module/project/view/task.html.php index acb9d15e0a..6d785b1322 100644 --- a/trunk/module/project/view/task.html.php +++ b/trunk/module/project/view/task.html.php @@ -24,18 +24,8 @@ ?> -
-
-
- -
-
- id", $lang->task->create); - //common::printLink('task', 'import', "project=$project->id", $lang->task->import); - ?> -
-
+ +
id&orderBy=%s&recTotal=$recTotal&recPerPage=$recPerPage"; ?> @@ -67,7 +57,7 @@ - +
left;?> task->typeList[$task->type];?> delay)) echo 'delayed';?>>deadline, 0, 4) > 0) echo $task->deadline;?>status;?> >task->statusList->{$task->status};?>status;?> >task->statusList[$task->status];?> storyID) @@ -87,4 +77,5 @@
+ diff --git a/trunk/module/project/view/taskheader.html.php b/trunk/module/project/view/taskheader.html.php new file mode 100644 index 0000000000..467b7ada81 --- /dev/null +++ b/trunk/module/project/view/taskheader.html.php @@ -0,0 +1,22 @@ +
+
+ +
+
+
+ " ; common::printLink('project', 'task', "project=$project->id", $lang->project->listTask); echo '' ; + echo "" ; common::printLink('project', 'groupTask', "project=$project->id&groupby=story", $lang->project->groupTaskByStory); echo '' ; + echo "" ; common::printLink('project', 'groupTask', "project=$project->id&groupby=status", $lang->project->groupTaskByStatus); echo '' ; + echo "" ; common::printLink('project', 'groupTask', "project=$project->id&groupby=pri", $lang->project->groupTaskByPri); echo '' ; + echo "" ; common::printLink('project', 'groupTask', "project=$project->id&groupby=owner", $lang->project->groupTaskByOwner); echo '' ; + echo ""; common::printLink('project', 'groupTask', "project=$project->id&groupby=estimate",$lang->project->groupTaskByEstimate); echo '' ; + echo ""; common::printLink('project', 'groupTask', "project=$project->id&groupby=consumed",$lang->project->groupTaskByConsumed); echo '' ; + echo "" ; common::printLink('project', 'groupTask', "project=$project->id&groupby=`left`", $lang->project->groupTaskByLeft); echo '' ; + echo "" ; common::printLink('project', 'groupTask', "project=$project->id&groupby=type", $lang->project->groupTaskByType); echo '' ; + echo ""; common::printLink('project', 'groupTask', "project=$project->id&groupby=deadline",$lang->project->groupTaskByDeadline); echo '' ; + ?> +
+
id", $lang->task->create); ?>
+
+
diff --git a/trunk/module/task/lang/zh-cn.php b/trunk/module/task/lang/zh-cn.php index 2c5929a8d5..5d344ed994 100644 --- a/trunk/module/task/lang/zh-cn.php +++ b/trunk/module/task/lang/zh-cn.php @@ -45,11 +45,11 @@ $lang->task->status = '任务状态'; $lang->task->desc = '任务描述'; $lang->task->statusCustom = '状态排序'; -$lang->task->statusList->wait = '未开始'; -$lang->task->statusList->doing = '进行中'; -$lang->task->statusList->done = '已完成'; -$lang->task->statusList->cancel = '已取消'; -$lang->task->statusList->delayed = '延期'; +$lang->task->statusList['wait'] = '未开始'; +$lang->task->statusList['doing'] = '进行中'; +$lang->task->statusList['done'] = '已完成'; +$lang->task->statusList['cancel'] = '已取消'; +$lang->task->statusList['delayed'] = '延期'; $lang->task->typeList[''] = ''; $lang->task->typeList['design'] = '设计'; diff --git a/trunk/www/js/jquery/treetable/min.js b/trunk/www/js/jquery/treetable/min.js new file mode 100644 index 0000000000..25c3b23fb6 --- /dev/null +++ b/trunk/www/js/jquery/treetable/min.js @@ -0,0 +1,13 @@ +/* jQuery treeTable Plugin 2.2.3 - http://ludo.cubicphuse.nl/jquery-plugins/treeTable/ */ +(function($){var options;var defaultPaddingLeft;$.fn.treeTable=function(opts){options=$.extend({},$.fn.treeTable.defaults,opts);return this.each(function(){$(this).addClass("treeTable").find("tbody tr").each(function(){if(!options.expandable||$(this)[0].className.search("child-of-")==-1){if(isNaN(defaultPaddingLeft)){defaultPaddingLeft=parseInt($($(this).children("td")[options.treeColumn]).css('padding-left'),10);} +initialize($(this));}else if(options.initialState=="collapsed"){this.style.display="none";}});});};$.fn.treeTable.defaults={childPrefix:"child-of-",clickableNodeNames:false,expandable:true,indent:19,initialState:"collapsed",treeColumn:0};$.fn.collapse=function(){$(this).addClass("collapsed");childrenOf($(this)).each(function(){if(!$(this).hasClass("collapsed")){$(this).collapse();} +this.style.display="none";});return this;};$.fn.expand=function(){$(this).removeClass("collapsed").addClass("expanded");childrenOf($(this)).each(function(){initialize($(this));if($(this).is(".expanded.parent")){$(this).expand();} +$(this).show();});return this;};$.fn.appendBranchTo=function(destination){var node=$(this);var parent=parentOf(node);var ancestorNames=$.map(ancestorsOf($(destination)),function(a){return a.id;});if($.inArray(node[0].id,ancestorNames)==-1&&(!parent||(destination.id!=parent[0].id))&&destination.id!=node[0].id){indent(node,ancestorsOf(node).length*options.indent*-1);if(parent){node.removeClass(options.childPrefix+parent[0].id);} +node.addClass(options.childPrefix+destination.id);move(node,destination);indent(node,ancestorsOf(node).length*options.indent);} +return this;};$.fn.reverse=function(){return this.pushStack(this.get().reverse(),arguments);};$.fn.toggleBranch=function(){if($(this).hasClass("collapsed")){$(this).expand();}else{$(this).removeClass("expanded").collapse();} +return this;};function ancestorsOf(node){var ancestors=[];while(node=parentOf(node)){ancestors[ancestors.length]=node[0];} +return ancestors;};function childrenOf(node){return $("table.treeTable tbody tr."+options.childPrefix+node[0].id);};function getPaddingLeft(node){var paddingLeft=parseInt(node[0].style.paddingLeft,10);return(isNaN(paddingLeft))?defaultPaddingLeft:paddingLeft;} +function indent(node,value){var cell=$(node.children("td")[options.treeColumn]);cell[0].style.paddingLeft=getPaddingLeft(cell)+value+"px";childrenOf(node).each(function(){indent($(this),value);});};function initialize(node){if(!node.hasClass("initialized")){node.addClass("initialized");var childNodes=childrenOf(node);if(!node.hasClass("parent")&&childNodes.length>0){node.addClass("parent");} +if(node.hasClass("parent")){var cell=$(node.children("td")[options.treeColumn]);var padding=getPaddingLeft(cell)+options.indent;childNodes.each(function(){$(this).children("td")[options.treeColumn].style.paddingLeft=padding+"px";});if(options.expandable){cell.prepend('');$(cell[0].firstChild).click(function(){node.toggleBranch();});if(options.clickableNodeNames){cell[0].style.cursor="pointer";$(cell).click(function(e){if(e.target.className!='expander'){node.toggleBranch();}});} +if(!(node.hasClass("expanded")||node.hasClass("collapsed"))){node.addClass(options.initialState);} +if(node.hasClass("expanded")){node.expand();}}}}};function move(node,destination){node.insertAfter(destination);childrenOf(node).reverse().each(function(){move($(this),node[0]);});};function parentOf(node){var classNames=node[0].className.split(' ');for(key in classNames){if(classNames[key].match("child-of-")){return $("#"+classNames[key].substring(9));}}};})(jQuery); \ No newline at end of file diff --git a/trunk/www/js/jquery/treetable/raw.js b/trunk/www/js/jquery/treetable/raw.js new file mode 100644 index 0000000000..84e28ec370 --- /dev/null +++ b/trunk/www/js/jquery/treetable/raw.js @@ -0,0 +1,191 @@ +/* jQuery treeTable Plugin 2.2.2 - http://ludo.cubicphuse.nl/jquery-plugins/treeTable/ */ +(function($) { + // Helps to make options available to all functions + // TODO: This gives problems when there are both expandable and non-expandable + // trees on a page. The options shouldn't be global to all these instances! + var options; + + $.fn.treeTable = function(opts) { + options = $.extend({}, $.fn.treeTable.defaults, opts); + + return this.each(function() { + $(this).addClass("treeTable").find("tbody tr").each(function() { + // Initialize root nodes only if possible + if(!options.expandable || $(this)[0].className.search("child-of-") == -1) { + initialize($(this)); + } else if(options.initialState == "collapsed") { + this.style.display = "none"; // Performance! $(this).hide() is slow... + } + }); + }); + }; + + $.fn.treeTable.defaults = { + childPrefix: "child-of-", + clickableNodeNames: false, + expandable: true, + indent: 19, + initialState: "collapsed", + treeColumn: 0 + }; + + // Recursively hide all node's children in a tree + $.fn.collapse = function() { + $(this).addClass("collapsed"); + + childrenOf($(this)).each(function() { + if(!$(this).hasClass("collapsed")) { + $(this).collapse(); + } + + $(this).hide(); + }); + + return this; + }; + + // Recursively show all node's children in a tree + $.fn.expand = function() { + $(this).removeClass("collapsed").addClass("expanded"); + + childrenOf($(this)).each(function() { + initialize($(this)); + + if($(this).is(".expanded.parent")) { + $(this).expand(); + } + + $(this).show(); + }); + + return this; + }; + + // Add an entire branch to +destination+ + $.fn.appendBranchTo = function(destination) { + var node = $(this); + var parent = parentOf(node); + + var ancestorNames = $.map(ancestorsOf($(destination)), function(a) { return a.id; }); + + // Conditions: + // 1: +node+ should not be inserted in a location in a branch if this would + // result in +node+ being an ancestor of itself. + // 2: +node+ should not have a parent OR the destination should not be the + // same as +node+'s current parent (this last condition prevents +node+ + // from being moved to the same location where it already is). + // 3: +node+ should not be inserted as a child of +node+ itself. + if($.inArray(node[0].id, ancestorNames) == -1 && (!parent || (destination.id != parent[0].id)) && destination.id != node[0].id) { + indent(node, ancestorsOf(node).length * options.indent * -1); // Remove indentation + + if(parent) { node.removeClass(options.childPrefix + parent[0].id); } + + node.addClass(options.childPrefix + destination.id); + move(node, destination); // Recursively move nodes to new location + indent(node, ancestorsOf(node).length * options.indent); + } + + return this; + }; + + // Add reverse() function from JS Arrays + $.fn.reverse = function() { + return this.pushStack(this.get().reverse(), arguments); + }; + + // Toggle an entire branch + $.fn.toggleBranch = function() { + if($(this).hasClass("collapsed")) { + $(this).expand(); + } else { + $(this).removeClass("expanded").collapse(); + } + + return this; + }; + + // === Private functions + + function ancestorsOf(node) { + var ancestors = []; + while(node = parentOf(node)) { + ancestors[ancestors.length] = node[0]; + } + return ancestors; + }; + + function childrenOf(node) { + return $("table.treeTable tbody tr." + options.childPrefix + node[0].id); + }; + + function indent(node, value) { + var cell = $(node.children("td")[options.treeColumn]); + var padding = parseInt(cell.css("padding-left"), 10) + value; + + cell.css("padding-left", + padding + "px"); + + childrenOf(node).each(function() { + indent($(this), value); + }); + }; + + function initialize(node) { + if(!node.hasClass("initialized")) { + node.addClass("initialized"); + + var childNodes = childrenOf(node); + + if(!node.hasClass("parent") && childNodes.length > 0) { + node.addClass("parent"); + } + + if(node.hasClass("parent")) { + var cell = $(node.children("td")[options.treeColumn]); + var padding = parseInt(cell.css("padding-left"), 10) + options.indent; + + childNodes.each(function() { + $($(this).children("td")[options.treeColumn]).css("padding-left", padding + "px"); + }); + + if(options.expandable) { + cell.prepend(''); + $(cell[0].firstChild).click(function() { node.toggleBranch(); }); + + if(options.clickableNodeNames) { + $(cell).css('cursor', 'pointer'); + $(cell).click(function(e) { + // Don't double-toggle if the click is on the existing expander icon + if (e.target.className != 'expander') { + node.toggleBranch(); + } + }); + } + + // Check for a class set explicitly by the user, otherwise set the default class + if(!(node.hasClass("expanded") || node.hasClass("collapsed"))) { + node.addClass(options.initialState); + } + + if(node.hasClass("expanded")) { + node.expand(); + } + } + } + } + }; + + function move(node, destination) { + node.insertAfter(destination); + childrenOf(node).reverse().each(function() { move($(this), node[0]); }); + }; + + function parentOf(node) { + var classNames = node[0].className.split(' '); + + for(key in classNames) { + if(classNames[key].match("child-of-")) { + return $("#" + classNames[key].substring(9)); + } + } + }; +})(jQuery); \ No newline at end of file diff --git a/trunk/www/theme/default/images/treetable/toggle-collapse-dark.png b/trunk/www/theme/default/images/treetable/toggle-collapse-dark.png new file mode 100644 index 0000000000..76577a57a2 Binary files /dev/null and b/trunk/www/theme/default/images/treetable/toggle-collapse-dark.png differ diff --git a/trunk/www/theme/default/images/treetable/toggle-collapse-light.png b/trunk/www/theme/default/images/treetable/toggle-collapse-light.png new file mode 100644 index 0000000000..ed1612fd9b Binary files /dev/null and b/trunk/www/theme/default/images/treetable/toggle-collapse-light.png differ diff --git a/trunk/www/theme/default/images/treetable/toggle-expand-dark.png b/trunk/www/theme/default/images/treetable/toggle-expand-dark.png new file mode 100644 index 0000000000..cfb42a4512 Binary files /dev/null and b/trunk/www/theme/default/images/treetable/toggle-expand-dark.png differ diff --git a/trunk/www/theme/default/images/treetable/toggle-expand-light.png b/trunk/www/theme/default/images/treetable/toggle-expand-light.png new file mode 100644 index 0000000000..27b52344dc Binary files /dev/null and b/trunk/www/theme/default/images/treetable/toggle-expand-light.png differ diff --git a/trunk/www/theme/default/style.css b/trunk/www/theme/default/style.css index f6169da77d..3562c76b69 100644 --- a/trunk/www/theme/default/style.css +++ b/trunk/www/theme/default/style.css @@ -126,6 +126,7 @@ caption {border:1px solid #e4e4e4; background:#efefef; margin:0; padding:5 .margin-15px {margin: 15px} .margin-20px {margin: 20px} .padding-10px{padding: 10px} +.padding-5px {padding: 5px} .mt-10px {margin-top: 10px} .mr-10px {margin-right: 10px} @@ -242,7 +243,9 @@ caption {border:1px solid #e4e4e4; background:#efefef; margin:0; padding:5 .done {color:darkgreen} .wait {color:#9F9F5F} .doing {color:red} +.delayed {background:red} .pass {color:darkgreen} .blocked {color:yellow} .fail {color:red} .hand {cursor:pointer} +.strong {font-weight:bold} diff --git a/trunk/www/theme/default/treetable.css b/trunk/www/theme/default/treetable.css new file mode 100644 index 0000000000..04bd7581e4 --- /dev/null +++ b/trunk/www/theme/default/treetable.css @@ -0,0 +1,43 @@ +/* jQuery TreeTable Core 2.0 stylesheet + * + * This file contains styles that are used to display the tree table. Each tree + * table is assigned the +treeTable+ class. + * ========================================================================= */ + +/* jquery.treeTable.collapsible + * ------------------------------------------------------------------------- */ +.treeTable tr td .expander { + background-position: left center; + background-repeat: no-repeat; + cursor: pointer; + padding: 0; + zoom: 1; /* IE7 Hack */ +} + +.treeTable tr.collapsed td .expander { + background-image: url(./images/treetable/toggle-expand-dark.png); +} + +.treeTable tr.expanded td .expander { + background-image: url(./images/treetable/toggle-collapse-dark.png); +} + +/* jquery.treeTable.sortable + * ------------------------------------------------------------------------- */ +.treeTable tr.selected, .treeTable tr.accept { + background-color: #3875d7; + color: #fff; +} + +.treeTable tr.collapsed.selected td .expander, .treeTable tr.collapsed.accept td .expander { + background-image: url(./images/treetable/toggle-expand-light.png); +} + +.treeTable tr.expanded.selected td .expander, .treeTable tr.expanded.accept td .expander { + background-image: url(./images/treetable/toggle-collapse-light.png); +} + +.treeTable .ui-draggable-dragging { + color: #000; + z-index: 1; +}