diff --git a/lib/zin/wg/gantt/js/v1.js b/lib/zin/wg/gantt/js/v1.js index 3070881ff1..ff47207dea 100644 --- a/lib/zin/wg/gantt/js/v1.js +++ b/lib/zin/wg/gantt/js/v1.js @@ -353,9 +353,16 @@ function initGantt() let resizeGanttView = function() { if(gantt.getState().fullscreen) return false; - $('#' + ganttID).css('height', Math.max(200, Math.floor($(window).height() - $('#header').outerHeight() - $('#mainMenu').outerHeight() - 5))); - }; + let ganttHeight = $(window).height() - $('#header').height(); + if($('#mainNavbar').length) ganttHeight -= $('#mainNavbar').height(); + if($('#mainMenu').length) ganttHeight -= $('#mainMenu').height(); + if($('.detail-header').length) ganttHeight -= $('.detail-header').height(); + ganttHeight -= 30; + + if(height) ganttHeight = height; + $('#' + ganttID).css('height', Math.max(200, ganttHeight)); + }; let getDeadlineBtn = function(task) { diff --git a/lib/zin/wg/gantt/v1.php b/lib/zin/wg/gantt/v1.php index c90df552f9..139f67019b 100644 --- a/lib/zin/wg/gantt/v1.php +++ b/lib/zin/wg/gantt/v1.php @@ -58,10 +58,11 @@ class gantt extends wg $cssFile = $app->getWebRoot() . 'js/dhtmlxgantt/min.css'; $jsFile = $app->getWebRoot() . 'js/dhtmlxgantt/min.js'; - list($id, $zooming, $colsWidth) = $this->prop(array('id', 'zooming', 'colsWidth')); - if(empty($id)) $id = 'ganttView'; - if(empty($zooming)) $zooming = 'day'; - if(empty($colsWidth)) $colsWidth = '600'; + list($id, $zooming, $colsWidth, $showChart) = $this->prop(array('id', 'zooming', 'colsWidth', 'showChart')); + if(empty($id)) $id = 'ganttView'; + if(empty($zooming)) $zooming = 'day'; + if(empty($colsWidth)) $colsWidth = '600'; + if($showChart !== false) $showChart = true; $fileName = data('fileName'); $ganttType = data('ganttType'); @@ -83,14 +84,15 @@ class gantt extends wg jsVar('ganttType', $ganttType), jsVar('showFields', $showFields), jsVar('colsWidth', $colsWidth), + jsVar('showChart', $showChart), jsVar('userList', $this->getUserList()), jsVar('ganttLang', $this->prop('ganttLang')), jsVar('canGanttEdit', $this->prop('canEdit')), jsVar('canEditDeadline', $this->prop('canEditDeadline')), jsVar('ganttFields', $this->prop('ganttFields')), - jsVar('showChart', $this->prop('showChart')), jsVar('zooming', $this->prop('zooming')), jsVar('options', $this->prop('options')), + jsVar('height', (int)$this->prop('height')), setID('ganttContainer'), div(setID($id), setClass('gantt')), div(setID('myCover'), div(setID('gantt_here'))) diff --git a/module/programplan/ui/gantt.html.php b/module/programplan/ui/gantt.html.php index 9c9f5a62db..4999f79541 100644 --- a/module/programplan/ui/gantt.html.php +++ b/module/programplan/ui/gantt.html.php @@ -58,12 +58,10 @@ if($app->rawModule == 'programplan') gantt ( - setID('ganttView'), set('ganttLang', $ganttLang), + set('ganttFields', $ganttFields), set('canEdit', common::hasPriv('programplan', 'ganttEdit')), set('canEditDeadline', common::hasPriv('review', 'edit')), - set('ganttFields', $ganttFields), - set('showChart', true), set('zooming', isset($zooming) ? $zooming : 'day'), set('options', $plans) );