diff --git a/trunk/module/story/control.php b/trunk/module/story/control.php
index bf60f4b4b7..0e6221ab1a 100644
--- a/trunk/module/story/control.php
+++ b/trunk/module/story/control.php
@@ -140,6 +140,11 @@ class story extends control
}
$this->commonAction($storyID);
+ $this->story->getAffectedScope($this->view->story);
+ $this->app->loadLang('task');
+ $this->app->loadLang('bug');
+ $this->app->loadLang('testcase');
+ $this->app->loadLang('project');
/* 赋值到模板。*/
$this->view->header->title = $this->view->product->name . $this->lang->colon . $this->lang->story->change . $this->lang->colon . $this->view->story->title;
@@ -259,6 +264,14 @@ class story extends control
$this->view->story = $story;
$this->view->actions = $this->action->getList('story', $storyID);
$this->view->users = $this->loadModel('user')->getPairs();
+
+ /* 影响范围。*/
+ $this->story->getAffectedScope($this->view->story);
+ $this->app->loadLang('task');
+ $this->app->loadLang('bug');
+ $this->app->loadLang('testcase');
+ $this->app->loadLang('project');
+
$this->display();
}
diff --git a/trunk/module/story/lang/zh-cn.php b/trunk/module/story/lang/zh-cn.php
index 0e2c6a9dda..09fea212b3 100644
--- a/trunk/module/story/lang/zh-cn.php
+++ b/trunk/module/story/lang/zh-cn.php
@@ -123,6 +123,10 @@ $lang->story->legendHistory = '历史记录';
$lang->story->legendVersion = '历史版本';
$lang->story->legendMisc = '其他相关';
+$lang->story->affectedProjects = '影响的项目';
+$lang->story->affectedBugs = '影响的Bug';
+$lang->story->affectedCases = '影响的用例';
+
$lang->story->specTemplate = "建议参考的模板:作为一名<某种类型的用户>,我希望<达成某些目的>,这样可以<开发的价值>。";
$lang->story->needNotReview = '不需要评审';
$lang->story->confirmDelete = "您确认删除该需求吗?";
diff --git a/trunk/module/story/model.php b/trunk/module/story/model.php
index 08db6da575..f8f8fd2f96 100644
--- a/trunk/module/story/model.php
+++ b/trunk/module/story/model.php
@@ -35,14 +35,14 @@ class storyModel extends model
$spec = $this->dao->select('title,spec')->from(TABLE_STORYSPEC)->where('story')->eq($storyID)->andWhere('version')->eq($version)->fetch();
$story->title = $spec->title;
$story->spec = $spec->spec;
- $story->projects = $this->dao->select('t1.project, t2.name')
+ $story->projects = $this->dao->select('t1.project, t2.name, t2.status')
->from(TABLE_PROJECTSTORY)->alias('t1')
->leftJoin(TABLE_PROJECT)->alias('t2')
->on('t1.project = t2.id')
->where('t1.story')->eq($storyID)
->orderBy('t1.project DESC')
- ->fetchPairs();
- $story->tasks = $this->dao->select('id,name,project')->from(TABLE_TASK)->where('story')->eq($storyID)->orderBy('id DESC')->fetchAll();
+ ->fetchAll('project');
+ $story->tasks = $this->dao->select('id, name, owner, project, status, consumed, `left`')->from(TABLE_TASK)->where('story')->eq($storyID)->orderBy('id DESC')->fetchGroup('project');
//$story->bugCount = $this->dao->select('COUNT(*)')->alias('count')->from(TABLE_BUG)->where('story')->eq($storyID)->fetch('count');
//$story->caseCount = $this->dao->select('COUNT(*)')->alias('count')->from(TABLE_CASE)->where('story')->eq($storyID)->fetch('count');
if($story->toBug) $story->toBugTitle = $this->dao->findById($story->toBug)->from(TABLE_BUG)->fetch('title');
@@ -56,6 +56,36 @@ class storyModel extends model
return $story;
}
+ /* 获得需求的影响范围。*/
+ public function getAffectedScope($story)
+ {
+ /* 移除已经结束的项目。*/
+ if($story->projects)
+ {
+ foreach($story->projects as $projectID => $project)
+ {
+ if($project->status != 'doing') unset($story->projects[$projectID]);
+ }
+ }
+
+ /* 获得项目中的成员。*/
+ if($story->projects)
+ {
+ $story->teams = $this->dao->select('account, project')
+ ->from(TABLE_TEAM)
+ ->where('project')->in(array_keys($story->projects))
+ ->fetchGroup('project');
+ }
+
+ /* 获得影响的Bug。*/
+ $story->bugs = $this->dao->findByStory($story->id)->from(TABLE_BUG)->andWhere('status')->ne('closed')->orderBy('id desc')->fetchAll();
+
+ /* 获得影响的用例。*/
+ $story->cases = $this->dao->findByStory($story->id)->from(TABLE_CASE)->fetchAll();
+
+ return $story;
+ }
+
/* 新增需求。*/
public function create()
{
diff --git a/trunk/module/story/view/affected.html.php b/trunk/module/story/view/affected.html.php
new file mode 100644
index 0000000000..5f30b331f9
--- /dev/null
+++ b/trunk/module/story/view/affected.html.php
@@ -0,0 +1,74 @@
+
+ story->affectedProjects;?>
+
+ projects as $projectID => $project):?>
+
+ $project->name "; ?> |
+ teams[$projectID] as $member) echo $users[$member->account] . ' ';?> |
+
+
+
+ | task->id;?> |
+ task->name;?> |
+ task->owner;?> |
+ task->status;?> |
+ task->consumed;?> |
+ task->left;?> |
+
+ tasks[$projectID] as $task):?>
+
+ | id;?> |
+ createLink('task', 'view', "taskID=$task->id"), $task->name, '_blank');?> |
+ owner];?> |
+ task->statusList[$task->status];?> |
+ consumed;?> |
+ left;?> |
+
+
+
+ |
+
+
+
+
+ story->affectedBugs;?>
+
+ | bug->id;?> |
+ bug->title;?> |
+ bug->status;?> |
+ bug->openedBy;?> |
+ bug->resolvedBy;?> |
+ bug->resolution;?> |
+ bug->lastEditedBy;?> |
+
+ bugs as $bug):?>
+
+ | id;?> |
+ createLink('bug', 'view', "bugID=$bug->id"), $bug->title, '_blank');?> |
+ bug->statusList[$bug->status];?> |
+ openedBy];?> |
+ resolvedBy];?> |
+ bug->resolutionList[$bug->resolution];?> |
+ lastEditedBy];?> |
+
+
+
+
+ story->affectedCases;?>
+
+ | testcase->id;?> |
+ testcase->title;?> |
+ testcase->status;?> |
+ testcase->openedBy;?> |
+ testcase->lastEditedBy;?> |
+
+ cases as $case):?>
+
+ | id;?> |
+ createLink('testcase', 'view', "caseID=$case->id"), $case->title, '_blank');?> |
+ testcase->statusList[$case->status];?> |
+ openedBy];?> |
+ lastEditedBy];?> |
+
+
+
diff --git a/trunk/module/story/view/change.html.php b/trunk/module/story/view/change.html.php
index 61b979e1c9..653c4c8bfd 100644
--- a/trunk/module/story/view/change.html.php
+++ b/trunk/module/story/view/change.html.php
@@ -47,12 +47,9 @@
attatch;?> |
fetch('file', 'buildform', 'filecount=2');?> |
-
- |
- goback, inlink('view', "storyID=$story->id"));?>
- |
-
+ goback, inlink('view', "storyID=$story->id"));?>
+
diff --git a/trunk/module/story/view/review.html.php b/trunk/module/story/view/review.html.php
index 873518deda..eab8aaeb10 100644
--- a/trunk/module/story/view/review.html.php
+++ b/trunk/module/story/view/review.html.php
@@ -121,6 +121,7 @@ function setStory(reason)
+
diff --git a/trunk/module/story/view/view.html.php b/trunk/module/story/view/view.html.php
index b5a7c495a5..1b3a5e167c 100644
--- a/trunk/module/story/view/view.html.php
+++ b/trunk/module/story/view/view.html.php
@@ -160,11 +160,14 @@
tasks as $task)
+ foreach($story->tasks as $projectTasks)
{
- $projectName = $story->projects[$task->project];
- echo html::a($this->createLink('project', 'browse', "projectID=$task->project"), $projectName);
- echo '' . html::a($this->createLink('task', 'view', "taskID=$task->id"), "#$task->id $task->name") . ' ';
+ foreach($projectTasks as $task)
+ {
+ $projectName = $story->projects[$task->project]->name;
+ echo html::a($this->createLink('project', 'browse', "projectID=$task->project"), $projectName);
+ echo '' . html::a($this->createLink('task', 'view', "taskID=$task->id"), "#$task->id $task->name") . ' ';
+ }
}
?>
|