From e06a98bd09eb59bdd888d4db5843c0f08875d796 Mon Sep 17 00:00:00 2001 From: tanghucheng Date: Tue, 25 Oct 2022 16:26:10 +0800 Subject: [PATCH 1/2] * Code for task #73235. --- module/programplan/control.php | 46 +++++++++++----- module/programplan/lang/de.php | 2 + module/programplan/lang/en.php | 2 + module/programplan/lang/fr.php | 2 + module/programplan/lang/zh-cn.php | 2 + module/programplan/view/gantt.html.php | 72 +++++++++++++++----------- module/project/view/execution.html.php | 4 ++ 7 files changed, 88 insertions(+), 42 deletions(-) diff --git a/module/programplan/control.php b/module/programplan/control.php index 2c66ab4dfa..d607021d95 100644 --- a/module/programplan/control.php +++ b/module/programplan/control.php @@ -119,6 +119,7 @@ class programplan extends control $this->view->position[] = $this->lang->programplan->browse; $this->view->projectID = $projectID; $this->view->productID = $this->productID; + $this->view->productList = $this->loadModel('product')->getProductPairsByProject($projectID); $this->view->type = $type; $this->view->plans = $plans; $this->view->orderBy = $orderBy; @@ -245,19 +246,40 @@ class programplan extends control */ public function ajaxCustom() { - $data = fixer::input('post')->get(); - $owner = $this->app->user->account; - $module = 'programplan'; - $section = 'browse'; - $object = 'stageCustom'; - $setting = $this->loadModel('setting'); - $custom = empty($data->stageCustom) ? '' : implode(',', $data->stageCustom); - $setting->setItem("$owner.$module.$section.$object", $custom); + $owner = $this->app->user->account; + $module = 'programplan'; + $this->app->loadLang('execution'); + $this->loadModel('datatable'); + $this->loadModel('setting'); - $response = array(); - $response['result'] = 'success'; - $response['message'] = ''; - return $this->send($response); + $stageCustom = $this->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"); + + if($_POST) + { + $data = fixer::input('post')->get(); + $zooming = empty($data->zooming) ? '' : $data->zooming; + $stageCustom = empty($data->stageCustom) ? '' : implode(',', $data->stageCustom); + $ganttFields = empty($data->ganttFields) ? '' : implode(',', $data->ganttFields); + + $this->setting->setItem("$owner.$module.browse.stageCustom", $stageCustom); + $this->setting->setItem("$owner.$module.ganttCustom.ganttFields", $ganttFields); + $this->setting->setItem("$owner.$module.ganttCustom.zooming", $zooming); + + return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent')); + } + + /* Set Custom. */ + foreach(explode(',', $this->config->programplan->custom->customGanttFields) as $field) $customFields[$field] = $this->lang->programplan->ganttCustom[$field]; + + $this->view->zooming = $zooming; + $this->view->customFields = $customFields; + $this->view->showFields = $this->config->programplan->ganttCustom->ganttFields; + $this->view->ganttFields = $ganttFields; + $this->view->stageCustom = $stageCustom; + + $this->display(); } /** diff --git a/module/programplan/lang/de.php b/module/programplan/lang/de.php index 889b03bcaa..a186daf4c5 100644 --- a/module/programplan/lang/de.php +++ b/module/programplan/lang/de.php @@ -62,6 +62,8 @@ $lang->programplan->hideCriticalPath = 'Hide Critical Path'; $lang->programplan->showCriticalPath = 'Show Critical Path'; $lang->programplan->delay = 'Delay'; $lang->programplan->delayDays = 'Delay days'; +$lang->programplan->settingGantt = 'Gantt Setting'; +$lang->programplan->viewSetting = 'Setting'; $lang->programplan->errorBegin = "Project begin date: %s, begin date should be >= project begin date."; $lang->programplan->errorEnd = "Project end date: %s, end date should be <= project end date."; diff --git a/module/programplan/lang/en.php b/module/programplan/lang/en.php index 6ed9867b61..b2084c75f4 100644 --- a/module/programplan/lang/en.php +++ b/module/programplan/lang/en.php @@ -62,6 +62,8 @@ $lang->programplan->hideCriticalPath = 'Hide Critical Path'; $lang->programplan->showCriticalPath = 'Show Critical Path'; $lang->programplan->delay = 'Delay'; $lang->programplan->delayDays = 'Delay days'; +$lang->programplan->settingGantt = 'Gantt Setting'; +$lang->programplan->viewSetting = 'Setting'; $lang->programplan->errorBegin = "Project begin date: %s, begin date should be >= project begin date."; $lang->programplan->errorEnd = "Project end date: %s, end date should be <= project end date."; diff --git a/module/programplan/lang/fr.php b/module/programplan/lang/fr.php index 889b03bcaa..a186daf4c5 100644 --- a/module/programplan/lang/fr.php +++ b/module/programplan/lang/fr.php @@ -62,6 +62,8 @@ $lang->programplan->hideCriticalPath = 'Hide Critical Path'; $lang->programplan->showCriticalPath = 'Show Critical Path'; $lang->programplan->delay = 'Delay'; $lang->programplan->delayDays = 'Delay days'; +$lang->programplan->settingGantt = 'Gantt Setting'; +$lang->programplan->viewSetting = 'Setting'; $lang->programplan->errorBegin = "Project begin date: %s, begin date should be >= project begin date."; $lang->programplan->errorEnd = "Project end date: %s, end date should be <= project end date."; diff --git a/module/programplan/lang/zh-cn.php b/module/programplan/lang/zh-cn.php index 1e4fdfbacd..b3f4b04429 100644 --- a/module/programplan/lang/zh-cn.php +++ b/module/programplan/lang/zh-cn.php @@ -62,6 +62,8 @@ $lang->programplan->hideCriticalPath = '隐藏关键路径'; $lang->programplan->showCriticalPath = '显示关键路径'; $lang->programplan->delay = '是否延期'; $lang->programplan->delayDays = '延期天数'; +$lang->programplan->settingGantt = '设置甘特图'; +$lang->programplan->viewSetting = '显示设置'; $lang->programplan->errorBegin = '阶段的开始时间不能小于所属项目的开始时间%s'; $lang->programplan->errorEnd = '阶段的结束时间不能大于所属项目的结束时间%s'; diff --git a/module/programplan/view/gantt.html.php b/module/programplan/view/gantt.html.php index 6b1f88c074..e68b128d0e 100644 --- a/module/programplan/view/gantt.html.php +++ b/module/programplan/view/gantt.html.php @@ -45,7 +45,7 @@ form {display: block; margin-top: 0em; margin-block-end: 1em;} .gantt_row.task-item{cursor: pointer;} #ganttDownload, #ganttHeader {display: none;} -#ganttContainer {margin-top: 10px;} +#ganttContainer {margin-top: 40px;} #mainContent:before {background: #fff;} #mainContent.loading {overflow: hidden} #mainContent.loading #ganttView {overflow: hidden} @@ -65,6 +65,9 @@ form {display: block; margin-top: 0em; margin-block-end: 1em;} .gantt_task_line.gantt_task_inline_color{border:0px;} .gantt_grid_scale, .gantt_task_scale, .gantt_task_vscroll{background-color: #F2F7FF;} #myCover {display:none;left:12px!important;z-index:10!important;top:9px!important;height:unset!important;} +.button-group{position: relative;} +.flax{display: flex; margin-bottom: 10px;} +.switchBtn > i {padding-left: 7px;} createLink('programplan', 'ajaxCustom'));?> @@ -74,34 +77,43 @@ form {display: block; margin-top: 0em; margin-block-end: 1em;} config->programplan->ganttCustom->ganttFields);?>
-
- app->getModuleName() == 'programplan') - { - $customLink = $this->createLink('custom', 'ajaxSaveCustomFields', 'module=programplan§ion=ganttCustom&key=ganttFields'); - include '../../common/view/customfield.html.php'; - } - ?> -
-
-
- programplan->full, 'id="fullScreenBtn"', 'btn btn-primary btn-sm')?> - rawModule == 'review' and $app->rawMethod == 'assess') unset($lang->programplan->stageCustom->date); ?> - programplan->stageCustom, $selectCustom);?> - - + app->getModuleName() == 'programplan'):?> +
+
+ product->allProduct;?> + +
- +
+
+
+ createLink('project', 'execution', "status=all&projectID=$projectID"),"  ", '', "class='btn btn-icon switchBtn' title='{$lang->project->bylist}'");?> +  ", '', "class='btn btn-icon text-primary switchBtn' title='{$lang->programplan->gantt}'");?> +
+ programplan->full;?> + + ' . $lang->settings, '', "class='iframe btn btn-link' data-width='30%'"); + if(common::hasPriv('programplan', 'create')) echo html::a($this->createLink('programplan', 'create', "projectID=$projectID"), " " . $this->lang->programplan->create, '', "class='btn btn-primary'"); + ?> +
+
@@ -145,7 +157,7 @@ gantt.init("gantt_here"); gantt.attachEvent("onBeforeExpand",function(){ $('#myCover').css('display', 'unset'); $('#mainContent .pull-right').css('opacity', '0'); - $('.example').css('display', 'none'); + $('.btn-toolbar').css('display', 'none'); return true; }); @@ -153,7 +165,7 @@ gantt.attachEvent("onBeforeExpand",function(){ gantt.attachEvent("onCollapse", function (){ $('#myCover').css('display', 'none'); $('#mainContent .pull-right').css('opacity', '1'); - $('.example').css('display', 'block'); + $('.btn-toolbar').css('display', 'flex'); }); /** diff --git a/module/project/view/execution.html.php b/module/project/view/execution.html.php index 0c47eaabf2..d349c0629b 100644 --- a/module/project/view/execution.html.php +++ b/module/project/view/execution.html.php @@ -40,6 +40,10 @@ $lang->programplan->stageCustom->task), '', $this->cookie->showTask ? 'checked=checked' : '');?>
+
+  ", '', "class='btn btn-icon text-primary switchBtn' title='{$lang->project->bylist}'");?> + createLink('programplan', 'browse', "projectID=$projectID&productID=$productID&type=gantt"), "  ", '', "class='btn btn-icon switchBtn' title='{$lang->programplan->gantt}'");?> +
" . $lang->export, '', "class='btn btn-link export'")?> createLink('programplan', 'create', "projectID=$projectID&productID=$productID"), " " . $lang->programplan->create, '', "class='btn btn-primary'");?> From dc2745f5ba086b72e1830d97f353e6e495234fc8 Mon Sep 17 00:00:00 2001 From: tanghucheng Date: Tue, 25 Oct 2022 16:35:26 +0800 Subject: [PATCH 2/2] * Add view.html.php for gantt setting. --- module/programplan/control.php | 8 ---- module/programplan/view/ajaxcustom.html.php | 44 +++++++++++++++++++++ 2 files changed, 44 insertions(+), 8 deletions(-) create mode 100644 module/programplan/view/ajaxcustom.html.php diff --git a/module/programplan/control.php b/module/programplan/control.php index d607021d95..efb2988be9 100644 --- a/module/programplan/control.php +++ b/module/programplan/control.php @@ -64,14 +64,6 @@ class programplan extends control $products = $this->loadModel('product')->getProducts($projectID); $this->lang->modulePageNav = $this->product->select($products, $this->productID, 'programplan', 'browse', $type, 0, 0, '', false); - $this->lang->TRActions = ""; - $this->lang->TRActions .= ""; - - if(common::hasPriv('programplan', 'create')) $this->lang->TRActions .= html::a($this->createLink('programplan', 'create', "projectID=$projectID"), " " . $this->lang->programplan->create, '', "class='btn btn-primary'"); - $selectCustom = 0; // Display date and task settings. $dateDetails = 1; // Gantt chart detail date display. if($type == 'gantt') diff --git a/module/programplan/view/ajaxcustom.html.php b/module/programplan/view/ajaxcustom.html.php new file mode 100644 index 0000000000..dd0e8c015c --- /dev/null +++ b/module/programplan/view/ajaxcustom.html.php @@ -0,0 +1,44 @@ + + * @package programplan + * @version $Id: ajaxcustom.html.php 935 2022-10-25 16:15:24Z $ + * @link https://www.zentao.net + */ +?> + + + +
+
+

programplan->settingGantt;?>

+
+
+ + + + + + + + + + + + + + + + +
execution->gantt->format;?>execution->gantt->zooming, $zooming ? $zooming : 'day');?>
programplan->viewSetting;?>programplan->stageCustom, $stageCustom);?>
customField;?>
+ +
+
+
+