* finish task #3588.

This commit is contained in:
wangyidong
2017-12-29 17:01:35 +08:00
parent 1e547a4bed
commit 9abd1d6cf3
9 changed files with 125 additions and 5 deletions
+16
View File
@@ -325,6 +325,22 @@ class actionModel extends model
}
}
}
elseif($actionName == 'finished' and $objectType == 'todo')
{
$action->appendLink = '';
if(strpos($action->extra, ':')!== false)
{
list($extra, $id) = explode(':', $action->extra);
$action->extra = strtolower($extra);
if($id)
{
$table = $this->config->objectTables[$action->extra];
$field = $this->config->action->objectNameFields[$action->extra];
$name = $this->dao->select($field)->from($table)->where('id')->eq($id)->fetch($field);
if($name) $action->appendLink = html::a(helper::createLink($action->extra, 'view', "id=$id"), "#$id " . $name);
}
}
}
$action->history = isset($histories[$actionID]) ? $histories[$actionID] : array();
$actionName = strtolower($action->action);
+15
View File
@@ -247,6 +247,14 @@ class bug extends control
$actionID = $this->action->create('bug', $bugID, 'Opened');
$this->bug->sendmail($bugID, $actionID);
$extras = str_replace(array(',', ' '), array('&', ''), $extras);
parse_str($extras, $output);
if(isset($output['todoID']))
{
$this->dao->update(TABLE_TODO)->set('status')->eq('done')->where('id')->eq($output['todoID'])->exec();
$this->action->create('todo', $output['todoID'], 'finished', '', "BUG:$bugID");
}
$location = $this->createLink('bug', 'browse', "productID={$this->post->product}&branch=$branch&type=byModule&param={$this->post->module}");
$response['locate'] = isset($_SESSION['bugList']) ? $this->session->bugList : $location;
$this->send($response);
@@ -304,6 +312,13 @@ class bug extends control
$deadline = $bug->deadline;
$color = $bug->color;
}
if(isset($todoID))
{
$todo = $this->loadModel('todo')->getById($todoID);
$title = $todo->name;
$steps = $todo->desc;
$pri = $todo->pri;
}
/* If projectID is setted, get builds and stories of this project. */
if($projectID)
+17 -1
View File
@@ -37,10 +37,11 @@ class story extends control
* @param int $projectID
* @param int $bugID
* @param int $planID
* @param int $todoID
* @access public
* @return void
*/
public function create($productID = 0, $branch = 0, $moduleID = 0, $storyID = 0, $projectID = 0, $bugID = 0, $planID = 0)
public function create($productID = 0, $branch = 0, $moduleID = 0, $storyID = 0, $projectID = 0, $bugID = 0, $planID = 0, $todoID = 0)
{
if(!empty($_POST))
{
@@ -75,6 +76,12 @@ class story extends control
$actionID = $this->action->create('story', $storyID, $action, '', $extra);
$this->story->sendmail($storyID, $actionID);
if($todoID > 0)
{
$this->dao->update(TABLE_TODO)->set('status')->eq('done')->where('id')->eq($todoID)->exec();
$this->action->create('todo', $todoID, 'finished', '', "STORY:$storyID");
}
if($this->post->newStory)
{
$response['message'] = $this->lang->story->successSaved . $this->lang->story->newStory;
@@ -156,6 +163,15 @@ class story extends control
}
}
if($todoID > 0)
{
$todo = $this->loadModel('todo')->getById($todoID);
$source = 'todo';
$title = $todo->name;
$spec = $todo->desc;
$pri = $todo->pri;
}
/* Set Custom*/
foreach(explode(',', $this->config->story->list->customCreateFields) as $field) $customFields[$field] = $this->lang->story->$field;
$this->view->customFields = $customFields;
+16 -1
View File
@@ -39,10 +39,11 @@ class task extends control
* @param int $storyID
* @param int $moduleID
* @param int $taskID
* @param int $todoID
* @access public
* @return void
*/
public function create($projectID = 0, $storyID = 0, $moduleID = 0, $taskID = 0)
public function create($projectID = 0, $storyID = 0, $moduleID = 0, $taskID = 0, $todoID = 0)
{
$task = new stdClass();
$task->module = $moduleID;
@@ -63,6 +64,14 @@ class task extends control
$projectID = $task->project;
}
if($todoID > 0)
{
$todo = $this->loadModel('todo')->getById($todoID);
$task->name = $todo->name;
$task->pri = $todo->pri;
$task->desc = $todo->desc;
}
$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");
@@ -115,6 +124,12 @@ class task extends control
$this->send($response);
}
if($todoID > 0)
{
$this->dao->update(TABLE_TODO)->set('status')->eq('done')->where('id')->eq($todoID)->exec();
$this->action->create('todo', $todoID, 'finished', '', "TASK:$taskID");
}
/* Locate the browser. */
if($this->post->after == 'continueAdding')
{
+1
View File
@@ -279,6 +279,7 @@ class todo extends control
$this->view->users = $this->user->getPairs('noletter');
$this->view->actions = $this->loadModel('action')->getList('todo', $todoID);
$this->view->from = $from;
$this->view->projects = $this->loadModel('project')->getPairs();
$this->display();
}
+9
View File
@@ -0,0 +1,9 @@
$(function()
{
$('#toTaskButton').click(function()
{
var projectID = $(this).closest('.input-group').find('#project').val();
var link = createLink('task', 'create', 'projectID=' + projectID + '&storyID=0&moduleID=0&taskID=0&todoID=' + todoID);
parent.location.href = link;
})
});
+6 -1
View File
@@ -24,6 +24,11 @@ $lang->todo->import2Today = "Import to Today";
$lang->todo->import = "Import";
$lang->todo->legendBasic = "Basic Info";
$lang->todo->reasonList['story'] = "Transfer Story";
$lang->todo->reasonList['task'] = "Transfer Task";
$lang->todo->reasonList['bug'] = "Transfer Bug";
$lang->todo->reasonList['done'] = "Done";
$lang->todo->id = 'ID';
$lang->todo->account = 'Owner';
$lang->todo->date = 'Date';
@@ -83,5 +88,5 @@ $lang->todo->periods['before'] = 'Undone';
$lang->todo->periods['all'] = 'All';
$lang->todo->action = new stdclass();
$lang->todo->action->finished = array('main' => '$date, is finished by <strong>$actor</strong>.');
$lang->todo->action->finished = array('main' => '$date, is $extra by <strong>$actor</strong>.', 'extra' => 'reasonList');
$lang->todo->action->marked = array('main' => '$date, is marked by <strong>$actor</strong> as <strong>$extra</strong>.', 'extra' => 'statusList');
+6 -1
View File
@@ -24,6 +24,11 @@ $lang->todo->import2Today = "导入到今天";
$lang->todo->import = "导入";
$lang->todo->legendBasic = "基本信息";
$lang->todo->reasonList['story'] = "转需求";
$lang->todo->reasonList['task'] = "转任务";
$lang->todo->reasonList['bug'] = "转Bug";
$lang->todo->reasonList['done'] = "完成";
$lang->todo->id = '编号';
$lang->todo->account = '所有者';
$lang->todo->date = '日期';
@@ -83,5 +88,5 @@ $lang->todo->periods['before'] = '未完';
$lang->todo->periods['all'] = '所有';
$lang->todo->action = new stdclass();
$lang->todo->action->finished = array('main' => '$date, 由 <strong>$actor</strong>完成');
$lang->todo->action->finished = array('main' => '$date, 由 <strong>$actor</strong> $extra。$appendLink', 'extra' => 'reasonList');
$lang->todo->action->marked = array('main' => '$date, 由 <strong>$actor</strong> 标记为<strong>$extra</strong>。', 'extra' => 'statusList');
+39 -1
View File
@@ -84,7 +84,28 @@
$browseLink = $this->createLink('user', 'todo', "account=$todo->account");
}
common::printIcon('todo', 'finish', "id=$todo->id", $todo, 'button', '', 'hiddenwin', 'showinonlybody btn-success');
if($todo->status != 'done')
{
echo "<div class='btn-group dropup'>";
echo html::a($this->createLink('todo', 'finish', "id=$todo->id", 'html', true), "<i class='icon icon-ok'></i> " . $lang->todo->finish, 'hiddenwin', "class='btn showinonlybody btn-success'");
$createStoryPriv = common::hasPriv('story', 'create');
$createTaskPriv = common::hasPriv('task', 'create');
$createBugPriv = common::hasPriv('bug', 'create');
if($createStoryPriv or $createTaskPriv or $createBugPriv)
{
$isonlybody = isonlybody();
unset($_GET['onlybody']);
echo "<button type='button' class='btn btn-success dropdown-toggle' data-toggle='dropdown'><span class='caret'></span></button>";
echo "<ul class='dropdown-menu pull-right' role='menu'>";
if($createStoryPriv) echo '<li>' . html::a($this->createLink('story', 'create', "productID=0&branch=0&moduleID=0&storyID=0&projectID=0&bugID=0&planID=0&todoID={$todo->id}"), $lang->todo->reasonList['story'], '_parent') . '</li>';
if($createTaskPriv) echo '<li>' . html::a('###', $lang->todo->reasonList['task'], '', "data-toggle='modal' data-target='#projectModal' data-moveable='true' data-position='193px'") . '</li>';
if($createBugPriv) echo '<li>' . html::a($this->createLink('bug', 'create', "productID=0&branch=0&extras=todoID={$todo->id}"), $lang->todo->reasonList['bug'], '_parent') . '</li>';
echo "</ul>";
if($isonlybody) $_GET['onlybody'] = 'yes';
}
echo "</div>";
}
if($todo->account == $app->user->account)
{
common::printIcon('todo', 'edit', "todoID=$todo->id");
@@ -94,6 +115,23 @@
?>
</div>
</div>
<div class="modal fade" id="projectModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title"><i class="icon-file-text"></i> <?php echo $lang->project->selectProject;?></h4>
</div>
<div class="modal-body">
<div class='input-group'>
<?php echo html::select('project', $projects, '', "class='form-control chosen'");?>
<span class='input-group-btn'><?php echo html::commonButton($lang->todo->toTask, "id='toTaskButton'");?></span>
</div>
</div>
</div>
</div>
</div>
<?php js::set('todoID', $todo->id);?>
<?php else:?>
<?php echo $lang->todo->thisIsPrivate;?>
<?php endif;?>