+ add the feature of list affected scopes.

This commit is contained in:
wangchunsheng
2010-03-29 15:01:33 +00:00
parent f8d57f267c
commit d37b117bd6
7 changed files with 134 additions and 12 deletions

View File

@@ -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();
}

View File

@@ -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 = "建议参考的模板:作为一名<<i class='red'>某种类型的用户</i>>,我希望<<i class='red'>达成某些目的</i>>,这样可以<<i class='red'>开发的价值</i>>。";
$lang->story->needNotReview = '不需要评审';
$lang->story->confirmDelete = "您确认删除该需求吗?";

View File

@@ -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()
{

View File

@@ -0,0 +1,74 @@
<table class='table-1 mt-10px'>
<caption><?php echo $lang->story->affectedProjects;?></caption>
<?php foreach($story->projects as $projectID => $project):?>
<tr>
<td class='a-center'><?php echo "<strong>$project->name</strong><br />"; ?> </td>
<td class='a-center'><?php foreach($story->teams[$projectID] as $member) echo $users[$member->account] . ' ';?></td>
<td>
<table class='table-1' style='margin:0'>
<tr class='colhead'>
<th><?php echo $lang->task->id;?></th>
<th><?php echo $lang->task->name;?></th>
<th><?php echo $lang->task->owner;?></th>
<th><?php echo $lang->task->status;?></th>
<th><?php echo $lang->task->consumed;?></th>
<th><?php echo $lang->task->left;?></th>
</tr>
<?php foreach($story->tasks[$projectID] as $task):?>
<tr class='a-center'>
<td><?php echo $task->id;?></td>
<td class='a-left'><?php echo html::a($this->createLink('task', 'view', "taskID=$task->id"), $task->name, '_blank');?></td>
<td><?php echo $users[$task->owner];?></td>
<td><?php echo $lang->task->statusList[$task->status];?></td>
<td><?php echo $task->consumed;?></td>
<td><?php echo $task->left;?></td>
</tr>
<?php endforeach;?>
</table>
</td>
</tr>
<?php endforeach;?>
</table>
<table class='table-1'>
<caption><?php echo $lang->story->affectedBugs;?></caption>
<tr>
<th class='w-p10'><?php echo $lang->bug->id;?></th>
<th class='w-p40'><?php echo $lang->bug->title;?></th>
<th class='w-p10'><?php echo $lang->bug->status;?></th>
<th class='w-p10'><?php echo $lang->bug->openedBy;?></th>
<th><?php echo $lang->bug->resolvedBy;?></th>
<th><?php echo $lang->bug->resolution;?></th>
<th><?php echo $lang->bug->lastEditedBy;?></th>
</tr>
<?php foreach($story->bugs as $bug):?>
<tr class='a-center'>
<td><?php echo $bug->id;?></td>
<td class='a-left'><?php echo html::a($this->createLink('bug', 'view', "bugID=$bug->id"), $bug->title, '_blank');?></td>
<td><?php echo $lang->bug->statusList[$bug->status];?></td>
<td><?php echo $users[$bug->openedBy];?></td>
<td><?php echo $users[$bug->resolvedBy];?></td>
<td><?php echo $lang->bug->resolutionList[$bug->resolution];?></td>
<td><?php echo $users[$bug->lastEditedBy];?></td>
</tr>
<?php endforeach;?>
</table>
<table class='table-1'>
<caption><?php echo $lang->story->affectedCases;?></caption>
<tr>
<th class='w-p10'><?php echo $lang->testcase->id;?></th>
<th class='w-p40'><?php echo $lang->testcase->title;?></th>
<th class='w-p10'><?php echo $lang->testcase->status;?></th>
<th class='w-p10'><?php echo $lang->testcase->openedBy;?></th>
<th><?php echo $lang->testcase->lastEditedBy;?></th>
</tr>
<?php foreach($story->cases as $case):?>
<tr class='a-center'>
<td><?php echo $case->id;?></td>
<td class='a-left'><?php echo html::a($this->createLink('testcase', 'view', "caseID=$case->id"), $case->title, '_blank');?></td>
<td><?php echo $lang->testcase->statusList[$case->status];?></td>
<td><?php echo $users[$case->openedBy];?></td>
<td><?php echo $users[$case->lastEditedBy];?></td>
</tr>
<?php endforeach;?>
</table>

View File

@@ -47,12 +47,9 @@
<th class='rowhead'><?php echo $lang->attatch;?></th>
<td><?php echo $this->fetch('file', 'buildform', 'filecount=2');?></td>
</tr>
<tr>
<td colspan='2' class='a-center'>
<?php echo html::submitButton() . html::linkButton($lang->goback, inlink('view', "storyID=$story->id"));?>
</td>
</tr>
</table>
<div class='a-center'><?php echo html::submitButton() . html::linkButton($lang->goback, inlink('view', "storyID=$story->id"));?></div>
<?php include './affected.html.php';?>
<?php include '../../common/view/action.html.php';?>
</form>
</div>

View File

@@ -121,6 +121,7 @@ function setStory(reason)
</tr>
</table>
</form>
<?php include './affected.html.php';?>
<?php include '../../common/view/action.html.php';?>
</div>
<?php include '../../common/view/footer.html.php';?>

View File

@@ -160,11 +160,14 @@
<tr>
<td>
<?php
foreach($story->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 '<span class="nobr">' . html::a($this->createLink('task', 'view', "taskID=$task->id"), "#$task->id $task->name") . '</span><br />';
foreach($projectTasks as $task)
{
$projectName = $story->projects[$task->project]->name;
echo html::a($this->createLink('project', 'browse', "projectID=$task->project"), $projectName);
echo '<span class="nobr">' . html::a($this->createLink('task', 'view', "taskID=$task->id"), "#$task->id $task->name") . '</span><br />';
}
}
?>
</td>