From 47dd4370e6fd66afed879ada7e2f8218eccb3274 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Tue, 18 Jul 2023 15:37:15 +0800 Subject: [PATCH] * Refactor edit doc lib page. --- module/doc/control.php | 3 +- module/doc/css/editlib.ui.css | 1 + module/doc/js/common.ui.js | 2 +- module/doc/js/editlib.ui.js | 4 ++ module/doc/ui/editlib.html.php | 101 +++++++++++++++++++++++++++++++++ 5 files changed, 109 insertions(+), 2 deletions(-) create mode 100644 module/doc/css/editlib.ui.css create mode 100644 module/doc/js/editlib.ui.js create mode 100644 module/doc/ui/editlib.html.php diff --git a/module/doc/control.php b/module/doc/control.php index 6dbb0cfe06..42728d3135 100755 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -262,7 +262,8 @@ class doc extends control $response['message'] = $this->lang->saveSuccess; $response['result'] = 'success'; - $response['locate'] = 'parent'; + $response['closeModal'] = true; + $response['load'] = true; return $this->send($response); } diff --git a/module/doc/css/editlib.ui.css b/module/doc/css/editlib.ui.css new file mode 100644 index 0000000000..6261bde4aa --- /dev/null +++ b/module/doc/css/editlib.ui.css @@ -0,0 +1 @@ +.items-center {align-items: center !important;} diff --git a/module/doc/js/common.ui.js b/module/doc/js/common.ui.js index 3e3b55542d..e06c79d28e 100644 --- a/module/doc/js/common.ui.js +++ b/module/doc/js/common.ui.js @@ -33,7 +33,7 @@ function toggleAcl(type) let link = $.createLink('doc', 'ajaxGetWhitelist', 'doclibID=' + doclibID + '&acl=' + acl); $.get(link, function(users) { - if(users) + if(users != 'private' && users) { users = JSON.parse(users); const $usersPicker = $('select[name^=users]').zui('picker'); diff --git a/module/doc/js/editlib.ui.js b/module/doc/js/editlib.ui.js new file mode 100644 index 0000000000..6865f34372 --- /dev/null +++ b/module/doc/js/editlib.ui.js @@ -0,0 +1,4 @@ +$(function() +{ + toggleAcl('lib'); +}) diff --git a/module/doc/ui/editlib.html.php b/module/doc/ui/editlib.html.php new file mode 100644 index 0000000000..b194408700 --- /dev/null +++ b/module/doc/ui/editlib.html.php @@ -0,0 +1,101 @@ + + * @package doc + * @link https://www.zentao.net + */ +namespace zin; +jsVar('doclibID', $lib->id); +jsVar('libType', $lib->type); +modalHeader +( + set::title($lang->doc->editLib), + set::entityID($lib->id), + set::entityText($lib->name), +); + +formPanel +( + in_array($lib->type, array('product', 'project', 'execution')) ? formGroup + ( + setClass('items-center'), + set::label($lang->doc->{$lib->type}), + $object->name + ) : null, + formGroup + ( + set::label($lang->doc->libName), + set::name('name'), + set::value($lib->name), + radioList + ( + setClass('hidden'), + set::name('acl'), + set::items($lang->doc->libTypeList), + set::value($lib->type), + ), + ), + formRow + ( + setID('aclBox'), + formGroup + ( + set::label($lang->doclib->control), + radioList + ( + set::name('acl'), + set::items($lib->type == 'api' ? $lang->api->aclList : $lang->doclib->aclList), + set::value(empty($lib->main) ? $lib->acl : 'default'), + on::change("toggleAcl('lib')"), + ), + ) + ), + formRow + ( + setID('whiteListBox'), + setClass('hidden'), + formGroup + ( + set::label($lang->doc->whiteList), + div + ( + setClass('w-full check-list'), + div + ( + inputGroup + ( + $lang->doclib->group, + picker + ( + set::name('groups[]'), + set::items($groups), + set::value($lib->groups), + set::multiple(true), + ) + ) + ), + div + ( + inputGroup + ( + $lang->doclib->user, + picker + ( + set::name('users[]'), + set::items($users), + set::value($lib->users), + set::multiple(true), + ) + ) + ) + ) + ) + ), +); + +/* ====== Render page ====== */ +render();