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

This commit is contained in:
Uwe Steinmann 2022-04-30 14:11:51 +02:00
commit 16c560d549
5 changed files with 85 additions and 32 deletions

View File

@ -54,6 +54,8 @@ function getReadableDate($timestamp=0) { /* {{{ */
global $settings;
if($timestamp === 0)
$timestamp = time();
elseif($timestamp && is_numeric($timestamp))
;
elseif($timestamp && is_string($timestamp))
$timestamp = strtotime($timestamp);
elseif(!is_numeric($timestamp))

View File

@ -3020,22 +3020,18 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
$status = $latestContent->getStatus();
$attentionstr = '';
if ( $document->isLocked() ) {
$attentionstr .= "<img src=\"".$this->getImgPath("lock.png")."\" title=\"". getMLText("locked_by").": ".htmlspecialchars($document->getLockingUser()->getFullName())."\"> ";
$attentionstr .= "<i class=\"fa fa-lock\" title=\"". getMLText("locked_by").": ".htmlspecialchars($document->getLockingUser()->getFullName())."\"></i> ";
}
$needwkflaction = false;
if($workflowmode == 'advanced') {
$workflow = $latestContent->getWorkflow();
if($workflow) {
$needwkflaction = $latestContent->needsWorkflowAction($user);
if($workflow && $latestContent->needsWorkflowAction($user)) {
$attentionstr .= "<i class=\"fa fa-exclamation-triangle\" title=\"". getMLText("workflow").": ".htmlspecialchars($workflow->getName())."\"></i> ";
}
}
if ( $needwkflaction ) {
$attentionstr .= "<img src=\"".$this->getImgPath("attention.gif")."\" title=\"". getMLText("workflow").": ".htmlspecialchars($workflow->getName())."\"> ";
}
$content = '';
if($attentionstr)
$content .= $attentionstr."<br />";
$content .= "<small>";
/* Retrieve attacheѕ files */
$files = $document->getDocumentFiles($latestContent->getVersion());
$files = SeedDMS_Core_DMS::filterDocumentFiles($user, $files);
@ -3048,17 +3044,18 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
$revlinks = $document->getReverseDocumentLinks();
$revlinks = SeedDMS_Core_DMS::filterDocumentLinks($user, $revlinks);
$content .= "<div class=\"font-size: 85%;\">";
if(count($files))
$content .= count($files)." ".getMLText("linked_files")."<br />";
$content .= '<i class="fa fa-paperclip" title="'.getMLText("linked_files").'"></i> '.count($files)."<br />";
if(count($links) || count($revlinks))
$content .= count($links)."/".count($revlinks)." ".getMLText("linked_documents")."<br />";
$content .= '<i class="fa fa-link" title="'.getMLText("linked_documents").'"></i> '.count($links)."/".count($revlinks)."<br />";
if($status["status"] == S_IN_WORKFLOW && $workflowmode == 'advanced') {
if($workflowstate = $latestContent->getWorkflowState())
$content .= '<span title="'.getOverallStatusText($status["status"]).': '.($workflow ? htmlspecialchars($workflow->getName()) : '').'">'.($workflowstate ? htmlspecialchars($workflowstate->getName()) : '').'</span>';
} else {
$content .= getOverallStatusText($status["status"]);
$content .= $this->getOverallStatusIcon($status['status']);
}
$content .= "</small>";
$content .= "</div>";
return $content;
} /* }}} */
@ -3354,21 +3351,25 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
$content .= $extracontent['bottom_title'];
$content .= "</td>\n";
// $content .= "<td>".htmlspecialchars($owner->getFullName())."</td>";
$content .= "<td colspan=\"1\" nowrap><small>";
$content .= "<td colspan=\"1\" nowrap><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);
$content .= $cc['folder_count']." ".getMLText("folders")."<br />".$cc['document_count']." ".getMLText("documents");
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 />".(!$cc['document_precise'] ? '~'.(round($cc['document_count']/$rr)*$rr) : $cc['document_count'])." ".getMLText("documents");
$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
@ -3381,7 +3382,7 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
$subdoc = SeedDMS_Core_DMS::filterAccess($subdoc, $user, M_READ);
$content .= count($subsub)." ".getMLText("folders")."<br />".count($subdoc)." ".getMLText("documents");
}
$content .= "</small></td>";
$content .= "</div></td>";
$content .= "<td>";
$content .= $this->folderListRowAction($subFolder, $skipcont, $extracontent);
$content .= "</td>";

View File

@ -338,6 +338,8 @@ i.warning {color: #ff9900;}
i.initstate {color: #ff9900;}
i.released {color: #00b000;}
i.rejected {color: #b00000;}
i.expired {color: #b0b0b0;}
i.obsolete {color: #9e5d42;}
i.in-workflow {color: #11479e;}
i.workflow-action {color: #91479e;}
i.selected {border: 1px solid #d4d4d4;padding:3px;border-radius:3px;background-color:#fafafa;background-image: linear-gradient(to bottom, #ffffff, #f2f2f2);}

View File

@ -1311,6 +1311,51 @@ 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;
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;
}
return '<i class="fa '.$icon.'"'.($color ? ' style="color: '.$color.';"' : '').' title="'.getOverallStatusText($status).'"></i>';
}
} /* }}} */
/**
* Get attributes for a button opening a modal box
*
@ -3013,22 +3058,18 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
$status = $latestContent->getStatus();
$attentionstr = '';
if ( $document->isLocked() ) {
$attentionstr .= "<img src=\"".$this->getImgPath("lock.png")."\" title=\"". getMLText("locked_by").": ".htmlspecialchars($document->getLockingUser()->getFullName())."\"> ";
$attentionstr .= "<i class=\"fa fa-lock\" title=\"". getMLText("locked_by").": ".htmlspecialchars($document->getLockingUser()->getFullName())."\"></i> ";
}
$needwkflaction = false;
if($workflowmode == 'advanced') {
$workflow = $latestContent->getWorkflow();
if($workflow) {
$needwkflaction = $latestContent->needsWorkflowAction($user);
if($workflow && $latestContent->needsWorkflowAction($user)) {
$attentionstr .= "<i class=\"fa fa-exclamation-triangle\" title=\"". getMLText("workflow").": ".htmlspecialchars($workflow->getName())."\"></i> ";
}
}
if ( $needwkflaction ) {
$attentionstr .= "<img src=\"".$this->getImgPath("attention.gif")."\" title=\"". getMLText("workflow").": ".htmlspecialchars($workflow->getName())."\"> ";
}
$content = '';
if($attentionstr)
$content .= $attentionstr."<br />";
$content .= "<small>";
/* Retrieve attacheѕ files */
$files = $document->getDocumentFiles($latestContent->getVersion());
$files = SeedDMS_Core_DMS::filterDocumentFiles($user, $files);
@ -3041,17 +3082,18 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
$revlinks = $document->getReverseDocumentLinks();
$revlinks = SeedDMS_Core_DMS::filterDocumentLinks($user, $revlinks);
$content .= "<div class=\"font-size: 85%;\">";
if(count($files))
$content .= count($files)." ".getMLText("linked_files")."<br />";
$content .= '<i class="fa fa-paperclip" title="'.getMLText("linked_files").'"></i> '.count($files)."<br />";
if(count($links) || count($revlinks))
$content .= count($links)."/".count($revlinks)." ".getMLText("linked_documents")."<br />";
$content .= '<i class="fa fa-link" title="'.getMLText("linked_documents").'"></i> '.count($links)."/".count($revlinks)."<br />";
if($status["status"] == S_IN_WORKFLOW && $workflowmode == 'advanced') {
if($workflowstate = $latestContent->getWorkflowState())
$content .= '<span title="'.getOverallStatusText($status["status"]).': '.($workflow ? htmlspecialchars($workflow->getName()) : '').'">'.($workflowstate ? htmlspecialchars($workflowstate->getName()) : '').'</span>';
} else {
$content .= getOverallStatusText($status["status"]);
$content .= $this->getOverallStatusIcon($status['status']);
}
$content .= "</small>";
$content .= "</div>";
return $content;
} /* }}} */
@ -3347,21 +3389,25 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
$content .= $extracontent['bottom_title'];
$content .= "</td>\n";
// $content .= "<td>".htmlspecialchars($owner->getFullName())."</td>";
$content .= "<td colspan=\"1\" nowrap><small>";
$content .= "<td colspan=\"1\" nowrap><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);
$content .= $cc['folder_count']." ".getMLText("folders")."<br />".$cc['document_count']." ".getMLText("documents");
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 />".(!$cc['document_precise'] ? '~'.(round($cc['document_count']/$rr)*$rr) : $cc['document_count'])." ".getMLText("documents");
$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
@ -3374,7 +3420,7 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
$subdoc = SeedDMS_Core_DMS::filterAccess($subdoc, $user, M_READ);
$content .= count($subsub)." ".getMLText("folders")."<br />".count($subdoc)." ".getMLText("documents");
}
$content .= "</small></td>";
$content .= "</div></td>";
$content .= "<td>";
$content .= $this->folderListRowAction($subFolder, $skipcont, $extracontent);
$content .= "</td>";

View File

@ -343,6 +343,8 @@ i.warning {color: #ff9900;}
i.initstate {color: #ff9900;}
i.released {color: #00b000;}
i.rejected {color: #b00000;}
i.expired {color: #b0b0b0;}
i.obsolete {color: #9e5d42;}
i.in-workflow {color: #11479e;}
i.workflow-action {color: #91479e;}
i.selected {border: 1px solid #d4d4d4;padding:3px;border-radius:3px;background-color:#fafafa;background-image: linear-gradient(to bottom, #ffffff, #f2f2f2);}