* [task#131758,doing,0.5h] add control for add template type.

This commit is contained in:
zhouxin
2024-11-11 17:13:45 +08:00
committed by 綦新志
parent 503afdc3c5
commit b97e0c4157
2 changed files with 29 additions and 0 deletions
+16
View File
@@ -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;
+13
View File
@@ -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);
}
}