* Code for task #49888.

This commit is contained in:
zhangzilong
2022-03-09 10:41:46 +08:00
parent d04161c0cc
commit 6327b37eae
5 changed files with 52 additions and 28 deletions
+1 -1
View File
@@ -67,7 +67,7 @@ function setLane(regionID)
laneLink = createLink('kanban', 'ajaxGetLanes', 'regionID=' + regionID + '&type=bug&field=lane');
$.get(laneLink, function(lane)
{
if(!lane) lane = "<select id='lane' name='lane' class='form-control'>select>";
if(!lane) lane = "<select id='lane' name='lane' class='form-control'></select>";
$('#lane').replaceWith(lane);
$("#lane" + "_chosen").remove();
$("#lane").next('.picker').remove();
+21 -24
View File
@@ -86,30 +86,19 @@ class task extends control
$execution = $this->execution->getById($executionID);
$taskLink = $this->createLink('execution', 'browse', "executionID=$executionID&tab=task");
$this->loadModel('kanban');
if($execution->type == 'kanban')
{
$this->loadModel('kanban');
$regionPairs = $this->kanban->getRegionPairs($execution->id, 0, 'execution');
$regionID = isset($output['regionID']) ? $output['regionID'] : key($regionPairs);
$lanePairs = $this->kanban->getLanePairsByRegion($regionID, 'task');
$laneID = isset($output['laneID']) ? $output['laneID'] : key($lanePairs);
$cardPositions = $this->kanban->getCardPositions($executionID, 'task', 'wait');
$kanbanLanePairs = array();
if($output)
{
$lane = $this->kanban->getLaneByID($output['laneID']);
$kanbanLanePairs = $this->kanban->getLanePairsByRegion($lane->region, 'task');
}
else
{
foreach($cardPositions as $cardPosition) $kanbanLanePairs[$cardPosition->laneID] = $cardPosition->name . ' / ' . $cardPosition->laneName;
}
if($this->post->kanbanLane)
{
$output['laneID'] = $this->post->kanbanLane;
$output['columnID'] =$cardPositions[$this->post->kanbanLane]->columnID;
}
$this->view->kanbanLanePairs = $kanbanLanePairs;
$this->view->executionType = $execution->type;
$this->view->regionID = $regionID;
$this->view->laneID = $laneID;
$this->view->regionPairs = $regionPairs;
$this->view->lanePairs = $lanePairs;
}
/* Set menu. */
@@ -155,10 +144,18 @@ class task extends control
$this->action->create('task', $taskID, 'Opened', '');
}
$this->loadModel('kanban');
$kanbanID = $execution->type == 'kanban' ? $executionID : $_POST['execution'];
if(isset($output['laneID']) and isset($output['columnID'])) $this->kanban->addKanbanCell($kanbanID, $output['laneID'], $output['columnID'], 'task', $taskID);
if(!isset($output['laneID']) or !isset($output['columnID'])) $this->kanban->updateLane($kanbanID, 'task');
$laneID = isset($output['laneID']) ? $output['laneID'] : 0;
if(isset($_POST['lane'])) $laneID = $_POST['lane'];
$columnID = isset($output['columnID']) ? $output['columnID'] : 0;
if(!empty($laneID))
{
$columnIDByLaneID = $this->kanban->getColumnIDByLaneID($laneID, 'wait');
$columnID = empty($columnIDByLaneID) ? $columnID : $columnIDByLaneID;
}
if(!empty($laneID) and !empty($columnID)) $this->kanban->addKanbanCell($kanbanID, $laneID, $columnID, 'task', $taskID);
if(empty($laneID) or empty($columnID)) $this->kanban->updateLane($kanbanID, 'task');
if($todoID > 0)
{
+21
View File
@@ -270,6 +270,27 @@ function loadModuleRelated()
setStories(moduleID, executionID);
}
/**
* Set lane.
*
* @param int $regionID
* @access public
* @return void
*/
function setLane(regionID)
{
console.log(regionID);
laneLink = createLink('kanban', 'ajaxGetLanes', 'regionID=' + regionID + '&type=task&field=lane');
$.get(laneLink, function(lane)
{
if(!lane) lane = "<select id='lane' name='lane' class='form-control'></select>";
$('#lane').replaceWith(lane);
$("#lane" + "_chosen").remove();
$("#lane").next('.picker').remove();
$("#lane").chosen();
});
}
/* Get select of stories.*/
function setStories(moduleID, executionID)
{
+1 -1
View File
@@ -64,7 +64,7 @@ class taskModel extends model
->cleanINT('execution,story,module')
->stripTags($this->config->task->editor->create['id'], $this->config->allowedTags)
->join('mailto', ',')
->remove('after,files,labels,assignedTo,uid,storyEstimate,storyDesc,storyPri,team,teamEstimate,teamMember,multiple,teams,contactListMenu,selectTestStory,testStory,testPri,testEstStarted,testDeadline,testAssignedTo,testEstimate,sync,otherLane,region,kanbanLane')
->remove('after,files,labels,assignedTo,uid,storyEstimate,storyDesc,storyPri,team,teamEstimate,teamMember,multiple,teams,contactListMenu,selectTestStory,testStory,testPri,testEstStarted,testDeadline,testAssignedTo,testEstimate,sync,otherLane,region,lane')
->add('version', 1)
->get();
+8 -2
View File
@@ -139,11 +139,17 @@
</td>
</tr>
<?php endif;?>
<?php if(isset($kanbanLanePairs)):?>
<?php if(isset($executionType) and $executionType == 'kanban'):?>
<tr>
<th><?php echo $lang->kanbancard->region;?></th>
<td colspan='3'>
<div class="input group"><?php echo html::select('region', $regionPairs, $regionID, "onchange='setLane(this.value)' class='form-control chosen'");?></div>
</td>
</tr>
<tr>
<th><?php echo $lang->kanbancard->lane;?></th>
<td colspan='3'>
<div class="input group"><?php echo html::select('kanbanLane', $kanbanLanePairs, '', "class='form-control chosen'");?></div>
<div class="input group"><?php echo html::select('lane', $lanePairs, $laneID, "class='form-control chosen'");?></div>
</td>
</tr>
<?php endif;?>