From a7fd56792b2e0fb60238ba7777daaccefd8405d7 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Thu, 5 Jul 2018 13:19:01 +0800 Subject: [PATCH 1/7] * finish task #4633. --- module/doc/model.php | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/module/doc/model.php b/module/doc/model.php index dc2d1e0045..5cddaaadb6 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -816,6 +816,13 @@ class docModel extends model if(!empty($object->product) and !empty($acls['products']) and !in_array($object->product, $acls['products'])) return false; if(!empty($object->project) and !empty($acls['projects']) and !in_array($object->project, $acls['projects'])) return false; + if(isset($object->lib)) + { + static $libs; + if(empty($libs)) $libs = $this->getLibs('all'); + if(!isset($libs[$object->lib])) return false; + } + if($object->acl == 'open') return true; $account = ',' . $this->app->user->account . ','; @@ -831,14 +838,7 @@ class docModel extends model if(strpos(",$object->groups,", ",$groupID,") !== false) return true; } } - - if(isset($object->lib)) - { - static $libs; - if(empty($libs)) $libs = $this->getLibs('all'); - if(!isset($libs[$object->lib])) return false; - - } + if(isset($object->lib)) return false; if($object->project) { @@ -1137,19 +1137,26 @@ class docModel extends model */ public function statLibCounts($idList) { - $moduleCounts= $this->dao->select("root, count(id) as moduleCount")->from(TABLE_MODULE) + $moduleCounts = $this->dao->select("root, count(id) as moduleCount")->from(TABLE_MODULE) ->where('type')->eq('doc') ->andWhere('root')->in($idList) ->andWhere('deleted')->eq(0) ->groupBy('root') ->fetchPairs(); - $docCounts= $this->dao->select("lib, count(id) as docCount")->from(TABLE_DOC) + $docs = $this->dao->select("id,lib,acl,users,groups")->from(TABLE_DOC) ->where('lib')->in($idList) ->andWhere('deleted')->eq(0) ->andWhere('module')->eq(0) - ->groupBy('lib') - ->fetchPairs(); + ->fetchAll(); + + $docCounts = array(); + foreach($docs as $doc) + { + if(!$this->checkPriv($doc)) continue; + if(!isset($docCounts[$doc->lib])) $docCounts[$doc->lib] = 0; + $docCounts[$doc->lib] ++; + } $itemCounts = array(); foreach($idList as $libID) From 4f0d8e7409d5bd57b66435a37c3dee4fd57460ac Mon Sep 17 00:00:00 2001 From: chenfeiCF Date: Thu, 5 Jul 2018 13:20:14 +0800 Subject: [PATCH 2/7] * Finish task #4508. --- module/doc/model.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/module/doc/model.php b/module/doc/model.php index dc2d1e0045..f0a9d705b4 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -48,7 +48,7 @@ class docModel extends model $selectHtml .= "
"; $selectHtml .= "
"; - $selectHtml .= "" . $mainLib . " "; + $selectHtml .= "" . $mainLib . " "; $selectHtml .= "