* Code for task #49888.

This commit is contained in:
zhangzilong
2022-03-09 10:08:46 +08:00
parent 590ba16d6a
commit d04161c0cc
5 changed files with 52 additions and 24 deletions
+9 -15
View File
@@ -326,23 +326,17 @@ class bug extends control
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, 'bug');
$laneID = isset($output['laneID']) ? $output['laneID'] : key($lanePairs);
$cardPositions = $this->kanban->getCardPositions($output['executionID'], 'bug', 'unconfirmed');
$this->view->executionType = $execution->type;
$this->view->regionID = $regionID;
$this->view->laneID = $laneID;
$this->view->regionPairs = $regionPairs;
$this->view->lanePairs = $lanePairs;
$kanbanLanePairs = array();
if(isset($output['laneID']))
{
$lane = $this->kanban->getLaneByID($output['laneID']);
$kanbanLanePairs = $this->kanban->getLanePairsByRegion($lane->region, 'bug');
}
else
{
foreach($cardPositions as $cardPosition) $kanbanLanePairs[$cardPosition->laneID] = $cardPosition->name . ' / ' . $cardPosition->laneName;
}
if($this->post->kanbanLane) $extras = 'laneID=' . "{$this->post->kanbanLane}" . ",columnID=" . $cardPositions[$this->post->kanbanLane]->columnID . ",executionID=" . $output['executionID'];
$this->view->kanbanLanePairs = $kanbanLanePairs;
}
}
else if($this->app->tab == 'project')
+21
View File
@@ -54,6 +54,27 @@ function loadModuleRelated()
setStories(moduleID, productID, storyID);
}
/**
* Set lane.
*
* @param int $regionID
* @access public
* @return void
*/
function setLane(regionID)
{
console.log(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>";
$('#lane').replaceWith(lane);
$("#lane" + "_chosen").remove();
$("#lane").next('.picker').remove();
$("#lane").chosen();
});
}
/**
* Set the assignedTo field.
*
+14 -3
View File
@@ -76,7 +76,7 @@ class bugModel extends model
->trim('title')
->join('openedBuild', ',')
->join('mailto', ',')
->remove('files,labels,uid,oldTaskID,contactListMenu,column,kanbanLane')
->remove('files,labels,uid,oldTaskID,contactListMenu,column,region,lane')
->get();
if($bug->execution != 0) $bug->project = $this->dao->select('parent')->from(TABLE_EXECUTION)->where('id')->eq($bug->execution)->fetch('parent');
@@ -107,8 +107,19 @@ class bugModel extends model
if($bug->execution)
{
$this->loadModel('kanban');
if(isset($output['laneID']) and isset($output['columnID'])) $this->kanban->addKanbanCell($bug->execution, $output['laneID'], $output['columnID'], 'bug', $bugID);
if(!isset($output['laneID']) or !isset($output['columnID'])) $this->kanban->updateLane($bug->execution, 'bug');
$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, 'unconfirmed');
$columnID = empty($columnIDByLaneID) ? $columnID : $columnIDByLaneID;
}
if(!empty($laneID) and !empty($columnID)) $this->kanban->addKanbanCell($bug->execution, $laneID, $columnID, 'bug', $bugID);
if(empty($laneID) or empty($columnID)) $this->kanban->updateLane($bug->execution, 'bug');
}
/* Callback the callable method to process the related data for object that is transfered to bug. */
+6 -4
View File
@@ -197,12 +197,14 @@ if($this->app->tab == 'project') js::set('objectID', $projectID);
</td>
</tr>
<?php endif;?>
<?php if(isset($kanbanLanePairs)):?>
<?php if(isset($executionType) and $executionType == 'kanban'):?>
<tr>
<th><?php echo $lang->kanbancard->lane;?></th>
<td colspan='2'>
<th><?php echo $lang->kanbancard->region;?></th>
<td colspan="1"><?php echo html::select('region', $regionPairs, $regionID, "onchange='setLane(this.value)' class='form-control chosen'");?></td>
<td colspan='1'>
<div class='input-group'>
<?php echo html::select('kanbanLane', $kanbanLanePairs, '', "class='form control chosen'");?>
<div class="input-group-addon"><?php echo $lang->kanbancard->lane;?></div>
<?php echo html::select('lane', $lanePairs, $laneID, "class='form control chosen'");?>
</div>
</td>
</tr>
+2 -2
View File
@@ -280,7 +280,7 @@ function createColumnCreateMenu(options)
}
else if(col.type == 'unconfirmed')
{
if(priv.canCreateBug) items.push({label: bugLang.create, url: $.createLink('bug', 'create', 'productID=0&moduleID=0&extra=laneID=' + laneID + ',columnID=' + col.id + ',executionID=' + executionID, '', true), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}});
if(priv.canCreateBug) items.push({label: bugLang.create, url: $.createLink('bug', 'create', 'productID=0&moduleID=0&extra=regionID=' + regionID + 'laneID=' + laneID + ',columnID=' + col.id + ',executionID=' + executionID, '', true), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}});
if(priv.canBatchCreateBug)
{
if(productNum > 1) items.push({label: bugLang.batchCreate, url: '#batchCreateBug', 'attrs' : {'data-toggle': 'modal'}});
@@ -289,7 +289,7 @@ function createColumnCreateMenu(options)
}
else if(col.type == 'wait')
{
if(priv.canCreateTask) items.push({label: taskLang.create, url: $.createLink('task', 'create', 'executionID=' + executionID + "&storyID=0&moduleID=0&taskID=0&todoID=0&extra=laneID=" + laneID + ",columnID=" + col.id, '', true), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}});
if(priv.canCreateTask) items.push({label: taskLang.create, url: $.createLink('task', 'create', 'executionID=' + executionID + "&storyID=0&moduleID=0&taskID=0&todoID=0&extra=regionID=" + regionID + "laneID=" + laneID + ",columnID=" + col.id, '', true), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}});
if(priv.canBatchCreateTask) items.push({label: taskLang.batchCreate, url: $.createLink('task', 'batchcreate', 'executionID=' + executionID + "&storyID=0&moduleID=0&taskID=0&iframe=0&extra=regionID=" + regionID + ",laneID=" + laneID + ",columnID=" + col.id, '', true), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}});
if(priv.canImportBug && vision == 'rnd') items.push({label: executionLang.importBug, url: $.createLink('execution', 'importBug', 'executionID=' + executionID + "&storyID=0&moduleID=0&taskID=0&todoID=0&extra=laneID=" + laneID + ",columnID=" + col.id, '', true), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}});
}