From 8cd6a20a3835db028ed836dce54d63e78e38bf0e Mon Sep 17 00:00:00 2001 From: hufangzhou Date: Tue, 31 Aug 2021 16:00:35 +0800 Subject: [PATCH 1/8] * Code for task #41781. --- module/product/css/kanban.css | 17 +++++--- module/product/view/kanban.html.php | 62 +++++++++++++++++++---------- 2 files changed, 51 insertions(+), 28 deletions(-) diff --git a/module/product/css/kanban.css b/module/product/css/kanban.css index 8f36e4012d..8100681b52 100644 --- a/module/product/css/kanban.css +++ b/module/product/css/kanban.css @@ -1,12 +1,15 @@ #kanban {padding: 10px;} -.main-table tbody>tr>td {padding: 0 10px 10px;} .table caption {background: #fff; border-top-left-radius: 2px; border-top-right-radius: 2px; margin-bottom: 0; font-weight: 500; padding-top: 0;} -.table .program {writing-mode: vertical-lr; padding-left: 4px !important; color: #fff;} - .table th, .table td {border-top: 2px solid #fff; border-bottom: 2px solid #fff; border-left: 3px solid #fff; border-bottom: 3px solid #fff;} .table tbody tr:last-child td {border-bottom: unset;} -td.project, td.execution {padding: 10px 0 !important;} -td.plan, td.release {vertical-align: top !important;} +td.plan, td.release, td.project, td.execution {vertical-align: top !important;} + +.main-table tbody>tr>td {padding: 0 10px 10px;} +.table .program {writing-mode: vertical-lr; padding-left: 4px !important; color: #fff;} +td.product {padding-top: 10px !important;} +td.project, td.execution {padding: 0 0 10px 0 !important;} +td > div:not(.board) > .board-item:first-child {margin-top: 10px;} +td > div.board:first-child {margin-top: 5px;} .board-item {border: 1px solid #ebebeb; padding: 3px 10px; cursor: default; border-radius: 2px; background-color: #fff; text-align: left;} .board-item:hover {border-color: #ccc;} @@ -14,8 +17,10 @@ td.plan, td.release {vertical-align: top !important;} .board + .board {margin-top: 5px;} .board-item + .board-item {margin-top: 10px;} .project .board, .execution .board {padding-top: 5px; border-top: 2px solid #fff;} -.project .board:first-child, .execution .board:first-child {padding-top: 0; border-top: unset;} +.project .board:first-child, .execution .board:first-child {padding-top: 5px; border-top: unset;} .release .board-item {display: flex; flex-flow: row nowrap; justify-content: flex-start; align-items: center;} .emptyBoard {padding: 3px 10px; cursor: default;} .project .table-row > .table-col:last-child, .execution .table-row > .table-col:last-child {width: 24px; padding-top: 2px;} + +.scroll {overflow-x: hidden;; overflow-y: auto;} diff --git a/module/product/view/kanban.html.php b/module/product/view/kanban.html.php index c8f65606dc..0baf449beb 100644 --- a/module/product/view/kanban.html.php +++ b/module/product/view/kanban.html.php @@ -39,29 +39,38 @@ $programProduct):?> + 5 or $releaseCount > 5)) $scroll = 'scroll'; + ?> - + - ' . html::a($this->createLink('product', 'browse', "productID=$productID"), $productList[$productID]->name, '', "title={$productList[$productID]->name}") . '';?> + " . html::a($this->createLink('product', 'browse', "productID=$productID"), $productList[$productID]->name, '', "title={$productList[$productID]->name}") . '';?> name}>{$productList[$productID]->name}";?> - - $plan):?> -
- - createLink('productplan', 'view', "planID=$planID"), $plan->title, '', "title={$plan->title}");?> - - title}>{$plan->title}"?> +
+ + $plan):?> +
+ + createLink('productplan', 'view', "planID=$planID"), $plan->title, '', "title={$plan->title}");?> + + title}>{$plan->title}"?> + +
+
- - @@ -133,18 +142,20 @@ - - $release):?> -
- - createLink('release', 'view', "releaseID=$releaseID"), $release->name, '', "title={$release->name} class='text-ellipsis'");?> - - name}>{$release->name}"?> +
+ + $release):?> +
+ + createLink('release', 'view', "releaseID=$releaseID"), $release->name, '', "title={$release->name} class='text-ellipsis'");?> + + name}>{$release->name}"?> + + marker) echo " ";?> +
+ - marker) echo " ";?>
- - @@ -168,7 +179,14 @@ $(function() } }) - $('.emptyBoard').parent().height($('.project .board').height()); + $('.board').height($('.project .board').height()); + + $('.table div.scroll').each(function() + { + var count = $(this).parent().siblings('td.project').children('.board').length >= 5 ? $(this).parent().siblings('td.project').children('.board').length : 5; + var preHeight = $(this).parent().siblings('td.project').children('.board').length >= 5 ? $('.board').outerHeight(true) : $(this).find('.board-item').outerHeight(true); + $(this).css('max-height', preHeight * count); + }) }) From 42db6b50eb5fe3d03e62efa24a7af0e61971856c Mon Sep 17 00:00:00 2001 From: tianshujie Date: Tue, 31 Aug 2021 16:02:11 +0800 Subject: [PATCH 2/8] * Fix bug #14820. --- module/common/lang/menu.php | 2 +- module/testcase/view/batchedit.html.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/module/common/lang/menu.php b/module/common/lang/menu.php index 979a276a96..414d918862 100644 --- a/module/common/lang/menu.php +++ b/module/common/lang/menu.php @@ -94,7 +94,7 @@ $lang->my->menu->work['subMenu']->task = array('link' => "{$lang->task->comm if($config->URAndSR) $lang->my->menu->work['subMenu']->requirement = "$lang->URCommon|my|work|mode=requirement"; $lang->my->menu->work['subMenu']->story = "$lang->SRCommon|my|work|mode=story"; $lang->my->menu->work['subMenu']->bug = "{$lang->bug->common}|my|work|mode=bug"; -$lang->my->menu->work['subMenu']->testcase = "{$lang->testcase->common}|my|work|mode=testcase&type=assigntome"; +$lang->my->menu->work['subMenu']->testcase = array('link' => "{$lang->testcase->common}|my|work|mode=testcase&type=assigntome", 'subModule' => 'testtask'); $lang->my->menu->work['subMenu']->testtask = "{$lang->testtask->common}|my|work|mode=testtask&type=wait"; $lang->my->menu->work['menuOrder'][5] = 'task'; diff --git a/module/testcase/view/batchedit.html.php b/module/testcase/view/batchedit.html.php index 4474520799..f77dac15b5 100644 --- a/module/testcase/view/batchedit.html.php +++ b/module/testcase/view/batchedit.html.php @@ -67,7 +67,7 @@ lib) + if((!$productID and !$cases[$caseID]->lib) or $app->tab != 'qa') { $product = $this->product->getByID($cases[$caseID]->product); $branches = $product->type == 'normal' ? array('' => '') : $this->loadModel('branch')->getPairs($product->id); From 174518c1b58b33c735e925cf950cc6e3ebbaad43 Mon Sep 17 00:00:00 2001 From: dingguodong Date: Tue, 31 Aug 2021 16:09:03 +0800 Subject: [PATCH 3/8] * Remove membership filter. --- module/gitlab/model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/gitlab/model.php b/module/gitlab/model.php index 0942deab50..5bd5a65153 100644 --- a/module/gitlab/model.php +++ b/module/gitlab/model.php @@ -406,7 +406,7 @@ class gitlabModel extends model $allResults = array(); for($page = 1; true; $page ++) { - $results = json_decode(commonModel::http($host . "?private_token={$gitlab->token}&simple=true&membership=true&page={$page}&per_page=100")); + $results = json_decode(commonModel::http($host . "?private_token={$gitlab->token}&simple=true&page={$page}&per_page=100")); if(empty($results) or $page > 10) break; $allResults = array_merge($allResults, $results); } From 71a023247a2aef0a4018215a42a2858a740d758a Mon Sep 17 00:00:00 2001 From: dingguodong Date: Tue, 31 Aug 2021 16:09:43 +0800 Subject: [PATCH 4/8] - Remove getGitlabProjects function from repo model. --- module/repo/model.php | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/module/repo/model.php b/module/repo/model.php index 25a5193b94..db67885e7c 100644 --- a/module/repo/model.php +++ b/module/repo/model.php @@ -1752,29 +1752,6 @@ class repoModel extends model return $buildedURL; } - /** - * Get gitlab projects. - * - * @param string $host - * @param string $token - * @access public - * @return array - */ - public function getGitlabProjects($host, $token) - { - $host = rtrim($host, '/'); - $host .= '/api/v4/projects'; - $allResults = array(); - for($page = 1; true; $page ++) - { - $results = json_decode(common::http($host . "?private_token=$token&simple=true&membership=true&page={$page}&per_page=100")); - if(empty($results) or $page > 10) break; - $allResults = $allResults + $results; - } - - return $allResults; - } - /** * Process gitlab repo. * From 104c1e854849d3d57d63ddf98d82876cf3220c2e Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Tue, 31 Aug 2021 16:25:27 +0800 Subject: [PATCH 5/8] * Code for task#41781. --- module/project/control.php | 1 - module/project/css/kanban.css | 12 +++++------- module/project/js/kanban.js | 27 +++++++++++++++++++++++++++ module/project/model.php | 5 +---- module/project/view/kanban.html.php | 13 ++----------- 5 files changed, 35 insertions(+), 23 deletions(-) create mode 100644 module/project/js/kanban.js diff --git a/module/project/control.php b/module/project/control.php index 071a615857..146c5944df 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -305,7 +305,6 @@ class project extends control $this->view->title = $this->lang->project->kanban; $this->view->kanbanGroup = $kanbanGroup; $this->view->latestExecutions = $latestExecutions; - $this->view->statusCount = $statusCount; $this->view->programPairs = array(0 => $this->lang->project->noProgram) + $this->loadModel('program')->getPairs(true); $this->display(); diff --git a/module/project/css/kanban.css b/module/project/css/kanban.css index 0abab98e7e..200fd755a6 100644 --- a/module/project/css/kanban.css +++ b/module/project/css/kanban.css @@ -5,15 +5,13 @@ .board-item:hover {border-color: #ccc;} .board-project .board-item + .board-item {margin-top: 10px;} -.board-project {padding: 10px;} -.board-wait, .board-closed {vertical-align: top !important;} +.board-project {padding: 0 10px 10px 10px;} +.board-project .board-item:first-child {margin-top: 10px;} -.board-doing {padding: 0px !important; vertical-align: top !important;} +.board-doing, .board-wait, .board-closed {padding: 0px !important; vertical-align: top !important;} +.board-doing .board-doing-project,.board-doing .board-doing-execution {padding: 10px;} .board-doing .board-doing-project:not(:last-child), -.board-doing .board-doing-execution:not(:last-child) {padding: 10px; border-bottom: 2px solid #fff;} - -.board-doing .board-doing-project:last-child, -.board-doing .board-doing-execution:last-child {padding: 10px;} +.board-doing .board-doing-execution:not(:last-child) {border-bottom: 2px solid #fff;} .board-doing-project .table-row .table-col:last-child, .c-progress {width: 30px;} .board-doing-execution .table-row .table-col:last-child, .c-progress {width: 30px;} diff --git a/module/project/js/kanban.js b/module/project/js/kanban.js new file mode 100644 index 0000000000..522fe5ff68 --- /dev/null +++ b/module/project/js/kanban.js @@ -0,0 +1,27 @@ +$(function() +{ + $("div[class^='board-doing-']").height($('.board-doing-project').height()); + + $('.board-program').each(function() + { + var boardWaitCount = $(this).find('.board-wait .board-item').length; + var boardClosedCount = $(this).find('.board-closed .board-item').length; + var boardDoingCount = $(this).find('.board-doing .board-item').length; + + if((boardWaitCount > 5 || boardClosedCount > 5) && (boardWaitCount > boardDoingCount || boardClosedCount > boardDoingCount)) + { + var boardHeight = 0; + if(boardDoingCount > 5) + { + boardHeight = $('.board-doing-project').outerHeight(true) * boardDoingCount; + } + else + { + var boardHeight = $(this).find('.board-project .board-item').outerHeight(true) * 5; + } + + $(this).find('.board-project').css("height", boardHeight); + $(this).find('.board-project').css("overflow", 'auto'); + } + }); +}) diff --git a/module/project/model.php b/module/project/model.php index dba7681ca5..ce24e747f2 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -1798,7 +1798,6 @@ class projectModel extends model $myProjects = array(); $otherProjects = array(); - $statusCount = array(); foreach($projects as $project) { if(strpos('wait,doing,closed', $project->status) === false) continue; @@ -1809,17 +1808,15 @@ class projectModel extends model if($project->PM == $this->app->user->account) { $myProjects[$topProgram][$project->status][$project->id] = $project; - $statusCount['my'][$topProgram][$project->status] = count($myProjects[$topProgram][$project->status]); } else { $otherProjects[$topProgram][$project->status][$project->id] = $project; - $statusCount['other'][$topProgram][$project->status] = count($otherProjects[$topProgram][$project->status]); } } - return array('kanbanGroup' => array('my' => $myProjects, 'other' => $otherProjects), 'latestExecutions' => $latestExecutions, 'statusCount' => $statusCount); + return array('kanbanGroup' => array('my' => $myProjects, 'other' => $otherProjects), 'latestExecutions' => $latestExecutions); } /** diff --git a/module/project/view/kanban.html.php b/module/project/view/kanban.html.php index 71fd7871a0..b3b50a8f90 100644 --- a/module/project/view/kanban.html.php +++ b/module/project/view/kanban.html.php @@ -10,13 +10,11 @@ ?> -

project->empty;?>

- $projectGroup):?>
@@ -39,7 +37,7 @@ $statusList):?> - + @@ -110,7 +108,7 @@ -
$statusCount[$type][$programID]['doing'])) echo "style='max-height: 273px; overflow: auto;'";?>> +
> @@ -143,11 +141,4 @@
- - From 705b0c69e8b67e6d562acad68e0636731dc922f3 Mon Sep 17 00:00:00 2001 From: liyuchun Date: Tue, 31 Aug 2021 16:26:03 +0800 Subject: [PATCH 6/8] * Fix bug #14439. --- module/doc/model.php | 2 +- module/doc/view/tablecontents.html.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/module/doc/model.php b/module/doc/model.php index dc7f054707..34b2071b52 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -2310,7 +2310,7 @@ EOT; { $libs = $this->getLibsByObject('book', 0, '', $appendLib); $this->app->rawMethod = 'book'; - if($libID == 0 and !empty($libs)) $libID = reset($libs)->id; + if(!empty($libs) and ($libID == 0 or !isset($libs[$libID]))) $libID = reset($libs)->id; $this->lang->modulePageNav = $this->select($type, $objects, $objectID, $libs, $libID); $object = new stdclass(); diff --git a/module/doc/view/tablecontents.html.php b/module/doc/view/tablecontents.html.php index e54b1de5a8..fa0adfb0db 100644 --- a/module/doc/view/tablecontents.html.php +++ b/module/doc/view/tablecontents.html.php @@ -52,7 +52,7 @@ if(empty($type)) $type = 'product'; echo '
'; } - if($type == 'book' and ($canEditLib or $canManageBook)) + if($type == 'book' and ($canEditLib or $canManageBook) and !empty($libs)) { echo "