From 2530d27f0bdc3ee2133922480f7db8818e377098 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=B9=BF=E6=98=8E?= Date: Wed, 26 Jan 2022 10:13:46 +0800 Subject: [PATCH] * Fix bug #18972. --- module/execution/control.php | 5 +++-- module/execution/js/kanban.js | 21 +++++++++++++++++++++ module/execution/view/kanban.html.php | 1 + module/tutorial/model.php | 2 ++ 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/module/execution/control.php b/module/execution/control.php index 82a87d3869..1903a680f1 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -3610,17 +3610,18 @@ class execution extends control * @param string $enterTime * @param string $browseType * @param string $groupBy + * @param string $from execution|RD * @access public * @return void */ - public function ajaxUpdateKanban($executionID = 0, $enterTime = '', $browseType = '', $groupBy = '') + public function ajaxUpdateKanban($executionID = 0, $enterTime = '', $browseType = '', $groupBy = '', $from = 'execution') { $enterTime = date('Y-m-d H:i:s', $enterTime); $lastEditedTime = $this->dao->select("max(lastEditedTime) as lastEditedTime")->from(TABLE_KANBANLANE)->where('execution')->eq($executionID)->fetch('lastEditedTime'); if($lastEditedTime > $enterTime or $groupBy != 'default') { - $kanbanGroup = $this->loadModel('kanban')->getExecutionKanban($executionID, $browseType, $groupBy); + $kanbanGroup = $from == 'execution' ? $this->loadModel('kanban')->getExecutionKanban($executionID, $browseType, $groupBy) : $this->loadModel('kanban')->getRDKanban($executionID, $browseType, 'id_asc', 0, $groupBy);; die(json_encode($kanbanGroup)); } else diff --git a/module/execution/js/kanban.js b/module/execution/js/kanban.js index f683dd1e1c..b3e35cd827 100644 --- a/module/execution/js/kanban.js +++ b/module/execution/js/kanban.js @@ -1294,6 +1294,27 @@ $(function() if(sortType == 'lane') $cards.show(); } }); + + /* Ajax update kanban. */ + if(groupBy == 'default') + { + var lastUpdateData; + setInterval(function() + { + $.get(createLink('execution', 'ajaxUpdateKanban', "executionID=" + executionID + "&entertime=" + entertime + "&browseType=" + browseType + "&groupBy=" + groupBy + '&from=RD'), function(data) + { + if(data && lastUpdateData !== data) + { + lastUpdateData = data; + kanbanData = $.parseJSON(data); + for(var region in kanbanData) + { + updateRegion(region, kanbanData[region]); + } + } + }); + }, 10000); + } }); /** Calculate column height */ diff --git a/module/execution/view/kanban.html.php b/module/execution/view/kanban.html.php index 6d36d404f6..4c13cdcadd 100644 --- a/module/execution/view/kanban.html.php +++ b/module/execution/view/kanban.html.php @@ -41,6 +41,7 @@ js::set('laneCount', $laneCount); js::set('userList', $userList); js::set('noAssigned', $lang->kanbancard->noAssigned); js::set('users', $users); +js::set('entertime', time()); js::set('displayCards', $execution->displayCards); js::set('fluidBoard', $execution->fluidBoard); js::set('colorListLang', $lang->kanbancard->colorList); diff --git a/module/tutorial/model.php b/module/tutorial/model.php index adba507a77..ed681e8003 100644 --- a/module/tutorial/model.php +++ b/module/tutorial/model.php @@ -158,6 +158,7 @@ class tutorialModel extends model $project->whitelist = ''; $project->budget = 0; $project->displayCards = 0; + $project->fluidBoard = 0; $project->deleted = '0'; return $project; @@ -295,6 +296,7 @@ class tutorialModel extends model $execution->totalHours = 0; $execution->totalEstimate = 0; $execution->displayCards = 0; + $execution->fluidBoard = 0; return $execution; }