+ add the feature of file, deadline.
This commit is contained in:
@@ -42,12 +42,13 @@
|
||||
<tr class='colhead'>
|
||||
<th><?php common::printOrderLink('id', $orderBy, $vars, $lang->task->id);?></th>
|
||||
<th><?php common::printOrderLink('pri', $orderBy, $vars, $lang->task->pri);?></th>
|
||||
<th class='w-p30'><?php common::printOrderLink('name', $orderBy, $vars, $lang->task->name);?></th>
|
||||
<th class='w-p20'><?php common::printOrderLink('name', $orderBy, $vars, $lang->task->name);?></th>
|
||||
<th><?php common::printOrderLink('owner', $orderBy, $vars, $lang->task->owner);?></th>
|
||||
<th><?php common::printOrderLink('estimate', $orderBy, $vars, $lang->task->estimate);?></th>
|
||||
<th><?php common::printOrderLink('consumed', $orderBy, $vars, $lang->task->consumed);?></th>
|
||||
<th><?php common::printOrderLink('`left`', $orderBy, $vars, $lang->task->left);?></th>
|
||||
<th><?php common::printOrderLink('type', $orderBy, $vars, $lang->task->type);?></th>
|
||||
<th><?php common::printOrderLink('deadline', $orderBy, $vars, $lang->task->deadline);?></th>
|
||||
<th><?php common::printOrderLink('status', $orderBy, $vars, $lang->task->status);?></th>
|
||||
<th class='w-p20'><?php common::printOrderLink('story', $orderBy, $vars, $lang->task->story);?></th>
|
||||
<th class='w-100px'><?php echo $lang->actions;?></th>
|
||||
@@ -65,6 +66,7 @@
|
||||
<td><?php echo $task->consumed;?></td>
|
||||
<td><?php echo $task->left;?></td>
|
||||
<td><?php echo $lang->task->typeList[$task->type];?></td>
|
||||
<td class=<?php if(isset($task->delay)) echo 'delayed';?>><?php if(substr($task->deadline, 0, 4) > 0) echo $task->deadline;?></td>
|
||||
<td class=<?php echo $task->status;?> ><?php echo $lang->task->statusList->{$task->status};?></td>
|
||||
<td class='a-left nobr'>
|
||||
<?php
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
$config->task->create->requiredFields = 'name,estimate,type,pri';
|
||||
$config->task->edit->requiredFields = $config->task->create->requiredFields;
|
||||
+10
-11
@@ -119,19 +119,18 @@ class task extends control
|
||||
die(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent'));
|
||||
}
|
||||
|
||||
$stories = $this->story->getProjectStoryPairs($project->id);
|
||||
$members = $this->project->getTeamMemberPairs($project->id);
|
||||
|
||||
$header['title'] = $this->lang->task->edit;
|
||||
$position[] = html::a($this->createLink('project', 'browse', "project=$task->project"), $project->name);
|
||||
$position[] = $this->lang->task->edit;
|
||||
/* 导航信息。*/
|
||||
$this->view->header->title = $this->lang->task->edit;
|
||||
$this->view->position[] = html::a($this->createLink('project', 'browse', "project=$task->project"), $project->name);
|
||||
$this->view->position[] = $this->lang->task->edit;
|
||||
|
||||
$this->assign('header', $header);
|
||||
$this->assign('position', $position);
|
||||
$this->assign('project', $project);
|
||||
$this->assign('stories', $stories);
|
||||
$this->assign('members', $members);
|
||||
$this->assign('task', $task);
|
||||
$this->view->task = $task;
|
||||
$this->view->project = $project;
|
||||
$this->view->stories = $this->story->getProjectStoryPairs($project->id);
|
||||
$this->view->members = $this->project->getTeamMemberPairs($project->id);
|
||||
$this->view->users = $this->view->members;
|
||||
$this->view->actions = $this->loadModel('action')->getList('task', $taskID);
|
||||
$this->display();
|
||||
}
|
||||
|
||||
|
||||
@@ -40,14 +40,16 @@ $lang->task->owner = '指派给';
|
||||
$lang->task->estimate = '最初预计';
|
||||
$lang->task->left = '预计剩余';
|
||||
$lang->task->consumed = '已消耗';
|
||||
$lang->task->deadline = '截止日期';
|
||||
$lang->task->status = '任务状态';
|
||||
$lang->task->desc = '任务描述';
|
||||
$lang->task->statusCustom = '状态排序';
|
||||
|
||||
$lang->task->statusList->wait = '未开始';
|
||||
$lang->task->statusList->doing = '进行中';
|
||||
$lang->task->statusList->done = '已完成';
|
||||
$lang->task->statusList->cancel= '已取消';
|
||||
$lang->task->statusList->wait = '未开始';
|
||||
$lang->task->statusList->doing = '进行中';
|
||||
$lang->task->statusList->done = '已完成';
|
||||
$lang->task->statusList->cancel = '已取消';
|
||||
$lang->task->statusList->delayed = '延期';
|
||||
|
||||
$lang->task->typeList[''] = '';
|
||||
$lang->task->typeList['design'] = '设计';
|
||||
@@ -58,6 +60,7 @@ $lang->task->typeList['discuss']= '讨论';
|
||||
$lang->task->typeList['ui'] = '界面';
|
||||
$lang->task->typeList['misc'] = '其他';
|
||||
|
||||
$lang->task->priList[''] = '';
|
||||
$lang->task->priList[3] = '一般';
|
||||
$lang->task->priList[1] = '最高';
|
||||
$lang->task->priList[2] = '较高';
|
||||
@@ -80,3 +83,4 @@ $lang->task->confirmDelete = "您确定要删除这个任务吗?";
|
||||
$lang->task->copyStoryTitle = "同需求";
|
||||
$lang->task->afterSubmit = "添加之后";
|
||||
$lang->task->successSaved = "成功添加,";
|
||||
$lang->task->delayWarning = "<strong>%s</strong>天";
|
||||
|
||||
+43
-9
@@ -36,6 +36,7 @@ class taskModel extends model
|
||||
->cleanFloat('estimate')
|
||||
->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)
|
||||
@@ -44,14 +45,17 @@ class taskModel extends model
|
||||
|
||||
$this->dao->insert(TABLE_TASK)->data($task)
|
||||
->autoCheck()
|
||||
->check('name', 'notempty')
|
||||
->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);
|
||||
|
||||
return $taskID;
|
||||
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;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* 更新一个任务。*/
|
||||
@@ -70,7 +74,7 @@ class taskModel extends model
|
||||
->get();
|
||||
$this->dao->update(TABLE_TASK)->data($task)
|
||||
->autoCheck()
|
||||
->check('name', 'notempty')
|
||||
->batchCheck($this->config->task->edit->requiredFields, 'notempty')
|
||||
->checkIF($task->estimate != false, 'estimate', 'float')
|
||||
->checkIF($task->left != false, 'left', 'float')
|
||||
->checkIF($task->consumed != false, 'consumed', 'float')
|
||||
@@ -101,14 +105,14 @@ class taskModel extends model
|
||||
->fetch();
|
||||
if(!$task) return false;
|
||||
$task->files = $this->loadModel('file')->getByObject('task', $taskID);
|
||||
return $task;
|
||||
return $this->computeDelay($task);
|
||||
}
|
||||
|
||||
/* 获得某一个项目的任务列表。*/
|
||||
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')
|
||||
$tasks = $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')
|
||||
@@ -118,6 +122,8 @@ class taskModel extends model
|
||||
->orderBy($orderBy)
|
||||
->page($pager)
|
||||
->fetchAll();
|
||||
if($tasks) return $this->computeDelays($tasks);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* 获得某一个项目的任务id=>name列表。*/
|
||||
@@ -189,4 +195,32 @@ class taskModel extends model
|
||||
foreach($stories as $storyID) if(!isset($taskCounts[$storyID])) $taskCounts[$storyID] = 0;
|
||||
return $taskCounts;
|
||||
}
|
||||
|
||||
/* 计算延期的天数。*/
|
||||
private function computeDelays($tasks)
|
||||
{
|
||||
$now = date('Y-m-d');
|
||||
foreach($tasks as $task)
|
||||
{
|
||||
if($task->deadline != '0000-00-00')
|
||||
{
|
||||
$delay = helper::diffDate($now, $task->deadline);
|
||||
if($delay > 0) $task->delay = $delay;
|
||||
}
|
||||
}
|
||||
return $tasks;
|
||||
}
|
||||
|
||||
/* 计算延期的天数。*/
|
||||
private function computeDelay($task)
|
||||
{
|
||||
$now = date('Y-m-d');
|
||||
if($task->deadline != '0000-00-00')
|
||||
{
|
||||
$delay = helper::diffDate($now, $task->deadline);
|
||||
if($delay > 0) $task->delay = $delay;
|
||||
}
|
||||
return $task;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -55,6 +55,10 @@
|
||||
<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->deadline;?></th>
|
||||
<td><input type='text' name='deadline' class='text-3' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->task->type;?></th>
|
||||
<td><?php echo html::select('type', $lang->task->typeList, '', 'class=select-3');?></td>
|
||||
|
||||
@@ -23,66 +23,80 @@
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/header.html.php';?>
|
||||
<form method='post' enctype='multipart/form-data' target='hiddenwin'>
|
||||
<div class='yui-d0'>
|
||||
<form method='post' enctype='multipart/form-data' target='hiddenwin'>
|
||||
<table class='table-1'>
|
||||
<caption><?php echo $header->title;?></caption>
|
||||
<div id='titlebar'>
|
||||
<div id='main'>TASK #<?php echo $task->id . $lang->colon . html::input('name', $task->name, 'class="text-1"');?></div>
|
||||
<div><?php echo html::submitButton();?></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='yui-d0 yui-t8'>
|
||||
<div class='yui-main'>
|
||||
<div class='yui-b'>
|
||||
<fieldset>
|
||||
<legend><?php echo $lang->task->desc;?></legend>
|
||||
<?php echo html::textarea('desc', $task->desc, "rows='4' class='area-1'");?>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend><?php echo $lang->comment;?></legend>
|
||||
<?php echo html::textarea('comment', '', "rows='5' class='area-1'");?>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend><?php echo $lang->files;?></legend>
|
||||
<?php echo $this->fetch('file', 'buildform');?>
|
||||
</fieldset>
|
||||
<div class='a-center'><?php echo html::submitButton() . html::resetButton();?></div>
|
||||
<?php include '../../common/action.html.php';?>
|
||||
</div>
|
||||
</div>
|
||||
<div class='yui-b'>
|
||||
<fieldset>
|
||||
<legend><?php echo $lang->task->legendBasic;?></legend>
|
||||
<table class='table-1'>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->task->project;?></th>
|
||||
<th class='rowhead w-p20'><?php echo $lang->task->project;?></th>
|
||||
<td><?php echo $project->name;?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->task->story;?></th>
|
||||
<td><?php echo html::select('story', $stories, $task->story, 'class=select-1');?>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->task->name;?></th>
|
||||
<td><input type='text' name='name' value='<?php echo $task->name;?>' class='text-1' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<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');?>
|
||||
<td><?php echo html::select('owner', $members, $task->owner, 'class=select-1');?>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->task->estimate;?></th>
|
||||
<td><input type='text' name='estimate' value='<?php echo $task->estimate;?>' class='text-3' /></td>
|
||||
<td><?php echo html::input('estimate', $task->estimate, "class='text-1'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->task->deadline;?></th>
|
||||
<td><?php echo html::input('deadline', $task->deadline, "class='text-1'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->task->consumed;?></th>
|
||||
<td><input type='text' name='consumed' value='<?php echo $task->consumed;?>' class='text-3' /></td>
|
||||
<td><input type='text' name='consumed' value='<?php echo $task->consumed;?>' class='text-1' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->task->left;?></th>
|
||||
<td><input type='text' name='left' value='<?php echo $task->left;?>' class='text-3' /></td>
|
||||
<td><input type='text' name='left' value='<?php echo $task->left;?>' class='text-1' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->task->type;?></th>
|
||||
<td><?php echo html::select('type', $lang->task->typeList, $task->type, 'class=select-3');?></td>
|
||||
<td><?php echo html::select('type', $lang->task->typeList, $task->type, 'class=select-1');?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->task->status;?></th>
|
||||
<td><?php echo html::select('status', (array)$lang->task->statusList, $task->status, 'class=select-3');?></td>
|
||||
<td><?php echo html::select('status', (array)$lang->task->statusList, $task->status, 'class=select-1');?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->task->pri;?></th>
|
||||
<td><?php echo html::select('pri', $lang->task->priList, $task->pri, 'class=select-3');?>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->comment;?></th>
|
||||
<td><textarea name='comment' rows='5' class='area-1'></textarea>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='2' class='a-center'><?php echo html::submitButton() . html::resetButton();?></td>
|
||||
<td><?php echo html::select('pri', $lang->task->priList, $task->pri, 'class=select-1');?>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<?php include '../../common/footer.html.php';?>
|
||||
|
||||
Reference in New Issue
Block a user