Merge branch 'seeddms-5.1.x' into seeddms-6.0.x

This commit is contained in:
Uwe Steinmann 2022-04-30 14:40:20 +02:00
commit 8c43c709b0
3 changed files with 128 additions and 75 deletions

View File

@ -465,7 +465,7 @@ class Settings { /* {{{ */
* @param string $stringValue string value * @param string $stringValue string value
* *
*/ */
protected function setViewOnlineFileTypesFromString($stringValue) { /* {{{ */ public function setViewOnlineFileTypesFromString($stringValue) { /* {{{ */
$this->_viewOnlineFileTypes = explode(";", $stringValue); $this->_viewOnlineFileTypes = explode(";", $stringValue);
} /* }}} */ } /* }}} */
@ -485,7 +485,7 @@ class Settings { /* {{{ */
* @param string $stringValue string value * @param string $stringValue string value
* *
*/ */
protected function setEditOnlineFileTypesFromString($stringValue) { /* {{{ */ public function setEditOnlineFileTypesFromString($stringValue) { /* {{{ */
$this->_editOnlineFileTypes = explode(";", $stringValue); $this->_editOnlineFileTypes = explode(";", $stringValue);
} /* }}} */ } /* }}} */

View File

@ -1387,6 +1387,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 '<i class="fa '.$icon.'"'.($color ? ' style="color: '.$color.';"' : '').' title="'.getOverallStatusText($status).'"></i>';
}
} /* }}} */
/** /**
* Get attributes for a button opening a modal box * Get attributes for a button opening a modal box
* *
@ -3312,6 +3348,48 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
return $content; 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 = "<div style=\"font-size: 85%;\">";
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 .= '<i class="fa fa-folder" title="'.getMLText("folders").'"></i> '.$cc['folder_count']."<br />";
if($cc['document_count'])
$content .= '<i class="fa fa-file" title="'.getMLText("documents").'"></i> '.$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")."<br />";
$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")."<br />".count($subdoc)." ".getMLText("documents");
}
$content .= "</div>";
return $content;
} /* }}} */
function folderListRow($subFolder, $skipcont=false, $extracontent=array()) { /* {{{ */ function folderListRow($subFolder, $skipcont=false, $extracontent=array()) { /* {{{ */
$dms = $this->params['dms']; $dms = $this->params['dms'];
$user = $this->params['user']; $user = $this->params['user'];
@ -3351,38 +3429,9 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
$content .= $extracontent['bottom_title']; $content .= $extracontent['bottom_title'];
$content .= "</td>\n"; $content .= "</td>\n";
// $content .= "<td>".htmlspecialchars($owner->getFullName())."</td>"; // $content .= "<td>".htmlspecialchars($owner->getFullName())."</td>";
$content .= "<td colspan=\"1\" nowrap><div style=\"font-size: 85%;\">"; $content .= "<td colspan=\"1\" nowrap>";
if($enableRecursiveCount) { $content .= $this->folderListRowStatus($subFolder);
if($user->isAdmin()) { $content .= "</td>";
/* 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 .= '<i class="fa fa-folder" title="'.getMLText("folders").'"></i> '.$cc['folder_count']."<br />";
if($cc['document_count'])
$content .= '<i class="fa fa-file" title="'.getMLText("documents").'"></i> '.$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")."<br />";
$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")."<br />".count($subdoc)." ".getMLText("documents");
}
$content .= "</div></td>";
$content .= "<td>"; $content .= "<td>";
$content .= $this->folderListRowAction($subFolder, $skipcont, $extracontent); $content .= $this->folderListRowAction($subFolder, $skipcont, $extracontent);
$content .= "</td>"; $content .= "</td>";

View File

@ -1339,15 +1339,6 @@ function getOverallStatusIcon($status) { /* {{{ */
case S_EXPIRED: case S_EXPIRED:
$icon = 'fa-circle expired'; $icon = 'fa-circle expired';
break; 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: default:
$icon = 'fa fa-question'; $icon = 'fa fa-question';
break; break;
@ -3306,6 +3297,48 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
return "</tr>\n"; return "</tr>\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 = "<div style=\"font-size: 85%;\">";
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 .= '<i class="fa fa-folder" title="'.getMLText("folders").'"></i> '.$cc['folder_count']."<br />";
if($cc['document_count'])
$content .= '<i class="fa fa-file" title="'.getMLText("documents").'"></i> '.$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")."<br />";
$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")."<br />".count($subdoc)." ".getMLText("documents");
}
$content .= "</div>";
return $content;
} /* }}} */
function folderListRowAction($subFolder, $skipcont=false, $extracontent=array()) { /* {{{ */ function folderListRowAction($subFolder, $skipcont=false, $extracontent=array()) { /* {{{ */
$dms = $this->params['dms']; $dms = $this->params['dms'];
$user = $this->params['user']; $user = $this->params['user'];
@ -3389,38 +3422,9 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
$content .= $extracontent['bottom_title']; $content .= $extracontent['bottom_title'];
$content .= "</td>\n"; $content .= "</td>\n";
// $content .= "<td>".htmlspecialchars($owner->getFullName())."</td>"; // $content .= "<td>".htmlspecialchars($owner->getFullName())."</td>";
$content .= "<td colspan=\"1\" nowrap><div style=\"font-size: 85%;\">"; $content .= "<td colspan=\"1\" nowrap>";
if($enableRecursiveCount) { $content .= $this->folderListRowStatus($subFolder);
if($user->isAdmin()) { $content .= "</td>";
/* 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 .= '<i class="fa fa-folder" title="'.getMLText("folders").'"></i> '.$cc['folder_count']."<br />";
if($cc['document_count'])
$content .= '<i class="fa fa-file" title="'.getMLText("documents").'"></i> '.$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")."<br />";
$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")."<br />".count($subdoc)." ".getMLText("documents");
}
$content .= "</div></td>";
$content .= "<td>"; $content .= "<td>";
$content .= $this->folderListRowAction($subFolder, $skipcont, $extracontent); $content .= $this->folderListRowAction($subFolder, $skipcont, $extracontent);
$content .= "</td>"; $content .= "</td>";