* add project field for create task.

This commit is contained in:
wangyidong
2018-12-20 17:16:50 +08:00
parent 6af2460b0b
commit 5ebceea09a
4 changed files with 75 additions and 1 deletions
+2
View File
@@ -92,6 +92,7 @@ class task extends control
$response['result'] = 'success';
$response['message'] = '';
if($this->post->project) $projectID = $this->post->project;
$tasksID = $this->task->create($projectID);
if(dao::isError())
{
@@ -191,6 +192,7 @@ class task extends control
$this->view->title = $title;
$this->view->position = $position;
$this->view->project = $project;
$this->view->projects = $this->loadModel('project')->getPairs();
$this->view->task = $task;
$this->view->users = $users;
$this->view->stories = $stories;
+68
View File
@@ -1,3 +1,71 @@
/**
* Load module, stories and members.
*
* @param int $projectID
* @access public
* @return void
*/
function loadAll(projectID)
{
loadModuleMenu(projectID);
loadProjectStories(projectID);
loadProjectMembers(projectID);
}
/**
* Load team members of the project.
*
* @param int $projectID
* @access public
* @return void
*/
function loadProjectMembers(projectID)
{
$.get(createLink('project', 'ajaxGetMembers', 'projectID=' + projectID + '&assignedTo=' + $('#assignedTo').val()), function(data)
{
$('#assignedTo_chosen').remove();
$('#assignedTo').replaceWith(data);
$('#assignedTo').attr('name', 'assignedTo[]').chosen();
$('.modal-dialog #taskTeamEditor tr').each(function()
{
$(this).find('#team_chosen').remove();
$(this).find('#team').replaceWith(data);
$(this).find('#assignedTo').attr('id', 'team').attr('name', 'team[]').chosen();
});
});
}
/**
* Load stories of the project.
*
* @param int $projectID
* @access public
* @return void
*/
function loadProjectStories(projectID)
{
$.get(createLink('story', 'ajaxGetProjectStories', 'projectID=' + projectID + '&productID=0&branch=0&moduleID=0&storyID=' + $('#story').val()), function(data)
{
$('#story_chosen').remove();
$('#story').replaceWith(data);
$('#story').chosen();
});
}
/**
* Load module of the project.
*
* @param int $projectID
* @access public
* @return void
*/
function loadModuleMenu(projectID)
{
var link = createLink('tree', 'ajaxGetOptionMenu', 'rootID=' + projectID + '&viewtype=task');
$('#moduleIdBox').load(link, function(){$('#module').chosen();});
}
/* Copy story title as task title. */
function copyStoryTitle()
{
+1 -1
View File
@@ -26,7 +26,7 @@ class taskModel extends model
$taskFiles = array();
$this->loadModel('file');
$task = fixer::input('post')
->add('project', (int)$projectID)
->setDefault('project', (int)$projectID)
->setDefault('estimate, left, story', 0)
->setDefault('status', 'wait')
->setIF($this->post->estimate != false, 'left', $this->post->estimate)
+4
View File
@@ -26,6 +26,10 @@
</div>
<form class='main-form form-ajax' method='post' enctype='multipart/form-data' id='dataform'>
<table class='table table-form'>
<tr>
<th><?php echo $lang->task->project;?></th>
<td><?php echo html::select('project', $projects, $project->id, "class='form-control chosen' onchange='loadAll(this.value)' required");?></td><td></td><td></td>
</tr>
<tr>
<th><?php echo $lang->task->type;?></th>
<td><?php echo html::select('type', $lang->task->typeList, $task->type, "class='form-control chosen' onchange='setOwners(this.value)' required");?></td><td></td><td></td>