From b638bd1c831e0c52a09fc4cc34f44320848cc7d7 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Wed, 30 Mar 2022 09:40:23 +0800 Subject: [PATCH 1/5] * Fix bug #21282. --- module/execution/js/kanban.js | 88 ++++++++++++++----------------- module/execution/js/taskkanban.js | 32 +++++++++++ 2 files changed, 71 insertions(+), 49 deletions(-) diff --git a/module/execution/js/kanban.js b/module/execution/js/kanban.js index c379071846..73298351c9 100644 --- a/module/execution/js/kanban.js +++ b/module/execution/js/kanban.js @@ -185,6 +185,8 @@ function changeKanbanScaleSize(newScaleSize) kanban.setOptions({cardsPerRow: newScaleSize, cardHeight: getCardHeight()}); } + if(laneCount == 1) resetRegionHeight('open'); + return newScaleSize; } @@ -1034,6 +1036,7 @@ function updateKanban(kanbanData, regionID = 0) }); } }, 200); + resetRegionHeight('open'); } /** @@ -1462,6 +1465,12 @@ $(function() }, 10000); } + if(groupBy != 'default') + { + $('.region').css('padding-bottom', '10px'); + $('.region').css('border', '0px'); + } + resetRegionHeight('open'); }); @@ -1484,54 +1493,35 @@ function calcColHeight(col, lane, colCards, colHeight, kanban) * @access public * @return void */ - function resetRegionHeight(fold) - { - var regionCount = 0; - if($.isEmptyObject(regions)) return false; - for(var i in regions) - { - regionCount += 1; - if(regionCount > 1) return false; - } +function resetRegionHeight(fold) +{ + var laneCount = 0; + $('.kanban-lane').each(function() + { + laneCount ++; + if(laneCount > 1) return; + }); - var regionID = Object.keys(regions)[0]; - var region = regions[regionID].groups; - var groupCount = 0; + if(laneCount > 1) return; + var regionHeaderHeight = $('.region-header').outerHeight(); + if(fold == 'open') + { + var windowHeight = $(window).height(); + var headerHeight = $('#mainHeader').outerHeight(); + var mainPadding = $('#main').css('padding-top'); + var menuHeight = $('#mainMenu').height(); + var panelBorder = $('.panel').css('border-top-width'); + var bodyPadding = $('.panel-body').css('padding-top'); + var regionBorder = $('.region').css('border-top-width'); + var regionPadding = $('.kanban').css('padding-bottom'); + var columnHeight = $('.kanban-header').outerHeight(); + var height = windowHeight - (parseInt(mainPadding) * 2) - menuHeight - (parseInt(bodyPadding) * 2) - headerHeight - (parseInt(panelBorder) * 2) - (parseInt(regionBorder) * 2); - if($.isEmptyObject(region)) return false; - for(var j in region) - { - groupCount += 1; - if(groupCount > 1) return false; - } - - var group = region[0]; - var laneCount = 0; - - if($.isEmptyObject(group.lanes)) return false; - for(var h in group.lanes) - { - laneCount += 1; - if(laneCount > 1) return false; - } - - var regionHeaderHeight = $('.region-header').outerHeight(); - if(fold == 'open') - { - var windowHeight = $(window).height(); - var headerHeight = $('#mainHeader').outerHeight(); - var mainPadding = $('#main').css('padding-top'); - var panelBorder = $('.panel').css('border-top-width'); - var bodyPadding = $('.panel-body').css('padding-top'); - var height = windowHeight - (parseInt(mainPadding) * 2) - (parseInt(bodyPadding) * 2) - headerHeight - (parseInt(panelBorder) * 2); - var regionPadding = $('.kanban').css('padding-bottom'); - var columnHeight = $('.kanban-header').outerHeight(); - - $('.region').css('height', height); - $('.kanban-lane').css('height', height - regionHeaderHeight - parseInt(regionPadding) - columnHeight); - } - else - { - $('.region').css('height', regionHeaderHeight); - } - } + if(groupBy == 'default') $('.region').css('height', height); + $('.kanban-lane').css('height', height - regionHeaderHeight - parseInt(regionPadding) - columnHeight); + } + else + { + $('.region').css('height', regionHeaderHeight); + } +} diff --git a/module/execution/js/taskkanban.js b/module/execution/js/taskkanban.js index 03defee35c..ffe37e5c35 100644 --- a/module/execution/js/taskkanban.js +++ b/module/execution/js/taskkanban.js @@ -361,6 +361,7 @@ function updateKanban(kanbanID, data) if(!$kanban.length) return; $kanban.data('zui.kanban').render(data); + resetKanbanHeight(); } /** @@ -985,6 +986,7 @@ function changeKanbanScaleSize(newScaleSize) kanban.setOptions({cardsPerRow: newScaleSize, cardHeight: getCardHeight()}); }); + resetKanbanHeight(); return newScaleSize; } @@ -1159,6 +1161,7 @@ $(function() } }); }, 10000); + resetKanbanHeight(); }); $('#type').change(function() @@ -1206,3 +1209,32 @@ $('.panel-body').scroll(function() { $.zui.ContextMenu.hide(); }); + +/** + * Reset kanban height according to window height. + * + * @access public + * @return void + */ +function resetKanbanHeight() +{ + var laneCount = 0; + $('.kanban-lane').each(function() + { + laneCount ++; + if(laneCount > 1) return; + }); + + if(laneCount > 1) return; + + var windowHeight = $(window).height(); + var headerHeight = $('#mainHeader').outerHeight(); + var mainPadding = $('#main').css('padding-top'); + var menuHeight = $('#mainMenu').height(); + var panelBorder = $('.panel').css('border-top-width'); + var bodyPadding = $('.panel-body').css('padding-top'); + var columnHeight = $('.kanban-header').outerHeight(); + var height = windowHeight - headerHeight - (parseInt(mainPadding) * 2) - menuHeight - (parseInt(panelBorder) * 2) - (parseInt(bodyPadding) * 2) - columnHeight; + + $('.kanban-lane').css('height', height -2); +} From 63e915a555d558ffae0ae550e3de03954571ebd7 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Wed, 30 Mar 2022 10:10:19 +0800 Subject: [PATCH 2/5] * Modify the code judgment logic. --- module/execution/js/kanban.js | 3 +-- module/execution/js/taskkanban.js | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/module/execution/js/kanban.js b/module/execution/js/kanban.js index 73298351c9..b7c9a2ef28 100644 --- a/module/execution/js/kanban.js +++ b/module/execution/js/kanban.js @@ -1499,10 +1499,9 @@ function resetRegionHeight(fold) $('.kanban-lane').each(function() { laneCount ++; - if(laneCount > 1) return; + if(laneCount > 1) return true; }); - if(laneCount > 1) return; var regionHeaderHeight = $('.region-header').outerHeight(); if(fold == 'open') { diff --git a/module/execution/js/taskkanban.js b/module/execution/js/taskkanban.js index ffe37e5c35..43b7d14d7b 100644 --- a/module/execution/js/taskkanban.js +++ b/module/execution/js/taskkanban.js @@ -1222,11 +1222,9 @@ function resetKanbanHeight() $('.kanban-lane').each(function() { laneCount ++; - if(laneCount > 1) return; + if(laneCount > 1) return true; }); - if(laneCount > 1) return; - var windowHeight = $(window).height(); var headerHeight = $('#mainHeader').outerHeight(); var mainPadding = $('#main').css('padding-top'); From 04316599a494b1ef4a8b8419971e16412046e419 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Wed, 30 Mar 2022 10:26:17 +0800 Subject: [PATCH 3/5] * Modify the error. --- module/project/view/index.html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/project/view/index.html.php b/module/project/view/index.html.php index 543f7a52a1..f27a1135ed 100644 --- a/module/project/view/index.html.php +++ b/module/project/view/index.html.php @@ -93,7 +93,7 @@ 2) break;?>
- $usersAvatar[$member->account], 'account' => $member->account, 'name' => $member->realname), 'avatar-circle avatar-' . zget($userIdPairs, $member->account)); ?> + zget($usersAvatar, $member->account, ''), 'account' => $member->account, 'name' => $member->realname), 'avatar-circle avatar-' . zget($userIdPairs, $member->account, '')); ?>
4):?> From 0e3779ca1b6c4b271e23893a9511af3cf2b0a44f Mon Sep 17 00:00:00 2001 From: tianshujie Date: Wed, 30 Mar 2022 10:45:01 +0800 Subject: [PATCH 4/5] * Fix Kanban related issues. --- module/execution/control.php | 2 +- module/execution/css/kanban.css | 1 - module/execution/js/kanban.js | 4 +++- module/execution/js/taskkanban.js | 2 ++ module/project/control.php | 2 +- module/user/model.php | 3 ++- 6 files changed, 9 insertions(+), 5 deletions(-) diff --git a/module/execution/control.php b/module/execution/control.php index 1e9f4bb4db..90e8517836 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -2070,7 +2070,7 @@ class execution extends control $userList = array(); $users = $this->loadModel('user')->getPairs('noletter|nodeleted'); - $avatarPairs = $this->user->getAvatarPairs(); + $avatarPairs = $this->user->getAvatarPairs('all'); foreach($avatarPairs as $account => $avatar) { if(!isset($users[$account])) continue; diff --git a/module/execution/css/kanban.css b/module/execution/css/kanban.css index b5cef787ca..00a13ba1a2 100644 --- a/module/execution/css/kanban.css +++ b/module/execution/css/kanban.css @@ -68,7 +68,6 @@ .kanban-col[data-type=ADD] {display: none;} .kanban-col[data-type=EMPTY] {display: none;} .kanban-col {padding-right: 0px !important;} -.kanban-item:hover .title {padding-right: 10px;} .gray .actions {display:none;} .c-type {width: 150px !important; overflow: unset;} diff --git a/module/execution/js/kanban.js b/module/execution/js/kanban.js index b7c9a2ef28..054986c08c 100644 --- a/module/execution/js/kanban.js +++ b/module/execution/js/kanban.js @@ -1499,9 +1499,11 @@ function resetRegionHeight(fold) $('.kanban-lane').each(function() { laneCount ++; - if(laneCount > 1) return true; + if(laneCount > 1) return; }); + if(laneCount > 1) return; + var regionHeaderHeight = $('.region-header').outerHeight(); if(fold == 'open') { diff --git a/module/execution/js/taskkanban.js b/module/execution/js/taskkanban.js index 43b7d14d7b..aa057b5375 100644 --- a/module/execution/js/taskkanban.js +++ b/module/execution/js/taskkanban.js @@ -1225,6 +1225,8 @@ function resetKanbanHeight() if(laneCount > 1) return true; }); + if(laneCount > 1) return true; + var windowHeight = $(window).height(); var headerHeight = $('#mainHeader').outerHeight(); var mainPadding = $('#main').css('padding-top'); diff --git a/module/project/control.php b/module/project/control.php index f8df0dda9a..f8ab7647f0 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -260,7 +260,7 @@ class project extends control $this->view->kanbanList = $kanbanList; $this->view->browseType = $browseType; $this->view->memberGroup = $this->execution->getMembersByIdList(array_keys($kanbanList)); - $this->view->usersAvatar = $this->loadModel('user')->getAvatarPairs(); + $this->view->usersAvatar = $this->loadModel('user')->getAvatarPairs('all'); $this->view->executionActions = $executionActions; } diff --git a/module/user/model.php b/module/user/model.php index 873869dd0b..2f4e5f94c5 100644 --- a/module/user/model.php +++ b/module/user/model.php @@ -40,7 +40,8 @@ class userModel extends model public function getList($params = 'nodeleted') { return $this->dao->select('*')->from(TABLE_USER) - ->where('type')->eq('inside') + ->where(true) + ->beginIF(strpos($params, 'all') === false)->andWhere('type')->eq('inside')->fi() ->beginIF(strpos($params, 'nodeleted') !== false)->andWhere('deleted')->eq(0)->fi() ->orderBy('account') ->fetchAll(); From 317ff297b10be4d4d685e637550face0af1a2ec2 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Wed, 30 Mar 2022 11:02:29 +0800 Subject: [PATCH 5/5] * Fix Kanban related issues. --- module/execution/js/taskkanban.js | 20 ++++++++++---------- module/project/control.php | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/module/execution/js/taskkanban.js b/module/execution/js/taskkanban.js index aa057b5375..2627d3dd92 100644 --- a/module/execution/js/taskkanban.js +++ b/module/execution/js/taskkanban.js @@ -1222,19 +1222,19 @@ function resetKanbanHeight() $('.kanban-lane').each(function() { laneCount ++; - if(laneCount > 1) return true; + if(laneCount > 1) return; }); - if(laneCount > 1) return true; + if(laneCount > 1) return; - var windowHeight = $(window).height(); - var headerHeight = $('#mainHeader').outerHeight(); - var mainPadding = $('#main').css('padding-top'); - var menuHeight = $('#mainMenu').height(); - var panelBorder = $('.panel').css('border-top-width'); - var bodyPadding = $('.panel-body').css('padding-top'); - var columnHeight = $('.kanban-header').outerHeight(); - var height = windowHeight - headerHeight - (parseInt(mainPadding) * 2) - menuHeight - (parseInt(panelBorder) * 2) - (parseInt(bodyPadding) * 2) - columnHeight; + var windowHeight = $(window).height(); + var headerHeight = $('#mainHeader').outerHeight(); + var mainPadding = $('#main').css('padding-top'); + var menuHeight = $('#mainMenu').height(); + var panelBorder = $('.panel').css('border-top-width'); + var bodyPadding = $('.panel-body').css('padding-top'); + var columnHeight = $('.kanban-header').outerHeight(); + var height = windowHeight - headerHeight - (parseInt(mainPadding) * 2) - menuHeight - (parseInt(panelBorder) * 2) - (parseInt(bodyPadding) * 2) - columnHeight; $('.kanban-lane').css('height', height -2); } diff --git a/module/project/control.php b/module/project/control.php index f8ab7647f0..ab35cc5be7 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -267,7 +267,7 @@ class project extends control $this->view->title = $this->lang->project->common . $this->lang->colon . $this->lang->project->index; $this->view->position[] = $this->lang->project->index; $this->view->project = $project; - $this->view->userIdPairs = $this->loadModel('user')->getPairs('nodeleted|showid'); + $this->view->userIdPairs = $this->loadModel('user')->getPairs('nodeleted|showid|all'); $this->display(); }