* Code for task#59546. Update create story and copy bug.

This commit is contained in:
xieqiyu
2022-07-07 09:06:33 +08:00
parent 01e9f98e06
commit e10272248b
7 changed files with 124 additions and 47 deletions
+4 -3
View File
@@ -404,11 +404,12 @@ class bug extends control
if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $bugID));
/* If link from no head then reload. */
if(isset($output['executionID']) and isonlybody())
if(isonlybody())
{
$executionID = $this->post->execution ? $this->post->execution : $output['executionID'];
$executionID = isset($output['executionID']) ? $output['executionID'] : $this->session->execution;
$executionID = $this->post->execution ? $this->post->execution : $executionID;
$execution = $this->loadModel('execution')->getByID($executionID);
if($executionID == $output['executionID'] and $this->app->tab == 'execution' and $execution->type == 'kanban')
if($this->app->tab == 'execution' and $execution->type == 'kanban')
{
$execLaneType = $this->session->execLaneType ? $this->session->execLaneType : 'all';
$execGroupBy = $this->session->execGroupBy ? $this->session->execGroupBy : 'default';
-4
View File
@@ -2271,7 +2271,6 @@ class execution extends control
public function kanban($executionID, $browseType = 'all', $orderBy = 'id_asc', $groupBy = 'default')
{
$this->app->loadLang('bug');
$this->loadModel('story');
if(empty($groupBy)) $groupBy = 'default';
@@ -2345,7 +2344,6 @@ class execution extends control
$this->view->kanbanData = $kanbanData;
$this->view->executionActions = $executionActions;
$this->view->kanban = $this->lang->execution->kanban;
$this->view->reviewStoryParis = $this->story->getExecutionStoryPairs($execution->id, 0, 'all', 0, 'full', 'review');
$this->display();
}
@@ -2374,7 +2372,6 @@ class execution extends control
/* Load language. */
$this->app->loadLang('task');
$this->app->loadLang('bug');
$this->loadModel('story');
$this->loadModel('kanban');
/* Compatibility IE8. */
@@ -2435,7 +2432,6 @@ class execution extends control
$this->view->groupBy = $groupBy;
$this->view->canBeChanged = $canBeChanged;
$this->view->userList = $userList;
$this->view->reviewStoryParis = $this->story->getExecutionStoryPairs($execution->id, 0, 'all', 0, 'full', 'review');
$this->display();
}
+52 -19
View File
@@ -1092,28 +1092,29 @@ function changeCardColType(cardID, fromColID, toColID, fromLaneID, toLaneID, car
}
else
{
if(toColType == 'ready' && typeof(reviewStoryParis[objectID]) != 'undefined')
if(toColType == 'ready')
{
bootbox.alert(executionLang.storyDragError);
return false;
$.get(createLink('story', 'ajaxGetInfo', "storyID=" + cardID), function(data)
{
if(data)
{
data = $.parseJSON(data);
if(data.status == 'draft' || data.status == 'changed')
{
bootbox.alert(executionLang.storyDragError);
}
else
{
ajaxMoveCard(objectID, fromColID, toColID, fromLaneID, toLaneID, regionID);
}
}
});
}
else
{
ajaxMoveCard(objectID, fromColID, toColID, fromLaneID, toLaneID, regionID);
}
var link = createLink('kanban', 'ajaxMoveCard', 'cardID=' + objectID + '&fromColID=' + fromColID + '&toColID=' + toColID + '&fromLaneID=' + fromLaneID + '&toLaneID=' + toLaneID + '&execitionID=' + executionID + '&browseType=' + browseType + '&groupBy=' + groupBy + '&regionID=' + regionID+ '&orderBy=' + orderBy );
$.ajax(
{
method: 'post',
dataType: 'json',
url: link,
success: function(data)
{
data = groupBy == 'default' ? data[regionID] : data[groupBy];
updateRegion(regionID, data);
},
error: function(xhr, status, error)
{
showErrorMessager(error || lang.timeout);
}
});
}
}
@@ -1124,6 +1125,38 @@ function changeCardColType(cardID, fromColID, toColID, fromLaneID, toLaneID, car
}
}
/**
* AJAX: move card.
*
* @param int $objectID
* @param int $fromColID
* @param int $toColID
* @param int $fromLaneID
* @param int $toLaneID
* @param int $regionID
* @access public
* @return void
*/
function ajaxMoveCard(objectID, fromColID, toColID, fromLaneID, toLaneID, regionID)
{
var link = createLink('kanban', 'ajaxMoveCard', 'cardID=' + objectID + '&fromColID=' + fromColID + '&toColID=' + toColID + '&fromLaneID=' + fromLaneID + '&toLaneID=' + toLaneID + '&execitionID=' + executionID + '&browseType=' + browseType + '&groupBy=' + groupBy + '&regionID=' + regionID+ '&orderBy=' + orderBy );
$.ajax(
{
method: 'post',
dataType: 'json',
url: link,
success: function(data)
{
data = groupBy == 'default' ? data[regionID] : data[groupBy];
updateRegion(regionID, data);
},
error: function(xhr, status, error)
{
showErrorMessager(error || lang.timeout);
}
});
}
/**
* Delete a card.
*
+49 -18
View File
@@ -774,28 +774,28 @@ function changeCardColType(cardID, fromColID, toColID, fromLaneID, toLaneID, car
}
else
{
if(toColType == 'ready' && typeof(reviewStoryParis[objectID]) != 'undefined')
if(toColType == 'ready')
{
bootbox.alert(executionLang.storyDragError);
return false;
}
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)
{
if(data)
$.get(createLink('story', 'ajaxGetInfo', "storyID=" + cardID), function(data)
{
kanbanGroup = $.parseJSON(data);
if(groupBy == 'default')
if(data)
{
updateKanban('story', kanbanGroup.story);
data = $.parseJSON(data);
if(data.status == 'draft' || data.status == 'changed')
{
bootbox.alert(executionLang.storyDragError);
}
else
{
ajaxMoveCard(objectID, fromColID, toColID, fromLaneID, toLaneID);
}
}
else
{
updateKanban(browseType, kanbanGroup[groupBy]);
}
}
});
});
}
else
{
ajaxMoveCard(objectID, fromColID, toColID, fromLaneID, toLaneID);
}
}
}
@@ -806,6 +806,37 @@ function changeCardColType(cardID, fromColID, toColID, fromLaneID, toLaneID, car
}
}
/**
* AJAX: move card.
*
* @param int $objectID
* @param int $fromColID
* @param int $toColID
* @param int $fromLaneID
* @param int $toLaneID
* @access public
* @return void
*/
function ajaxMoveCard(objectID, fromColID, toColID, fromLaneID, toLaneID)
{
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)
{
if(data)
{
kanbanGroup = $.parseJSON(data);
if(groupBy == 'default')
{
updateKanban('story', kanbanGroup.story);
}
else
{
updateKanban(browseType, kanbanGroup[groupBy]);
}
}
});
}
/**
* Handle drop task.
*
-1
View File
@@ -53,7 +53,6 @@ js::set('projectID', $projectID);
js::set('vision', $this->config->vision);
js::set('productCount', count($productNames));
js::set('executionID', $execution->id);
js::set('reviewStoryParis', $reviewStoryParis);
js::set('needLinkProducts', $lang->execution->needLinkProducts);
js::set('lastUpdateData', '');
js::set('rdSearchValue', '');
@@ -218,7 +218,6 @@ js::set('priv',
<?php js::set('entertime', time());?>
<?php js::set('fluidBoard', $execution->fluidBoard);?>
<?php js::set('displayCards', $execution->displayCards);?>
<?php js::set('reviewStoryParis', $reviewStoryParis);?>
<?php js::set('needLinkProducts', $lang->execution->needLinkProducts);?>
<?php js::set('hourUnit', $config->hourUnit);?>
<?php include '../../common/view/footer.html.php';?>
+19 -1
View File
@@ -184,7 +184,24 @@ class story extends control
if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $storyID));
/* If link from no head then reload. */
if(isonlybody()) return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent'));
if(isonlybody())
{
$execution = $this->execution->getByID($this->session->execution);
if($this->app->tab == 'execution' and $execution->type == 'kanban')
{
$execLaneType = $this->session->execLaneType ? $this->session->execLaneType : 'all';
$execGroupBy = $this->session->execGroupBy ? $this->session->execGroupBy : 'default';
$rdSearchValue = $this->session->rdSearchValue ? $this->session->rdSearchValue : '';
$kanbanData = $this->loadModel('kanban')->getRDKanban($this->session->execution, $execLaneType, 'id_desc', 0, $execGroupBy, $rdSearchValue);
$kanbanData = json_encode($kanbanData);
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'closeModal' => true, 'callback' => "parent.updateKanban($kanbanData, 0)"));
}
else
{
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent'));
}
}
if($this->post->newStory)
{
@@ -2187,6 +2204,7 @@ class story extends control
$storyInfo['estimate'] = $story->estimate;
$storyInfo['pri'] = $story->pri;
$storyInfo['spec'] = html_entity_decode($story->spec, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401, 'UTF-8');
$storyInfo['status'] = $story->status;
echo json_encode($storyInfo);
}