From 758a9c81df5ca0cfb272832e5f042b638c7a8109 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Sat, 14 Jun 2025 00:40:05 +0000 Subject: [PATCH 1/5] * [task#144985,doing,1h] Add the tip when delete template of use project review. --- module/doc/js/browsetemplate.ui.js | 7 ++++++- module/doc/lang/de.php | 1 + module/doc/lang/en.php | 1 + module/doc/lang/fr.php | 1 + module/doc/lang/zh-cn.php | 1 + module/doc/ui/templatelist.html.php | 1 + 6 files changed, 11 insertions(+), 1 deletion(-) diff --git a/module/doc/js/browsetemplate.ui.js b/module/doc/js/browsetemplate.ui.js index f087d5eb23..08c7b46dfa 100644 --- a/module/doc/js/browsetemplate.ui.js +++ b/module/doc/js/browsetemplate.ui.js @@ -590,9 +590,14 @@ $.extend(window.docAppCommands, const doc = docInfo.data; const isChapter = doc?.type === 'chapter'; + const reviewObjects = ['PP', 'SRS', 'HLDS', 'DDS', 'DBDS', 'ADS', 'ITTC', 'STTC']; + const templateType = doc.templateType; + const reviewTemplates = docApp.props.projectReviewTemplates; + const confirmTip = reviewObjects.includes(templateType) && reviewTemplates?.[templateType]?.[docID] ? 'confirmDeleteReviewTemplate' : 'confirmDelete'; + $.ajaxSubmit( { - confirm: getLang(isChapter ? (docInfo.docs.length > 0 ? 'confirmDeleteChapterWithSub' : 'confirmDeleteChapter') : (docInfo.docs.length > 0 ? 'confirmDeleteWithSub' : 'confirmDelete')), + confirm: getLang(isChapter ? (docInfo.docs.length > 0 ? 'confirmDeleteChapterWithSub' : 'confirmDeleteChapter') : (docInfo.docs.length > 0 ? 'confirmDeleteWithSub' : confirmTip)), url: $.createLink('doc', 'deleteTemplate', `docID=${docID}`), load: false, onSuccess: function() diff --git a/module/doc/lang/de.php b/module/doc/lang/de.php index cb81fa8607..18756b4155 100644 --- a/module/doc/lang/de.php +++ b/module/doc/lang/de.php @@ -114,6 +114,7 @@ $lang->docTemplate->confirmDeleteChapterWithSub = "After deleting a chapter, th $lang->docTemplate->confirmDeleteTemplateWithSub = "After deleting the template, the lower level content of the template will be hidden. Are you sure you want to delete this template?"; $lang->docTemplate->scopeHasTemplateTips = 'There are templates within this scope. Please remove them before deleting the scope.'; $lang->docTemplate->scopeHasModuleTips = 'There are template category data within this scope. Please remove them before deleting the scope.'; +$lang->docTemplate->confirmDeleteReviewTemplate = "After deletion, when using the category to which this template belongs for project review, the system template cannot automatically generate data for review. Are you sure you want to delete it?"; $lang->docTemplate->create = 'Create Template'; $lang->docTemplate->edit = 'Edit Template'; diff --git a/module/doc/lang/en.php b/module/doc/lang/en.php index 241964178d..7040fd5767 100644 --- a/module/doc/lang/en.php +++ b/module/doc/lang/en.php @@ -114,6 +114,7 @@ $lang->docTemplate->confirmDeleteChapterWithSub = "After deleting a chapter, th $lang->docTemplate->confirmDeleteTemplateWithSub = "After deleting the template, the lower level content of the template will be hidden. Are you sure you want to delete this template?"; $lang->docTemplate->scopeHasTemplateTips = 'There are templates within this scope. Please remove them before deleting the scope.'; $lang->docTemplate->scopeHasModuleTips = 'There are template category data within this scope. Please remove them before deleting the scope.'; +$lang->docTemplate->confirmDeleteReviewTemplate = "After deletion, when using the category to which this template belongs for project review, the system template cannot automatically generate data for review. Are you sure you want to delete it?"; $lang->docTemplate->create = 'Create Template'; $lang->docTemplate->edit = 'Edit Template'; diff --git a/module/doc/lang/fr.php b/module/doc/lang/fr.php index 0dd124d94e..939665c1ef 100644 --- a/module/doc/lang/fr.php +++ b/module/doc/lang/fr.php @@ -114,6 +114,7 @@ $lang->docTemplate->confirmDeleteChapterWithSub = "After deleting a chapter, th $lang->docTemplate->confirmDeleteTemplateWithSub = "After deleting the template, the lower level content of the template will be hidden. Are you sure you want to delete this template?"; $lang->docTemplate->scopeHasTemplateTips = 'There are templates within this scope. Please remove them before deleting the scope.'; $lang->docTemplate->scopeHasModuleTips = 'There are template category data within this scope. Please remove them before deleting the scope.'; +$lang->docTemplate->confirmDeleteReviewTemplate = "After deletion, when using the category to which this template belongs for project review, the system template cannot automatically generate data for review. Are you sure you want to delete it?"; $lang->docTemplate->create = 'Create Template'; $lang->docTemplate->edit = 'Edit Template'; diff --git a/module/doc/lang/zh-cn.php b/module/doc/lang/zh-cn.php index df8d32185d..bd28b1854e 100644 --- a/module/doc/lang/zh-cn.php +++ b/module/doc/lang/zh-cn.php @@ -114,6 +114,7 @@ $lang->docTemplate->confirmDeleteChapterWithSub = "删除章节后,章节下 $lang->docTemplate->confirmDeleteTemplateWithSub = "删除文档模板后,文档模板下层级内容将一并隐藏,确定要删除该文档模板吗?"; $lang->docTemplate->scopeHasTemplateTips = '该范围下有文档模板,请移除后再删除范围。'; $lang->docTemplate->scopeHasModuleTips = '该范围下有模板分类数据,请移除后再删除范围。'; +$lang->docTemplate->confirmDeleteReviewTemplate = "删除后,使用该模板所属分类进行项目评审时不能由系统模板自动生成数据进行评审,确认要删除吗?"; $lang->docTemplate->more = '更多'; $lang->docTemplate->scopeLabel = '范围'; diff --git a/module/doc/ui/templatelist.html.php b/module/doc/ui/templatelist.html.php index 6ecb13802e..b3261bc698 100644 --- a/module/doc/ui/templatelist.html.php +++ b/module/doc/ui/templatelist.html.php @@ -75,6 +75,7 @@ $langData['createTypeFirst'] = $lang->docTemplate->createTypeFirst; $langData['addSubDocTemplate'] = $lang->docTemplate->addSubDocTemplate; $langData['confirmDeleteChapterWithSub'] = $lang->docTemplate->confirmDeleteChapterWithSub; $langData['confirmDeleteWithSub'] = $lang->docTemplate->confirmDeleteTemplateWithSub; +$langData['confirmDeleteReviewTemplate'] = $lang->docTemplate->confirmDeleteReviewTemplate; $langData['actions']['addModule'] = $lang->docTemplate->addTemplateType; $langData['actions']['addSameModule'] = $lang->docTemplate->addSameModule; From 4eeaf80212ba4c222f803815543289cf0519c7d0 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Sat, 14 Jun 2025 00:45:26 +0000 Subject: [PATCH 2/5] * [task#145140,doing,0.5h] Delete the tip of add template type. --- module/doc/lang/de.php | 1 - module/doc/lang/en.php | 1 - module/doc/lang/fr.php | 1 - module/doc/lang/zh-cn.php | 1 - module/doc/ui/addtemplatetype.html.php | 16 ---------------- module/tree/ui/edit.html.php | 16 ---------------- 6 files changed, 36 deletions(-) diff --git a/module/doc/lang/de.php b/module/doc/lang/de.php index 18756b4155..d481ac7145 100644 --- a/module/doc/lang/de.php +++ b/module/doc/lang/de.php @@ -94,7 +94,6 @@ $lang->docTemplate->addTemplateType = 'Add template category'; $lang->docTemplate->editTemplateType = 'Edit template category'; $lang->docTemplate->docTitlePlaceholder = 'Enter the document template title'; $lang->docTemplate->docTitleRequired = 'Please enter the doc template title.'; -$lang->docTemplate->noticeAddTemplateType = 'Support two-level categories. Built-in template category cannot move.'; $lang->docTemplate->errorDeleteType = 'There is document template exists in the current category, it cannot be deleted.'; $lang->docTemplate->convertToNewDocConfirm = 'Are you ready to convert this document template to the new format using a modern block-level editor? After saving as a draft or publishing, you can no longer switch back to the old editor.'; $lang->docTemplate->oldDocEditingTip = 'This document template is being created in the old editor, the new editor is now enabled for editing. If you want to switch to the new editor, please save the document template first.'; diff --git a/module/doc/lang/en.php b/module/doc/lang/en.php index 7040fd5767..d5169fbdcb 100644 --- a/module/doc/lang/en.php +++ b/module/doc/lang/en.php @@ -94,7 +94,6 @@ $lang->docTemplate->addTemplateType = 'Add template category'; $lang->docTemplate->editTemplateType = 'Edit template category'; $lang->docTemplate->docTitlePlaceholder = 'Enter the document template title'; $lang->docTemplate->docTitleRequired = 'Please enter the doc template title.'; -$lang->docTemplate->noticeAddTemplateType = 'Support two-level categories. Built-in template category cannot move.'; $lang->docTemplate->errorDeleteType = 'There is document template exists in the current category, it cannot be deleted.'; $lang->docTemplate->convertToNewDocConfirm = 'Are you ready to convert this document template to the new format using a modern block-level editor? After saving as a draft or publishing, you can no longer switch back to the old editor.'; $lang->docTemplate->oldDocEditingTip = 'This document template is being created in the old editor, the new editor is now enabled for editing. If you want to switch to the new editor, please save the document template first.'; diff --git a/module/doc/lang/fr.php b/module/doc/lang/fr.php index 939665c1ef..59fc533609 100644 --- a/module/doc/lang/fr.php +++ b/module/doc/lang/fr.php @@ -94,7 +94,6 @@ $lang->docTemplate->addTemplateType = 'Add template category'; $lang->docTemplate->editTemplateType = 'Edit template category'; $lang->docTemplate->docTitlePlaceholder = 'Enter the document template title'; $lang->docTemplate->docTitleRequired = 'Please enter the doc template title.'; -$lang->docTemplate->noticeAddTemplateType = 'Support two-level categorys. Built-in template category cannot move.'; $lang->docTemplate->errorDeleteType = 'There is document template exists in the current category, it cannot be deleted.'; $lang->docTemplate->convertToNewDocConfirm = 'Are you ready to convert this document template to the new format using a modern block-level editor? After saving as a draft or publishing, you can no longer switch back to the old editor.'; $lang->docTemplate->oldDocEditingTip = 'This document template is being created in the old editor, the new editor is now enabled for editing. If you want to switch to the new editor, please save the document template first.'; diff --git a/module/doc/lang/zh-cn.php b/module/doc/lang/zh-cn.php index bd28b1854e..8b108d46e6 100644 --- a/module/doc/lang/zh-cn.php +++ b/module/doc/lang/zh-cn.php @@ -94,7 +94,6 @@ $lang->docTemplate->addTemplateType = '添加模板分类'; $lang->docTemplate->editTemplateType = '编辑模板分类'; $lang->docTemplate->docTitlePlaceholder = '请输入文档模板标题'; $lang->docTemplate->docTitleRequired = '文档模板标题不能为空。'; -$lang->docTemplate->noticeAddTemplateType = '支持两级分类,内置模板分类参与逻辑运算,不可修改所在位置'; $lang->docTemplate->errorDeleteType = '当前分类存在文档模板,不可删除'; $lang->docTemplate->convertToNewDocConfirm = '全新文档格式使用现代化块级编辑器,带来全新的文档功能体验。确定要将此文档模板转换为新文档格式吗?存为草稿或者发布后,不能再切换回旧编辑器。'; $lang->docTemplate->oldDocEditingTip = '此文档模板为旧版本编辑器创建,已启用新版编辑器编辑,保存后将转换为新版文档模板'; diff --git a/module/doc/ui/addtemplatetype.html.php b/module/doc/ui/addtemplatetype.html.php index 74d8541a03..884f22d2fe 100644 --- a/module/doc/ui/addtemplatetype.html.php +++ b/module/doc/ui/addtemplatetype.html.php @@ -21,22 +21,6 @@ formPanel setClass('text-xl font-black'), set::level(1), set::text($lang->docTemplate->addTemplateType) - ), - div - ( - label - ( - to::before - ( - icon - ( - setClass('warning-ghost margin-left8'), - 'help' - ) - ), - set::text($lang->docTemplate->noticeAddTemplateType), - setClass('gray-200-pale') - ) ) ) ), diff --git a/module/tree/ui/edit.html.php b/module/tree/ui/edit.html.php index cbf53d2f14..e3c0b6a15f 100644 --- a/module/tree/ui/edit.html.php +++ b/module/tree/ui/edit.html.php @@ -35,22 +35,6 @@ formPanel setClass('text-xl font-black'), set::level(1), set::text($lang->docTemplate->editTemplateType) - ), - div - ( - label - ( - to::before - ( - icon - ( - setClass('warning-ghost margin-left8'), - 'help' - ) - ), - set::text($lang->docTemplate->noticeAddTemplateType), - setClass('gray-200-pale') - ) ) ) ) : null, From 2768aa3e2770a0ee67d20d97f456f83ddb5d6d4d Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Sat, 14 Jun 2025 01:49:20 +0000 Subject: [PATCH 3/5] * [task#144511,doing,0.5h] Modify the judgment of has built-in doc template. --- module/upgrade/model.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/module/upgrade/model.php b/module/upgrade/model.php index a52ddf56f3..e13d034fc0 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -11212,13 +11212,9 @@ class upgradeModel extends model { /* 为八种类型添加内置模板,若已存在则返回。*/ /* Return when has bulit-in doc template. */ - $builtInTemplateTypes = array('PP', 'SRS', 'HLDS', 'DDS', 'ADS', 'DBDS', 'ITTC', 'STTC'); - $builtInDocTemplates = $this->dao->select('*')->from(TABLE_DOC) - ->where('templateType')->in($builtInTemplateTypes) - ->andWhere('lib')->gt(0) - ->andWhere('module')->gt(0) - ->fetchAll(); - if(!empty($builtInDocTemplates)) return; + $this->loadModel('setting'); + $projectReviewDocTemplate = $this->setting->getItem('vision=rnd&owner=system&module=doc&key=projectReviewDocTemplate'); + if(!empty($projectReviewDocTemplate)) return; /* 获取有系统数据的wiki模板的类型。*/ /* Get the type of wiki template with system data. */ From b07517cca8e9571cae71fec2355480bff77174a9 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Sat, 14 Jun 2025 05:18:22 +0000 Subject: [PATCH 4/5] * [task#144513,doing,1h] Record the upgrade time when upgrade doc template. --- module/doc/model.php | 4 ++++ module/upgrade/control.php | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/module/doc/model.php b/module/doc/model.php index b7f22723ae..e042f56aca 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -4707,5 +4707,9 @@ class docModel extends model $this->action->create('docTemplate', $templateID, 'Created'); } + + /* 记录文档模板的更新时间。*/ + /* Record the time of upgrade doc template. */ + $this->setting->setItem("system.doc.upgradeTime", helper::now()); } } diff --git a/module/upgrade/control.php b/module/upgrade/control.php index d76ac0d8e3..4d913b6f2a 100644 --- a/module/upgrade/control.php +++ b/module/upgrade/control.php @@ -978,6 +978,10 @@ class upgrade extends control { $this->session->set('upgradeDocTemplates', true); $this->doc->upgradeTemplateLibAndModule($upgradeDocTemplates['all']); + + /* 记录文档模板的更新时间。*/ + /* Record the time of upgrade doc template. */ + $this->setting->setItem("system.doc.upgradeTime", helper::now()); } return $this->locate(inlink('afterExec', "fromVersion={$fromVersion}&processed=no&skipMoveFile=yes&skipUpdateDocs=yes&skipUpdateDocTemplates=yes")); } From fb0cccad94291c99a260b7cc8f4980ff00fe0c8c Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Sat, 14 Jun 2025 06:05:20 +0000 Subject: [PATCH 5/5] * [task#144513,doing,0.5h] Fix the bug of upgrade doc template. --- module/upgrade/control.php | 2 +- module/upgrade/model.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/module/upgrade/control.php b/module/upgrade/control.php index 4d913b6f2a..4c040d21f8 100644 --- a/module/upgrade/control.php +++ b/module/upgrade/control.php @@ -981,7 +981,7 @@ class upgrade extends control /* 记录文档模板的更新时间。*/ /* Record the time of upgrade doc template. */ - $this->setting->setItem("system.doc.upgradeTime", helper::now()); + $this->loadModel('setting')->setItem("system.doc.upgradeTime", helper::now()); } return $this->locate(inlink('afterExec', "fromVersion={$fromVersion}&processed=no&skipMoveFile=yes&skipUpdateDocs=yes&skipUpdateDocTemplates=yes")); } diff --git a/module/upgrade/model.php b/module/upgrade/model.php index e13d034fc0..7c4f7939b3 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -11228,6 +11228,7 @@ class upgradeModel extends model /* 获取没有系统数据的wiki模板的类型。*/ /* Get the type of wiki template without system data. */ $noSystemDataTemplateTypes = array(); + $builtInTemplateTypes = array('PP', 'SRS', 'HLDS', 'DDS', 'ADS', 'DBDS', 'ITTC', 'STTC'); foreach($builtInTemplateTypes as $type) { if(!isset($hasSystemDataTemplateTypes[$type])) $noSystemDataTemplateTypes[] = $type;