use check_xxx_access() and html_link(), backported from 6.0.x

This commit is contained in:
Uwe Steinmann 2021-07-06 09:32:02 +02:00
parent 496c70c024
commit b7885ad6f6

View File

@ -216,7 +216,6 @@ $(document).ready( function() {
echo $txt; echo $txt;
else { else {
$this->contentHeading(getMLText("document_infos")); $this->contentHeading(getMLText("document_infos"));
// $this->contentContainerStart();
$txt = $this->callHook('preDocumentInfos', $document); $txt = $this->callHook('preDocumentInfos', $document);
if(is_string($txt)) if(is_string($txt))
echo $txt; echo $txt;
@ -384,76 +383,79 @@ $(document).ready( function() {
if(!$showfullpreview) if(!$showfullpreview)
return; return;
$latestContent = $this->callHook('documentLatestContent', $document); $accessobject = $this->params['accessobject'];
if($latestContent === null) if($accessobject->check_controller_access('ViewOnline', array('action'=>'version'))) {
$latestContent = $document->getLatestContent(); $latestContent = $this->callHook('documentLatestContent', $document);
$txt = $this->callHook('preDocumentPreview', $latestContent); if($latestContent === null)
if(is_string($txt)) $latestContent = $document->getLatestContent();
echo $txt; $txt = $this->callHook('preDocumentPreview', $latestContent);
$txt = $this->callHook('documentPreview', $latestContent); if(is_string($txt))
if(is_string($txt)) echo $txt;
echo $txt; $txt = $this->callHook('documentPreview', $latestContent);
else { if(is_string($txt))
switch($latestContent->getMimeType()) { echo $txt;
case 'audio/mpeg': else {
case 'audio/mp3': switch($latestContent->getMimeType()) {
case 'audio/ogg': case 'audio/mpeg':
case 'audio/wav': case 'audio/mp3':
$this->contentHeading(getMLText("preview")); case 'audio/ogg':
?> case 'audio/wav':
<audio controls style="width: 100%;" preload="false"> $this->contentHeading(getMLText("preview"));
<source src="<?= $settings->_httpRoot ?>op/op.ViewOnline.php?documentid=<?php echo $latestContent->getDocument()->getID(); ?>&version=<?php echo $latestContent->getVersion(); ?>" type="audio/mpeg"> ?>
</audio> <audio controls style="width: 100%;" preload="false">
<?php <source src="<?= $settings->_httpRoot ?>op/op.ViewOnline.php?documentid=<?php echo $latestContent->getDocument()->getID(); ?>&version=<?php echo $latestContent->getVersion(); ?>" type="audio/mpeg">
break; </audio>
case 'video/webm': <?php
case 'video/mp4': break;
case 'video/avi': case 'video/webm':
case 'video/msvideo': case 'video/mp4':
case 'video/x-msvideo': case 'video/avi':
case 'video/x-matroska': case 'video/msvideo':
$this->contentHeading(getMLText("preview")); case 'video/x-msvideo':
?> case 'video/x-matroska':
$this->contentHeading(getMLText("preview"));
?>
<video controls style="width: 100%;"> <video controls style="width: 100%;">
<source src="<?= $settings->_httpRoot ?>op/op.ViewOnline.php?documentid=<?php echo $latestContent->getDocument()->getID(); ?>&version=<?php echo $latestContent->getVersion(); ?>" type="video/mp4"> <source src="<?= $settings->_httpRoot ?>op/op.ViewOnline.php?documentid=<?php echo $latestContent->getDocument()->getID(); ?>&version=<?php echo $latestContent->getVersion(); ?>" type="video/mp4">
</video> </video>
<?php <?php
break; break;
case 'application/pdf': case 'application/pdf':
$this->contentHeading(getMLText("preview")); $this->contentHeading(getMLText("preview"));
?> ?>
<iframe src="<?= $settings->_httpRoot ?>pdfviewer/web/viewer.html?file=<?php echo urlencode($settings->_httpRoot.'op/op.ViewOnline.php?documentid='.$latestContent->getDocument()->getID().'&version='.$latestContent->getVersion()); ?>" width="100%" height="700px"></iframe> <iframe src="<?= $settings->_httpRoot ?>pdfviewer/web/viewer.html?file=<?php echo urlencode($settings->_httpRoot.'op/op.ViewOnline.php?documentid='.$latestContent->getDocument()->getID().'&version='.$latestContent->getVersion()); ?>" width="100%" height="700px"></iframe>
<?php <?php
break; break;
case 'image/svg+xml': case 'image/svg+xml':
case 'image/jpg': case 'image/jpg':
case 'image/jpeg': case 'image/jpeg':
case 'image/png': case 'image/png':
case 'image/gif': case 'image/gif':
$this->contentHeading(getMLText("preview")); $this->contentHeading(getMLText("preview"));
?> ?>
<img src="<?= $settings->_httpRoot ?>op/op.ViewOnline.php?documentid=<?php echo $latestContent->getDocument()->getID(); ?>&version=<?php echo $latestContent->getVersion(); ?>" width="100%"> <img src="<?= $settings->_httpRoot ?>op/op.ViewOnline.php?documentid=<?php echo $latestContent->getDocument()->getID(); ?>&version=<?php echo $latestContent->getVersion(); ?>" width="100%">
<?php <?php
break; break;
default: default:
$txt = $this->callHook('additionalDocumentPreview', $latestContent); $txt = $this->callHook('additionalDocumentPreview', $latestContent);
if(is_string($txt)) if(is_string($txt))
echo $txt; echo $txt;
break; break;
}
} }
} $txt = $this->callHook('postDocumentPreview', $latestContent);
$txt = $this->callHook('postDocumentPreview', $latestContent); if(is_string($txt))
if(is_string($txt)) echo $txt;
echo $txt;
if($converttopdf) { if($converttopdf) {
$pdfpreviewer = new SeedDMS_Preview_PdfPreviewer($cachedir, $timeout, $xsendfile); $pdfpreviewer = new SeedDMS_Preview_PdfPreviewer($cachedir, $timeout, $xsendfile);
$pdfpreviewer->setConverters($pdfconverters); $pdfpreviewer->setConverters($pdfconverters);
if($pdfpreviewer->hasConverter($latestContent->getMimeType())) { if($pdfpreviewer->hasConverter($latestContent->getMimeType())) {
$this->contentHeading(getMLText("preview_pdf")); $this->contentHeading(getMLText("preview_pdf"));
?> ?>
<iframe src="<?= $settings->_httpRoot ?>pdfviewer/web/viewer.html?file=<?php echo urlencode($settings->_httpRoot.'op/op.PdfPreview.php?documentid='.$latestContent->getDocument()->getID().'&version='.$latestContent->getVersion()); ?>" width="100%" height="700px"></iframe> <iframe src="<?= $settings->_httpRoot ?>pdfviewer/web/viewer.html?file=<?php echo urlencode($settings->_httpRoot.'op/op.PdfPreview.php?documentid='.$latestContent->getDocument()->getID().'&version='.$latestContent->getVersion()); ?>" width="100%" height="700px"></iframe>
<?php <?php
}
} }
} }
} /* }}} */ } /* }}} */
@ -496,7 +498,7 @@ $(document).ready( function() {
$dms = $this->params['dms']; $dms = $this->params['dms'];
$user = $this->params['user']; $user = $this->params['user'];
$folder = $this->params['folder']; $folder = $this->params['folder'];
$accessop = $this->params['accessobject']; $accessobject = $this->params['accessobject'];
$viewonlinefiletypes = $this->params['viewonlinefiletypes']; $viewonlinefiletypes = $this->params['viewonlinefiletypes'];
$enableownerrevapp = $this->params['enableownerrevapp']; $enableownerrevapp = $this->params['enableownerrevapp'];
$workflowmode = $this->params['workflowmode']; $workflowmode = $this->params['workflowmode'];
@ -518,10 +520,10 @@ $(document).ready( function() {
$this->columnStart(4); $this->columnStart(4);
if ($file_exists) { if ($file_exists) {
if ($viewonlinefiletypes && (in_array(strtolower($latestContent->getFileType()), $viewonlinefiletypes) || in_array(strtolower($latestContent->getMimeType()), $viewonlinefiletypes))) { if ($viewonlinefiletypes && (in_array(strtolower($latestContent->getFileType()), $viewonlinefiletypes) || in_array(strtolower($latestContent->getMimeType()), $viewonlinefiletypes))) {
if($accessop->check_controller_access('ViewOnline', array('action'=>'run'))) if($accessobject->check_controller_access('ViewOnline', array('action'=>'run')))
print "<a target=\"_blank\" href=\"".$this->params['settings']->_httpRoot."op/op.ViewOnline.php?documentid=".$latestContent->getDocument()->getId()."&version=". $latestContent->getVersion()."\">"; print "<a target=\"_blank\" href=\"".$this->params['settings']->_httpRoot."op/op.ViewOnline.php?documentid=".$latestContent->getDocument()->getId()."&version=". $latestContent->getVersion()."\">";
} else { } else {
if($accessop->check_controller_access('Download', array('action'=>'version'))) if($accessobject->check_controller_access('Download', array('action'=>'version')))
print "<a href=\"".$this->params['settings']->_httpRoot."op/op.Download.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion()."\">"; print "<a href=\"".$this->params['settings']->_httpRoot."op/op.Download.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion()."\">";
} }
} }
@ -531,7 +533,7 @@ $(document).ready( function() {
} else { } else {
print "<img class=\"mimeicon\" width=\"".$previewwidthdetail."\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; print "<img class=\"mimeicon\" width=\"".$previewwidthdetail."\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">";
} }
if ($file_exists && ($accessop->check_controller_access('ViewOnline', array('action'=>'run')) || $accessop->check_controller_access('Download', array('action'=>'version')))) { if ($file_exists && ($accessobject->check_controller_access('ViewOnline', array('action'=>'run')) || $accessobject->check_controller_access('Download', array('action'=>'version')))) {
print "</a>"; print "</a>";
} }
// print "</td>\n"; // print "</td>\n";
@ -575,9 +577,9 @@ $(document).ready( function() {
$this->columnStart(4); $this->columnStart(4);
if ($file_exists){ if ($file_exists){
$items = array(); $items = array();
if($accessop->check_controller_access('Download', array('action'=>'version'))) if($accessobject->check_controller_access('Download', array('action'=>'version')))
$items[] = array('link'=>$this->params['settings']->_httpRoot."op/op.Download.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'download', 'label'=>'download'); $items[] = array('link'=>$this->params['settings']->_httpRoot."op/op.Download.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'download', 'label'=>'download');
if($accessop->check_controller_access('ViewOnline', array('action'=>'run'))) if($accessobject->check_controller_access('ViewOnline', array('action'=>'run')))
if ($viewonlinefiletypes && (in_array(strtolower($latestContent->getFileType()), $viewonlinefiletypes) || in_array(strtolower($latestContent->getMimeType()), $viewonlinefiletypes))) if ($viewonlinefiletypes && (in_array(strtolower($latestContent->getFileType()), $viewonlinefiletypes) || in_array(strtolower($latestContent->getMimeType()), $viewonlinefiletypes)))
$items[] = array('link'=>$this->params['settings']->_httpRoot."op/op.ViewOnline.php?documentid=".$latestContent->getDocument()->getId()."&version=". $latestContent->getVersion(), 'icon'=>'eye', 'label'=>'view_online', 'target'=>'_blank'); $items[] = array('link'=>$this->params['settings']->_httpRoot."op/op.ViewOnline.php?documentid=".$latestContent->getDocument()->getId()."&version=". $latestContent->getVersion(), 'icon'=>'eye', 'label'=>'view_online', 'target'=>'_blank');
if($newitems = $this->callHook('extraVersionViews', $latestContent)) if($newitems = $this->callHook('extraVersionViews', $latestContent))
@ -589,38 +591,40 @@ $(document).ready( function() {
$items = array(); $items = array();
if ($file_exists){ if ($file_exists){
if($islatest && $accessop->mayEditVersion()) { if($islatest && $accessobject->mayEditVersion()) {
$items[] = array('link'=>$this->params['settings']->_httpRoot."out/out.EditOnline.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'edit', 'label'=>'edit_version'); $items[] = array('link'=>$this->params['settings']->_httpRoot."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 /* Only admin has the right to remove version in any case or a regular
* user if enableVersionDeletion is on * user if enableVersionDeletion is on
*/ */
if($accessop->mayRemoveVersion()) { if($accessobject->mayRemoveVersion()) {
$items[] = array('link'=>$this->params['settings']->_httpRoot."out/out.RemoveVersion.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'remove', 'label'=>'rm_version'); $items[] = array('link'=>$this->params['settings']->_httpRoot."out/out.RemoveVersion.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'remove', 'label'=>'rm_version');
} }
if($islatest && $accessop->mayOverwriteStatus()) { if($islatest && $accessobject->mayOverwriteStatus()) {
$items[] = array('link'=>$this->params['settings']->_httpRoot."out/out.OverrideContentStatus.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'align-justify', 'label'=>'change_status'); $items[] = array('link'=>$this->params['settings']->_httpRoot."out/out.OverrideContentStatus.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'align-justify', 'label'=>'change_status');
} }
if($workflowmode == 'traditional' || $workflowmode == 'traditional_only_approval') { if($workflowmode == 'traditional' || $workflowmode == 'traditional_only_approval') {
// Allow changing reviewers/approvals only if not reviewed // Allow changing reviewers/approvals only if not reviewed
if($accessop->maySetReviewersApprovers()) { if($accessobject->maySetReviewersApprovers()) {
$items[] = array('link'=>$this->params['settings']->_httpRoot."out/out.SetReviewersApprovers.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'edit', 'label'=>'change_assignments'); $items[] = array('link'=>$this->params['settings']->_httpRoot."out/out.SetReviewersApprovers.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'edit', 'label'=>'change_assignments');
} }
} elseif($workflowmode == 'advanced') { } elseif($workflowmode == 'advanced') {
if($accessop->maySetWorkflow()) { if($accessobject->maySetWorkflow()) {
$workflow = $latestContent->getWorkflow(); $workflow = $latestContent->getWorkflow();
if(!$workflow) { if(!$workflow) {
$items[] = array('link'=>$this->params['settings']->_httpRoot."out/out.SetWorkflow.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'random', 'label'=>'set_workflow'); $items[] = array('link'=>$this->params['settings']->_httpRoot."out/out.SetWorkflow.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'random', 'label'=>'set_workflow');
} }
} }
} }
if($accessop->mayEditComment()) { if($accessobject->check_view_access('EditComment'))
$items[] = array('link'=>"out.EditComment.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'comment', 'label'=>'edit_comment'); if($accessobject->mayEditComment()) {
} $items[] = array('link'=>"out.EditComment.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'comment', 'label'=>'edit_comment');
if($accessop->mayEditAttributes()) { }
$items[] = array('link'=>"out.EditAttributes.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'edit', 'label'=>'edit_attributes'); if($accessobject->check_view_access('EditAttributes'))
} if($accessobject->mayEditAttributes()) {
$items[] = array('link'=>"out.EditAttributes.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'edit', 'label'=>'edit_attributes');
}
if(!$islatest) if(!$islatest)
$items[] = array('link'=>"out.DocumentVersionDetail.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'info', 'label'=>'details'); $items[] = array('link'=>"out.DocumentVersionDetail.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'info', 'label'=>'details');
@ -645,7 +649,7 @@ $(document).ready( function() {
$user = $this->params['user']; $user = $this->params['user'];
$folder = $this->params['folder']; $folder = $this->params['folder'];
$document = $this->params['document']; $document = $this->params['document'];
$accessop = $this->params['accessobject']; $accessobject = $this->params['accessobject'];
$viewonlinefiletypes = $this->params['viewonlinefiletypes']; $viewonlinefiletypes = $this->params['viewonlinefiletypes'];
$enableownerrevapp = $this->params['enableownerrevapp']; $enableownerrevapp = $this->params['enableownerrevapp'];
$enableremoverevapp = $this->params['enableremoverevapp']; $enableremoverevapp = $this->params['enableremoverevapp'];
@ -733,8 +737,9 @@ $(document).ready( function() {
if(is_string($txt)) if(is_string($txt))
echo $txt; echo $txt;
$this->documentInfos(); $this->documentInfos();
$this->preview(); if($accessobject->check_controller_access('ViewOnline', array('action'=>'run'))) {
$this->preview();
}
$this->columnEnd(); $this->columnEnd();
$this->columnStart(8); $this->columnStart(8);
@ -927,23 +932,25 @@ $(document).ready( function() {
print htmlspecialchars($r["comment"]); print htmlspecialchars($r["comment"]);
if($r['file']) { if($r['file']) {
echo "<br />"; echo "<br />";
echo "<a href=\"".$this->params['settings']->_httpRoot."op/op.Download.php?documentid=".$documentid."&reviewlogid=".$r['reviewLogID']."\" class=\"btn btn-secondary btn-mini\"><i class=\"fa fa-download\"></i> ".getMLText('download')."</a>"; if($accessobject->check_controller_access('Download', array('action'=>'run'))) {
echo "<a href=\"".$this->params['settings']->_httpRoot."op/op.Download.php?documentid=".$latestContent->getDocument()->getId()."&reviewlogid=".$r['reviewLogID']."\" class=\"btn btn-secondary btn-mini\"><i class=\"fa fa-download\"></i> ".getMLText('download')."</a>";
}
} }
print "</td>\n"; print "</td>\n";
print "<td>"; print "<td>";
if($class) if($class)
echo "<i class=\"fa fa-circle text-".$class."\"></i> "; echo "<i class=\"fa fa-circle text-".$class."\"></i> ";
print getReviewStatusText($r["status"])."</td>\n"; print getReviewStatusText($r["status"])."</td>\n";
print "<td><ul class=\"actions unstyled\">"; print "<td><ul class=\"actions unstyled\">";
if($accesserr) if($accesserr)
echo "<li><span class=\"text-error\">".$accesserr."</span></li>"; echo "<li><span class=\"text-error\">".$accesserr."</span></li>";
if($accessop->mayReview()) { if($accessobject->mayReview()) {
if ($is_reviewer) { if ($is_reviewer) {
if ($r["status"]==0) { if ($r["status"]==0) {
print "<li><a href=\"".$this->params['settings']->_httpRoot."out/out.ReviewDocument.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion()."&reviewid=".$r['reviewID']."\" class=\"btn btn-primary btn-mini\">".getMLText("add_review")."</a></li>"; print $this->html_link('ReviewDocument', array('documentid'=>$latestContent->getDocument()->getId(), 'version'=>$latestContent->getVersion(), 'reviewid'=>$r['reviewID']), array('class'=>'btn btn-mini btn-primary'), getMLText("add_review"), false, true, array('<li>', '</li>'));
} elseif ($accessop->mayUpdateReview($updateUser) && (($r["status"]==1)||($r["status"]==-1))) { } elseif ($accessobject->mayUpdateReview($updateUser) && (($r["status"]==1)||($r["status"]==-1))){
print "<li><a href=\"".$this->params['settings']->_httpRoot."out/out.ReviewDocument.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion()."&reviewid=".$r['reviewID']."\" class=\"btn btn-primary btn-mini\">".getMLText("edit")."</a></li>"; print $this->html_link('ReviewDocument', array('documentid'=>$latestContent->getDocument()->getId(), 'version'=>$latestContent->getVersion(), 'reviewid'=>$r['reviewID']), array('class'=>'btn btn-mini btn-primary'), getMLText("edit"), false, true, array('<li>', '</li>'));
} }
} }
} }
@ -1031,23 +1038,25 @@ $(document).ready( function() {
print htmlspecialchars($a["comment"]); print htmlspecialchars($a["comment"]);
if($a['file']) { if($a['file']) {
echo "<br />"; echo "<br />";
echo "<a href=\"".$this->params['settings']->_httpRoot."op/op.Download.php?documentid=".$documentid."&approvelogid=".$a['approveLogID']."\" class=\"btn btn-secondary btn-mini\"><i class=\"fa fa-download\"></i> ".getMLText('download')."</a>"; if($accessobject->check_controller_access('Download', array('action'=>'run'))) {
echo "<a href=\"".$this->params['settings']->_httpRoot."op/op.Download.php?documentid=".$latestContent->getDocument()->getId()."&approvelogid=".$a['approveLogID']."\" class=\"btn btn-secondary btn-mini\"><i class=\"fa fa-download\"></i> ".getMLText('download')."</a>";
}
} }
echo "</td>\n"; echo "</td>\n";
print "<td>"; print "<td>";
if($class) if($class)
echo "<i class=\"fa fa-circle text-".$class."\"></i> "; echo "<i class=\"fa fa-circle text-".$class."\"></i> ";
print getApprovalStatusText($a["status"])."</td>\n"; print getApprovalStatusText($a["status"])."</td>\n";
print "<td><ul class=\"actions unstyled\">"; print "<td><ul class=\"actions unstyled\">";
if($accesserr) if($accesserr)
echo "<li><span class=\"text-error\">".$accesserr."</span></li>"; echo "<li><span class=\"text-error\">".$accesserr."</span></li>";
if($accessop->mayApprove()) { if($accessobject->mayApprove()) {
if ($is_approver) { if ($is_approver) {
if ($a['status'] == 0) { if ($a['status'] == 0) {
print "<li><a class=\"btn btn-primary btn-mini\" href=\"".$this->params['settings']->_httpRoot."out/out.ApproveDocument.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion()."&approveid=".$a['approveID']."\">".getMLText("add_approval")."</a></li>"; print $this->html_link('ApproveDocument', array('documentid'=>$latestContent->getDocument()->getId(), 'version'=>$latestContent->getVersion(), 'approveid'=>$a['approveID']), array('class'=>'btn btn-mini btn-primary'), getMLText("add_approval"), false, true, array('<li>', '</li>'));
} elseif ($accessop->mayUpdateApproval($updateUser) && (($a["status"]==1)||($a["status"]==-1))) { } elseif ($accessobject->mayUpdateApproval($updateUser) && (($a["status"]==1)||($a["status"]==-1))){
print "<li><a class=\"btn btn-primary btn-mini\" href=\"".$this->params['settings']->_httpRoot."out/out.ApproveDocument.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion()."&approveid=".$a['approveID']."\">".getMLText("edit")."</a></li>"; print $this->html_link('ApproveDocument', array('documentid'=>$latestContent->getDocument()->getId(), 'version'=>$latestContent->getVersion(), 'approveid'=>$a['approveID']), array('class'=>'btn btn-mini btn-primary'), getMLText("edit"), false, true, array('<li>', '</li>'));
} }
} }
} }
@ -1100,7 +1109,7 @@ $(document).ready( function() {
<div class="tab-pane <?php if($currenttab == 'workflow') echo 'active'; ?>" id="workflow" role="tabpanel"> <div class="tab-pane <?php if($currenttab == 'workflow') echo 'active'; ?>" id="workflow" role="tabpanel">
<?php <?php
$this->rowStart(); $this->rowStart();
if($user_is_involved || $user->isAdmin()) if ($user_is_involved && $accessobject->check_view_access('WorkflowGraph'))
$this->columnStart(6); $this->columnStart(6);
else else
$this->columnStart(12); $this->columnStart(12);
@ -1288,7 +1297,7 @@ $(document).ready( function() {
} }
$this->contentContainerEnd(); $this->contentContainerEnd();
$this->columnEnd(); $this->columnEnd();
if($user_is_involved || $user->isAdmin()) { if ($user_is_involved && $accessobject->check_view_access('WorkflowGraph')) {
$this->columnStart(6); $this->columnStart(6);
?> ?>
<iframe src="out.WorkflowGraph.php?workflow=<?php echo $workflow->getID(); ?><?php if($allowedtransitions) foreach($allowedtransitions as $tr) {echo "&transitions[]=".$tr->getID();} ?>" width="99%" height="661" style="border: 1px solid #AAA;"></iframe> <iframe src="out.WorkflowGraph.php?workflow=<?php echo $workflow->getID(); ?><?php if($allowedtransitions) foreach($allowedtransitions as $tr) {echo "&transitions[]=".$tr->getID();} ?>" width="99%" height="661" style="border: 1px solid #AAA;"></iframe>
@ -1343,10 +1352,15 @@ $(document).ready( function() {
print "<td>"; print "<td>";
$previewer->createPreview($file, $previewwidthdetail); $previewer->createPreview($file, $previewwidthdetail);
if($file_exists) { if($file_exists) {
if ($viewonlinefiletypes && (in_array(strtolower($file->getFileType()), $viewonlinefiletypes) || in_array(strtolower($file->getMimeType()), $viewonlinefiletypes))) if ($viewonlinefiletypes && (in_array(strtolower($file->getFileType()), $viewonlinefiletypes) || in_array(strtolower($file->getMimeType()), $viewonlinefiletypes))) {
print "<a target=\"_blank\" href=\"".$this->params['settings']->_httpRoot."op/op.ViewOnline.php?documentid=".$documentid."&file=". $file->getID()."\">"; if($accessobject->check_controller_access('ViewOnline', array('action'=>'run'))) {
else print "<a target=\"_blank\" href=\"".$this->params['settings']->_httpRoot."op/op.ViewOnline.php?documentid=".$documentid."&file=". $file->getID()."\">";
print "<a href=\"".$this->params['settings']->_httpRoot."op/op.Download.php?documentid=".$documentid."&file=".$file->getID()."\">"; }
} else {
if($accessobject->check_controller_access('Download', array('action'=>'file'))) {
print "<a href=\"".$this->params['settings']->_httpRoot."op/op.Download.php?documentid=".$documentid."&file=".$file->getID()."\">";
}
}
} }
if($previewer->hasPreview($file)) { if($previewer->hasPreview($file)) {
print("<img class=\"mimeicon\" width=\"".$previewwidthdetail."\" src=\"".$this->params['settings']->_httpRoot."op/op.Preview.php?documentid=".$document->getID()."&file=".$file->getID()."&width=".$previewwidthdetail."\" title=\"".htmlspecialchars($file->getMimeType())."\">"); print("<img class=\"mimeicon\" width=\"".$previewwidthdetail."\" src=\"".$this->params['settings']->_httpRoot."op/op.Preview.php?documentid=".$document->getID()."&file=".$file->getID()."&width=".$previewwidthdetail."\" title=\"".htmlspecialchars($file->getMimeType())."\">");
@ -1354,7 +1368,8 @@ $(document).ready( function() {
print "<img class=\"mimeicon\" width=\"".$previewwidthdetail."\" src=\"".$this->getMimeIcon($file->getFileType())."\" title=\"".htmlspecialchars($file->getMimeType())."\">"; print "<img class=\"mimeicon\" width=\"".$previewwidthdetail."\" src=\"".$this->getMimeIcon($file->getFileType())."\" title=\"".htmlspecialchars($file->getMimeType())."\">";
} }
if($file_exists) { if($file_exists) {
print "</a>"; if($accessobject->check_controller_access('Download', array('action'=>'run')) || $accessobject->check_controller_access('ViewOnline', array('action'=>'run')))
print "</a>";
} }
print "</td>"; print "</td>";
@ -1377,9 +1392,14 @@ $(document).ready( function() {
print "<td><ul class=\"unstyled actions\">"; print "<td><ul class=\"unstyled actions\">";
if ($file_exists) { if ($file_exists) {
print "<li><a href=\"".$this->params['settings']->_httpRoot."op/op.Download.php?documentid=".$documentid."&file=".$file->getID()."\"><i class=\"fa fa-download\"></i>".getMLText('download')."</a>"; if($accessobject->check_controller_access('Download', array('action'=>'file'))) {
if ($viewonlinefiletypes && (in_array(strtolower($file->getFileType()), $viewonlinefiletypes) || in_array(strtolower($file->getMimeType()), $viewonlinefiletypes))) print "<li><a href=\"".$this->params['settings']->_httpRoot."op/op.Download.php?documentid=".$documentid."&file=".$file->getID()."\"><i class=\"fa fa-download\"></i>".getMLText('download')."</a></li>";
print "<li><a target=\"_blank\" href=\"".$this->params['settings']->_httpRoot."op/op.ViewOnline.php?documentid=".$documentid."&file=". $file->getID()."\"><i class=\"fa fa-star\"></i>" . getMLText("view_online") . "</a></li>"; }
if ($viewonlinefiletypes && (in_array(strtolower($file->getFileType()), $viewonlinefiletypes) || in_array(strtolower($file->getMimeType()), $viewonlinefiletypes))) {
if($accessobject->check_controller_access('ViewOnline', array('action'=>'run'))) {
print "<li><a target=\"_blank\" href=\"".$this->params['settings']->_httpRoot."op/op.ViewOnline.php?documentid=".$documentid."&file=". $file->getID()."\"><i class=\"fa fa-star\"></i>" . getMLText("view_online") . "</a></li>";
}
}
} }
echo "</ul><ul class=\"unstyled actions\">"; echo "</ul><ul class=\"unstyled actions\">";
if (($document->getAccessMode($user) == M_ALL)||($file->getUserID()==$user->getID())) { if (($document->getAccessMode($user) == M_ALL)||($file->getUserID()==$user->getID())) {
@ -1395,13 +1415,15 @@ $(document).ready( function() {
} }
else $this->infoMsg(getMLText("no_attached_files")); else $this->infoMsg(getMLText("no_attached_files"));
if ($document->getAccessMode($user) >= M_READWRITE){ if($accessobject->check_controller_access('AddFile')) {
if(0){ if ($document->getAccessMode($user) >= M_READWRITE){
if(0){
?> ?>
<div id="_draganddrophandler" class="droptarget well alert" data-droptarget="attachment_<?= $document->getID(); ?>" data-target="<?= $document->getID(); ?>" data-uploadformtoken="<?= createFormKey(''); ?>"><?php printMLText('drop_files_here'); ?><a href="<?= $this->params['settings']->_httpRoot ?>out/out.AddFile.php?documentid=<?= $documentid ?>"> <?= getMLText("add") ?></a></div> <div id="_draganddrophandler" class="droptarget well alert" data-droptarget="attachment_<?= $document->getID(); ?>" data-target="<?= $document->getID(); ?>" data-uploadformtoken="<?= createFormKey(''); ?>"><?php printMLText('drop_files_here'); ?><a href="<?= $this->params['settings']->_httpRoot ?>out/out.AddFile.php?documentid=<?= $documentid ?>"> <?= getMLText("add") ?></a></div>
<?php <?php
}
print $this->html_link('AddFile', array('documentid'=>$documentid), array('class'=>'btn btn-primary'), getMLText("add"), false, true)."\n";
} }
print "<a href=\"".$this->params['settings']->_httpRoot."out/out.AddFile.php?documentid=".$documentid."\" class=\"btn btn-primary\">".getMLText("add")."</a>\n";
} }
?> ?>
</div> </div>
@ -1443,7 +1465,7 @@ $(document).ready( function() {
} }
else $this->infoMsg(getMLText("no_linked_files")); else $this->infoMsg(getMLText("no_linked_files"));
if (!$user->isGuest()){ if ($accessobject->check_view_access('AddDocumentLink')){
?> ?>
<br> <br>
<form action="<?= $this->params['settings']->_httpRoot ?>op/op.AddDocumentLink.php" id="form1" name="form1" class="form-horizontal"> <form action="<?= $this->params['settings']->_httpRoot ?>op/op.AddDocumentLink.php" id="form1" name="form1" class="form-horizontal">