* Add move card for execution-kanban.
This commit is contained in:
@@ -1973,11 +1973,12 @@ class execution extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function kanban($executionID, $browseType = 'all', $orderBy = 'id_asc', $groupBy = 'all')
|
||||
public function kanban($executionID, $browseType = 'all', $orderBy = 'id_asc', $groupBy = '')
|
||||
{
|
||||
if($groupBy == '') $groupBy = 'default';
|
||||
$this->lang->execution->menu = new stdclass();
|
||||
$execution = $this->commonAction($executionID);
|
||||
$kanbanData = $this->loadModel('kanban')->getRDKanban($executionID, $browseType, $orderBy, $groupBy);
|
||||
$kanbanData = $this->loadModel('kanban')->getRDKanban($executionID, $browseType, $orderBy);
|
||||
$executionActions = array();
|
||||
|
||||
foreach($this->config->execution->statusActions as $action)
|
||||
|
||||
@@ -222,8 +222,8 @@ if(!window.kanbanDropRules)
|
||||
{
|
||||
story:
|
||||
{
|
||||
backlog: ['ready'],
|
||||
ready: ['backlog'],
|
||||
backlog: ['ready', 'backlog'],
|
||||
ready: ['backlog', 'ready'],
|
||||
},
|
||||
bug:
|
||||
{
|
||||
@@ -237,12 +237,12 @@ if(!window.kanbanDropRules)
|
||||
},
|
||||
task:
|
||||
{
|
||||
'wait': ['developing', 'developed', 'canceled', 'closed'],
|
||||
'developing': ['developed', 'pause'],
|
||||
'developed': ['canceled', 'closed'],
|
||||
'pause': ['developing'],
|
||||
'canceled': ['developing'],
|
||||
'closed': ['developing'],
|
||||
'wait': ['wait', 'developing', 'developed', 'canceled', 'closed'],
|
||||
'developing': ['developing', 'developed', 'pause'],
|
||||
'developed': ['developed', 'canceled', 'closed'],
|
||||
'pause': ['pause', 'developing'],
|
||||
'canceled': ['canceled', 'developing'],
|
||||
'closed': ['closed', 'developing'],
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -256,13 +256,13 @@ function findDropColumns($element, $root)
|
||||
{
|
||||
var $col = $element.closest('.kanban-col');
|
||||
var col = $col.data();
|
||||
var kanbanID = $root.data('id');
|
||||
var kanbanRules = window.kanbanDropRules ? window.kanbanDropRules[kanbanID] : null;
|
||||
var laneType = $element.closest('.kanban-lane').data().lane.type;
|
||||
var kanbanRules = window.kanbanDropRules ? window.kanbanDropRules[laneType] : null;
|
||||
|
||||
if(!kanbanRules) return $root.find('.kanban-lane-col:not([data-type="' + col.type + '"])');
|
||||
|
||||
var colRules = kanbanRules[col.type];
|
||||
var lane = $col.closest('.kanban-lane').data('lane');
|
||||
var groupID = $col.closest('.kanban-board').data().id;
|
||||
return $root.find('.kanban-lane-col').filter(function()
|
||||
{
|
||||
if(!colRules) return false;
|
||||
@@ -270,11 +270,9 @@ function findDropColumns($element, $root)
|
||||
|
||||
var $newCol = $(this);
|
||||
var newCol = $newCol.data();
|
||||
if(newCol.id === col.id) return false;
|
||||
var newGroupID = $newCol.closest('.kanban-board').data().id;
|
||||
|
||||
var $newLane = $newCol.closest('.kanban-lane');
|
||||
var newLane = $newLane.data('lane');
|
||||
var canDropHere = colRules.indexOf(newCol.type) > -1 && newLane.id === lane.id;
|
||||
var canDropHere = colRules.indexOf(newCol.type) > -1 && newGroupID.id === groupID.id;
|
||||
if(canDropHere) $newCol.addClass('can-drop-here');
|
||||
return canDropHere;
|
||||
});
|
||||
@@ -642,6 +640,27 @@ function renderLaneName($lane, lane, $kanban, columns, kanban)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a region.
|
||||
*
|
||||
* @param int regionID
|
||||
* @param array regionData
|
||||
* @access public
|
||||
* @return boolean
|
||||
*/
|
||||
function updateRegion(regionID, regionData = [])
|
||||
{
|
||||
if(!regionID) return false;
|
||||
|
||||
var $region = $('#kanban'+ regionID).kanban();
|
||||
|
||||
if(!$region.length) return false;
|
||||
if(!regionData) regionData = regions[regionID];
|
||||
|
||||
$region.data('zui.kanban').render(regionData.groups);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle drop task.
|
||||
*
|
||||
@@ -669,8 +688,9 @@ function handleDropTask($element, event, kanban)
|
||||
var cardID = $card.data().id;
|
||||
var fromColType = $oldCol.data('type');
|
||||
var toColType = $newCol.data('type');
|
||||
var regionID = $card.closest('.region').data().id;
|
||||
|
||||
changeCardColType(cardID, oldCol.id, newCol.id, oldLane.id, newLane.id, cardType, fromColType, toColType);
|
||||
changeCardColType(cardID, oldCol.id, newCol.id, oldLane.id, newLane.id, cardType, fromColType, toColType, regionID);
|
||||
}
|
||||
|
||||
var kanbanActionHandlers =
|
||||
@@ -691,18 +711,19 @@ function handleKanbanAction(action, $element, event, kanban)
|
||||
/**
|
||||
* changeCardColType
|
||||
*
|
||||
* @param int $cardID
|
||||
* @param int $fromColID
|
||||
* @param int $toColID
|
||||
* @param int $fromLaneID
|
||||
* @param int $toLaneID
|
||||
* @param string $cardType
|
||||
* @param string $fromColType
|
||||
* @param string $toColType
|
||||
* @param int cardID
|
||||
* @param int fromColID
|
||||
* @param int toColID
|
||||
* @param int fromLaneID
|
||||
* @param int toLaneID
|
||||
* @param string cardType
|
||||
* @param string fromColType
|
||||
* @param string toColType
|
||||
* @param int regionID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function changeCardColType(cardID, fromColID, toColID, fromLaneID, toLaneID, cardType, fromColType, toColType)
|
||||
function changeCardColType(cardID, fromColID, toColID, fromLaneID, toLaneID, cardType, fromColType, toColType, regionID = 0)
|
||||
{
|
||||
var objectID = cardID;
|
||||
var showIframe = false;
|
||||
@@ -805,22 +826,21 @@ function changeCardColType(cardID, fromColID, toColID, fromLaneID, toLaneID, car
|
||||
|
||||
if(moveCard)
|
||||
{
|
||||
var link = createLink('kanban', 'ajaxMoveCard', 'cardID=' + objectID + '&fromColID=' + fromColID + '&toColID=' + toColID + '&fromLaneID=' + fromLaneID + '&toLaneID=' + toLaneID + '&execitionID=' + executionID + '&browseType=' + browseType + '&groupBy=' + groupBy);
|
||||
$.get(link, function(data)
|
||||
var link = createLink('kanban', 'ajaxMoveCard', 'cardID=' + objectID + '&fromColID=' + fromColID + '&toColID=' + toColID + '&fromLaneID=' + fromLaneID + '&toLaneID=' + toLaneID + '&execitionID=' + executionID + '&browseType=' + browseType + '&groupBy=' + groupBy + '®ionID=' + regionID + '&orderBy=' + orderBy );
|
||||
$.ajax(
|
||||
{
|
||||
if(data)
|
||||
method: 'post',
|
||||
dataType: 'json',
|
||||
url: link,
|
||||
success: function(data)
|
||||
{
|
||||
kanbanGroup = $.parseJSON(data);
|
||||
if(groupBy == 'default')
|
||||
{
|
||||
updateKanban('bug', kanbanGroup.bug);
|
||||
}
|
||||
else
|
||||
{
|
||||
updateKanban(browseType, kanbanGroup[groupBy]);
|
||||
}
|
||||
updateRegion(regionID, data[regionID]);
|
||||
},
|
||||
error: function(xhr, status, error)
|
||||
{
|
||||
showErrorMessager(error || lang.timeout);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -829,22 +849,21 @@ function changeCardColType(cardID, fromColID, toColID, fromLaneID, toLaneID, car
|
||||
{
|
||||
if(toColType == 'ready' || toColType == 'backlog')
|
||||
{
|
||||
var link = createLink('kanban', 'ajaxMoveCard', 'cardID=' + objectID + '&fromColID=' + fromColID + '&toColID=' + toColID + '&fromLaneID=' + fromLaneID + '&toLaneID=' + toLaneID + '&execitionID=' + executionID + '&browseType=' + browseType + '&groupBy=' + groupBy);
|
||||
$.get(link, function(data)
|
||||
var link = createLink('kanban', 'ajaxMoveCard', 'cardID=' + objectID + '&fromColID=' + fromColID + '&toColID=' + toColID + '&fromLaneID=' + fromLaneID + '&toLaneID=' + toLaneID + '&execitionID=' + executionID + '&browseType=' + browseType + '&groupBy=' + groupBy + '®ionID=' + regionID+ '&orderBy=' + orderBy );
|
||||
$.ajax(
|
||||
{
|
||||
if(data)
|
||||
method: 'post',
|
||||
dataType: 'json',
|
||||
url: link,
|
||||
success: function(data)
|
||||
{
|
||||
kanbanGroup = $.parseJSON(data);
|
||||
if(groupBy == 'default')
|
||||
{
|
||||
updateKanban('story', kanbanGroup.story);
|
||||
}
|
||||
else
|
||||
{
|
||||
updateKanban(browseType, kanbanGroup[groupBy]);
|
||||
}
|
||||
updateRegion(regionID, data[regionID]);
|
||||
},
|
||||
error: function(xhr, status, error)
|
||||
{
|
||||
showErrorMessager(error || lang.timeout);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,9 @@ $laneCount = 0;
|
||||
foreach($regions as $region) $laneCount += $region->laneCount;
|
||||
|
||||
js::set('regions', $regions);
|
||||
js::set('browseType', $browseType);
|
||||
js::set('orderBy', $orderBy);
|
||||
js::set('groupBy', $groupBy);
|
||||
js::set('execution', $execution);
|
||||
js::set('productID', $productID);
|
||||
js::set('kanbanLang', $lang->kanban);
|
||||
|
||||
+13
-11
@@ -1027,19 +1027,21 @@ class kanban extends control
|
||||
|
||||
/**
|
||||
* Ajax move card.
|
||||
*
|
||||
* @param int $cardID
|
||||
* @param int $fromColID
|
||||
* @param int $toColID
|
||||
* @param int $fromLaneID
|
||||
* @param int $toLaneID
|
||||
* @param int $executionID
|
||||
* @param string $browseType
|
||||
* @param string $groupBy
|
||||
*
|
||||
* @param int $cardID
|
||||
* @param int $fromColID
|
||||
* @param int $toColID
|
||||
* @param int $fromLaneID
|
||||
* @param int $toLaneID
|
||||
* @param int $executionID
|
||||
* @param string $browseType
|
||||
* @param string $groupBy
|
||||
* @param int $regionID
|
||||
* @param string $orderBy
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function ajaxMoveCard($cardID = 0, $fromColID = 0, $toColID = 0, $fromLaneID = 0, $toLaneID = 0, $executionID = 0, $browseType = 'all', $groupBy = '')
|
||||
public function ajaxMoveCard($cardID = 0, $fromColID = 0, $toColID = 0, $fromLaneID = 0, $toLaneID = 0, $executionID = 0, $browseType = 'all', $groupBy = '', $regionID = 0, $orderBy)
|
||||
{
|
||||
$fromCell = $this->dao->select('id, cards')->from(TABLE_KANBANCELL)
|
||||
->where('kanban')->eq($executionID)
|
||||
@@ -1069,7 +1071,7 @@ class kanban extends control
|
||||
->andWhere('`column`')->eq($toColID)
|
||||
->exec();
|
||||
|
||||
$kanbanGroup = $this->kanban->getExecutionKanban($executionID, $browseType, $groupBy);
|
||||
$kanbanGroup = $regionID == 0 ? $this->kanban->getExecutionKanban($executionID, $browseType, $groupBy) : $this->kanban->getRDKanban($executionID, $browseType, $orderBy, $groupBy, $regionID);
|
||||
die(json_encode($kanbanGroup));
|
||||
}
|
||||
|
||||
|
||||
@@ -626,17 +626,17 @@ class kanbanModel extends model
|
||||
* @param int $executionID
|
||||
* @param string $browseType all|story|task|bug
|
||||
* @param string $orderBy
|
||||
* @param string $groupBy
|
||||
* @param int $regionID
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getRDKanban($executionID, $browseType = 'all', $orderBy = 'id_desc', $groupBy = 'all')
|
||||
public function getRDKanban($executionID, $browseType = 'all', $orderBy = 'id_desc', $regionID = 0)
|
||||
{
|
||||
$kanbanData = array();
|
||||
$actions = array('sortGroup');
|
||||
$regions = $this->getRegionPairs($executionID);
|
||||
$regionIDList = array_keys($regions);
|
||||
$regionIDList = $regionID == 0 ? array_keys($regions) : array(0 => $regionID);
|
||||
$groupGroup = $this->getGroupGroupByRegions($regionIDList);
|
||||
$laneGroup = $this->getLaneGroupByRegions($regionIDList, $browseType);
|
||||
$columnGroup = $this->getRDColumnGroupByRegions($regionIDList, array_keys($laneGroup));
|
||||
@@ -999,7 +999,6 @@ class kanbanModel extends model
|
||||
->where('execution')->eq($executionID)
|
||||
->andWhere('deleted')->eq(0)
|
||||
->beginIF($browseType != 'all')->andWhere('type')->eq($browseType)->fi()
|
||||
->beginIF($groupBy == 'default')->andWhere('groupby')->eq('')->fi()
|
||||
->orderBy('order_asc')
|
||||
->fetchAll('id');
|
||||
|
||||
@@ -1114,9 +1113,10 @@ class kanbanModel extends model
|
||||
public function getKanban4Group($executionID, $browseType, $groupBy)
|
||||
{
|
||||
/* Get card data. */
|
||||
if($browseType == 'story') $cardList = $this->loadModel('story')->getExecutionStories($executionID);
|
||||
if($browseType == 'bug') $cardList = $this->loadModel('bug')->getExecutionBugs($executionID);
|
||||
if($browseType == 'task') $cardList = $this->loadModel('execution')->getKanbanTasks($executionID, "id");
|
||||
$cardList = array();
|
||||
if($browseType == 'story') $cardList .= $this->loadModel('story')->getExecutionStories($executionID);
|
||||
if($browseType == 'bug') $cardList .= $this->loadModel('bug')->getExecutionBugs($executionID);
|
||||
if($browseType == 'task') $cardList .= $this->loadModel('execution')->getKanbanTasks($executionID, "id");
|
||||
|
||||
$lanes = $this->getLanes4Group($executionID, $browseType, $groupBy, $cardList);
|
||||
if(empty($lanes)) return array();
|
||||
@@ -1213,7 +1213,7 @@ class kanbanModel extends model
|
||||
|
||||
/**
|
||||
* Build lane data for group kanban.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @param int $executionID
|
||||
* @param string $browseType
|
||||
|
||||
Reference in New Issue
Block a user