* [task#137615,doing,1h] Alert tip when has no type when create doc template.

This commit is contained in:
xieqiyu
2025-02-21 09:53:16 +08:00
committed by 代婷婷
parent f743d7c800
commit 270151c855
3 changed files with 11 additions and 12 deletions
+6 -9
View File
@@ -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();
}
+3 -2
View File
@@ -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)
+2 -1
View File
@@ -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();