diff --git a/module/story/control.php b/module/story/control.php index 3359dda1f7..7526de14df 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -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. * diff --git a/module/story/js/create.js b/module/story/js/create.js index 26b48b29d0..fbb39a8cf5 100644 --- a/module/story/js/create.js +++ b/module/story/js/create.js @@ -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)); }); diff --git a/module/story/model.php b/module/story/model.php index cd248a07b8..ab8e7a4bed 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -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. */ diff --git a/module/story/view/create.html.php b/module/story/view/create.html.php index 346fce6b3d..11ef848cc1 100644 --- a/module/story/view/create.html.php +++ b/module/story/view/create.html.php @@ -165,10 +165,16 @@ - +