From f818d387f2911a4d864d8ff3ad3623e84541b4ec Mon Sep 17 00:00:00 2001 From: tianshujie Date: Mon, 27 Mar 2023 16:45:03 +0800 Subject: [PATCH] * Code for task #89152. --- db/zentaopms299.sql | 1 + module/doc/control.php | 7 +++++++ module/doc/css/createlib.css | 3 ++- module/doc/js/common.js | 1 + module/doc/lang/zh-cn.php | 1 + module/doc/model.php | 18 ++---------------- module/doc/view/createlib.html.php | 22 +++------------------- 7 files changed, 17 insertions(+), 36 deletions(-) diff --git a/db/zentaopms299.sql b/db/zentaopms299.sql index 8581d194e3..e76b5c95f7 100644 --- a/db/zentaopms299.sql +++ b/db/zentaopms299.sql @@ -1,3 +1,4 @@ UPDATE `zt_doc` SET `type` = 'text' WHERE `type` = 'url'; UPDATE `zt_doclib` SET `acl` = 'private' WHERE `type` = 'custom' and `acl` = 'custom'; +UPDATE `zt_doclib` SET `acl` = 'default' WHERE `type` = 'product' AND `acl` = 'custom'; diff --git a/module/doc/control.php b/module/doc/control.php index dfdd33af5a..2791f85ccb 100755 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -188,6 +188,13 @@ class doc extends control if($execution->type == 'stage') $this->lang->doc->execution = str_replace($this->lang->executionCommon, $this->lang->project->stage, $this->lang->doc->execution); } + if($type == 'custom') unset($this->lang->doclib->aclList['defalut']); + if($type != 'custom') + { + $this->lang->doclib->aclList['default'] = sprintf($this->lang->doclib->aclList['default'], $this->lang->{$type}->common); + unset($this->lang->doclib->aclList['open']); + } + $this->view->groups = $this->loadModel('group')->getPairs(); $this->view->users = $this->user->getPairs('nocode|noclosed'); $this->view->objects = $objects; diff --git a/module/doc/css/createlib.css b/module/doc/css/createlib.css index a3b21f7701..01bac79eba 100644 --- a/module/doc/css/createlib.css +++ b/module/doc/css/createlib.css @@ -10,4 +10,5 @@ table {width: 90% !important;} #execution_chosen {width: 50% !important;} #groups_chosen.chosen-container .chosen-results, #users_chosen.chosen-container .chosen-results {max-height: 160px;} -.objectBox > td.required:after {right: 180px;} +.objectBox > td.required:after {right: 277px;} +#aclBox .radio-inline + .radio-inline {margin-top: 5px; margin-left: 0px;} diff --git a/module/doc/js/common.js b/module/doc/js/common.js index f92dd4e03e..2ed36419aa 100644 --- a/module/doc/js/common.js +++ b/module/doc/js/common.js @@ -21,6 +21,7 @@ function loadModules(libID) */ function toggleAcl(acl, type) { + if(acl == 'default' && type == 'lib') return; var libID = $('#lib').val(); if(acl == 'custom') { diff --git a/module/doc/lang/zh-cn.php b/module/doc/lang/zh-cn.php index 429fcafb6b..d3090c93dc 100644 --- a/module/doc/lang/zh-cn.php +++ b/module/doc/lang/zh-cn.php @@ -34,6 +34,7 @@ $lang->doclib->aclListB['private'] = '私有'; $lang->doclib->aclList = array(); $lang->doclib->aclList['open'] = "公开 (有文档视图权限即可访问)"; +$lang->doclib->aclList['default'] = "默认 (有所选%s访问权限用户和白名单用户可以访问)"; $lang->doclib->aclList['private'] = "私有 (仅创建者和白名单用户可访问)"; $lang->doclib->create['product'] = '创建' . $lang->productCommon . '文档库'; diff --git a/module/doc/model.php b/module/doc/model.php index 66210831eb..15377bb6c0 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -1142,7 +1142,7 @@ class docModel extends model if(isset($extraDocLibs[$object->id])) return true; } - if(!empty($object->product) or !empty($object->execution)) + if($object->acl == 'default' and (!empty($object->product) or !empty($object->execution))) { $acls = $this->app->user->rights['acls']; if(!empty($object->product) and !empty($acls['products']) and !in_array($object->product, $acls['products'])) return false; @@ -1493,24 +1493,10 @@ class docModel extends model ->fetchPairs('product', 'projectCount'); } - $docCountPairs = $this->dao->select('lib, count(id) as docCount')->from(TABLE_DOC) - ->where('lib')->in(array_keys($objectLibs)) - ->andWhere('vision')->eq($this->config->vision) - ->andWhere('type')->notin('chapter') - ->andWhere('deleted')->eq(0) - ->groupBy('lib') - ->fetchPairs('lib'); - $libs = array(); foreach($objectLibs as $lib) { - if($this->checkPrivLib($lib)) - { - $docCount = zget($docCountPairs, $lib->id, 0); - $lib->docCount = $docCount > 99 ? '99+' : $docCount; - - $libs[$lib->id] = $lib; - } + if($this->checkPrivLib($lib)) $libs[$lib->id] = $lib; } $itemCounts = $this->statLibCounts(array_keys($libs)); diff --git a/module/doc/view/createlib.html.php b/module/doc/view/createlib.html.php index 0e493ca14e..596cc4586f 100644 --- a/module/doc/view/createlib.html.php +++ b/module/doc/view/createlib.html.php @@ -42,23 +42,13 @@ api->baseUrl?> api->baseUrlDesc . "'");?> - doclib->control;?> - doclib->aclList, 'open', "onchange='toggleAcl(this.value, \"lib\")'", 'block')?> + doclib->aclList, $type == 'custom' ? 'open' : 'default', "onchange='toggleAcl(this.value, \"lib\")'")?> - - - doclib->control;?> - - doc->aclList, 'open', "onchange='toggleAcl(this.value, \"lib\")'")?> - doc->noticeAcl['lib']['product']['default'];?> - - - - + doc->whiteList;?>
@@ -92,18 +82,12 @@
doc->noticeAcl['lib']);?>