From 3d07125426393021c8f24db8cd55e303553ea5cf Mon Sep 17 00:00:00 2001 From: daitingting Date: Wed, 28 May 2025 09:13:26 +0000 Subject: [PATCH] * [task#143871,done,2h] Set gantt block when create document by template. --- lib/zin/wg/docapp/js/v1.js | 25 +++++++++++++++++++------ lib/zin/wg/docapp/v1.php | 2 +- module/doc/config.php | 2 +- module/doc/control.php | 6 +++--- module/doc/ui/zentaolist.html.php | 11 ++++++----- module/programplan/control.php | 1 + 6 files changed, 31 insertions(+), 16 deletions(-) diff --git a/lib/zin/wg/docapp/js/v1.js b/lib/zin/wg/docapp/js/v1.js index 15dda7be9f..05b96d2a51 100644 --- a/lib/zin/wg/docapp/js/v1.js +++ b/lib/zin/wg/docapp/js/v1.js @@ -9,10 +9,11 @@ let docLangData = null; let docBasicModal = {}; const savingDocData = {}; -window.setZentaoSlashMenu = function(menus, title, vision, position) +window.setZentaoSlashMenu = function(menus, title, vision, position, docID) { if(vision == 'or' || vision == 'lite') return; if(!menus?.length) return; + const slashMenus = menus.map(menu => { if(menu.subMenu) @@ -29,11 +30,23 @@ window.setZentaoSlashMenu = function(menus, title, vision, position) } else { - menu.action = function (context) { - zui.Modal.open({ - size: menu.modalSize ? menu.modalSize : 'lg', - url: $.createLink(menu.module, menu.method, menu.params) - }); + if(menu.key == 'gantt' && !menu.isModal) + { + menu.action = function (context) { + $.ajaxSubmit({ + url: $.createLink(menu.module, menu.method, menu.params), + data: {templateID: docID} + }); + } + } + else + { + menu.action = function (context) { + zui.Modal.open({ + size: menu.modalSize ? menu.modalSize : 'lg', + url: $.createLink(menu.module, menu.method, menu.params) + }); + } } } return menu; diff --git a/lib/zin/wg/docapp/v1.php b/lib/zin/wg/docapp/v1.php index f37e7051cd..6896158b6b 100644 --- a/lib/zin/wg/docapp/v1.php +++ b/lib/zin/wg/docapp/v1.php @@ -322,7 +322,7 @@ class docApp extends wg set::showToolbar(true), set::canPreviewOffice($canPreviewOffice), set::fileInfoUrl($fileInfoUrl), - $hasZentaoSlashMenu ? jsCall('setZentaoSlashMenu', $this->getZentaoListMenu(), $lang->doc->zentaoData, $config->vision, $config->doc->zentaoListMenuPosition) : null + $hasZentaoSlashMenu ? jsCall('setZentaoSlashMenu', $this->getZentaoListMenu(), $lang->doc->zentaoData, $config->vision, $config->doc->zentaoListMenuPosition, data('docID')) : null ); } } diff --git a/module/doc/config.php b/module/doc/config.php index 0815221380..b6d724d3a1 100644 --- a/module/doc/config.php +++ b/module/doc/config.php @@ -174,7 +174,7 @@ if(in_array($config->edition, array('biz', 'max', 'ipd'))) $config->doc->zentaoList['more']['subMenu'][] = array('key' => 'ticket', 'name' => $lang->doc->zentaoList['ticket'] . $lang->doc->list, 'icon' => 'support-ticket', 'module' => 'ticket', 'method' => 'browse', 'params' => 'browseType=wait¶m=0&orderBy=id_desc&recTotal=0&recPerPage=20&pageID=1&from=doc', 'priv' => 'ticketBrowse'); } -if(in_array($config->edition, array('max', 'ipd'))) $config->doc->zentaoList['gantt'] = array('key' => 'gantt', 'name' => $lang->doc->zentaoList['gantt'], 'icon' => 'gantt', 'module' => 'programPlan', 'method' => 'browse', "params" => 'projectID=0&productID=0&type=gantt&orderBy=id_asc&baselineID=0&browseType=&queryID=0&from=doc'); +if(in_array($config->edition, array('max', 'ipd'))) $config->doc->zentaoList['gantt'] = array('key' => 'gantt', 'name' => $lang->doc->zentaoList['gantt'], 'icon' => 'gantt', 'isModal' => true, 'module' => 'programPlan', 'method' => 'browse', "params" => 'projectID=0&productID=0&type=gantt&orderBy=id_asc&baselineID=0&browseType=&queryID=0&from=doc'); //$config->doc->zentaoList['storyView'] = array('key' => 'storyView', 'name' => $lang->doc->zentaoList['story'] . $lang->doc->detail, 'icon' => 'lightbulb', 'priv' => 'storyView'); //$config->doc->zentaoList['taskView'] = array('key' => 'taskView', 'name' => $lang->doc->zentaoList['task'] . $lang->doc->detail, 'icon' => 'check-sign', 'priv' => 'taskView'); diff --git a/module/doc/control.php b/module/doc/control.php index fc8ab00c5d..51d7d35ce7 100755 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -174,7 +174,7 @@ class doc extends control $this->view->type = $type; $this->view->blockID = $blockID; $this->view->settings = $blockData->settings; - $this->view->searchTab = $blockData->content->searchTab; + $this->view->searchTab = zget($blockData->content, 'searchTab', ''); if($type == 'productCase' || $type == 'projectCase') $this->view->caseStage = $blockData->content->caseStage; @@ -185,8 +185,8 @@ class doc extends control if($fromTemplate) { $this->view->title = sprintf($this->lang->doc->insertTitle, $this->lang->docTemplate->zentaoList[$type]); - $this->view->searchTab = $blockData->content->searchTab; - $this->view->isSetted = isset($blockData->content->data) && isset($blockData->content->cols); + $this->view->searchTab = zget($blockData->content, 'searchTab', ''); + $this->view->isSetted = isset($blockData->content->data) && isset($blockData->content->cols) || isset($blockData->content->ganttOptions); } else { diff --git a/module/doc/ui/zentaolist.html.php b/module/doc/ui/zentaolist.html.php index 5b97f4c0f2..b09281b51b 100644 --- a/module/doc/ui/zentaolist.html.php +++ b/module/doc/ui/zentaolist.html.php @@ -35,7 +35,8 @@ $actions[] = array('icon' => 'trash', 'text' => $lang->doc->zentaoAction['delete if($isTemplate || $fromTemplate) { - $blockTitle = $lang->docTemplate->searchTabList[$type][$searchTab] . $lang->docTemplate->of; + $blockTitle = ''; + if(!empty($lang->docTemplate->searchTabList[$type][$searchTab])) $blockTitle = $lang->docTemplate->searchTabList[$type][$searchTab] . $lang->docTemplate->of; if($type == 'bug' && $searchTab == 'overduebugs') $blockTitle = $lang->docTemplate->overdue . $lang->docTemplate->of; if(($type == 'productCase' || $type == 'projectCase') && !empty($caseStage)) $blockTitle = $blockTitle . $lang->testcase->stageList[$caseStage]; } @@ -56,7 +57,7 @@ div h2 ( setClass('font-bold text-xl'), - ($isTemplate || $fromTemplate ? $blockTitle . $lang->docTemplate->zentaoList[$type] : $lang->doc->zentaoList[$type]) . $lang->doc->list + ($isTemplate || $fromTemplate ? $blockTitle . $lang->docTemplate->zentaoList[$type] : $lang->doc->zentaoList[$type]) . ($type == 'gantt' ? '' : $lang->doc->list) ), div ( @@ -70,13 +71,13 @@ div ) ) ), - $isTemplate ? div + $isTemplate || ($type == 'gantt' && empty($ganttData)) ? div ( setClass('canvas border rounded py-3 px-3'), div ( setClass('config-tip text-center px-3 py-2'), - $lang->docTemplate->configTip + $isTemplate ? sprintf($lang->docTemplate->configTip, $type == 'gantt' ? $lang->docTemplate->zentaoList['gantt'] : $lang->doc->list) : $emptyTip ) ):null, !$isTemplate && $type != 'gantt' ? dtable @@ -95,7 +96,7 @@ div $type == 'productRelease' ? set::plugins(array('cellspan')) : null, $type == 'productRelease' ? set::getCellSpan(jsRaw('window.getCellSpan')) : null ) : null, - $type == 'gantt' ? zui::gantt + $type == 'gantt' && !empty($ganttData) ? zui::gantt ( set::data($ganttData), set::links($ganttLinks) diff --git a/module/programplan/control.php b/module/programplan/control.php index 58e3d401d0..99c8c22b7d 100644 --- a/module/programplan/control.php +++ b/module/programplan/control.php @@ -65,6 +65,7 @@ class programplan extends control $projects = $this->loadModel('project')->getPairsByModel(array('ipd', 'waterfall', 'waterfallplus')); if(empty($projects)) return $this->send(array('result' => 'fail', 'message' => $this->lang->doc->tips->noProject)); + if(!$projectID) $projectID = key($projects); $this->view->projects = $projects; }