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