From 5d021ba1d2f4034b4779b252e6d8d74df97a35e4 Mon Sep 17 00:00:00 2001 From: zhouxin Date: Mon, 11 Nov 2024 09:41:32 +0800 Subject: [PATCH] * [task#131758,doing,1h] add edit template page. --- module/doc/control.php | 14 ++++++++++++ module/tree/control.php | 42 ++++++++++++++++++++++++------------ module/tree/ui/edit.html.php | 12 +++++------ 3 files changed, 48 insertions(+), 20 deletions(-) diff --git a/module/doc/control.php b/module/doc/control.php index 57441f28d9..b570c928e0 100755 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -351,6 +351,20 @@ class doc extends control $this->display(); } + + /** + * 编辑一个模板类型。 + * Edit a template type. + * + * @param int $moduleID + * @access public + * @return void + */ + public function editTemplateType(int $moduleID) + { + echo $this->fetch('tree', 'edit', "moduleID={$moduleID}&type=docTemplate"); + } + /** * 上传文档。 * Upload docs. diff --git a/module/tree/control.php b/module/tree/control.php index aa0b57d77b..03191531e5 100644 --- a/module/tree/control.php +++ b/module/tree/control.php @@ -187,31 +187,45 @@ class tree extends control $this->view->libs = $this->doc->getLibs($docLib->type, '', '', $objectID, 'book'); } - if($type == 'doc' || $type == 'api') + if($type == 'docTemplate') { - $name = $this->lang->tree->dir; - $title = $this->lang->tree->editDir; + $name = $this->lang->docTemplate->typeName; + $title = $this->lang->docTemplate->editTemplateType; + $parentLabel = $this->lang->docTemplate->parentModule; + + $scopes = array(); + foreach($this->config->doc->templateMenu as $scopeID => $scope) $scopes[$scopeID] = $scope['name']; + $this->view->scopes = $scopes; + } + elseif($type == 'doc' || $type == 'api') + { + $name = $this->lang->tree->dir; + $title = $this->lang->tree->editDir; + $parentLabel = $this->lang->tree->parentCate; } elseif($type == 'line') { - $name = $this->lang->tree->line; - $title = $this->lang->tree->manageLine; + $name = $this->lang->tree->line; + $title = $this->lang->tree->manageLine; + $parentLabel = $this->lang->tree->parent; } else { - $name = $this->lang->tree->name; - $title = $this->lang->tree->edit; + $name = $this->lang->tree->name; + $title = $this->lang->tree->edit; + $parentLabel = $this->lang->tree->parent; } if($type == 'host') $this->app->loadLang('host'); - $this->view->name = $name; - $this->view->title = $title; - $this->view->title = $type == 'host' ? $this->lang->host->groupMaintenance : $title; - $this->view->module = $module; - $this->view->type = $type; - $this->view->branch = $branch; - $this->view->users = $this->loadModel('user')->getPairs('noclosed|nodeleted', $module->owner); + $this->view->name = $name; + $this->view->title = $title; + $this->view->title = $type == 'host' ? $this->lang->host->groupMaintenance : $title; + $this->view->parentLabel = $parentLabel; + $this->view->module = $module; + $this->view->type = $type; + $this->view->branch = $branch; + $this->view->users = $this->loadModel('user')->getPairs('noclosed|nodeleted', $module->owner); $showProduct = strpos('story|bug|case', $type) !== false ? true : false; if($showProduct) diff --git a/module/tree/ui/edit.html.php b/module/tree/ui/edit.html.php index ba5c87cddf..3bd38e4107 100644 --- a/module/tree/ui/edit.html.php +++ b/module/tree/ui/edit.html.php @@ -58,14 +58,14 @@ formPanel ) ) ) : null, - $type == 'doc' ? formGroup + ($type == 'doc' || $type == 'docTemplate') ? formGroup ( - set::label($lang->doc->lib), + set::label($type == 'docTemplate' ? $lang->docTemplate->scope : $lang->doc->lib), picker ( set::name('root'), set::value($module->root), - set::items($libs), + set::items($type == 'docTemplate' ? $scopes : $libs), set::required(true), on::change('changeRoot') ) @@ -82,7 +82,7 @@ formPanel $module->type != 'line' ? formGroup ( set::className('moduleBox ', $hidden ? 'hidden' : ''), - set::label(($type == 'doc' or $type == 'api') ? $lang->tree->parentCate : $lang->tree->parent), + set::label($parentLabel), picker ( set::name('parent'), @@ -102,7 +102,7 @@ formPanel set::items($users) ) ) : null, - formGroup + $type != 'docTemplate' ? formGroup ( set::label($lang->tree->short), inputControl @@ -113,5 +113,5 @@ formPanel set::value($module->short) ) ) - ) + ) : null );