* finish the task #538.

This commit is contained in:
shiyangyangwork@yahoo.cn
2011-10-24 07:14:34 +00:00
parent a489d77dae
commit 5c11b70712
10 changed files with 161 additions and 38 deletions
+1 -1
View File
@@ -33,8 +33,8 @@ var browseType = '<?php echo $browseType;?>';
<div class='f-right'>
<?php common::printLink('story', 'export', "productID=$productID&orderBy=$orderBy", $lang->export, '', 'class="export"'); ?>
<?php common::printLink('story', 'report', "productID=$productID&browseType=$browseType&moduleID=$moduleID", $lang->story->report->common); ?>
<?php if(common::hasPriv('story', 'create')) echo html::a($this->createLink('story', 'create', "productID=$productID&moduleID=$moduleID"), $lang->story->create); ?>
<?php if(common::hasPriv('story', 'create')) echo html::a($this->createLink('story', 'batchCreate', "productID=$productID&moduleID=$moduleID"), $lang->story->batchCreate); ?>
<?php if(common::hasPriv('story', 'create')) echo html::a($this->createLink('story', 'create', "productID=$productID&moduleID=$moduleID"), $lang->story->create); ?>
</div>
</div>
<div id='querybox' class='<?php if($browseType !='bysearch') echo 'hidden';?>'><?php echo $searchForm;?></div>
+1
View File
@@ -22,6 +22,7 @@
if($browseType != 'needconfirm') common::printLink('task', 'export', "projectID=$projectID&orderBy=$orderBy", $lang->export, '', 'class="export"');
common::printLink('project', 'importTask', "project=$project->id", $lang->project->importTask);
common::printLink('task', 'report', "project=$project->id&browseType=$browseType", $lang->task->report->common);
common::printLink('task', 'batchCreate', "projectID=$project->id", $lang->task->batchCreate);
common::printLink('task', 'create', "project=$project->id", $lang->task->create);
?>
</div>
+1 -1
View File
@@ -1,5 +1,5 @@
<?php
$config->story->batchCreate = 20;
$config->story->batchCreate = 10;
$config->story->create->requiredFields = 'title';
$config->story->edit->requiredFields = 'title';
$config->story->change->requiredFields = 'title';
+1 -1
View File
@@ -11,7 +11,7 @@
*/
$lang->story->browse = "需求列表";
$lang->story->create = "新增需求";
$lang->story->batchCreate = "批量新增需求";
$lang->story->batchCreate = "批量添加需求";
$lang->story->change = "变更";
$lang->story->changed = '需求变更';
$lang->story->review = '评审';
+2
View File
@@ -15,6 +15,7 @@
<table align='center' class='table-1'>
<caption><?php echo $lang->story->product . $lang->colon . $lang->story->batchCreate; echo "<span class='star'><small>{$lang->story->notes}</small></span>";?></caption>
<tr>
<th class='w-id'><?php echo $lang->idAB;?></th>
<th><?php echo $lang->story->module;?></th>
<th><?php echo $lang->story->plan;?></th>
<th><?php echo $lang->story->title;?></th>
@@ -27,6 +28,7 @@
<?php $moduleID = $i == 0 ? 0 : 'same';?>
<?php $planID = $i == 0 ? '' : 'same';?>
<tr class='a-center'>
<td><?php echo $i+1;?></td>
<td><?php echo html::select("module[$i]", $moduleOptionMenu, $moduleID, 'class=select-2');?></td>
<td><?php echo html::select("plan[$i]", $plans, $planID, 'class=select-2');?></td>
<td><?php echo html::input("title[$i]", $title, "class='text-1'"); echo "<span class='star'>*</span>";?></td>
+6 -5
View File
@@ -1,9 +1,10 @@
<?php
$config->task->create->requiredFields = 'name,estimate,type,pri';
$config->task->edit->requiredFields = $config->task->create->requiredFields;
$config->task->start->requiredFields = 'estimate';
$config->task->finish->requiredFields = 'consumed';
$config->task->activate->requiredFields = 'left';
$config->task->batchCreate = 10;
$config->task->create->requiredFields = 'name,estimate,type,pri';
$config->task->edit->requiredFields = $config->task->create->requiredFields;
$config->task->start->requiredFields = 'estimate';
$config->task->finish->requiredFields = 'consumed';
$config->task->activate->requiredFields = 'left';
$config->task->editor->create = array('id' => 'desc', 'tools' => 'simpleTools');
$config->task->editor->edit = array('id' => 'desc', 'tools' => 'simpleTools');
+47
View File
@@ -86,6 +86,53 @@ class task extends control
$this->display();
}
/**
* Create a task.
*
* @param int $projectID
* @param int $storyID
* @access public
* @return void
*/
public function batchCreate($projectID = 0, $storyID = 0)
{
$project = $this->project->getById($projectID);
$taskLink = $this->createLink('project', 'browse', "projectID=$projectID&tab=task");
$storyLink = $this->session->storyList ? $this->session->storyList : $this->createLink('project', 'story', "projectID=$projectID");
$this->view->users = $this->loadModel('user')->getPairs('noletter');
/* Set menu. */
$this->project->setMenu($this->project->getPairs(), $project->id);
if(!empty($_POST))
{
$mails = $this->task->batchCreate($projectID);
if(dao::isError()) die(js::error(dao::getError()));
foreach($mails as $mail)
{
$this->sendmail($mail->taskID, $mail->actionID);
}
/* Locate the browser. */
die(js::locate($taskLink, 'parent'));
}
$stories = $this->story->getProjectStoryPairs($projectID);
$members = $this->project->getTeamMemberPairs($projectID, 'nodeleted');
$header['title'] = $project->name . $this->lang->colon . $this->lang->task->create;
$position[] = html::a($taskLink, $project->name);
$position[] = $this->lang->task->create;
$this->view->header = $header;
$this->view->position = $position;
$this->view->project = $project;
$this->view->stories = $stories;
$this->view->storyID = $storyID;
$this->view->members = $members;
$this->display();
}
/**
* Common actions of task module.
*
+19 -15
View File
@@ -9,21 +9,22 @@
* @version $Id$
* @link http://www.zentao.net
*/
$lang->task->index = "Index";
$lang->task->create = "Create";
$lang->task->import = "Import undone";
$lang->task->edit = "Update";
$lang->task->delete = "Delete";
$lang->task->view = "Info";
$lang->task->logEfforts= "Efforts";
$lang->task->start = "Start";
$lang->task->finish = "Finish";
$lang->task->close = "Close";
$lang->task->batchClose= "Batch close";
$lang->task->cancel = "Cancel";
$lang->task->activate = "Activate";
$lang->task->export = "Export";
$lang->task->reportChart = "Report chart";
$lang->task->index = "Index";
$lang->task->create = "Create";
$lang->task->batchCreate = "Batch create";
$lang->task->import = "Import undone";
$lang->task->edit = "Update";
$lang->task->delete = "Delete";
$lang->task->view = "Info";
$lang->task->logEfforts = "Efforts";
$lang->task->start = "Start";
$lang->task->finish = "Finish";
$lang->task->close = "Close";
$lang->task->batchClose = "Batch close";
$lang->task->cancel = "Cancel";
$lang->task->activate = "Activate";
$lang->task->export = "Export";
$lang->task->reportChart = "Report chart";
$lang->task->confirmStoryChange = "Confirm story change";
$lang->task->common = 'Task';
@@ -36,6 +37,7 @@ $lang->task->type = 'Type';
$lang->task->pri = 'Pri';
$lang->task->mailto = 'Mailto';
$lang->task->estimate = 'Estimate';
$lang->task->estimateBatch = 'Estimate';
$lang->task->estimateAB = 'Est';
$lang->task->left = 'Left';
$lang->task->leftAB = 'Left';
@@ -66,6 +68,8 @@ $lang->task->lastEditedBy = 'Last Edited By';
$lang->task->lastEditedDate = 'Last Edited Date';
$lang->task->lastEdited = 'Last Edited';
$lang->task->notes = '(Notes: the name, type, pri and estimate must be written, otherwise it is no use)';
$lang->task->statusList[''] = '';
$lang->task->statusList['wait'] = 'Waiting';
$lang->task->statusList['doing'] = 'Doing';
+19 -15
View File
@@ -9,21 +9,22 @@
* @version $Id$
* @link http://www.zentao.net
*/
$lang->task->index = "任务一览";
$lang->task->create = "新增任务";
$lang->task->import = "导入之前未完任务";
$lang->task->edit = "更新任务";
$lang->task->delete = "删除任务";
$lang->task->view = "查看任务";
$lang->task->logEfforts= "记录工时";
$lang->task->start = "开始任务";
$lang->task->finish = "完成任务";
$lang->task->close = "关闭任务";
$lang->task->batchClose= "批量关闭";
$lang->task->cancel = "取消任务";
$lang->task->activate = "激活任务";
$lang->task->export = "导出数据";
$lang->task->reportChart = "报表统计";
$lang->task->index = "任务一览";
$lang->task->create = "新增任务";
$lang->task->batchCreate = "批量添加任务";
$lang->task->import = "导入之前未完任务";
$lang->task->edit = "更新任务";
$lang->task->delete = "删除任务";
$lang->task->view = "查看任务";
$lang->task->logEfforts = "记录工时";
$lang->task->start = "开始任务";
$lang->task->finish = "完成任务";
$lang->task->close = "关闭任务";
$lang->task->batchClose = "批量关闭";
$lang->task->cancel = "取消任务";
$lang->task->activate = "激活任务";
$lang->task->export = "导出数据";
$lang->task->reportChart = "报表统计";
$lang->task->confirmStoryChange = "确认需求变动";
$lang->task->common = '任务';
@@ -36,6 +37,7 @@ $lang->task->type = '任务类型';
$lang->task->pri = '优先级';
$lang->task->mailto = '抄送给';
$lang->task->estimate = '最初预计';
$lang->task->estimateBatch = '预计工时';
$lang->task->estimateAB = '预';
$lang->task->left = '预计剩余';
$lang->task->leftAB = '剩';
@@ -66,6 +68,8 @@ $lang->task->lastEditedBy = '最后修改';
$lang->task->lastEditedDate = '最后修改日期';
$lang->task->lastEdited = '最后编辑';
$lang->task->notes = '(注:“任务类型”、“任务名称”、“优先级”和“预计工时”必需填写,否则此行无效)';
$lang->task->statusList[''] = '';
$lang->task->statusList['wait'] = '未开始';
$lang->task->statusList['doing'] = '进行中';
+64
View File
@@ -77,6 +77,70 @@ class taskModel extends model
return $tasksID;
}
/**
* Create a batch task.
*
* @param int $projectID
* @access public
* @return void
*/
public function batchCreate($projectID)
{
$now = helper::now();
$tasks = fixer::input('post')->get();
for($i = 0; $i < $this->config->task->batchCreate; $i++)
{
if($tasks->type[$i] != '' and $tasks->name[$i] != '' and $tasks->pri[$i] != 0 and $tasks->estimate[$i] != '')
{
$data[$i]->story = $tasks->story[$i];
$data[$i]->type = $tasks->type[$i];
$data[$i]->name = $tasks->name[$i];
$data[$i]->desc = $tasks->desc[$i];
$data[$i]->assignedTo = $tasks->assignedTo[$i];
$data[$i]->pri = $tasks->pri[$i];
$data[$i]->estimate = $tasks->estimate[$i];
$data[$i]->left = $tasks->estimate[$i];
$data[$i]->project = $projectID;
$data[$i]->deadline = '0000-00-00';
$data[$i]->status = 'wait';
$data[$i]->openedBy = $this->app->user->account;
$data[$i]->openedDate = $now;
$data[$i]->statusCustom = strpos(self::CUSTOM_STATUS_ORDER, 'wait') + 1;
if($tasks->story[$i] != '') $data[$i]->storyVersion = $this->loadModel('story')->getVersion($tasks->story[$i]);
if($tasks->assignedTo[$i] != '') $data[$i]->assignedDate = $now;
$this->dao->insert(TABLE_TASK)->data($data[$i])
->autoCheck()
->batchCheck($this->config->task->create->requiredFields, 'notempty')
->checkIF($data[$i]->estimate != '', 'estimate', 'float')
->exec();
if(dao::isError())
{
echo js::error(dao::getError());
die(js::reload('parent'));
}
$taskID = $this->dao->lastInsertID();
if($tasks->story[$i] != false) $this->story->setStage($tasks->story[$i]);
$actionID = $this->loadModel('action')->create('task', $taskID, 'Opened', '');
$mails[$i]->taskID = $taskID;
$mails[$i]->actionID = $actionID;
}
else
{
unset($tasks->story[$i]);
unset($tasks->type[$i]);
unset($tasks->name[$i]);
unset($tasks->desc[$i]);
unset($tasks->assignedTo[$i]);
unset($tasks->pri[$i]);
unset($tasks->estimate[$i]);
}
}
return $mails;
}
/**
* Update a task.
*