From d97d22c0db6bd92e69a48a0bde6cbf59b24a8fe2 Mon Sep 17 00:00:00 2001 From: chenfeiCF Date: Mon, 7 Mar 2016 13:16:51 +0800 Subject: [PATCH] * add story files and comments for task view. --- module/task/control.php | 4 +++- module/task/lang/en.php | 4 ++++ module/task/lang/zh-cn.php | 4 ++++ module/task/model.php | 16 ++++++++++++++++ module/task/view/view.html.php | 24 +++++++++++++++++++++++- 5 files changed, 50 insertions(+), 2 deletions(-) diff --git a/module/task/control.php b/module/task/control.php index ca9de978a1..e87ce474d4 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -455,7 +455,9 @@ class task extends control else { $story = $this->story->getById($task->story); - $task->storySpec = empty($story) ? '' : $story->spec; + $task->storySpec = empty($story) ? '' : $story->spec; + $task->storyComments = empty($story) ? array() : $this->task->getStoryComments($task->story); + $task->storyFiles = $this->loadModel('file')->getByObject('story', $task->story); } /* Update action. */ diff --git a/module/task/lang/en.php b/module/task/lang/en.php index a3833060b8..54ae9ab9d6 100644 --- a/module/task/lang/en.php +++ b/module/task/lang/en.php @@ -40,8 +40,11 @@ $lang->task->module = 'Module'; $lang->task->story = 'Story'; $lang->task->storySpec = 'Story desc'; $lang->task->storyVersion = 'Version'; +$lang->task->storyFiles = 'Story Files'; +$lang->task->storyComment = 'Story comment'; $lang->task->name = 'Name'; $lang->task->type = 'Type'; +$lang->task->taskFiles = 'Task files'; $lang->task->pri = 'Pri'; $lang->task->mailto = 'Mailto'; $lang->task->estimate = 'Estimate'; @@ -150,6 +153,7 @@ $lang->task->remindBug = "This task from Bug, update the Bug:%s or n $lang->task->confirmChangeProject = "Change {$lang->projectCommon} will change module, story and assignedTo also, are you sure?"; $lang->task->confirmFinish = '"Left" is zero, this task will be done. Are you sure?'; $lang->task->confirmRecord = '"Left" is zero, this task will be done. Are you sure?'; +$lang->task->commentActions = '%s. %s, commented by%s.'; $lang->task->error = new stdclass(); $lang->task->error->consumedNumber = '"Consumed" must be number'; diff --git a/module/task/lang/zh-cn.php b/module/task/lang/zh-cn.php index e52ee21a24..a056879e78 100644 --- a/module/task/lang/zh-cn.php +++ b/module/task/lang/zh-cn.php @@ -40,8 +40,11 @@ $lang->task->module = '所属模块'; $lang->task->story = '相关需求'; $lang->task->storySpec = '需求描述'; $lang->task->storyVersion = '需求版本'; +$lang->task->storyFiles = '需求附件'; +$lang->task->storyComment = '需求备注'; $lang->task->name = '任务名称'; $lang->task->type = '任务类型'; +$lang->task->taskFiles = '任务附件'; $lang->task->pri = '优先级'; $lang->task->mailto = '抄送给'; $lang->task->estimate = '最初预计'; @@ -150,6 +153,7 @@ $lang->task->remindBug = "该任务为Bug转化得到,是否更新 $lang->task->confirmChangeProject = "修改{$lang->projectCommon}会导致相应的所属模块、相关需求和指派人发生变化,确定吗?"; $lang->task->confirmFinish = '"预计剩余"为0,确认将任务状态改为"已完成"吗?'; $lang->task->confirmRecord = '"剩余"为0,任务将标记为"已完成",您确定吗?'; +$lang->task->commentActions = '%s. %s, 由 %s 添加备注。'; $lang->task->error = new stdclass(); $lang->task->error->consumedNumber = '"已经消耗"必须为数字'; diff --git a/module/task/model.php b/module/task/model.php index 32871919f2..a28c706c17 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -1112,6 +1112,22 @@ class taskModel extends model return $task; } + /** + * Get story comments. + * + * @param int $storyID + * @access public + * @return array + */ + public function getStoryComments($storyID) + { + return $this->dao->select('*')->from(TABLE_ACTION) + ->where('objectType')->eq('story') + ->andWhere('objectID')->eq($storyID) + ->andWhere('comment')->ne('') + ->fetchAll(); + } + /** * Merge the default chart settings and the settings of current chart. * diff --git a/module/task/view/view.html.php b/module/task/view/view.html.php index 2c6329d67d..fa374801df 100644 --- a/module/task/view/view.html.php +++ b/module/task/view/view.html.php @@ -71,6 +71,10 @@ task->legendDesc;?>
desc;?>
+
+ task->taskFiles;?> + fetch('file', 'printFiles', array('files' => $task->files, 'fieldset' => 'false'));?> +
fromBug != 0):?>
bug->steps;?> @@ -81,8 +85,26 @@ task->storySpec;?>
storySpec;?>
+
+ task->storyFiles;?> + fetch('file', 'printFiles', array('files' => $task->storyFiles, 'fieldset' => 'false'));?> +
+
+ task->storyComment;?> + storyComments as $item => $commentAction) + { + if(isset($users[$commentAction->actor])) $commentAction->actor = $users[$commentAction->actor]; + if(strpos($commentAction->actor, ':') !== false) $commentAction->actor = substr($commentAction->actor, strpos($commentAction->actor, ':') + 1); + printf($lang->task->commentActions, $item + 1, $commentAction->date, $commentAction->actor); + + echo "
"; + echo strip_tags($commentAction->comment) == $commentAction->comment ? nl2br($commentAction->comment) : $commentAction->comment; + echo "
"; + } + ?> +
- fetch('file', 'printFiles', array('files' => $task->files, 'fieldset' => 'true'));?>
deleted) echo $actionLinks;?>