* complete task #227:add multiple and size options to task owner.

This commit is contained in:
fujia
2010-06-23 02:09:16 +00:00
parent c74d6451d9
commit f79d717ce9
5 changed files with 56 additions and 29 deletions

View File

@@ -93,6 +93,8 @@ class mailModel extends model
/* 获得用户的真实姓名和email列表。*/
$this->loadModel('user');
$emails = $this->user->getRealNameAndEmails(str_replace(' ', '', $toList . ',' . $ccList));
$this->clear();
try
{
@@ -154,7 +156,7 @@ class mailModel extends model
private function clear()
{
$this->mta->clearAddresses();
$this->mta->cearAttachments();
$this->mta->clearAttachments();
}
/* 判断是否有错!*/

View File

@@ -42,11 +42,14 @@ class task extends control
if(!empty($_POST))
{
$taskID = $this->task->create($projectID);
$tasksID = $this->task->create($projectID);
if(dao::isError()) die(js::error(dao::getError()));
$this->loadModel('action');
$actionID = $this->action->create('task', $taskID, 'Opened', '');
$this->sendmail($taskID, $actionID);
foreach($tasksID as $taskID)
{
$actionID = $this->action->create('task', $taskID, 'Opened', '');
$this->sendmail($taskID, $actionID);
}
if($this->post->after == 'continueAdding')
{
echo js::alert($this->lang->task->successSaved . $this->lang->task->afterChoices['continueAdding']);
@@ -243,6 +246,7 @@ class task extends control
/* 赋值,获得邮件内容。*/
$this->assign('task', $task);
$this->assign('action', $action);
$this->clear();
$mailContent = $this->parse($this->moduleName, 'sendmail');
/* 发信。*/

View File

@@ -67,6 +67,7 @@ $lang->task->typeList['test'] = '测试';
$lang->task->typeList['study'] = '研究';
$lang->task->typeList['discuss']= '讨论';
$lang->task->typeList['ui'] = '界面';
$lang->task->typeList['affair'] = '事务';
$lang->task->typeList['misc'] = '其他';
$lang->task->priList[0] = '';

View File

@@ -30,31 +30,37 @@ class taskModel extends model
/* 新增一个任务。*/
public function create($projectID)
{
$task = fixer::input('post')
->striptags('name')
->specialChars('desc')
->add('project', (int)$projectID)
->setDefault('estimate, left, story', 0)
->setDefault('deadline', '0000-00-00')
->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,files,labels')
->get();
$this->dao->insert(TABLE_TASK)->data($task)
->autoCheck()
->batchCheck($this->config->task->create->requiredFields, 'notempty')
->checkIF($task->estimate != '', 'estimate', 'float')
->exec();
if(!dao::isError())
$tasksID = array();
foreach($this->post->owner as $owner)
{
$taskID = $this->dao->lastInsertID();
if($this->post->story) $this->loadModel('story')->setStage($this->post->story);
$this->loadModel('file')->saveUpload('task', $taskID);
return $taskID;
$task = fixer::input('post')
->striptags('name')
->specialChars('desc')
->add('project', (int)$projectID)
->setDefault('estimate, left, story', 0)
->setDefault('deadline', '0000-00-00')
->setIF($this->post->estimate != false, 'left', $this->post->estimate)
->setForce('owner', $owner)
->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,files,labels')
->get();
$this->dao->insert(TABLE_TASK)->data($task)
->autoCheck()
->batchCheck($this->config->task->create->requiredFields, 'notempty')
->checkIF($task->estimate != '', 'estimate', 'float')
->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);
$tasksID[$owner] = $taskID;
}
else return false;
}
return false;
return $tasksID;
}
/* 更新一个任务。*/

View File

@@ -32,6 +32,20 @@ function copyStoryTitle()
storyTitle = storyTitle.substr(storyTitle.lastIndexOf(':')+ 1);
$('#name').attr('value', storyTitle);
}
/* 设置任务指派给多选。*/
function setOwners(result)
{
if(result == 'affair')
{
$('#owner').attr('size', 4);
$('#owner').attr('multiple', 'multiple');
}
else
{
$('#owner').removeAttr('size');
$('#owner').removeAttr('multiple');
}
}
function sendMailTo()
{
var userList = "<?php echo join(',', array_keys($users));?>".split(',');
@@ -78,7 +92,7 @@ $(document).ready(function()
</tr>
<tr>
<th class='rowhead'><?php echo $lang->task->type;?></th>
<td><?php echo html::select('type', $lang->task->typeList, '', 'class=select-3');?></td>
<td><?php echo html::select('type', $lang->task->typeList, '', 'class=select-3 onchange="setOwners(this.value)"');?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->task->status;?></th>
@@ -86,7 +100,7 @@ $(document).ready(function()
</tr>
<tr>
<th class='rowhead'><?php echo $lang->task->owner;?></th>
<td><?php echo html::select('owner', $members, '', 'class=select-3');?>
<td><?php echo html::select('owner[]', $members, '', 'class=select-3');?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->task->mailto;?></th>