new config option to exclude folders from dashboard

This commit is contained in:
Uwe Steinmann 2024-11-27 19:11:00 +01:00
parent ae22f5aba6
commit 5221f9756e
6 changed files with 28 additions and 0 deletions

View File

@ -2,6 +2,8 @@
Changes in version 5.1.37
--------------------------------------------------------------------------------
- do not show chart by category if there are no categories
- documents in certain folders can be excluded from dashboard, could be useful
for folders containing archived documents
--------------------------------------------------------------------------------
Changes in version 5.1.36

View File

@ -279,6 +279,8 @@ class Settings { /* {{{ */
var $_maxRecursiveCount = 10000;
// number of days in the past of the dashboard
var $_daysPastDashboard = 7;
// list of folders not considered for dashboard
var $_excludeFoldersDashboard = '';
// enable/disable help
var $_enableHelp = true;
// enable/disable language selection menu
@ -566,6 +568,8 @@ class Settings { /* {{{ */
$this->_enableRecursiveCount = Settings::boolVal($tab["enableRecursiveCount"]);
$this->_maxRecursiveCount = intval($tab["maxRecursiveCount"]);
$this->_daysPastDashboard = intval($tab["daysPastDashboard"]);
if(trim(strval($tab["excludeFoldersDashboard"])))
$this->_excludeFoldersDashboard = explode(',',strval($tab["excludeFoldersDashboard"]));
$this->_enableHelp = Settings::boolVal($tab["enableHelp"]);
$this->_enableLanguageSelector = Settings::boolVal($tab["enableLanguageSelector"]);
$this->_enableThemeSelector = Settings::boolVal($tab["enableThemeSelector"]);
@ -976,6 +980,7 @@ class Settings { /* {{{ */
$this->setXMLAttributValue($node, "enableRecursiveCount", $this->_enableRecursiveCount);
$this->setXMLAttributValue($node, "maxRecursiveCount", $this->_maxRecursiveCount);
$this->setXMLAttributValue($node, "daysPastDashboard", $this->_daysPastDashboard);
$this->setXMLAttributValue($node, "excludeFoldersDashboard", implode(',', $this->_excludeFoldersDashboard));
$this->setXMLAttributValue($node, "enableHelp", $this->_enableHelp);
$this->setXMLAttributValue($node, "enableLanguageSelector", $this->_enableLanguageSelector);
$this->setXMLAttributValue($node, "enableThemeSelector", $this->_enableThemeSelector);

View File

@ -148,6 +148,7 @@ if ($action == "saveSettings")
setBoolValue("enableRecursiveCount");
setIntValue("maxRecursiveCount");
setIntValue("daysPastDashboard");
setArrayValue("excludeFoldersDashboard");
setBoolValue("enableLanguageSelector");
setBoolValue("enableHelp");
setBoolValue("enableThemeSelector");

View File

@ -25,6 +25,7 @@ if($view) {
$view->setParam('convertToPdf', $settings->_convertToPdf);
$view->setParam('timeout', $settings->_cmdTimeout);
$view->setParam('dayspastdashboard', (int) $settings->_daysPastDashboard);
$view->setParam('excludedfolders', $settings->_excludeFoldersDashboard);
$view->setParam('accessobject', $accessop);
$view->setParam('xsendfile', $settings->_enableXsendfile);
$view($_GET);

View File

@ -69,6 +69,7 @@ class SeedDMS_View_Dashboard extends SeedDMS_Theme_Style {
$previewconverters = $this->params['previewConverters'];
$timeout = $this->params['timeout'];
$dayspastdashboard = $this->params['dayspastdashboard'];
$excludedfolders = $this->params['excludedfolders'];
$xsendfile = $this->params['xsendfile'];
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout, $xsendfile);
@ -80,6 +81,11 @@ class SeedDMS_View_Dashboard extends SeedDMS_Theme_Style {
echo $this->contentHeading(getMLText('new_documents'));
$documents = $dms->getLatestChanges('newdocuments', mktime(0, 0, 0)-$dayspastdashboard*86400, time());
$documents = SeedDMS_Core_DMS::filterAccess($documents, $user, M_READ);
foreach($documents as $i=>$doc) {
$fl = explode(':', $doc->getFolderList());
if(array_diff($fl, $excludedfolders))
unset($documents[$i]);
}
if (count($documents) > 0) {
$this->printList($documents, $previewer);
}
@ -94,6 +100,7 @@ class SeedDMS_View_Dashboard extends SeedDMS_Theme_Style {
$previewconverters = $this->params['previewConverters'];
$timeout = $this->params['timeout'];
$dayspastdashboard = $this->params['dayspastdashboard'];
$excludedfolders = $this->params['excludedfolders'];
$xsendfile = $this->params['xsendfile'];
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout, $xsendfile);
@ -105,6 +112,11 @@ class SeedDMS_View_Dashboard extends SeedDMS_Theme_Style {
echo $this->contentHeading(getMLText('updated_documents'));
$documents = $dms->getLatestChanges('updateddocuments', mktime(0, 0, 0)-$dayspastdashboard*86400, time());
$documents = SeedDMS_Core_DMS::filterAccess($documents, $user, M_READ);
foreach($documents as $i=>$doc) {
$fl = explode(':', $doc->getFolderList());
if(array_diff($fl, $excludedfolders))
unset($documents[$i]);
}
if (count($documents) > 0) {
$this->printList($documents, $previewer);
}
@ -119,6 +131,7 @@ class SeedDMS_View_Dashboard extends SeedDMS_Theme_Style {
$previewconverters = $this->params['previewConverters'];
$timeout = $this->params['timeout'];
$dayspastdashboard = $this->params['dayspastdashboard'];
$excludedfolders = $this->params['excludedfolders'];
$xsendfile = $this->params['xsendfile'];
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout, $xsendfile);
@ -130,6 +143,11 @@ class SeedDMS_View_Dashboard extends SeedDMS_Theme_Style {
echo $this->contentHeading(getMLText('status_change'));
$documents = $dms->getLatestChanges('statuschange', mktime(0, 0, 0)-$dayspastdashboard*86400, time());
$documents = SeedDMS_Core_DMS::filterAccess($documents, $user, M_READ);
foreach($documents as $i=>$doc) {
$fl = explode(':', $doc->getFolderList());
if(array_diff($fl, $excludedfolders))
unset($documents[$i]);
}
if (count($documents) > 0) {
$this->printList($documents, $previewer);
}

View File

@ -467,6 +467,7 @@ if(($kkk = $this->callHook('getFullSearchEngine')) && is_array($kkk))
<?php $this->showConfigCheckbox('settings_enableRecursiveCount', 'enableRecursiveCount'); ?>
<?php $this->showConfigText('settings_maxRecursiveCount', 'maxRecursiveCount'); ?>
<?php $this->showConfigText('settings_daysPastDashboard', 'daysPastDashboard'); ?>
<?php $this->showConfigFolder('settings_excludeFoldersDashboard', 'excludeFoldersDashboard'); ?>
<?php $this->showConfigCheckbox('settings_enableLanguageSelector', 'enableLanguageSelector'); ?>
<?php $this->showConfigCheckbox('settings_enableHelp', 'enableHelp'); ?>
<?php $this->showConfigCheckbox('settings_enableThemeSelector', 'enableThemeSelector'); ?>