+ complete task #269:add start,complete and cancel to task.

This commit is contained in:
fujia
2010-07-16 09:02:20 +00:00
parent 6ee3a44a77
commit 02dcd61981
8 changed files with 298 additions and 3 deletions
+90
View File
@@ -199,6 +199,96 @@ class task extends control
die(js::reload('parent'));
}
/* 开始一个任务。*/
public function start($taskID)
{
/* 执行公共的操作。*/
$this->commonAction($taskID);
if(!empty($_POST))
{
$this->loadModel('action');
$changes = $this->task->changeStatus($taskID);
if(dao::isError()) die(js::error(dao::getError()));
if($this->post->comment != '' or !empty($changes))
{
$action = !empty($changes) ? 'Edited' : 'Commented';
$actionID = $this->action->create('task', $taskID, $action, $this->post->comment);
$this->action->logHistory($actionID, $changes);
$this->sendmail($taskID, $actionID);
}
die(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent'));
}
/* 赋值。*/
$this->view->header->title = $this->view->project->name . $this->lang->colon .$this->lang->task->start;
$this->view->position[] = $this->lang->task->start;
$this->view->members = $this->loadModel('user')->setDeleted($this->view->members, $this->view->task->owner);
$this->display();
}
/* 完成一个任务。*/
public function complete($taskID)
{
/* 执行公共的操作。*/
$this->commonAction($taskID);
if(!empty($_POST))
{
$this->loadModel('action');
$changes = $this->task->changeStatus($taskID);
if(dao::isError()) die(js::error(dao::getError()));
if($this->post->comment != '' or !empty($changes))
{
$action = !empty($changes) ? 'Edited' : 'Commented';
$actionID = $this->action->create('task', $taskID, $action, $this->post->comment);
$this->action->logHistory($actionID, $changes);
$this->sendmail($taskID, $actionID);
}
die(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent'));
}
/* 赋值。*/
$this->view->header->title = $this->view->project->name . $this->lang->colon .$this->lang->task->complete;
$this->view->position[] = $this->lang->task->complete;
$this->view->members = $this->loadModel('user')->setDeleted($this->view->members, $this->view->task->owner);
$this->display();
}
/* 取消一个任务。*/
public function cancel($taskID)
{
/* 执行公共的操作。*/
$this->commonAction($taskID);
if(!empty($_POST))
{
$this->loadModel('action');
$changes = $this->task->changeStatus($taskID);
if(dao::isError()) die(js::error(dao::getError()));
if($this->post->comment != '' or !empty($changes))
{
$action = !empty($changes) ? 'Edited' : 'Commented';
$actionID = $this->action->create('task', $taskID, $action, $this->post->comment);
$this->action->logHistory($actionID, $changes);
$this->sendmail($taskID, $actionID);
}
die(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent'));
}
/* 赋值。*/
$this->view->header->title = $this->view->project->name . $this->lang->colon .$this->lang->task->cancel;
$this->view->position[] = $this->lang->task->cancel;
$this->view->members = $this->loadModel('user')->setDeleted($this->view->members, $this->view->task->owner);
$this->display();
}
/* 删除一个任务。*/
public function delete($projectID, $taskID, $confirm = 'no')
{