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

This commit is contained in:
Uwe Steinmann 2021-05-06 13:09:45 +02:00
commit 791872adee
3 changed files with 161 additions and 150 deletions

View File

@ -1383,7 +1383,8 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
$attrs[] = array('href', $config['remote']);
$attrs[] = array('data-toggle', 'modal');
$attrs[] = array('role', 'button');
$attrs[] = array('class', $config['class']);
if(isset($config['class']))
$attrs[] = array('class', $config['class']);
return $attrs;
} /* }}} */

View File

@ -475,13 +475,13 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Theme_Style {
if(is_string($item))
echo "<li class=\"nav-item\">".$item."</li>";
elseif(is_array($item)) {
echo "<li class=\"nav-item m-1\"><a class=\"_nav-link btn btn-outline-primary btn-sm".($item['class'] ? ' '. $item['class'] : '')."\"".(!isset($item['link']) ? " href=\"".$item['link']."\"" : '').(!empty($item['target']) ? ' target="'.$item['target'].'"' : '');
echo "<li class=\"nav-item m-1\"><a class=\"_nav-link btn btn-mini btn-outline-primary btn-sm".(!empty($item['class']) ? ' '. $item['class'] : '')."\"".(isset($item['link']) ? " href=\"".$item['link']."\"" : '').(!empty($item['target']) ? ' target="'.$item['target'].'"' : '');
if(!empty($item['attributes'])) {
foreach($item['attributes'] as $attr) {
echo ' '.$attr[0].'="'.$attr[1].'"';
}
}
echo ">".(!empty($item['icon']) ? "<i class=\"fa fa-".$item['icon']."\"></i> " : "").getMLText($item['label'])."</a></li>";
echo ">".(!empty($item['icon']) ? "<i class=\"fa fa-".$item['icon']."\"></i> " : "").'<span class="d-none d-lg-inline">'.getMLText($item['label'])."</span></a></li>";
}
}
print "</ul>";
@ -503,6 +503,159 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Theme_Style {
print "</ul>";
} /* }}} */
protected function showVersionDetails($latestContent, $previewer) { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
$accessobject = $this->params['accessobject'];
$viewonlinefiletypes = $this->params['viewonlinefiletypes'];
$enableownerrevapp = $this->params['enableownerrevapp'];
$enablereceiptworkflow = $this->params['enablereceiptworkflow'];
$enablereceiptreject = $this->params['enablereceiptreject'];
$enablerevisionworkflow = $this->params['enablerevisionworkflow'];
$workflowmode = $this->params['workflowmode'];
$previewwidthdetail = $this->params['previewWidthDetail'];
// verify if file exists
$file_exists=file_exists($dms->contentDir . $latestContent->getPath());
$status = $latestContent->getStatus();
// print "<table class=\"table\">";
// print "<thead>\n<tr>\n";
// print "<th colspan=\"2\">".htmlspecialchars($latestContent->getOriginalFileName())."</th>\n";
// print "</tr></thead><tbody>\n";
// print "<tr>\n";
// print "<td style=\"width:".$previewwidthdetail."px; text-align: center;\">";
$this->contentHeading(htmlspecialchars($latestContent->getOriginalFileName()));
$this->rowStart();
$this->columnStart(4);
if ($file_exists) {
if ($viewonlinefiletypes && (in_array(strtolower($latestContent->getFileType()), $viewonlinefiletypes) || in_array(strtolower($latestContent->getMimeType()), $viewonlinefiletypes))) {
print "<a target=\"_blank\" href=\"../op/op.ViewOnline.php?documentid=".$latestContent->getDocument()->getId()."&version=". $latestContent->getVersion()."\">";
} else {
print "<a href=\"../op/op.Download.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion()."\">";
}
}
$previewer->createPreview($latestContent);
if($previewer->hasPreview($latestContent)) {
print("<img class=\"mimeicon\" width=\"".$previewwidthdetail."\" src=\"../op/op.Preview.php?documentid=".$latestContent->getDocument()->getID()."&version=".$latestContent->getVersion()."&width=".$previewwidthdetail."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">");
} else {
print "<img class=\"mimeicon\" width=\"".$previewwidthdetail."\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">";
}
if ($file_exists) {
print "</a>";
}
// print "</td>\n";
// print "<td>";
$this->columnEnd();
$this->columnStart(4);
print "<ul class=\"actions unstyled\">\n";
print "<li>".getMLText('version').": ".$latestContent->getVersion()."</li>\n";
if ($file_exists)
print "<li>". SeedDMS_Core_File::format_filesize($latestContent->getFileSize()) .", ".htmlspecialchars($latestContent->getMimeType())."</li>";
else print "<li><span class=\"warning\">".getMLText("document_deleted")."</span></li>";
$updatingUser = $latestContent->getUser();
print "<li>".getMLText("uploaded_by")." <a href=\"mailto:".htmlspecialchars($updatingUser->getEmail())."\">".htmlspecialchars($updatingUser->getFullName())."</a></li>";
print "<li>".getLongReadableDate($latestContent->getDate())."</li>";
print "<li>".getMLText('status').": ".getOverallStatusText($status["status"]);
if ( $status["status"]==S_DRAFT_REV || $status["status"]==S_DRAFT_APP || $status["status"]==S_IN_WORKFLOW || $status["status"]==S_EXPIRED ){
print "<br><span".($latestContent->getDocument()->hasExpired()?" class=\"warning\" ":"").">".(!$latestContent->getDocument()->getExpires() ? getMLText("does_not_expire") : getMLText("expires").": ".getReadableDate($latestContent->getDocument()->getExpires()))."</span>";
}
print "</li>";
print "</ul>\n";
$txt = $this->callHook('showVersionComment', $latestContent);
if($txt) {
echo $txt;
} else {
if($latestContent->getComment())
print "<p style=\"font-style: italic;\">".htmlspecialchars($latestContent->getComment())."</p>";
}
print "<ul class=\"actions unstyled\">\n";
$this->printVersionAttributes($folder, $latestContent);
print "</ul>";
// print "</td>\n";
// print "<td>";
$this->columnEnd();
$this->columnStart(4);
if ($file_exists){
$items = array();
$items[] = array('link'=>"../op/op.Download.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'download', 'label'=>'download');
if ($viewonlinefiletypes && (in_array(strtolower($latestContent->getFileType()), $viewonlinefiletypes) || in_array(strtolower($latestContent->getMimeType()), $viewonlinefiletypes)))
$items[] = array('link'=>"../op/op.ViewOnline.php?documentid=".$latestContent->getDocument()->getId()."&version=". $latestContent->getVersion(), 'icon'=>'eye', 'label'=>'view_online', 'target'=>'_blank');
if($newitems = $this->callHook('extraVersionViews', $latestContent))
$items = array_merge($items, $newitems);
if($items) {
$this->showActions($items);
}
}
$items = array();
if ($file_exists){
if($accessobject->mayEditVersion($latestContent->getDocument())) {
$items[] = array('link'=>"../out/out.EditOnline.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'edit', 'label'=>'edit_version');
}
}
/* Only admin has the right to remove version in any case or a regular
* user if enableVersionDeletion is on
*/
if($accessobject->mayRemoveVersion($latestContent->getDocument())) {
$items[] = array('link'=>"../out/out.RemoveVersion.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'remove', 'label'=>'rm_version');
}
if($accessobject->mayOverrideStatus($latestContent->getDocument())) {
$items[] = array('link'=>"../out/out.OverrideContentStatus.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'align-justify', 'label'=>'change_status');
}
if($enablereceiptworkflow && $accessobject->check_controller_access('SetRecipients'))
if($accessobject->maySetRecipients($latestContent->getDocument())) {
$items[] = array('link'=>"../out/out.SetRecipients.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'check', 'label'=>'change_recipients');
}
if($enablerevisionworkflow && $accessobject->check_controller_access('SetRevisors'))
if($accessobject->maySetRevisors($latestContent->getDocument())) {
$items[] = array('link'=>"../out/out.SetRevisors.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'refresh', 'label'=>'change_revisors');
}
if($workflowmode == 'traditional' || $workflowmode == 'traditional_only_approval') {
// Allow changing reviewers/approvals only if not reviewed
if($accessobject->maySetReviewersApprovers($latestContent->getDocument())) {
$items[] = array('link'=>"../out/out.SetReviewersApprovers.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'edit', 'label'=>'change_assignments');
}
} elseif($workflowmode == 'advanced') {
if($accessobject->maySetWorkflow($latestContent->getDocument())) {
if(!$workflow) {
$items[] = array('link'=>"../out/out.SetWorkflow.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'random', 'label'=>'set_workflow');
}
}
}
if($accessobject->check_controller_access('AddToTransmittal'))
if($dms->getAllTransmittals($user)) {
if($accessobject->check_view_access('AddToTransmittal'))
$items[] = array('link'=>"out.AddToTransmittal.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'list', 'label'=>'add_to_transmittal');
}
if($accessobject->mayEditComment($latestContent->getDocument())) {
$items[] = array('link'=>"out.EditComment.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'comment', 'label'=>'edit_comment');
}
if($accessobject->mayEditAttributes($latestContent->getDocument())) {
$items[] = array('link'=>"out.EditAttributes.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'edit', 'label'=>'edit_attributes');
}
if($newitems = $this->callHook('extraVersionActions', $latestContent))
$items = array_merge($items, $newitems);
if($items) {
$this->showActions($items);
}
// echo "</td>";
// print "</tr></tbody>\n</table>\n";
$this->columnEnd();
$this->rowEnd();
} /* }}} */
function show() { /* {{{ */
parent::show();
@ -589,7 +742,6 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Theme_Style {
$this->infoMsg(getMLText('needs_workflow_action'));
}
$status = $latestContent->getStatus();
$reviewStatus = $latestContent->getReviewStatus();
$approvalStatus = $latestContent->getApprovalStatus();
$receiptStatus = $latestContent->getReceiptStatus();
@ -674,154 +826,10 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Theme_Style {
if(is_string($txt))
echo $txt;
// verify if file exists
$file_exists=file_exists($dms->contentDir . $latestContent->getPath());
$this->contentContainerStart();
print "<table class=\"table\">";
print "<thead>\n<tr>\n";
print "<th colspan=\"2\">".htmlspecialchars($latestContent->getOriginalFileName())."</th>\n";
// print "<th width='*'>".getMLText("file")."</th>\n";
// print "<th width='25%'>".getMLText("comment")."</th>\n";
// print "<th width='25%'></th>\n";
print "</tr></thead><tbody>\n";
print "<tr>\n";
print "<td style=\"width:".$previewwidthdetail."px; text-align: center;\">";
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidthdetail, $timeout, $xsendfile);
$previewer->setConverters($previewconverters);
$previewer->createPreview($latestContent);
if ($file_exists) {
if ($viewonlinefiletypes && (in_array(strtolower($latestContent->getFileType()), $viewonlinefiletypes) || in_array(strtolower($latestContent->getMimeType()), $viewonlinefiletypes))) {
if($accessobject->check_controller_access('ViewOnline', array('action'=>'run'))) {
print "<a target=\"_blank\" href=\"../op/op.ViewOnline.php?documentid=".$latestContent->getDocument()->getId()."&version=". $latestContent->getVersion()."\">";
}
} else {
if($accessobject->check_controller_access('Download', array('action'=>'version'))) {
print "<a href=\"../op/op.Download.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion()."\">";
}
}
}
if($previewer->hasPreview($latestContent)) {
print("<img class=\"mimeicon\" width=\"".$previewwidthdetail."\" src=\"../op/op.Preview.php?documentid=".$latestContent->getDocument()->getID()."&version=".$latestContent->getVersion()."&width=".$previewwidthdetail."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">");
} else {
print "<img class=\"mimeicon\" width=\"".$previewwidthdetail."\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">";
}
if ($file_exists) {
if($accessobject->check_controller_access('Download', array('action'=>'run')) || $accessobject->check_controller_access('ViewOnline', array('action'=>'run')))
print "</a>";
}
print "</td>\n";
print "<td><ul class=\"actions unstyled\">\n";
print "<li>".getMLText('version').": ".$latestContent->getVersion()."</li>\n";
if ($file_exists)
print "<li>". SeedDMS_Core_File::format_filesize($latestContent->getFileSize()) .", ".htmlspecialchars($latestContent->getMimeType())."</li>";
else print "<li><span class=\"warning\">".getMLText("document_deleted")."</span></li>";
$updatingUser = $latestContent->getUser();
print "<li>".getMLText("uploaded_by")." <a href=\"mailto:".htmlspecialchars($updatingUser->getEmail())."\">".htmlspecialchars($updatingUser->getFullName())."</a></li>";
print "<li>".getLongReadableDate($latestContent->getDate())."</li>";
print "<li>".getMLText('status').": ".getOverallStatusText($status["status"]);
if ( $status["status"]==S_DRAFT_REV || $status["status"]==S_DRAFT_APP || $status["status"]==S_IN_WORKFLOW || $status["status"]==S_EXPIRED ){
print "<br><span".($document->hasExpired()?" class=\"warning\" ":"").">".(!$document->getExpires() ? getMLText("does_not_expire") : getMLText("expires").": ".getReadableDate($document->getExpires()))."</span>";
}
print "</li>";
print "</ul>\n";
$txt = $this->callHook('showVersionComment', $latestContent);
if($txt) {
echo $txt;
} else {
if($latestContent->getComment())
print "<p style=\"font-style: italic;\">".htmlspecialchars($latestContent->getComment())."</p>";
}
print "<ul class=\"actions unstyled\">\n";
$this->printVersionAttributes($folder, $latestContent);
print "</ul>";
// print "</td>\n";
// print "<td>";
if ($file_exists){
$items = array();
if($accessobject->check_controller_access('Download', array('action'=>'version')))
$items[] = array('link'=>"../op/op.Download.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'download', 'label'=>'download');
if($accessobject->check_controller_access('ViewOnline', array('action'=>'run'))) {
if ($viewonlinefiletypes && (in_array(strtolower($latestContent->getFileType()), $viewonlinefiletypes) || in_array(strtolower($latestContent->getMimeType()), $viewonlinefiletypes)))
$items[] = array('link'=>"../op/op.ViewOnline.php?documentid=".$latestContent->getDocument()->getId()."&version=". $latestContent->getVersion(), 'icon'=>'eye', 'label'=>'view_online', 'target'=>'_blank');
}
if($newitems = $this->callHook('extraVersionViews', $latestContent))
$items = array_merge($items, $newitems);
if($items) {
$this->showActions($items);
}
}
$items = array();
if ($file_exists){
if($accessobject->check_view_access('EditOnline'))
if($accessobject->mayEditVersion($latestContent->getDocument())) {
$items[] = array('link'=>"../out/out.EditOnline.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'edit', 'label'=>'edit_version');
}
/* Only admin has the right to remove version in any case or a regular
* user if enableVersionDeletion is on
*/
if($accessobject->check_controller_access('RemoveVersion'))
if($accessobject->mayRemoveVersion($latestContent->getDocument())) {
$items[] = array('link'=>"../out/out.RemoveVersion.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'remove', 'label'=>'rm_version');
}
if($accessobject->check_controller_access('OverrideContentStatus'))
if($accessobject->mayOverrideStatus($latestContent->getDocument())) {
$items[] = array('link'=>"../out/out.OverrideContentStatus.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'align-justify', 'label'=>'change_status');
}
if($enablereceiptworkflow && $accessobject->check_controller_access('SetRecipients'))
if($accessobject->maySetRecipients($latestContent->getDocument())) {
$items[] = array('link'=>"../out/out.SetRecipients.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'check', 'label'=>'change_recipients');
}
if($enablerevisionworkflow && $accessobject->check_controller_access('SetRevisors'))
if($accessobject->maySetRevisors($latestContent->getDocument())) {
$items[] = array('link'=>"../out/out.SetRevisors.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'refresh', 'label'=>'change_revisors');
}
if($workflowmode == 'traditional' || $workflowmode == 'traditional_only_approval') {
// Allow changing reviewers/approvals only if not reviewed
if($accessobject->check_controller_access('SetReviewersApprovers'))
if($accessobject->maySetReviewersApprovers($latestContent->getDocument())) {
$items[] = array('link'=>"../out/out.SetReviewersApprovers.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'edit', 'label'=>'change_assignments');
}
} elseif($workflowmode == 'advanced') {
if($accessobject->check_controller_access('SetWorkflow'))
if($accessobject->maySetWorkflow($latestContent->getDocument())) {
if(!$workflow) {
$items[] = array('link'=>"../out/out.SetWorkflow.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'random', 'label'=>'set_workflow');
}
}
}
if($accessobject->check_controller_access('AddToTransmittal'))
if($dms->getAllTransmittals($user)) {
if($accessobject->check_view_access('AddToTransmittal'))
$items[] = array('link'=>"out.AddToTransmittal.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'list', 'label'=>'add_to_transmittal');
}
if($accessobject->check_controller_access('EditComment'))
if($accessobject->mayEditComment($latestContent->getDocument())) {
$items[] = array('link'=>"out.EditComment.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'comment', 'label'=>'edit_comment');
}
if($accessobject->check_controller_access('EditAttributes'))
if($accessobject->mayEditAttributes($latestContent->getDocument())) {
$items[] = array('link'=>"out.EditAttributes.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'edit', 'label'=>'edit_attributes');
}
if($newitems = $this->callHook('extraVersionActions', $latestContent))
$items = array_merge($items, $newitems);
if($items) {
$this->showActions($items);
}
}
echo "</td>";
print "</tr></tbody>\n</table>\n";
$this->showVersionDetails($latestContent, $previewer);
$this->contentContainerEnd();
if($user->isAdmin()) {

View File

@ -1309,7 +1309,8 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
$attrs[] = array('href', $config['remote']);
$attrs[] = array('data-toggle', 'modal');
$attrs[] = array('role', 'button');
$attrs[] = array('class', $config['class']);
if(isset($config['class']))
$attrs[] = array('class', $config['class']);
return $attrs;
} /* }}} */
@ -1536,6 +1537,7 @@ $(document).ready(function() {
array(
'target' => 'docChooser'.$formid,
'remote' => "../out/out.DocumentChooser.php?form=".$formid."&folderid=".$folderid."&partialtree=".$partialtree,
'class' => 'btn btn-secondary',
'title' => getMLText('document').'…'
));
$content .= "</div>\n";