From bcd15517ebc5ff323e8918c8d9f85760181e2a81 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Sat, 30 Apr 2022 14:19:56 +0200 Subject: [PATCH 1/2] make setViewOnlineFileTypesFromString() and setEditOnlineFileTypesFromString() public --- inc/inc.ClassSettings.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/inc.ClassSettings.php b/inc/inc.ClassSettings.php index 29667e9cc..f28049be9 100644 --- a/inc/inc.ClassSettings.php +++ b/inc/inc.ClassSettings.php @@ -417,7 +417,7 @@ class Settings { /* {{{ */ * @param string $stringValue string value * */ - protected function setViewOnlineFileTypesFromString($stringValue) { /* {{{ */ + public function setViewOnlineFileTypesFromString($stringValue) { /* {{{ */ $this->_viewOnlineFileTypes = explode(";", $stringValue); } /* }}} */ @@ -437,7 +437,7 @@ class Settings { /* {{{ */ * @param string $stringValue string value * */ - protected function setEditOnlineFileTypesFromString($stringValue) { /* {{{ */ + public function setEditOnlineFileTypesFromString($stringValue) { /* {{{ */ $this->_editOnlineFileTypes = explode(";", $stringValue); } /* }}} */ From 5cd7dbec89dc9da82b7d19d327a29ebf1db78bd2 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Sat, 30 Apr 2022 14:39:49 +0200 Subject: [PATCH 2/2] - move folder status column into own method --- views/bootstrap/class.Bootstrap.php | 113 ++++++++++++++++++-------- views/bootstrap4/class.Bootstrap4.php | 86 ++++++++++---------- 2 files changed, 126 insertions(+), 73 deletions(-) diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php index fb4577c0f..f3f496250 100644 --- a/views/bootstrap/class.Bootstrap.php +++ b/views/bootstrap/class.Bootstrap.php @@ -1276,6 +1276,42 @@ background-image: linear-gradient(to bottom, #882222, #111111);; } } /* }}} */ +function getOverallStatusIcon($status) { /* {{{ */ + if (is_null($status)) { + return ''; + } else { + $icon = ''; + $color = ''; + switch($status) { + case S_IN_WORKFLOW: + $icon = 'fa fa-circle in-workflow'; + break; + case S_DRAFT_REV: + $icon = 'fa fa-circle in-workflow'; + break; + case S_DRAFT_APP: + $icon = 'fa fa-circle in-workflow'; + break; + case S_RELEASED: + $icon = 'fa-circle released'; + break; + case S_REJECTED: + $icon = 'fa-circle rejected'; + break; + case S_OBSOLETE: + $icon = 'fa-circle obsolete'; + break; + case S_EXPIRED: + $icon = 'fa-circle expired'; + break; + default: + $icon = 'fa fa-question'; + break; + } + return ''; + } +} /* }}} */ + /** * Get attributes for a button opening a modal box * @@ -3164,6 +3200,48 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) return $content; } /* }}} */ + function folderListRowStatus($subFolder) { /* {{{ */ + $dms = $this->params['dms']; + $user = $this->params['user']; + $showtree = $this->params['showtree']; + $enableRecursiveCount = $this->params['enableRecursiveCount']; + $maxRecursiveCount = $this->params['maxRecursiveCount']; + + $content = "
"; + 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); + if($cc['folder_count']) + $content .= ' '.$cc['folder_count']."
"; + if($cc['document_count']) + $content .= ' '.$cc['document_count']; + } else { + $cc = $subFolder->countChildren($user, $maxRecursiveCount); + if($maxRecursiveCount > 5000) + $rr = 100.0; + else + $rr = 10.0; + $content .= (!$cc['folder_precise'] ? '~'.(round($cc['folder_count']/$rr)*$rr) : $cc['folder_count'])." ".getMLText("folders")."
"; + $content .= (!$cc['document_precise'] ? '~'.(round($cc['document_count']/$rr)*$rr) : $cc['document_count'])." ".getMLText("documents"); + } + } else { + /* FIXME: the following is very inefficient for just getting the number of + * subfolders and documents. Making it more efficient is difficult, because + * the access rights need to be checked. + */ + $subsub = $subFolder->getSubFolders(); + $subsub = SeedDMS_Core_DMS::filterAccess($subsub, $user, M_READ); + $subdoc = $subFolder->getDocuments(); + $subdoc = SeedDMS_Core_DMS::filterAccess($subdoc, $user, M_READ); + $content .= count($subsub)." ".getMLText("folders")."
".count($subdoc)." ".getMLText("documents"); + } + $content .= "
"; + return $content; + } /* }}} */ + function folderListRow($subFolder, $skipcont=false, $extracontent=array()) { /* {{{ */ $dms = $this->params['dms']; $user = $this->params['user']; @@ -3203,38 +3281,9 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) $content .= $extracontent['bottom_title']; $content .= "\n"; // $content .= "".htmlspecialchars($owner->getFullName()).""; - $content .= "
"; - 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); - if($cc['folder_count']) - $content .= ' '.$cc['folder_count']."
"; - if($cc['document_count']) - $content .= ' '.$cc['document_count']; - } else { - $cc = $subFolder->countChildren($user, $maxRecursiveCount); - if($maxRecursiveCount > 5000) - $rr = 100.0; - else - $rr = 10.0; - $content .= (!$cc['folder_precise'] ? '~'.(round($cc['folder_count']/$rr)*$rr) : $cc['folder_count'])." ".getMLText("folders")."
"; - $content .= (!$cc['document_precise'] ? '~'.(round($cc['document_count']/$rr)*$rr) : $cc['document_count'])." ".getMLText("documents"); - } - } else { - /* FIXME: the following is very inefficient for just getting the number of - * subfolders and documents. Making it more efficient is difficult, because - * the access rights need to be checked. - */ - $subsub = $subFolder->getSubFolders(); - $subsub = SeedDMS_Core_DMS::filterAccess($subsub, $user, M_READ); - $subdoc = $subFolder->getDocuments(); - $subdoc = SeedDMS_Core_DMS::filterAccess($subdoc, $user, M_READ); - $content .= count($subsub)." ".getMLText("folders")."
".count($subdoc)." ".getMLText("documents"); - } - $content .= "
"; + $content .= ""; + $content .= $this->folderListRowStatus($subFolder); + $content .= ""; $content .= ""; $content .= $this->folderListRowAction($subFolder, $skipcont, $extracontent); $content .= ""; diff --git a/views/bootstrap4/class.Bootstrap4.php b/views/bootstrap4/class.Bootstrap4.php index 9f3e98304..97ffff578 100644 --- a/views/bootstrap4/class.Bootstrap4.php +++ b/views/bootstrap4/class.Bootstrap4.php @@ -1306,15 +1306,6 @@ function getOverallStatusIcon($status) { /* {{{ */ case S_EXPIRED: $icon = 'fa-circle expired'; break; - case S_IN_REVISION: - $icon = 'fa-refresh'; - break; - case S_DRAFT: - $icon = 'fa-circle-o'; - break; - case S_NEEDS_CORRECTION: - return getMLText("needs_correction"); - break; default: $icon = 'fa fa-question'; break; @@ -3242,6 +3233,48 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) return "\n"; } /* }}} */ + function folderListRowStatus($subFolder) { /* {{{ */ + $dms = $this->params['dms']; + $user = $this->params['user']; + $showtree = $this->params['showtree']; + $enableRecursiveCount = $this->params['enableRecursiveCount']; + $maxRecursiveCount = $this->params['maxRecursiveCount']; + + $content = "
"; + 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); + if($cc['folder_count']) + $content .= ' '.$cc['folder_count']."
"; + if($cc['document_count']) + $content .= ' '.$cc['document_count']; + } else { + $cc = $subFolder->countChildren($user, $maxRecursiveCount); + if($maxRecursiveCount > 5000) + $rr = 100.0; + else + $rr = 10.0; + $content .= (!$cc['folder_precise'] ? '~'.(round($cc['folder_count']/$rr)*$rr) : $cc['folder_count'])." ".getMLText("folders")."
"; + $content .= (!$cc['document_precise'] ? '~'.(round($cc['document_count']/$rr)*$rr) : $cc['document_count'])." ".getMLText("documents"); + } + } else { + /* FIXME: the following is very inefficient for just getting the number of + * subfolders and documents. Making it more efficient is difficult, because + * the access rights need to be checked. + */ + $subsub = $subFolder->getSubFolders(); + $subsub = SeedDMS_Core_DMS::filterAccess($subsub, $user, M_READ); + $subdoc = $subFolder->getDocuments(); + $subdoc = SeedDMS_Core_DMS::filterAccess($subdoc, $user, M_READ); + $content .= count($subsub)." ".getMLText("folders")."
".count($subdoc)." ".getMLText("documents"); + } + $content .= "
"; + return $content; + } /* }}} */ + function folderListRowAction($subFolder, $skipcont=false, $extracontent=array()) { /* {{{ */ $dms = $this->params['dms']; $user = $this->params['user']; @@ -3323,38 +3356,9 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) $content .= $extracontent['bottom_title']; $content .= "\n"; // $content .= "".htmlspecialchars($owner->getFullName()).""; - $content .= "
"; - 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); - if($cc['folder_count']) - $content .= ' '.$cc['folder_count']."
"; - if($cc['document_count']) - $content .= ' '.$cc['document_count']; - } else { - $cc = $subFolder->countChildren($user, $maxRecursiveCount); - if($maxRecursiveCount > 5000) - $rr = 100.0; - else - $rr = 10.0; - $content .= (!$cc['folder_precise'] ? '~'.(round($cc['folder_count']/$rr)*$rr) : $cc['folder_count'])." ".getMLText("folders")."
"; - $content .= (!$cc['document_precise'] ? '~'.(round($cc['document_count']/$rr)*$rr) : $cc['document_count'])." ".getMLText("documents"); - } - } else { - /* FIXME: the following is very inefficient for just getting the number of - * subfolders and documents. Making it more efficient is difficult, because - * the access rights need to be checked. - */ - $subsub = $subFolder->getSubFolders(); - $subsub = SeedDMS_Core_DMS::filterAccess($subsub, $user, M_READ); - $subdoc = $subFolder->getDocuments(); - $subdoc = SeedDMS_Core_DMS::filterAccess($subdoc, $user, M_READ); - $content .= count($subsub)." ".getMLText("folders")."
".count($subdoc)." ".getMLText("documents"); - } - $content .= "
"; + $content .= ""; + $content .= $this->folderListRowStatus($subFolder); + $content .= ""; $content .= ""; $content .= $this->folderListRowAction($subFolder, $skipcont, $extracontent); $content .= "";