From a180e399b247edb095013866d4f421049e27aa41 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Tue, 17 Oct 2023 13:29:26 +0800 Subject: [PATCH] * Fixed the function of the actions button. --- lib/zin/wg/docmenu/v1.php | 34 +++++++++++++++++++--------------- module/api/control.php | 6 ++---- module/doc/control.php | 6 ++---- module/doc/lang/de.php | 1 + module/doc/lang/en.php | 1 + module/doc/lang/fr.php | 1 + module/doc/lang/zh-cn.php | 1 + 7 files changed, 27 insertions(+), 23 deletions(-) diff --git a/lib/zin/wg/docmenu/v1.php b/lib/zin/wg/docmenu/v1.php index 4f497e341c..cad21f69ab 100644 --- a/lib/zin/wg/docmenu/v1.php +++ b/lib/zin/wg/docmenu/v1.php @@ -114,6 +114,8 @@ class docMenu extends wg $itemID = 0; if(!in_array(strtolower($setting->type), $this->mineTypes)) $itemID = $setting->id ? $setting->id : $parentID; + $moduleName = $setting->type == 'apiLib' || $setting->objectType == 'api' ? 'api' : 'doc'; + $item = array( 'key' => $itemID, 'text' => $setting->name, @@ -125,7 +127,7 @@ class docMenu extends wg 'data-lib' => in_array($setting->type, array('docLib', 'apiLib')) ? $itemID : zget($setting, 'libID', ''), 'data-type' => $setting->type, 'data-parent' => $setting->parentID, - 'data-module' => $this->currentModule, + 'data-module' => $moduleName, 'active' => zget($setting, 'active', $itemID == $activeKey), 'actions' => $this->getActions($setting) ); @@ -259,8 +261,9 @@ class docMenu extends wg $menus = array(); if(in_array($item->type, array('docLib', 'apiLib'))) { - $itemID = $item->id ? $item->id : $item->parentID; - if(hasPriv($this->currentModule, 'addCatalog')) + $itemID = $item->id ? $item->id : $item->parentID; + $moduleName = $item->type == 'docLib' ? 'doc' : 'api'; + if(hasPriv($moduleName, 'addCatalog')) { $menus[] = array( 'key' => 'adddirectory', @@ -270,32 +273,33 @@ class docMenu extends wg ); } - if(hasPriv($this->currentModule, 'editCatalog')) + if(hasPriv($moduleName, 'editLib')) { $menus[] = array( 'key' => 'editlib', 'icon' => 'edit', 'text' => $this->lang->doc->libDropdown['editLib'], 'data-toggle' => 'modal', - 'data-url' => createlink($this->currentModule, 'editlib', "libID={$itemID}"), + 'data-url' => createlink($moduleName, 'editLib', "libID={$itemID}"), ); } - if(hasPriv($this->currentModule, 'deleteCatalog')) + if(hasPriv($moduleName, 'deleteLib')) { $menus[] = array( 'key' => 'dellib', 'icon' => 'trash', 'text' => $this->lang->doc->libDropdown['deleteLib'], - 'class' => 'ajax-submit', - 'data-url' => createLink($this->currentModule, 'deleteLib', "libID={$itemID}"), + 'innerClass' => 'ajax-submit', + 'data-url' => createLink($moduleName, 'deleteLib', "libID={$itemID}"), 'data-confirm' => $this->lang->doc->confirmDeleteLib, ); } } elseif($item->type == 'module') { - if(hasPriv($this->currentModule, 'addCatalog')) + $moduleName = $item->objectType == 'api' ? 'api' : 'doc'; + if(hasPriv($moduleName, 'addCatalog')) { $menus[] = array( 'key' => 'adddirectory', @@ -311,7 +315,7 @@ class docMenu extends wg ); } - if(hasPriv($this->currentModule, 'editCatalog')) + if(hasPriv($moduleName, 'editCatalog')) { $menus[] = array( 'key' => 'editmodule', @@ -319,19 +323,19 @@ class docMenu extends wg 'text' => $this->lang->doc->libDropdown['editModule'], 'link' => '', 'data-toggle' => 'modal', - 'data-url' => createlink($this->currentModule, 'editCatalog', "moduleID={$item->id}&type=" . ($this->rawModule == 'api' ? 'api' : 'doc')), + 'data-url' => createlink($moduleName, 'editCatalog', "moduleID={$item->id}&type=" . ($this->rawModule == 'api' ? 'api' : 'doc')), ); } - if(hasPriv($this->currentModule, 'deleteCatalog')) + if(hasPriv($moduleName, 'deleteCatalog')) { $menus[] = array( 'key' => 'delmodule', 'icon' => 'trash', 'text' => $this->lang->doc->libDropdown['delModule'], - 'class' => 'ajax-submit', - 'data-url' => createLink($this->currentModule, 'deleteCatalog', "rootID={$item->parentID}&moduleID={$item->id}"), - 'data-confirm' => $this->lang->api->confirmDeleteLib, + 'innerClass' => 'ajax-submit', + 'data-url' => createLink($moduleName, 'deleteCatalog', "moduleID={$item->id}"), + 'data-confirm' => $this->lang->doc->confirmDeleteModule, ); } } diff --git a/module/api/control.php b/module/api/control.php index 4db1dceccf..82197c7b43 100755 --- a/module/api/control.php +++ b/module/api/control.php @@ -1004,15 +1004,13 @@ class api extends control /** * Delete a catalog. * - * @param int $rootID * @param int $moduleID - * @param string $confirm yes|no * @access public * @return void */ - public function deleteCatalog($rootID, $moduleID, $confirm = 'no') + public function deleteCatalog($moduleID) { - echo $this->fetch('tree', 'delete', "rootID=$rootID&moduleID=$moduleID&confirm=$confirm"); + echo $this->fetch('tree', 'delete', "moduleID=$moduleID&confirm=yes"); } /** diff --git a/module/doc/control.php b/module/doc/control.php index f5cffdc801..063b87d006 100755 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -1491,15 +1491,13 @@ class doc extends control /** * Delete a catalog. * - * @param int $rootID * @param int $moduleID - * @param string $confirm yes|no * @access public * @return void */ - public function deleteCatalog($rootID, $moduleID, $confirm = 'no') + public function deleteCatalog($moduleID) { - echo $this->fetch('tree', 'delete', "rootID=$rootID&moduleID=$moduleID&confirm=$confirm"); + echo $this->fetch('tree', 'delete', "moduleID=$moduleID&confirm=yes"); } /** diff --git a/module/doc/lang/de.php b/module/doc/lang/de.php index dec3bdef27..e13d0c112f 100644 --- a/module/doc/lang/de.php +++ b/module/doc/lang/de.php @@ -304,6 +304,7 @@ $lang->doc->confirmDelete = "Möchten Sie dieses Dokument löschen?"; $lang->doc->confirmDeleteLib = "Möchten Sie diese Bibliothek löschen?"; $lang->doc->confirmDeleteBook = "Do you want to delete this book?"; $lang->doc->confirmDeleteChapter = "Do you want to delete this chapter?"; +$lang->doc->confirmDeleteModule = "Do you want to delete this module?"; $lang->doc->confirmOtherEditing = "This document is currently editing. Continuing to edit will overwrite the content edited by others. Do you want to continue?"; $lang->doc->errorEditSystemDoc = "System Dokumentenbibliothek darf nicht geändert werden."; $lang->doc->errorEmptyProduct = "Kein {$lang->productCommon}. Kann nicht erstellt werden."; diff --git a/module/doc/lang/en.php b/module/doc/lang/en.php index 0eb1f29220..d65bdb6fea 100644 --- a/module/doc/lang/en.php +++ b/module/doc/lang/en.php @@ -304,6 +304,7 @@ $lang->doc->confirmDelete = "Do you want to delete this document?"; $lang->doc->confirmDeleteLib = "Do you want to delete this document library?"; $lang->doc->confirmDeleteBook = "Do you want to delete this book?"; $lang->doc->confirmDeleteChapter = "Do you want to delete this chapter?"; +$lang->doc->confirmDeleteModule = "Do you want to delete this module?"; $lang->doc->confirmOtherEditing = "This document is currently editing. Continuing to edit will overwrite the content edited by others. Do you want to continue?"; $lang->doc->errorEditSystemDoc = "You don't have to change system document library."; $lang->doc->errorEmptyProduct = "No {$lang->productCommon}. It cannot be created."; diff --git a/module/doc/lang/fr.php b/module/doc/lang/fr.php index 8139596ef5..1e8e36362b 100644 --- a/module/doc/lang/fr.php +++ b/module/doc/lang/fr.php @@ -304,6 +304,7 @@ $lang->doc->confirmDelete = "Voulez-vous supprimer ce document ?"; $lang->doc->confirmDeleteLib = "Voulez-vous supprimer cette Bibliothèque ?"; $lang->doc->confirmDeleteBook = "Do you want to delete this book?"; $lang->doc->confirmDeleteChapter = "Do you want to delete this chapter?"; +$lang->doc->confirmDeleteModule = "Do you want to delete this module?"; $lang->doc->confirmOtherEditing = "This document is currently editing. Continuing to edit will overwrite the content edited by others. Do you want to continue?"; $lang->doc->errorEditSystemDoc = "Vous n'avez pas besoin de changer de système de Bibliothèque."; $lang->doc->errorEmptyProduct = "Aucun {$lang->productCommon}. Il ne peut pas être créé."; diff --git a/module/doc/lang/zh-cn.php b/module/doc/lang/zh-cn.php index 5f90f9bf30..d491ac4a4b 100644 --- a/module/doc/lang/zh-cn.php +++ b/module/doc/lang/zh-cn.php @@ -304,6 +304,7 @@ $lang->doc->confirmDelete = "您确定删除该文档吗?"; $lang->doc->confirmDeleteLib = "您确定删除该文档库吗?"; $lang->doc->confirmDeleteBook = "您确定删除该手册吗?"; $lang->doc->confirmDeleteChapter = "您确定删除该章节吗?"; +$lang->doc->confirmDeleteModule = "您确定删除该目录吗?"; $lang->doc->confirmOtherEditing = "该文档正在编辑中,如果继续编辑将覆盖他人编辑内容,是否继续?"; $lang->doc->errorEditSystemDoc = "系统文档库无需修改。"; $lang->doc->errorEmptyProduct = "没有{$lang->productCommon},无法创建文档";