* Code for task #49888.
This commit is contained in:
+23
-10
@@ -69,26 +69,31 @@ class story extends control
|
||||
$extra = str_replace(array(',', ' '), array('&', ''), $extra);
|
||||
parse_str($extra, $output);
|
||||
|
||||
if($execution->type == 'kanban')
|
||||
if(isset($execution) and $execution->type == 'kanban')
|
||||
{
|
||||
$this->loadModel('kanban');
|
||||
|
||||
$cardPositions = $this->kanban->getCardPositions($execution->id, 'story', 'backlog');
|
||||
$lanePairs = array();
|
||||
$regionPairs = array();
|
||||
$regionPairs = $this->kanban->getRegionPairs($execution->id, 0, 'execution');
|
||||
|
||||
$kanbanLanePairs = array();
|
||||
if($output)
|
||||
{
|
||||
$lane = $this->kanban->getLaneByID($output['laneID']);
|
||||
$kanbanLanePairs = $this->kanban->getLanePairsByRegion($lane->region, 'story');
|
||||
$lane = $this->kanban->getLaneByID($output['laneID']);
|
||||
$lanePairs = $this->kanban->getLanePairsByRegion($lane->region, 'story');
|
||||
$this->view->regionID = $lane->region;
|
||||
$this->view->laneID = $lane->id;
|
||||
}
|
||||
else
|
||||
else $lanePairs = $this->kanban->getLanePairsByRegion(array_keys($regionPairs)[0], 'story');
|
||||
|
||||
if($this->post->lane and $this->post->region)
|
||||
{
|
||||
foreach($cardPositions as $cardPosition) $kanbanLanePairs[$cardPosition->laneID] = $cardPosition->name . ' / ' . $cardPosition->laneName;
|
||||
$columnID = $this->kanban->getColumnIDByLaneID($this->post->lane, 'backlog');
|
||||
$extra = 'laneID=' . $this->post->lane . ',columnID=' . $columnID;
|
||||
}
|
||||
|
||||
if($this->post->kanbanLane) $extra = 'laneID=' . "{$this->post->kanbanLane}" . "&columnID=" . $cardPositions[$this->post->kanbanLane]->columnID;
|
||||
|
||||
$this->view->kanbanLanePairs = $kanbanLanePairs;
|
||||
$this->view->regionPairs = $regionPairs;
|
||||
$this->view->lanePairs = $lanePairs;
|
||||
}
|
||||
|
||||
foreach($output as $paramKey => $paramValue)
|
||||
@@ -2147,6 +2152,14 @@ class story extends control
|
||||
echo json_encode($result);
|
||||
}
|
||||
|
||||
public function ajaxGetLanesByRegionID($regionID)
|
||||
{
|
||||
$this->loadModel('kanban');
|
||||
$lanePairs = $this->kanban->getLanePairsByRegion($regionID, 'story');
|
||||
|
||||
return print(html::select('lane', $lanePairs, '', "class='form-control chosen'"));
|
||||
}
|
||||
|
||||
/**
|
||||
* AJAX: get spec and verify of a story. for web app.
|
||||
*
|
||||
|
||||
@@ -48,6 +48,18 @@ function refreshPlan()
|
||||
$('a.refresh').click();
|
||||
}
|
||||
|
||||
function loadLanes(regionID)
|
||||
{
|
||||
var link = createLink('story', 'ajaxGetLanesByRegionID', 'regionID=' + regionID);
|
||||
$.post(link, function(data)
|
||||
{
|
||||
console.log(data);
|
||||
$('#lane').replaceWith(data);
|
||||
$('#lane_chosen').remove();
|
||||
$('#lane').chosen();
|
||||
});
|
||||
}
|
||||
|
||||
$(window).unload(function(){
|
||||
if(blockID) window.parent.refreshBlock($('#block' + blockID));
|
||||
});
|
||||
|
||||
@@ -217,7 +217,7 @@ class storyModel extends model
|
||||
->setIF($bugID > 0, 'fromBug', $bugID)
|
||||
->join('mailto', ',')
|
||||
->stripTags($this->config->story->editor->create['id'], $this->config->allowedTags)
|
||||
->remove('files,labels,reviewer,needNotReview,newStory,uid,contactListMenu,URS,column,kanbanLane')
|
||||
->remove('files,labels,reviewer,needNotReview,newStory,uid,contactListMenu,URS,column,region,lane')
|
||||
->get();
|
||||
|
||||
/* Check repeat story. */
|
||||
|
||||
@@ -165,10 +165,16 @@
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<?php endif;?>
|
||||
<?php if (isset($kanbanLanePairs)):?>
|
||||
<?php if (isset($lanePairs) and isset($regionPairs)):?>
|
||||
<tr>
|
||||
<th><?php echo $lang->kanbancard->lane;?>
|
||||
<td colspan="4"><?php echo html::select('kanbanLane', $kanbanLanePairs, '', "class='form-control chosen'")?></td>
|
||||
<th><?php echo $lang->kanbancard->region;?>
|
||||
<td colspan="2"><?php echo html::select('region', $regionPairs, isset($regionID) ? $regionID : '', "onchange='loadLanes(this.value)' class='form-control chosen'");?></td>
|
||||
<td colspan="2">
|
||||
<div class='input-group'>
|
||||
<div class="input-group-addon"><?php echo $lang->kanbancard->lane;?></div>
|
||||
<?php echo html::select('lane', $lanePairs, isset($laneID) ? $laneID : '', "class='form-control chosen'");?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<tr>
|
||||
|
||||
Reference in New Issue
Block a user