count folders/documents recursively if set in configuration

This commit is contained in:
Uwe Steinmann 2013-04-10 15:42:11 +02:00
parent 6e263b7e0b
commit a02832040e
2 changed files with 27 additions and 2 deletions

View File

@ -654,10 +654,14 @@ $text = array(
'settings_enableLanguageSelector_desc' => "Show selector for user interface language after being logged in. This does not affect the language selection on the login page.", 'settings_enableLanguageSelector_desc' => "Show selector for user interface language after being logged in. This does not affect the language selection on the login page.",
'settings_enableLargeFileUpload_desc' => "If set, file upload is also available through a java applet called jumploader without a file size limit set by the browser. It also allows to upload several files in one step.", 'settings_enableLargeFileUpload_desc' => "If set, file upload is also available through a java applet called jumploader without a file size limit set by the browser. It also allows to upload several files in one step.",
'settings_enableLargeFileUpload' => "Enable large file upload", 'settings_enableLargeFileUpload' => "Enable large file upload",
'settings_maxRecursiveCount' => "Max. number of recursive document/folder count",
'settings_maxRecursiveCount_desc' => "This is the maximum number of documents or folders that will be checked for access rights, when recursively counting objects. If this number is exceeded, the number of documents and folders in the folder view will be estimated.",
'settings_enableOwnerNotification_desc' => "Check for adding a notification for the owner if a document when it is added.", 'settings_enableOwnerNotification_desc' => "Check for adding a notification for the owner if a document when it is added.",
'settings_enableOwnerNotification' => "Enable owner notification by default", 'settings_enableOwnerNotification' => "Enable owner notification by default",
'settings_enablePasswordForgotten_desc' => "If you want to allow user to set a new password and send it by mail, check this option.", 'settings_enablePasswordForgotten_desc' => "If you want to allow user to set a new password and send it by mail, check this option.",
'settings_enablePasswordForgotten' => "Enable Password forgotten", 'settings_enablePasswordForgotten' => "Enable Password forgotten",
'settings_enableRecursiveCount_desc' => "If turned on, the number of documents and folders in the folder view will be determined by counting all objects by recursively processing the folders and counting those documents and folders the user is allowed to access.",
'settings_enableRecursiveCount' => "Enable recursive document/folder count",
'settings_enableUserImage_desc' => "Enable users images", 'settings_enableUserImage_desc' => "Enable users images",
'settings_enableUserImage' => "Enable User Image", 'settings_enableUserImage' => "Enable User Image",
'settings_enableUsersView_desc' => "Enable/disable group and user view for all users", 'settings_enableUsersView_desc' => "Enable/disable group and user view for all users",

View File

@ -80,6 +80,8 @@ class SeedDMS_View_ViewFolder extends SeedDMS_Bootstrap_Style {
$enableClipboard = $this->params['enableClipboard']; $enableClipboard = $this->params['enableClipboard'];
$showtree = $this->params['showtree']; $showtree = $this->params['showtree'];
$cachedir = $this->params['cachedir']; $cachedir = $this->params['cachedir'];
$enableRecursiveCount = $this->params['enableRecursiveCount'];
$maxRecursiveCount = $this->params['maxRecursiveCount'];
$folderid = $folder->getId(); $folderid = $folder->getId();
@ -193,7 +195,26 @@ class SeedDMS_View_ViewFolder extends SeedDMS_Bootstrap_Style {
} }
print "</td>\n"; print "</td>\n";
print "<td>".htmlspecialchars($owner->getFullName())."</td>"; print "<td>".htmlspecialchars($owner->getFullName())."</td>";
print "<td colspan=\"1\"><small>".count($subsub)." ".getMLText("folders")."<br />".count($subdoc)." ".getMLText("documents")."</small></td>"; print "<td colspan=\"1\"><small>";
if($enableRecursiveCount) {
if($user->isAdmin()) {
/* No need to check for access rights in countChildren() for
* admin. So pass 0 as the limit.
*/
$cc = $subFolder->countChildren($user, 0);
print $cc['folder_count']." ".getMLText("folders")."<br />".$cc['document_count']." ".getMLText("documents");
} else {
$cc = $subFolder->countChildren($user, $maxRecursiveCount);
if($maxRecursiveCount > 5000)
$rr = 100.0;
else
$rr = 10.0;
print (!$cc['folder_precise'] ? '~'.(round($cc['folder_count']/$rr)*$rr) : $cc['folder_count'])." ".getMLText("folders")."<br />".(!$cc['document_precise'] ? '~'.(round($cc['document_count']/$rr)*$rr) : $cc['document_count'])." ".getMLText("documents");
}
} else {
print count($subsub)." ".getMLText("folders")."<br />".count($subdoc)." ".getMLText("documents");
}
print "</small></td>";
print "<td></td>"; print "<td></td>";
print "<td>"; print "<td>";
?> ?>
@ -222,7 +243,7 @@ class SeedDMS_View_ViewFolder extends SeedDMS_Bootstrap_Style {
/* Retrieve linked documents */ /* Retrieve linked documents */
$links = $document->getDocumentLinks(); $links = $document->getDocumentLinks();
$links = filterDocumentLinks($user, $links); $links = SeedDMS_Core_DMS::filterDocumentLinks($user, $links);
print "<tr>"; print "<tr>";