* Add selected lane when batch create story in kanban.

This commit is contained in:
xieqiyu
2022-03-08 21:14:06 +08:00
parent 944c0efdfe
commit b68d3dda7e
5 changed files with 56 additions and 17 deletions
+1 -1
View File
@@ -274,7 +274,7 @@ function createColumnCreateMenu(options)
if(col.type == 'backlog')
{
if(priv.canCreateStory) items.push({label: storyLang.create, url: $.createLink('story', 'create', 'productID=' + productID + '&branch=0&moduleID=0&storyID=0&objectID=' + executionID + '&bugID=0&planID=0&todoID=0&extra=laneID=' + laneID + ',columnID=' + col.id, '', true), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}});
if(priv.canBatchCreateStory) items.push({label: executionLang.batchCreateStory, url: productCount > 1 ? '#batchCreateStory' : $.createLink('story', 'batchcreate', 'productID=' + productID + '&branch=0&moduleID=0&storyID=0&executionID=' + executionID + '&plan=0&type=story&extra=laneID=' + laneID + ',columnID=' + col.id, '', true), className: 'iframe',attrs: {'data-toggle': 'modal', 'data-width': '90%'}});
if(priv.canBatchCreateStory) items.push({label: executionLang.batchCreateStory, url: productCount > 1 ? '#batchCreateStory' : $.createLink('story', 'batchcreate', 'productID=' + productID + '&branch=0&moduleID=0&storyID=0&executionID=' + executionID + '&plan=0&type=story&extra=regionID=' + regionID + ',laneID=' + laneID + ',columnID=' + col.id, '', true), className: 'iframe',attrs: {'data-toggle': 'modal', 'data-width': '90%'}});
if(priv.canLinkStory) items.push({label: executionLang.linkStory, url: $.createLink('execution', 'linkStory', 'executionID=' + executionID + '&browseType=&param=0&recTotal=0&recPerPage=50,&pageID=1&extra=laneID=' + laneID + ',columnID=' + col.id, '', true), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '90%'}});
if(priv.canLinkStoryByPlan) items.push({label: executionLang.linkStoryByPlan, url: '#linkStoryByPlan', 'attrs' : {'data-toggle': 'modal', 'data-target': '#linkStoryByPlan','data-col' : col.id, 'data-lane' : laneID, 'class' : 'linkStoryByPlanButton'}});
}
+13 -2
View File
@@ -2269,11 +2269,12 @@ class executionModel extends model
* @param array $stories
* @param array $products
* @param string $extra
* @param array $lanes
*
* @access public
* @return bool
*/
public function linkStory($executionID, $stories = array(), $products = array(), $extra = '')
public function linkStory($executionID, $stories = array(), $products = array(), $extra = '', $lanes = array())
{
if(empty($executionID)) return false;
if(empty($stories)) $stories = $this->post->stories;
@@ -2296,7 +2297,17 @@ class executionModel extends model
if(strpos($notAllowedStatus, $storyList[$storyID]->status) !== false) continue;
if(isset($linkedStories[$storyID])) continue;
if(isset($output['laneID']) and isset($output['columnID'])) $this->kanban->addKanbanCell($executionID, $output['laneID'], $output['columnID'], 'story', $storyID);
$columnID = isset($output['columnID']) ? $output['columnID'] : 0;
$laneID = isset($output['laneID']) ? $output['laneID'] : 0;
if(isset($lanes[$storyID])) $laneID = $lanes[$storyID];
if(!empty($laneID))
{
$columnIDByLaneID = $this->kanban->getColumnIDByLaneID($laneID, 'backlog');
$columnID = empty($columnIDByLaneID) ? $columnID : $columnIDByLaneID;
}
if(!empty($laneID) and !empty($columnID)) $this->kanban->addKanbanCell($executionID, $laneID, $columnID, 'story', $storyID);
$data = new stdclass();
$data->project = $executionID;
+15 -10
View File
@@ -424,14 +424,15 @@ class story extends control
if($execution->type == 'kanban')
{
$this->loadModel('kanban');
$regionPairs = $this->kanban->getRegionPairs($executionID, 0, 'execution');
$regionID = isset($output['regionID']) ? $output['regionID'] : key($regionPairs);
$lanePairs = $this->kanban->getLanePairsByRegion($regionID, 'story');
$laneID = isset($output['laneID']) ? $output['laneID'] : key($lanePairs);
$cardPositions = $this->kanban->getCardPositions($executionID, 'story', 'backlog');
$kanbanLanePairs = array();
foreach($cardPositions as $cardPosition) $kanbanLanePairs[$cardPosition->laneID] = $cardPosition->name . ' / ' . $cardPosition->laneName;
$this->view->kanbanLanePairs = $kanbanLanePairs;
$this->view->regionID = $regionID;
$this->view->laneID = $laneID;
$this->view->regionPairs = $regionPairs;
$this->view->lanePairs = $lanePairs;
}
$this->execution->setMenu($executionID);
@@ -439,8 +440,6 @@ class story extends control
$this->lang->navGroup->story = 'execution';
}
$this->view->execution = $execution;
}
else
{
@@ -468,12 +467,18 @@ class story extends control
$stories = array();
foreach($mails as $mail) $stories[] = $mail->storyID;
$lanes = array();
if(isset($_POST['lanes']))
{
foreach($mails as $i => $mail) $lanes[$mail->storyID] = $_POST['lanes'][$i];
}
/* Project or execution linked stories. */
if($executionID)
{
$products = array();
foreach($mails as $story) $products[$story->storyID] = $productID;
$this->execution->linkStory($executionID, $stories, $products, $extra);
$this->execution->linkStory($executionID, $stories, $products, $extra, $lanes);
if($executionID != $this->session->project) $this->execution->linkStory($this->session->project, $stories, $products);
}
+21
View File
@@ -115,3 +115,24 @@ function toggleCheck(obj)
$ditto.closest('.input-group-addon').hide();
}
}
/**
* Set lane.
*
* @param int $regionID
* @param int $num
* @access public
* @return void
*/
function setLane(regionID, num)
{
laneLink = createLink('kanban', 'ajaxGetLanes', 'regionID=' + regionID + '&type=story&field=lanes&i=' + num);
$.get(laneLink, function(lanes)
{
if(!lanes) lanes = '<select id="lanes' + num + '" name="lanes[' + num + ']" class="form-control"></select>';
$('#lanes' + num).replaceWith(lanes);
$("#lanes" + num + "_chosen").remove();
$("#lanes" + num).next('.picker').remove();
$("#lanes" + num).chosen();
});
}
+6 -4
View File
@@ -48,8 +48,9 @@
<?php if(!isonlybody()):?>
<th class='c-plan<?php echo zget($visibleFields, 'plan', ' hidden') . zget($requiredFields, 'plan', '', ' required');?>'><?php echo $lang->story->plan;?></th>
<?php endif;?>
<?php if(isset($kanbanLanePairs)):?>
<th class='c-lane'><?php echo $lang->kanbancard->lane;?></th>
<?php if(isset($execution) and $execution->type == 'kanban'):?>
<th class='c-branch'><?php echo $lang->kanbancard->region;?></th>
<th class='c-branch'><?php echo $lang->kanbancard->lane;?></th>
<?php endif;?>
<th class='c-name required has-btn'><?php echo $lang->story->title;?></th>
<th class='c-spec<?php echo zget($visibleFields, 'spec', ' hidden') . zget($requiredFields, 'spec', '', ' required');?>'><?php echo $lang->story->spec;?></th>
@@ -74,8 +75,9 @@
<?php if(!isonlybody()):?>
<td class='text-left<?php echo zget($visibleFields, 'plan', ' hidden')?>' style='overflow:visible'><?php echo html::select('plan[$id]', $plans, $planID, "class='form-control chosen'");?></td>
<?php endif;?>
<?php if(isset($kanbanLanePairs)):?>
<td class='text-left'><?php echo html::select('kanbanLanes[$id]', $kanbanLanePairs, '', "class='form-control chosen' id='lane_\$id'");?>
<?php if(isset($execution) and $execution->type == 'kanban'):?>
<td class='text-left'><?php echo html::select('regions[$id]', $regionPairs, $regionID, "class='form-control chosen' onchange='setLane(this.value, \$id)'");?>
<td class='text-left'><?php echo html::select('lanes[$id]', $lanePairs, $laneID, "class='form-control chosen'");?>
<?php endif;?>
<td style='overflow:visible'>
<div class="input-group">