diff --git a/module/programplan/config/form.php b/module/programplan/config/form.php index 2dcc9a971a..c0d030b9c8 100644 --- a/module/programplan/config/form.php +++ b/module/programplan/config/form.php @@ -38,9 +38,9 @@ $config->programplan->form->edit['milestone'] = array('required' => false, 'type $config->programplan->form->edit['output'] = array('required' => false, 'type' => 'array', 'default' => array(), 'filter' => 'join'); $config->programplan->form->ajaxCustom = array(); -$config->programplan->form->ajaxCustom['zooming'] = array('required' => false, 'type' => 'string'); -$config->programplan->form->ajaxCustom['stageCustom'] = array('required' => false, 'type' => 'array', 'filter' => 'join'); -$config->programplan->form->ajaxCustom['ganttFields'] = array('required' => false, 'type' => 'array', 'filter' => 'join'); +$config->programplan->form->ajaxCustom['zooming'] = array('required' => false, 'type' => 'string', 'default' => ''); +$config->programplan->form->ajaxCustom['stageCustom'] = array('required' => false, 'type' => 'array', 'filter' => 'join', 'default' => 'array()'); +$config->programplan->form->ajaxCustom['ganttFields'] = array('required' => false, 'type' => 'array', 'filter' => 'join', 'default' => 'array()'); $config->programplan->form->updateDateByGantt['id'] = array('required' => false, 'type' => 'int', 'default' => 0); $config->programplan->form->updateDateByGantt['startDate'] = array('required' => false, 'type' => 'string', 'default' => null); diff --git a/module/programplan/css/ajaxcustom.ui.css b/module/programplan/css/ajaxcustom.ui.css new file mode 100644 index 0000000000..4170e77bb2 --- /dev/null +++ b/module/programplan/css/ajaxcustom.ui.css @@ -0,0 +1 @@ +#ajaxCustomForm .customField .checkbox-primary {width: 20%;} diff --git a/module/programplan/lang/de.php b/module/programplan/lang/de.php index 0c56777c5b..9ace4da824 100644 --- a/module/programplan/lang/de.php +++ b/module/programplan/lang/de.php @@ -96,9 +96,8 @@ $lang->programplan->confirmDelete = 'Do you want to delete the current plan? $lang->programplan->confirmChangeAttr = 'The type of the sub-stage will be adjusted to "%s" synchronously according to the type of the parent stage after modification. Do you want to save?'; $lang->programplan->workloadTips = 'The proportion of the sub stage workload is divided by 100%.'; -$lang->programplan->stageCustom = new stdClass(); -$lang->programplan->stageCustom->date = 'Show Date'; -$lang->programplan->stageCustom->task = 'Show Task'; +$lang->programplan->stageCustom['date'] = 'Show Date'; +$lang->programplan->stageCustom['task'] = 'Show Task'; $lang->programplan->ganttCustom['PM'] = 'Manager'; $lang->programplan->ganttCustom['deadline'] = 'Deadline'; diff --git a/module/programplan/lang/en.php b/module/programplan/lang/en.php index 4debf890ae..a16d7fb52c 100644 --- a/module/programplan/lang/en.php +++ b/module/programplan/lang/en.php @@ -96,9 +96,8 @@ $lang->programplan->confirmDelete = 'Do you want to delete the current plan? $lang->programplan->confirmChangeAttr = 'The type of the sub-stage will be adjusted to "%s" synchronously according to the type of the parent stage after modification. Do you want to save?'; $lang->programplan->workloadTips = 'The workload of the sub stage is divided by 100%.'; -$lang->programplan->stageCustom = new stdClass(); -$lang->programplan->stageCustom->date = 'Show Date'; -$lang->programplan->stageCustom->task = 'Show Task'; +$lang->programplan->stageCustom['date'] = 'Show Date'; +$lang->programplan->stageCustom['task'] = 'Show Task'; $lang->programplan->ganttCustom['PM'] = 'Manager'; $lang->programplan->ganttCustom['deadline'] = 'Deadline'; diff --git a/module/programplan/lang/fr.php b/module/programplan/lang/fr.php index 0c56777c5b..9ace4da824 100644 --- a/module/programplan/lang/fr.php +++ b/module/programplan/lang/fr.php @@ -96,9 +96,8 @@ $lang->programplan->confirmDelete = 'Do you want to delete the current plan? $lang->programplan->confirmChangeAttr = 'The type of the sub-stage will be adjusted to "%s" synchronously according to the type of the parent stage after modification. Do you want to save?'; $lang->programplan->workloadTips = 'The proportion of the sub stage workload is divided by 100%.'; -$lang->programplan->stageCustom = new stdClass(); -$lang->programplan->stageCustom->date = 'Show Date'; -$lang->programplan->stageCustom->task = 'Show Task'; +$lang->programplan->stageCustom['date'] = 'Show Date'; +$lang->programplan->stageCustom['task'] = 'Show Task'; $lang->programplan->ganttCustom['PM'] = 'Manager'; $lang->programplan->ganttCustom['deadline'] = 'Deadline'; diff --git a/module/programplan/lang/zh-cn.php b/module/programplan/lang/zh-cn.php index c5c7b85a25..b1a9b5ae82 100644 --- a/module/programplan/lang/zh-cn.php +++ b/module/programplan/lang/zh-cn.php @@ -96,9 +96,8 @@ $lang->programplan->confirmDelete = '确定要删除当前计划吗?'; $lang->programplan->confirmChangeAttr = '修改后子阶段的类型将根据父阶段类型同步调整为“%s”,是否保存?'; $lang->programplan->workloadTips = '子阶段工作量占比按百分百的比例进行拆分'; -$lang->programplan->stageCustom = new stdClass(); -$lang->programplan->stageCustom->date = '显示日期'; -$lang->programplan->stageCustom->task = '显示任务'; +$lang->programplan->stageCustom['date'] = '显示日期'; +$lang->programplan->stageCustom['task'] = '显示任务'; $lang->programplan->ganttCustom['PM'] ='负责人'; $lang->programplan->ganttCustom['deadline'] ='计划完成'; diff --git a/module/programplan/ui/ajaxcustom.html.php b/module/programplan/ui/ajaxcustom.html.php new file mode 100644 index 0000000000..e8c5d91c12 --- /dev/null +++ b/module/programplan/ui/ajaxcustom.html.php @@ -0,0 +1,51 @@ + + * @package programplan + * @link https://www.zentao.net + */ +namespace zin; + +formPanel +( + setID('ajaxCustomForm'), + set::title($lang->programplan->settingGantt), + formGroup + ( + set::label($lang->execution->gantt->format), + radioList + ( + set::name('zooming'), + set::items($lang->execution->gantt->zooming), + set::value($zooming ? $zooming : 'day'), + set::inline(true) + ) + ), + formGroup + ( + set::label($lang->programplan->viewSetting), + checkList + ( + set::name('stageCustom'), + set::items($lang->programplan->stageCustom), + set::value($stageCustom), + set::inline(true) + ) + ), + formGroup + ( + setClass('customField'), + set::label($lang->customField), + checkList + ( + set::name('ganttFields'), + set::items($customFields), + set::value($showFields), + set::inline(true) + ) + ) +); diff --git a/module/programplan/view/gantt.html.php b/module/programplan/view/gantt.html.php index 28b4b2b226..f2eecfeb6f 100755 --- a/module/programplan/view/gantt.html.php +++ b/module/programplan/view/gantt.html.php @@ -257,7 +257,7 @@ function drawGanttToCanvas(exportType, successCallback, errorCallback) var $ganttDridData = $ganttView.find('.gantt_grid_data'); var ganttRowHeight = $ganttView.find('.gantt_row').first().outerHeight() || 25; - var ganttHeight = $ganttView.find('.gantt_grid_scale').outerHeight() + * ganttRowHeight; + var ganttHeight = $ganttView.find('.gantt_grid_scale').outerHeight() + * ganttRowHeight; var ganttWidth = $ganttDridData.width() - 100; @@ -577,7 +577,7 @@ $(function() $('#ganttView').css('height', Math.max(200, Math.floor($(window).height() - $('#footer').outerHeight() - $('#header').outerHeight() - $('#mainMenu').outerHeight() - 120))); }; - var ganttData = $.parseJSON(); + var ganttData = $.parseJSON(); if(!ganttData.data) ganttData.data = []; config->edition, array('max', 'ipd'))) { $plan->planDuration = $this->programplan->getDuration($plan->begin, $plan->end); - $plan->realDuration = $this->programplan->getDuration($plan->realBegan, $plan->realEnd); + $plan->realDuration = $this->programplan->getDuration((string)$plan->realBegan, (string)$plan->realEnd); } /* Check duplicated names to avoid to save same names. */ @@ -234,7 +234,7 @@ class programplanZen extends programplan */ protected function buildAjaxCustomView(string $owner, string $module, array $customFields) { - $stageCustom = $this->setting->getItem("owner=$owner&module=$module§ion=browse&key=stageCustom"); + $stageCustom = $this->loadModel('setting')->getItem("owner=$owner&module=$module§ion=browse&key=stageCustom"); $ganttFields = $this->setting->getItem("owner=$owner&module=$module§ion=ganttCustom&key=ganttFields"); $zooming = $this->setting->getItem("owner=$owner&module=$module§ion=ganttCustom&key=zooming"); @@ -305,8 +305,44 @@ class programplanZen extends programplan $selectCustom = 0; // Display date and task settings. $dateDetails = 1; // Gantt chart detail date display. - /* Get data of type lists. */ - if($type == 'lists') + /* Get data of type. */ + if($type == 'gantt') + { + $this->loadModel('setting'); + $owner = $this->app->user->account; + $module = 'programplan'; + $section = 'browse'; + $object = 'stageCustom'; + if(!isset($this->config->programplan->browse->stageCustom)) $this->setting->setItem("$owner.$module.browse.stageCustom", 'date,task,point'); + + $selectCustom = $this->setting->getItem("owner={$owner}&module={$module}§ion={$section}&key={$object}"); + + if(strpos($selectCustom, 'date') !== false) $dateDetails = 0; + + $plans = $this->programplan->getDataForGantt($projectID, $productID, $baselineID, $selectCustom, false); + + /* Set Custom. */ + foreach(explode(',', $this->config->programplan->custom->customGanttFields) as $field) $customFields[$field] = $this->lang->programplan->ganttCustom[$field]; + $this->view->customFields = $customFields; + $this->view->showFields = $this->config->programplan->ganttCustom->ganttFields; + } + elseif($type == 'assignedTo') + { + $owner = $this->app->user->account; + $module = 'programplan'; + $section = 'browse'; + $object = 'stageCustom'; + $selectCustom = $this->loadModel('setting')->getItem("owner={$owner}&module={$module}§ion={$section}&key={$object}"); + if(strpos($selectCustom, 'date') !== false) $dateDetails = 0; + + $plans = $this->programplan->getDataForGanttGroupByAssignedTo($projectID, $productID, $baselineID, $selectCustom, false); + + /* Set Custom. */ + foreach(explode(',', $this->config->programplan->custom->customGanttFields) as $field) $customFields[$field] = $this->lang->programplan->ganttCustom[$field]; + $this->view->customFields = $customFields; + $this->view->showFields = $this->config->programplan->ganttCustom->ganttFields; + } + elseif($type == 'lists') { $sort = common::appendOrder($orderBy); $stages = $this->programplan->getPlans($projectID, $productID, $sort);