+ add the confirm story feature of task.
This commit is contained in:
@@ -30,6 +30,7 @@ $lang->action->desc->closed = '$date, 由 <strong>$actor</strong> 关闭。';
|
||||
$lang->action->desc->commented = '$date, 由 <strong>$actor</strong> 发表评论。';
|
||||
$lang->action->desc->activated = '$date, 由 <strong>$actor</strong> 激活。';
|
||||
$lang->action->desc->moved = '$date, 由 <strong>$actor</strong> 移动,之前为 "$extra"';
|
||||
$lang->action->desc->confirmed = '$date, 由 <strong>$actor</strong> 确认需求变动,最新版本为<strong>#$extra</strong>';
|
||||
$lang->action->desc->diff1 = '修改了 <strong><i>%s</i></strong>,旧值为 "%s",新值为 "%s"。<br />';
|
||||
$lang->action->desc->diff2 = '修改了 <strong><i>%s</i></strong>,区别为:<blockquote>%s</blockquote>';
|
||||
|
||||
@@ -42,6 +43,7 @@ $lang->action->label->activated = '激活了';
|
||||
$lang->action->label->resolved = '解决了';
|
||||
$lang->action->label->reviewed = '评审了';
|
||||
$lang->action->label->moved = '移动了';
|
||||
$lang->action->label->confirmed = '确认了需求,';
|
||||
$lang->action->label->story = '需求|story|view|storyID=%s';
|
||||
$lang->action->label->task = '任务|task|view|taskID=%s';
|
||||
$lang->action->label->bug = 'Bug|bug|view|bugID=%s';
|
||||
|
||||
@@ -127,6 +127,7 @@ $lang->resource->task->create = 'create';
|
||||
$lang->resource->task->edit = 'edit';
|
||||
$lang->resource->task->delete = 'delete';
|
||||
$lang->resource->task->view = 'view';
|
||||
$lang->resource->task->confirmStoryChange = 'confirmStoryChange';
|
||||
$lang->resource->task->ajaxGetUserTasks = 'ajaxGetUserTasks';
|
||||
$lang->resource->task->ajaxGetProjectTasks = 'ajaxGetProjectTasks';
|
||||
|
||||
@@ -148,13 +149,15 @@ $lang->resource->bug->resolve = 'resolve';
|
||||
$lang->resource->bug->activate= 'activate';
|
||||
$lang->resource->bug->close = 'close';
|
||||
$lang->resource->bug->report = 'reportChart';
|
||||
$lang->resource->bug->ajaxGetUserBugs = 'ajaxGetUserBugs';
|
||||
$lang->resource->bug->confirmStoryChange = 'confirmStoryChange';
|
||||
$lang->resource->bug->ajaxGetUserBugs = 'ajaxGetUserBugs';
|
||||
|
||||
$lang->resource->testcase->index = 'index';
|
||||
$lang->resource->testcase->browse = 'browse';
|
||||
$lang->resource->testcase->create = 'create';
|
||||
$lang->resource->testcase->view = 'view';
|
||||
$lang->resource->testcase->edit = 'edit';
|
||||
$lang->resource->testcase->confirmStoryChange = 'confirmStoryChange';
|
||||
|
||||
$lang->resource->testtask->index = 'index';
|
||||
$lang->resource->testtask->create = 'create';
|
||||
|
||||
@@ -57,7 +57,18 @@
|
||||
<td><?php echo $task->left;?></td>
|
||||
<td><?php echo $lang->task->typeList[$task->type];?></td>
|
||||
<td class=<?php if(isset($task->delay)) echo 'delayed';?>><?php if(substr($task->deadline, 0, 4) > 0) echo $task->deadline;?></td>
|
||||
<td class=<?php echo $task->status;?> ><?php echo $lang->task->statusList[$task->status];?></td>
|
||||
<td class=<?php echo $task->status;?> >
|
||||
<?php
|
||||
if($task->storyStatus == 'active' and $task->latestStoryVersion > $task->storyVersion)
|
||||
{
|
||||
echo "<span class='warning'>{$lang->story->changed}</span> ";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo $lang->task->statusList[$task->status];
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td class='a-left nobr'>
|
||||
<?php
|
||||
if($task->storyID)
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
$lang->story->browse = "需求列表";
|
||||
$lang->story->create = "新增需求";
|
||||
$lang->story->change = "变更";
|
||||
$lang->story->changed = '需求变更';
|
||||
$lang->story->confirm = '确认';
|
||||
$lang->story->review = '评审';
|
||||
$lang->story->edit = "编辑需求";
|
||||
$lang->story->close = '关闭';
|
||||
|
||||
@@ -180,6 +180,15 @@ class task extends control
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/* 确认需求变动。*/
|
||||
public function confirmStoryChange($taskID)
|
||||
{
|
||||
$task = $this->task->getById($taskID);
|
||||
$this->dao->update(TABLE_TASK)->set('storyVersion')->eq($task->latestStoryVersion)->where('id')->eq($taskID)->exec();
|
||||
$this->loadModel('action')->create('task', $taskID, 'confirmed', '', $task->latestStoryVersion);
|
||||
die(js::reload('parent'));
|
||||
}
|
||||
|
||||
/* 删除一个任务。*/
|
||||
public function delete($projectID, $taskID, $confirm = 'no')
|
||||
{
|
||||
|
||||
+24
-11
@@ -99,7 +99,7 @@ class taskModel extends model
|
||||
/* 通过id获取一个任务信息。*/
|
||||
public function getById($taskID)
|
||||
{
|
||||
$task = $this->dao->select('t1.*, t2.id AS storyID, t2.title AS storyTitle, t3.realname AS ownerRealName')
|
||||
$task = $this->dao->select('t1.*, t2.id AS storyID, t2.title AS storyTitle, t2.version AS latestStoryVersion, t2.status AS storyStatus, t3.realname AS ownerRealName')
|
||||
->from(TABLE_TASK)->alias('t1')
|
||||
->leftJoin(TABLE_STORY)->alias('t2')
|
||||
->on('t1.story = t2.id')
|
||||
@@ -109,14 +109,14 @@ class taskModel extends model
|
||||
->fetch();
|
||||
if(!$task) return false;
|
||||
$task->files = $this->loadModel('file')->getByObject('task', $taskID);
|
||||
return $this->computeDelay($task);
|
||||
return $this->processTask($task);
|
||||
}
|
||||
|
||||
/* 获得某一个项目的任务列表。*/
|
||||
public function getProjectTasks($projectID, $status = 'all', $orderBy = 'status_asc, id_desc', $pager = null)
|
||||
{
|
||||
$orderBy = str_replace('status', 'statusCustom', $orderBy);
|
||||
$tasks = $this->dao->select('t1.*, t2.id AS storyID, t2.title AS storyTitle, t3.realname AS ownerRealName')
|
||||
$tasks = $this->dao->select('t1.*, t2.id AS storyID, t2.title AS storyTitle, t2.version AS latestStoryVersion, t2.status AS storyStatus, t3.realname AS ownerRealName')
|
||||
->from(TABLE_TASK)->alias('t1')
|
||||
->leftJoin(TABLE_STORY)->alias('t2')
|
||||
->on('t1.story = t2.id')
|
||||
@@ -127,7 +127,7 @@ class taskModel extends model
|
||||
->orderBy($orderBy)
|
||||
->page($pager)
|
||||
->fetchAll();
|
||||
if($tasks) return $this->computeDelays($tasks);
|
||||
if($tasks) return $this->processTasks($tasks);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ class taskModel extends model
|
||||
/* 获得用户的任务列表。*/
|
||||
public function getUserTasks($account, $status = 'all')
|
||||
{
|
||||
$tasks = $this->dao->select('t1.*, t2.id as projectID, t2.name as projectName, t3.id as storyID, t3.title as storyTitle')
|
||||
$tasks = $this->dao->select('t1.*, t2.id as projectID, t2.name as projectName, t3.id as storyID, t3.title as storyTitle, t3.status AS storyStatus, t3.version AS latestStoryVersion')
|
||||
->from(TABLE_TASK)->alias('t1')
|
||||
->leftjoin(TABLE_PROJECT)->alias('t2')
|
||||
->on('t1.project = t2.id')
|
||||
@@ -159,7 +159,7 @@ class taskModel extends model
|
||||
->where('t1.owner')->eq($account)
|
||||
->onCaseOf($status != 'all')->andWhere('t1.status')->in($status)->endCase()
|
||||
->fetchAll();
|
||||
if($tasks) return $this->computeDelays($tasks);
|
||||
if($tasks) return $this->processTasks($tasks);
|
||||
return array();
|
||||
}
|
||||
|
||||
@@ -204,23 +204,30 @@ class taskModel extends model
|
||||
return $taskCounts;
|
||||
}
|
||||
|
||||
/* 计算延期的天数。*/
|
||||
private function computeDelays($tasks)
|
||||
/* 计算一组任务的相关状态。*/
|
||||
private function processTasks($tasks)
|
||||
{
|
||||
$today = helper::today();
|
||||
foreach($tasks as $task)
|
||||
{
|
||||
/* 计算是否延期。*/
|
||||
if($task->deadline != '0000-00-00')
|
||||
{
|
||||
$delay = helper::diffDate($today, $task->deadline);
|
||||
if($delay > 0) $task->delay = $delay;
|
||||
}
|
||||
/* 判断需求是否变更。*/
|
||||
$task->needConfirm = false;
|
||||
if($task->storyStatus == 'active' and $task->latestStoryVersion > $task->storyVersion)
|
||||
{
|
||||
$task->needConfirm = true;
|
||||
}
|
||||
}
|
||||
return $tasks;
|
||||
}
|
||||
|
||||
/* 计算延期的天数。*/
|
||||
private function computeDelay($task)
|
||||
/* 计算一个任务的相关状态。*/
|
||||
private function processTask($task)
|
||||
{
|
||||
$today = helper::today();
|
||||
if($task->deadline != '0000-00-00')
|
||||
@@ -228,7 +235,13 @@ class taskModel extends model
|
||||
$delay = helper::diffDate($today, $task->deadline);
|
||||
if($delay > 0) $task->delay = $delay;
|
||||
}
|
||||
|
||||
/* 判断需求是否变更。*/
|
||||
$task->needConfirm = false;
|
||||
if($task->storyStatus == 'active' and $task->latestStoryVersion > $task->storyVersion)
|
||||
{
|
||||
$task->needConfirm = true;
|
||||
}
|
||||
return $task;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -77,7 +77,17 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->task->story;?></th>
|
||||
<td><?php if($task->storyTitle and !common::printLink('story', 'view', "storyID=$task->story", $task->storyTitle)) echo $task->storyTitle;?>
|
||||
<td>
|
||||
<?php
|
||||
if($task->storyTitle and !common::printLink('story', 'view', "storyID=$task->story", $task->storyTitle)) echo $task->storyTitle;
|
||||
if($task->needConfirm)
|
||||
{
|
||||
echo "(<span class='warning'>{$lang->story->changed}</span> ";
|
||||
echo html::a($this->createLink('task', 'confirmStoryChange', "taskID=$task->id"), $lang->story->confirm, 'hiddenwin');
|
||||
echo ")";
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->task->owner;?></th>
|
||||
|
||||
Reference in New Issue
Block a user