From 3e3741796efd3bb827b4788e926f1273bf2b07db Mon Sep 17 00:00:00 2001 From: mayue Date: Fri, 31 Dec 2021 13:03:18 +0800 Subject: [PATCH] * Finish task #46526. --- module/doc/control.php | 22 ++++++++++++++++++++++ module/doc/js/common.js | 10 ++++++++++ module/doc/lang/en.php | 4 +++- module/doc/lang/zh-cn.php | 4 +++- module/doc/view/editlib.html.php | 1 + 5 files changed, 39 insertions(+), 2 deletions(-) diff --git a/module/doc/control.php b/module/doc/control.php index 4d9c57ef6e..417a969793 100644 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -778,6 +778,28 @@ class doc extends control $this->doc->saveDraft($docID); } + /** + * + * @param int $doclibID + * @access public + * @return string + */ + public function ajaxGetWhitelist($doclibID) + { + $account = $this->app->user->account; + $doclib = $this->doc->getById($doclibID); + + if($doclib->acl != 'custom' and !empty($doclib->project)) + { + $project = $this->loadModel('project')->getById($doclib->project); + $projectTeams = $this->loadModel('user')->getTeamMemberPairs($doclib->project); + $stakeholders = $this->loadModel('stakeholder')->getStakeHolderPairs($doclib->project); + + return print(html::select('users[]', $users, $lib->users, "class='form-control chosen' multiple")); + } + return true; + } + /** * Show files. * diff --git a/module/doc/js/common.js b/module/doc/js/common.js index 2f095250d7..8c752e3d17 100644 --- a/module/doc/js/common.js +++ b/module/doc/js/common.js @@ -41,6 +41,16 @@ function toggleAcl(acl, type) var libType = $('input[name="type"]:checked').val(); var notice = typeof(noticeAcl[libType][acl]) != 'undefined' ? noticeAcl[libType][acl] : ''; $('#noticeAcl').html(notice); + + if(typeof(doclibID) != 'undefined') + { + link = createLink('doc', 'ajaxGetWhitelist', 'doclibID=' + doclibID); + $.get(link, function(users) + { + $('#users').replaceWith(users); + $('#users' + '_chosen').remove(); + }) + } } else { diff --git a/module/doc/lang/en.php b/module/doc/lang/en.php index f57d7a6036..7c175fb4df 100644 --- a/module/doc/lang/en.php +++ b/module/doc/lang/en.php @@ -206,7 +206,9 @@ $lang->doc->selectLibType = 'Please select a type of doc library.'; $lang->doc->noticeAcl['lib']['product']['default'] = 'Users who can access the selected product can access it.'; $lang->doc->noticeAcl['lib']['product']['custom'] = 'Users who can access the selected product or users in the whiltelist can access it.'; $lang->doc->noticeAcl['lib']['project']['default'] = 'Users who can access the selected project can access it.'; -$lang->doc->noticeAcl['lib']['project']['custom'] = 'Users who can access the selected project or users in the whiltelist can access it.'; +$lang->doc->noticeAcl['lib']['project']['open'] = 'Users who can access the selected project can access it.'; +$lang->doc->noticeAcl['lib']['project']['private'] = 'Users who can access the selected project or users in the whiltelist can access it.'; +$lang->doc->noticeAcl['lib']['project']['custom'] = 'Users in the whiltelist can access it.'; $lang->doc->noticeAcl['lib']['execution']['default'] = "Users who can access the selected {$lang->executionCommon} can access it."; $lang->doc->noticeAcl['lib']['execution']['custom'] = "Users who can access the selected {$lang->executionCommon} or users in the whiltelist can access it."; $lang->doc->noticeAcl['lib']['custom']['open'] = 'All users can access it.'; diff --git a/module/doc/lang/zh-cn.php b/module/doc/lang/zh-cn.php index cda43d8ffc..c9d2957bcf 100644 --- a/module/doc/lang/zh-cn.php +++ b/module/doc/lang/zh-cn.php @@ -206,7 +206,9 @@ $lang->doc->selectLibType = '请选择文档库类型'; $lang->doc->noticeAcl['lib']['product']['default'] = '有所选产品访问权限的用户可以访问。'; $lang->doc->noticeAcl['lib']['product']['custom'] = '有所选产品访问权限或白名单里的用户可以访问。'; $lang->doc->noticeAcl['lib']['project']['default'] = "有所选项目访问权限的用户可以访问。"; -$lang->doc->noticeAcl['lib']['project']['custom'] = "有所选项目访问权限或白名单里的用户可以访问。"; +$lang->doc->noticeAcl['lib']['project']['open'] = "有所选项目访问权限的用户可以访问。"; +$lang->doc->noticeAcl['lib']['project']['private'] = "有所选项目访问权限或白名单里的用户可以访问。"; +$lang->doc->noticeAcl['lib']['project']['custom'] = "白名单的用户可以访问。"; $lang->doc->noticeAcl['lib']['execution']['default'] = "有所选{$lang->executionCommon}访问权限的用户可以访问。"; $lang->doc->noticeAcl['lib']['execution']['custom'] = "有所选{$lang->executionCommon}访问权限或白名单里的用户可以访问。"; $lang->doc->noticeAcl['lib']['custom']['open'] = '所有人都可以访问。'; diff --git a/module/doc/view/editlib.html.php b/module/doc/view/editlib.html.php index 336c586729..b82f1e1cad 100644 --- a/module/doc/view/editlib.html.php +++ b/module/doc/view/editlib.html.php @@ -12,6 +12,7 @@ ?> +id);?> type == 'product'):?>