* [task#137615,doing,1h] Alert tip when has no type when create doc template.
This commit is contained in:
@@ -497,20 +497,16 @@ class doc extends control
|
||||
*/
|
||||
public function browseTemplate(int $libID = 0, string $type = 'all', int $docID = 0, string $orderBy = 'id_desc', int $recTotal = 0, int $recPerPage = 20, int $pageID = 1, string $mode = 'home')
|
||||
{
|
||||
$this->app->loadClass('pager', true);
|
||||
$pager = new pager($recTotal, $recPerPage, $pageID);
|
||||
|
||||
$this->lang->doc->menu->template['alias'] .= ',' . $this->app->rawMethod;
|
||||
$modules = $this->doc->getTemplateModules();
|
||||
$modules = $this->doc->getTemplateModules($libID);
|
||||
$modules = array_column($modules, 'fullName', 'id');
|
||||
if($mode == 'create' && empty($modules)) return $this->send(array('result' => 'success', 'load' => array('alert' => $this->lang->docTemplate->createTypeFirst)));
|
||||
|
||||
$templateList = $this->doc->getDocTemplateList(0, $type, $orderBy, $pager);
|
||||
$this->app->loadClass('pager', true);
|
||||
$pager = new pager($recTotal, $recPerPage, $pageID);
|
||||
$templateList = $this->doc->getDocTemplateList($libID, $type, $orderBy, $pager);
|
||||
$templateList = $this->doc->filterPrivDocs($templateList, 'template');
|
||||
foreach($templateList as $template)
|
||||
{
|
||||
$template->moduleName = zget($modules, $template->module);
|
||||
}
|
||||
foreach($templateList as $template) $template->moduleName = zget($modules, $template->module);
|
||||
|
||||
$this->view->title = $this->lang->doc->template;
|
||||
$this->view->libID = $libID;
|
||||
@@ -521,6 +517,7 @@ class doc extends control
|
||||
$this->view->recPerPage = $recPerPage;
|
||||
$this->view->pageID = $pageID;
|
||||
$this->view->mode = $mode;
|
||||
$this->view->hasModules = count($modules) ? true : false;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
|
||||
@@ -386,8 +386,9 @@ $.extend(window.docAppCommands,
|
||||
{
|
||||
startCreateTemplate: function()
|
||||
{
|
||||
const docApp = getDocApp();
|
||||
if(!docApp.treeMap.modules.size) return zui.Modal.alert(getLang('createTypeFirst'));
|
||||
const docApp = getDocApp();
|
||||
const hasModules = docApp.props.hasModules;
|
||||
if(!hasModules) return zui.Modal.alert(getLang('createTypeFirst'));
|
||||
docApp.startCreateDoc();
|
||||
},
|
||||
deleteDoc: function(_, args)
|
||||
|
||||
@@ -99,7 +99,8 @@ docApp
|
||||
set::viewModeUrl($viewModeUrl),
|
||||
set::pager(array('recTotal' => count($templateList), 'recPerPage' => $recPerPage, 'page' => $pageID)),
|
||||
set('$options', jsRaw('window.setDocAppOptions')),
|
||||
set::showDocOutline(false)
|
||||
set::showDocOutline(false),
|
||||
set::hasModules($hasModules)
|
||||
);
|
||||
|
||||
render();
|
||||
|
||||
Reference in New Issue
Block a user