From 1b41f6f79e732bd9f36c5420892570e4eb875db8 Mon Sep 17 00:00:00 2001 From: wangchunsheng Date: Mon, 28 Dec 2009 05:45:16 +0000 Subject: [PATCH] * adjust the task module. --- trunk/module/project/control.php | 2 +- trunk/module/task/control.php | 14 +++++++++++- trunk/module/task/lang/zh-cn.php | 9 +++++++- trunk/module/task/model.php | 31 +++++++++++++------------- trunk/module/task/view/create.html.php | 11 +++++++-- 5 files changed, 46 insertions(+), 21 deletions(-) diff --git a/trunk/module/project/control.php b/trunk/module/project/control.php index bc6924e5ff..e2bbe88535 100644 --- a/trunk/module/project/control.php +++ b/trunk/module/project/control.php @@ -72,7 +72,7 @@ class project extends control } /* 浏览某一个项目下面的任务。*/ - public function task($projectID = 0, $orderBy = 'status|desc', $recTotal = 0, $recPerPage = 15, $pageID = 1) + public function task($projectID = 0, $orderBy = 'status|asc,id|desc', $recTotal = 0, $recPerPage = 15, $pageID = 1) { /* 加载任务模块。*/ $this->loadModel('task'); diff --git a/trunk/module/task/control.php b/trunk/module/task/control.php index af9476bdcd..4259bf14cf 100644 --- a/trunk/module/task/control.php +++ b/trunk/module/task/control.php @@ -46,7 +46,19 @@ class task extends control if(dao::isError()) die(js::error(dao::getError())); $this->loadModel('action'); $this->action->create('task', $taskID, 'Opened', ''); - die(js::locate($browseProjectLink, 'parent')); + if($this->post->after == 'continueAdding') + { + echo js::alert($this->lang->task->successSaved . $this->lang->task->afterChoices['continueAdding']); + die(js::locate($this->createLink('task', 'create', "projectID=$projectID&storyID={$this->post->story}"), 'parent')); + } + elseif($this->post->after == 'toTastList') + { + die(js::locate($browseProjectLink, 'parent')); + } + elseif($this->post->after == 'toStoryList') + { + die(js::locate($this->createLink('project', 'story', "projectID=$projectID"), 'parent')); + } } $stories = $this->story->getProjectStoryPairs($projectID); diff --git a/trunk/module/task/lang/zh-cn.php b/trunk/module/task/lang/zh-cn.php index e512915a64..c0756b3d62 100644 --- a/trunk/module/task/lang/zh-cn.php +++ b/trunk/module/task/lang/zh-cn.php @@ -30,7 +30,10 @@ $lang->task->view = "查看任务"; $lang->task->ajaxGetUserTasks = "ajax:我的任务"; $lang->task->ajaxGetProjectTasks = "ajax:项目任务"; -$lang->task->confirmDelete = "您确定要删除这个任务吗?"; +$lang->task->confirmDelete = "您确定要删除这个任务吗?"; +$lang->task->copyStoryTitle = "同需求"; +$lang->task->afterSubmit = "添加之后"; +$lang->task->successSaved = "成功添加,"; $lang->task->id = '编号'; $lang->task->project = '所属项目'; @@ -54,6 +57,10 @@ $lang->task->priList[1] = '最高'; $lang->task->priList[2] = '较高'; $lang->task->priList[4] = '最低'; +$lang->task->afterChoices['continueAdding'] = '继续为该需求添加任务'; +$lang->task->afterChoices['toTastList'] = '返回任务列表'; +$lang->task->afterChoices['toStoryList'] = '返回需求列表'; + $lang->task->buttonEdit = '编辑'; $lang->task->buttonBackToList = '返回'; diff --git a/trunk/module/task/model.php b/trunk/module/task/model.php index 0d0d94ce2b..d14633ceb4 100644 --- a/trunk/module/task/model.php +++ b/trunk/module/task/model.php @@ -25,6 +25,8 @@ specialChars('desc') ->cleanFloat('estimate') ->add('project', (int)$projectID) - ->setIF($this->post->estimate == '', 'estimate', 0) - ->setIF($this->post->story == '', 'story', 0) + ->setDefault('estimate, left, story', 0) + ->setIF($this->post->estimate != false, 'left', $this->post->estimate) + ->setDefault('statusCustom', strpos(self::CUSTOM_STATUS_ORDER, $this->post->status) + 1) + ->remove('after') ->get(); - $task->left = $task->estimate; $this->dao->insert(TABLE_TASK)->data($task) ->autoCheck() ->check('name', 'notempty') ->checkIF($task->estimate != '', 'estimate', 'float') ->exec(); - if(!dao::isError()) - { - //$this->dao->update(TABLE_STORY)->set('status')->eq('doing')->where('id')->eq() - return $this->dao->lastInsertID(); - } + if(!dao::isError()) return $this->dao->lastInsertID(); } /* 更新一个任务。*/ @@ -58,18 +57,17 @@ class taskModel extends model ->striptags('name') ->specialChars('desc') ->cleanFloat('estimate, left, consumed') - ->setIF($this->post->story == '', 'story', 0) - ->setIF($this->post->estimate == '', 'estimate', 0) - ->setIF($this->post->left == '', 'left', 0) - ->setIF($this->post->consumed == '', 'consumed', 0) + ->setDefault('story, estimate, left, consumed', 0) + ->setIF($this->post->status == 'done', 'left', 0) + ->setDefault('statusCustom', strpos(self::CUSTOM_STATUS_ORDER, $this->post->status) + 1) ->remove('comment') ->get(); $this->dao->update(TABLE_TASK)->data($task) ->autoCheck() ->check('name', 'notempty') - ->checkIF($task->estimate != '', 'estimate', 'float') - ->checkIF($task->left != '', 'left', 'float') - ->checkIF($task->consumed != '', 'consumed', 'float') + ->checkIF($task->estimate != false, 'estimate', 'float') + ->checkIF($task->left != false, 'left', 'float') + ->checkIF($task->consumed != false, 'consumed', 'float') ->where('id')->eq((int)$taskID)->exec(); if(!dao::isError()) return common::createChanges($oldTask, $task); } @@ -94,8 +92,9 @@ class taskModel extends model } /* 获得某一个项目的任务列表。*/ - public function getProjectTasks($projectID, $orderBy = 'status|desc', $pager = null) + public function getProjectTasks($projectID, $orderBy = 'status|asc, id|desc', $pager = null) { + $orderBy = str_replace('status', 'statusCustom', $orderBy); return $this->dao->select('t1.*, t2.id AS storyID, t2.title AS storyTitle, t3.realname AS ownerRealName') ->from(TABLE_TASK)->alias('t1') ->leftJoin(TABLE_STORY)->alias('t2') diff --git a/trunk/module/task/view/create.html.php b/trunk/module/task/view/create.html.php index f50fe25921..22837ed658 100644 --- a/trunk/module/task/view/create.html.php +++ b/trunk/module/task/view/create.html.php @@ -23,7 +23,7 @@ */ ?> -
+
@@ -51,11 +51,18 @@ + + + + - + + + +
task->create;?>
task->estimate;?>
task->status;?>task->statusList, 'wait', 'class=select-3');?>
task->pri;?> task->priList, '', 'class=select-3');?>
task->afterSubmit;?>task->afterChoices, 'continueAdding');?>