* Finish task #46164.

This commit is contained in:
孙广明
2021-12-17 15:25:59 +08:00
parent 2722e08c1c
commit 9f7eecf9c6
4 changed files with 97 additions and 10 deletions
+66 -8
View File
@@ -453,14 +453,33 @@ if(!window.kanbanDropRules)
{
story:
{
blacklog: true,
ready: ['blacklog', 'dev-doing'],
'dev-doing': ['dev-done'],
'dev-done': ['test-doing'],
'test-doing': ['test-done'],
'test-done': ['accepted'],
'accepted': ['published'],
'published': false,
backlog: true,
ready: ['backlog', 'doing'],
'doing': ['developed'],
'developed': ['doing', 'testing'],
'testing': ['tested'],
'tested': ['verified'],
'verified': ['released'],
'released': false,
},
bug:
{
'unconfirmed': ['confirmed'],
'confirmed': ['fixing'],
'fixing': ['fixed'],
'fixed': ['testing'],
'testing': ['tested'],
'tested': ['closed'],
'closed': ['fixing'],
},
task:
{
'wait': ['developing', 'developed', 'canceled', 'closed'],
'developing': ['developed', 'pause'],
'developed': ['canceled', 'closed'],
'pause': ['developing'],
'canceled': ['developing'],
'closed': ['developing'],
}
}
}
@@ -511,6 +530,7 @@ function changeCardColType(card, fromColType, toColType, kanbanID)
var objectID = card.id;
var showIframe = false;
/* Task lane. */
if(kanbanID == 'task')
{
if(toColType == 'developed')
@@ -560,6 +580,44 @@ function changeCardColType(card, fromColType, toColType, kanbanID)
}
}
/* Bug lane. */
if(kanbanID == 'bug')
{
if(toColType == 'confirmed')
{
if(fromColType == 'unconfirmed' && priv.canConfirmBug)
{
var link = createLink('bug', 'confirmBug', 'bugID=' + objectID, '', true);
showIframe = true;
}
}
}
/* Story lane. */
if(kanbanID == 'story')
{
if(toColType == 'ready' || toColType == 'backlog')
{
var colID = card.$col.columnID;
var link = createLink('kanban', 'ajaxMoveCard', 'cardID=' + objectID + '&colID=' + colID + '&toColType=' + toColType + '&execitionID=' + executionID + '&browseType=' + browseType + '&groupBy=' + groupBy);
$.get(link, function(data)
{
if(data)
{
kanbanGroup = $.parseJSON(data);
if(groupBy == 'default')
{
updateKanban('story', kanbanGroup.story);
}
else
{
updateKanban(browseType, kanbanGroup[groupBy]);
}
}
})
}
}
if(showIframe)
{
var modalTrigger = new $.zui.ModalTrigger({type: 'iframe', width: '80%', url: link});
+2 -1
View File
@@ -154,7 +154,8 @@ js::set('priv',
'canCancelTask' => common::hasPriv('task', 'cancel'),
'canCloseTask' => common::hasPriv('task', 'close'),
'canActivateTask' => common::hasPriv('task', 'activate'),
'canStartTask' => common::hasPriv('task', 'start')
'canStartTask' => common::hasPriv('task', 'start'),
'canConfirmBug' => common::hasPriv('bug', 'confirm')
)
);
?>
+28
View File
@@ -712,6 +712,34 @@ class kanban extends control
echo true;
}
/**
* Ajax move card.
*
* @param int $cardID
* @param int $fromColID
* @param string $toColType
* @param int $executionID
* @param string $browseType
* @param string $browseType
* @access public
* @return void
*/
public function ajaxMoveCard($cardID, $fromColID, $toColType = 'ready', $executionID, $browseType, $groupBy)
{
$fromColumn = $this->dao->select('*')->from(TABLE_KANBANCOLUMN)->where('id')->eq($fromColID)->fetch();
$toColumn = $this->dao->select('*')->from(TABLE_KANBANCOLUMN)->where('type')->eq($toColType)->andWhere('lane')->eq($fromColumn->lane)->fetch();
$fromCards = str_replace(",$cardID,", ',', $fromColumn->cards);
$fromCards = $fromCards == ',' ? '' : $fromCards;
$toCards = ",$cardID," . ltrim($toColumn->cards, ',');
$this->dao->update(TABLE_KANBANCOLUMN)->set('cards')->eq($fromCards)->where('id')->eq($fromColumn->id)->exec();
$this->dao->update(TABLE_KANBANCOLUMN)->set('cards')->eq($toCards)->where('id')->eq($toColumn->id)->exec();
$kanbanGroup = $this->kanban->getExecutionKanban($executionID, $browseType, $groupBy);
die(json_encode($kanbanGroup));
}
/**
* Change the order through the lane move up and down.
*
+1 -1
View File
@@ -1405,7 +1405,7 @@ class kanbanModel extends model
{
$cardPairs['backlog'] = empty($cardPairs['backlog']) ? ",$storyID," : ",$storyID" . $cardPairs['backlog'];
}
elseif($story->stage == $stage and strpos($cardPairs[$colType], ",$storyID,") === false)
elseif($story->stage == $stage and strpos($cardPairs[$colType], ",$storyID,") === false and $colType != 'backlog')
{
$cardPairs[$colType] = empty($cardPairs[$colType]) ? ",$storyID," : ",$storyID" . $cardPairs[$colType];
}