* [task#131758,doing,0.5h] add control for add template type.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user