diff --git a/module/doc/control.php b/module/doc/control.php index ec1f2fc06e..ee9148088f 100755 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -362,6 +362,21 @@ class doc extends control { $moduleList = $this->doc->getTemplateModules(true, $scope, '1'); + if(!empty($_POST)) + { + $moduleData = form::data($this->config->doc->form->addTemplateType) + ->setDefault('type', 'docTemplate') + ->setDefault('path', '') + ->get(); + $moduleData->grade = $moduleData->parent === 0 ? 1 : 2; + if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); + + $moduleID = $this->doc->addTemplateType($moduleData); + if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); + + return $this->docZen->responseAfterAddTemplateType(); + } + $moduleItems = array(); if($parentModule === 0) { @@ -370,6 +385,7 @@ class doc extends control else { foreach($moduleList as $module) $moduleItems[] = array('value' => $module->id, 'text' => '/' . $module->name); + $moduleItems[] = array('value' => 0, 'text' => '/'); } $this->view->scope = $scope; diff --git a/module/doc/zen.php b/module/doc/zen.php index 58c6126e83..f0a92d08b4 100644 --- a/module/doc/zen.php +++ b/module/doc/zen.php @@ -1002,4 +1002,17 @@ class docZen extends doc $this->action->logHistory($actionID, $changes); } } + + /** + * 在创建版本类型后的返回。 + * Return after create a template type. + * + * @access public + * @return string + */ + public function responseAfterAddTemplateType() + { + $response = array('result' => 'success', 'message' => $this->lang->saveSuccess, 'load' => $this->createLink('doc', 'browseTemplate')); + return $this->send($response); + } }