* adjust the task module.
This commit is contained in:
@@ -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');
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 = '返回';
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
<?php
|
||||
class taskModel extends model
|
||||
{
|
||||
const CUSTOM_STATUS_ORDER = 'wait,doing,done,cancel';
|
||||
|
||||
/* 新增一个任务。*/
|
||||
public function create($projectID)
|
||||
{
|
||||
@@ -33,21 +35,18 @@ class taskModel extends model
|
||||
->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')
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/header.html.php';?>
|
||||
<div id='doc3'>
|
||||
<div class='yui-d0'>
|
||||
<form method='post' target='hiddenwin'>
|
||||
<table align='center' class='table-1 a-left'>
|
||||
<caption><?php echo $lang->task->create;?></caption>
|
||||
@@ -51,11 +51,18 @@
|
||||
<th class='rowhead'><?php echo $lang->task->estimate;?></th>
|
||||
<td><input type='text' name='estimate' class='text-3' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->task->status;?></th>
|
||||
<td><?php echo html::select('status', $lang->task->statusList, 'wait', 'class=select-3');?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->task->pri;?></th>
|
||||
<td><?php echo html::select('pri', $lang->task->priList, '', 'class=select-3');?>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->task->afterSubmit;?></th>
|
||||
<td><?php echo html::radio('after', $lang->task->afterChoices, 'continueAdding');?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='2' class='a-center'><?php echo html::submitButton() . html::resetButton();?></td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user