+ add the feature of attatch.
This commit is contained in:
@@ -106,10 +106,14 @@ class task extends control
|
||||
$this->loadModel('action');
|
||||
$changes = $this->task->update($taskID);
|
||||
if(dao::isError()) die(js::error(dao::getError()));
|
||||
if($this->post->comment != '' or !empty($changes))
|
||||
$files = $this->loadModel('file')->saveUpload('task', $taskID);
|
||||
|
||||
if($this->post->comment != '' or !empty($changes) or !empty($files))
|
||||
{
|
||||
$action = !empty($changes) ? 'Edited' : 'Commented';
|
||||
$actionID = $this->action->create('task', $taskID, $action, $this->post->comment);
|
||||
$fileAction = '';
|
||||
if(!empty($files)) $fileAction = $this->lang->addFiles . join(',', $files) . "\n" ;
|
||||
$actionID = $this->action->create('task', $taskID, $action, $fileAction . $this->post->comment);
|
||||
$this->action->logHistory($actionID, $changes);
|
||||
}
|
||||
die(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent'));
|
||||
|
||||
@@ -39,7 +39,7 @@ class taskModel extends model
|
||||
->setIF($this->post->estimate != false, 'left', $this->post->estimate)
|
||||
->setIF($this->post->story != false, 'storyVersion', $this->loadModel('story')->getVersion($this->post->story))
|
||||
->setDefault('statusCustom', strpos(self::CUSTOM_STATUS_ORDER, $this->post->status) + 1)
|
||||
->remove('after')
|
||||
->remove('after,files,labels')
|
||||
->get();
|
||||
|
||||
$this->dao->insert(TABLE_TASK)->data($task)
|
||||
@@ -49,6 +49,8 @@ class taskModel extends model
|
||||
->exec();
|
||||
if(!dao::isError()) $taskID = $this->dao->lastInsertID();
|
||||
if($this->post->story) $this->loadModel('story')->setStage($this->post->story);
|
||||
$this->loadModel('file')->saveUpload('task', $taskID);
|
||||
|
||||
return $taskID;
|
||||
}
|
||||
|
||||
@@ -64,7 +66,7 @@ class taskModel extends model
|
||||
->setIF($this->post->story != false and $this->post->story != $oldTask->story, 'storyVersion', $this->loadModel('story')->getVersion($this->post->story))
|
||||
->setIF($this->post->status == 'done', 'left', 0)
|
||||
->setDefault('statusCustom', strpos(self::CUSTOM_STATUS_ORDER, $this->post->status) + 1)
|
||||
->remove('comment')
|
||||
->remove('comment,fiels,labels')
|
||||
->get();
|
||||
$this->dao->update(TABLE_TASK)->data($task)
|
||||
->autoCheck()
|
||||
@@ -89,7 +91,7 @@ class taskModel extends model
|
||||
/* 通过id获取一个任务信息。*/
|
||||
public function getById($taskID)
|
||||
{
|
||||
return $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, t3.realname AS ownerRealName')
|
||||
->from(TABLE_TASK)->alias('t1')
|
||||
->leftJoin(TABLE_STORY)->alias('t2')
|
||||
->on('t1.story = t2.id')
|
||||
@@ -97,6 +99,9 @@ class taskModel extends model
|
||||
->on('t1.owner = t3.account')
|
||||
->where('t1.id')->eq((int)$taskID)
|
||||
->fetch();
|
||||
if(!$task) return false;
|
||||
$task->files = $this->loadModel('file')->getByObject('task', $taskID);
|
||||
return $task;
|
||||
}
|
||||
|
||||
/* 获得某一个项目的任务列表。*/
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
?>
|
||||
<?php include '../../common/header.html.php';?>
|
||||
<div class='yui-d0'>
|
||||
<form method='post' target='hiddenwin'>
|
||||
<form method='post' enctype='multipart/form-data' target='hiddenwin'>
|
||||
<table align='center' class='table-1 a-left'>
|
||||
<caption><?php echo $lang->task->create;?></caption>
|
||||
<tr>
|
||||
@@ -33,7 +33,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->task->story;?></th>
|
||||
<td><?php echo html::select('story', $stories, $storyID, 'class=select-1');?>
|
||||
<td><?php echo html::select('story', $stories, $storyID, 'class=select-1');?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->task->name;?></th>
|
||||
@@ -43,6 +43,10 @@
|
||||
<th class='rowhead'><?php echo $lang->task->desc;?></th>
|
||||
<td><textarea name='desc' rows='5' class='area-1'></textarea>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->files;?></th>
|
||||
<td class='a-left'><?php echo $this->fetch('file', 'buildform');?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->task->owner;?></th>
|
||||
<td><?php echo html::select('owner', $members, '', 'class=select-3');?>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
?>
|
||||
<?php include '../../common/header.html.php';?>
|
||||
<div class='yui-d0'>
|
||||
<form method='post' target='hiddenwin'>
|
||||
<form method='post' enctype='multipart/form-data' target='hiddenwin'>
|
||||
<table class='table-1'>
|
||||
<caption><?php echo $header->title;?></caption>
|
||||
<tr>
|
||||
@@ -43,6 +43,10 @@
|
||||
<th class='rowhead'><?php echo $lang->task->desc;?></th>
|
||||
<td><textarea name='desc' rows='5' class='area-1'><?php echo $task->desc;?></textarea>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->files;?></th>
|
||||
<td class='a-left'><?php echo $this->fetch('file', 'buildform');?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->task->owner;?></th>
|
||||
<td><?php echo html::select('owner', $members, $task->owner, 'class=select-3');?>
|
||||
|
||||
@@ -43,6 +43,10 @@
|
||||
<legend><?php echo $lang->task->legendDesc;?></legend>
|
||||
<div><?php echo nl2br($task->desc);?></div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend><?php echo $lang->files;?></legend>
|
||||
<div><?php foreach($task->files as $file) echo html::a($file->fullPath, $file->title, '_blank');?></div>
|
||||
</fieldset>
|
||||
<?php include '../../common/action.html.php';?>
|
||||
<div class='a-center' style='font-size:16px; font-weight:bold'>
|
||||
<?php
|
||||
|
||||
Reference in New Issue
Block a user