2012-12-14 07:53:13 +00:00
< ? php
/**
* Implementation of DocumentVersionDetail view
*
* @ category DMS
2013-02-14 11:10:53 +00:00
* @ package SeedDMS
2012-12-14 07:53:13 +00:00
* @ license GPL 2
* @ version @ version @
* @ author Uwe Steinmann < uwe @ steinmann . cx >
* @ copyright Copyright ( C ) 2002 - 2005 Markus Westphal ,
* 2006 - 2008 Malcolm Cowe , 2010 Matteo Lucarelli ,
* 2010 - 2012 Uwe Steinmann
* @ version Release : @ package_version @
*/
/**
* Include parent class
*/
2021-04-18 05:08:00 +00:00
//require_once("class.Bootstrap.php");
2012-12-14 07:53:13 +00:00
/**
* Class which outputs the html page for DocumentVersionDetail view
*
* @ category DMS
2013-02-14 11:10:53 +00:00
* @ package SeedDMS
2012-12-14 07:53:13 +00:00
* @ author Markus Westphal , Malcolm Cowe , Uwe Steinmann < uwe @ steinmann . cx >
* @ copyright Copyright ( C ) 2002 - 2005 Markus Westphal ,
* 2006 - 2008 Malcolm Cowe , 2010 Matteo Lucarelli ,
* 2010 - 2012 Uwe Steinmann
* @ version Release : @ package_version @
*/
2021-04-18 05:08:00 +00:00
class SeedDMS_View_DocumentVersionDetail extends SeedDMS_Theme_Style {
2012-12-14 07:53:13 +00:00
2020-09-17 08:51:37 +00:00
/**
* Output a single attribute in the document info section
*
* @ param object $attribute attribute
*/
protected function printAttribute ( $attribute ) { /* {{{ */
$attrdef = $attribute -> getAttributeDefinition ();
?>
< tr >
< td >< ? php echo htmlspecialchars ( $attrdef -> getName ()); ?> :</td>
< td >< ? php echo $this -> getAttributeValue ( $attribute ); ?> </td>
</ tr >
< ? php
} /* }}} */
2016-11-07 08:25:55 +00:00
function preview () { /* {{{ */
2020-09-17 08:51:37 +00:00
$dms = $this -> params [ 'dms' ];
2016-11-07 08:25:55 +00:00
$document = $this -> params [ 'document' ];
$timeout = $this -> params [ 'timeout' ];
2019-01-18 12:07:39 +00:00
$xsendfile = $this -> params [ 'xsendfile' ];
2016-11-07 08:25:55 +00:00
$showfullpreview = $this -> params [ 'showFullPreview' ];
$converttopdf = $this -> params [ 'convertToPdf' ];
2020-09-17 08:51:37 +00:00
$pdfconverters = $this -> params [ 'pdfConverters' ];
2016-11-07 08:25:55 +00:00
$cachedir = $this -> params [ 'cachedir' ];
2021-10-06 13:03:03 +00:00
$conversionmgr = $this -> params [ 'conversionmgr' ];
2016-11-07 08:25:55 +00:00
$version = $this -> params [ 'version' ];
if ( ! $showfullpreview )
return ;
2020-09-17 08:51:37 +00:00
$txt = $this -> callHook ( 'preDocumentPreview' , $version );
if ( is_string ( $txt ))
echo $txt ;
$txt = $this -> callHook ( 'documentPreview' , $version );
if ( is_string ( $txt ))
echo $txt ;
else {
switch ( $version -> getMimeType ()) {
case 'audio/mpeg' :
case 'audio/mp3' :
case 'audio/ogg' :
case 'audio/wav' :
$this -> contentHeading ( getMLText ( " preview " ));
?>
< audio controls style = " width: 100%; " >
< source src = " ../op/op.ViewOnline.php?documentid=<?php echo $version->getDocument ()->getID(); ?>&version=<?php echo $version->getVersion (); ?> " type = " audio/mpeg " >
</ audio >
< ? php
break ;
case 'video/webm' :
case 'video/mp4' :
case 'video/avi' :
case 'video/msvideo' :
case 'video/x-msvideo' :
case 'video/x-matroska' :
$this -> contentHeading ( getMLText ( " preview " ));
?>
< video controls style = " width: 100%; " >
< source src = " ../op/op.ViewOnline.php?documentid=<?php echo $version->getDocument ()->getID(); ?>&version=<?php echo $version->getVersion (); ?> " type = " video/mp4 " >
</ video >
< ? php
break ;
case 'application/pdf' :
$this -> contentHeading ( getMLText ( " preview " ));
?>
< iframe src = " ../pdfviewer/web/viewer.html?file=<?php echo urlencode('../../op/op.ViewOnline.php?documentid='. $version->getDocument ()->getID().'&version='. $version->getVersion ()); ?> " width = " 100% " height = " 700px " ></ iframe >
< ? php
break ;
case 'image/svg+xml' :
case 'image/jpg' :
case 'image/jpeg' :
case 'image/png' :
case 'image/gif' :
$this -> contentHeading ( getMLText ( " preview " ));
?>
< img src = " ../op/op.ViewOnline.php?documentid=<?php echo $version->getDocument ()->getID(); ?>&version=<?php echo $version->getVersion (); ?> " width = " 100% " >
< ? php
break ;
default :
$txt = $this -> callHook ( 'additionalDocumentPreview' , $version );
if ( is_string ( $txt ))
echo $txt ;
break ;
}
2016-11-07 08:25:55 +00:00
}
2020-09-17 08:51:37 +00:00
$txt = $this -> callHook ( 'postDocumentPreview' , $version );
if ( is_string ( $txt ))
echo $txt ;
2016-11-07 08:25:55 +00:00
if ( $converttopdf ) {
2019-01-18 12:07:39 +00:00
$pdfpreviewer = new SeedDMS_Preview_PdfPreviewer ( $cachedir , $timeout , $xsendfile );
2021-10-06 13:03:03 +00:00
if ( $conversionmgr )
$pdfpreviewer -> setConversionMgr ( $conversionmgr );
else
$pdfpreviewer -> setConverters ( $pdfconverters );
2016-11-07 08:25:55 +00:00
if ( $pdfpreviewer -> hasConverter ( $version -> getMimeType ())) {
2020-09-17 08:51:37 +00:00
$this -> contentHeading ( getMLText ( " preview_pdf " ));
2016-11-07 08:25:55 +00:00
?>
2020-09-17 08:51:37 +00:00
< iframe src = " ../pdfviewer/web/viewer.html?file=<?php echo urlencode('../../op/op.PdfPreview.php?documentid='. $version->getDocument ()->getID().'&version='. $version->getVersion ()); ?> " width = " 100% " height = " 700px " ></ iframe >
2016-11-07 08:25:55 +00:00
< ? php
}
}
} /* }}} */
2012-12-14 07:53:13 +00:00
function show () { /* {{{ */
$dms = $this -> params [ 'dms' ];
$user = $this -> params [ 'user' ];
$folder = $this -> params [ 'folder' ];
$document = $this -> params [ 'document' ];
2020-09-17 08:51:37 +00:00
$accessop = $this -> params [ 'accessobject' ];
2012-12-14 07:53:13 +00:00
$version = $this -> params [ 'version' ];
2016-08-11 11:25:27 +00:00
$accessop = $this -> params [ 'accessobject' ];
2012-12-14 07:53:13 +00:00
$viewonlinefiletypes = $this -> params [ 'viewonlinefiletypes' ];
$enableversionmodification = $this -> params [ 'enableversionmodification' ];
2013-01-25 07:37:19 +00:00
$cachedir = $this -> params [ 'cachedir' ];
2021-10-06 13:03:03 +00:00
$conversionmgr = $this -> params [ 'conversionmgr' ];
2016-02-15 09:41:33 +00:00
$previewwidthdetail = $this -> params [ 'previewWidthDetail' ];
2020-07-21 07:26:17 +00:00
$previewconverters = $this -> params [ 'previewConverters' ];
2016-02-15 09:57:37 +00:00
$timeout = $this -> params [ 'timeout' ];
2019-01-18 12:07:39 +00:00
$xsendfile = $this -> params [ 'xsendfile' ];
2012-12-14 07:53:13 +00:00
$status = $version -> getStatus ();
$reviewStatus = $version -> getReviewStatus ();
$approvalStatus = $version -> getApprovalStatus ();
$this -> htmlStartPage ( getMLText ( " document_title " , array ( " documentname " => htmlspecialchars ( $document -> getName ()))));
$this -> globalNavigation ( $folder );
$this -> contentStart ();
2013-03-08 16:55:14 +00:00
$this -> pageNavigation ( $this -> getFolderPathHTML ( $folder , true , $document ), " view_document " , $document );
2020-10-08 05:57:23 +00:00
$this -> rowStart ();
$this -> columnStart ( 4 );
2012-12-14 07:53:13 +00:00
$this -> contentHeading ( getMLText ( " document_infos " ));
2021-04-18 05:08:00 +00:00
// $this->contentContainerStart();
2012-12-14 07:53:13 +00:00
?>
2021-04-18 05:08:00 +00:00
< table class = " table table-condensed table-sm " >
2012-12-14 07:53:13 +00:00
< tr >
< td >< ? php printMLText ( " owner " ); ?> :</td>
< td >
< ? php
$owner = $document -> getOwner ();
2021-01-11 06:59:32 +00:00
print " <a class= \" infos \" href= \" mailto: " . htmlspecialchars ( $owner -> getEmail ()) . " \" > " . htmlspecialchars ( $owner -> getFullName ()) . " </a> " ;
2012-12-14 07:53:13 +00:00
?>
</ td >
</ tr >
2014-03-18 09:54:24 +00:00
< ? php
if ( $document -> getComment ()) {
?>
2012-12-14 07:53:13 +00:00
< tr >
< td >< ? php printMLText ( " comment " ); ?> :</td>
< td >< ? php print htmlspecialchars ( $document -> getComment ()); ?> </td>
</ tr >
2014-03-18 09:54:24 +00:00
< ? php
}
?>
< tr >
< td >< ? php printMLText ( " used_discspace " ); ?> :</td>
< td >< ? php print SeedDMS_Core_File :: format_filesize ( $document -> getUsedDiskSpace ()); ?> </td>
</ tr >
< tr >
2012-12-14 07:53:13 +00:00
< tr >
< td >< ? php printMLText ( " creation_date " ); ?> :</td>
< td >< ? php print getLongReadableDate ( $document -> getDate ()); ?> </td>
</ tr >
2014-03-18 09:54:24 +00:00
< ? php
if ( $document -> expires ()) {
?>
< tr >
< td >< ? php printMLText ( " expires " ); ?> :</td>
< td >< ? php print getReadableDate ( $document -> getExpires ()); ?> </td>
</ tr >
< ? php
}
if ( $document -> getKeywords ()) {
?>
2012-12-14 07:53:13 +00:00
< tr >
< td >< ? php printMLText ( " keywords " ); ?> :</td>
< td >< ? php print htmlspecialchars ( $document -> getKeywords ()); ?> </td>
</ tr >
< ? php
2014-03-18 09:54:24 +00:00
}
2012-12-14 07:53:13 +00:00
if ( $document -> isLocked ()) {
$lockingUser = $document -> getLockingUser ();
?>
< tr >
< td >< ? php printMLText ( " lock_status " ); ?> :</td>
< td >< ? php printMLText ( " lock_message " , array ( " email " => $lockingUser -> getEmail (), " username " => htmlspecialchars ( $lockingUser -> getFullName ()))); ?> </td>
</ tr >
< ? php
}
?>
</ tr >
2014-03-18 09:54:24 +00:00
< ? php
$attributes = $document -> getAttributes ();
if ( $attributes ) {
foreach ( $attributes as $attribute ) {
2020-09-17 08:51:37 +00:00
$arr = $this -> callHook ( 'showDocumentAttribute' , $document , $attribute );
if ( is_array ( $arr )) {
echo " <tr> " ;
echo " <td> " . $arr [ 0 ] . " :</td> " ;
echo " <td> " . $arr [ 1 ] . " </td> " ;
echo " </tr> " ;
} elseif ( is_string ( $arr )) {
echo $arr ;
} else {
$this -> printAttribute ( $attribute );
}
2014-03-18 09:54:24 +00:00
}
}
?>
2012-12-14 07:53:13 +00:00
</ table >
< ? php
2021-04-18 05:08:00 +00:00
// $this->contentContainerEnd();
2016-11-07 08:25:55 +00:00
$this -> preview ();
2020-10-08 05:57:23 +00:00
$this -> columnEnd ();
$this -> columnStart ( 8 );
2012-12-14 07:53:13 +00:00
// verify if file exists
$file_exists = file_exists ( $dms -> contentDir . $version -> getPath ());
$this -> contentHeading ( getMLText ( " details_version " , array ( " version " => $version -> getVersion ())));
$this -> contentContainerStart ();
2013-01-25 07:37:19 +00:00
print " <table class= \" table table-condensed \" > " ;
2012-12-14 07:53:13 +00:00
print " <thead> \n <tr> \n " ;
2020-09-17 08:51:37 +00:00
print " <th colspan= \" 2 \" > " . htmlspecialchars ( $version -> getOriginalFileName ()) . " </th> \n " ;
// print "<th width='25%'>".getMLText("comment")."</th>\n";
print " <th width='20%'> " . getMLText ( " status " ) . " </th> \n " ;
print " <th width='25%'></th> \n " ;
2012-12-14 07:53:13 +00:00
print " </tr> \n </thead> \n <tbody> \n " ;
print " <tr> \n " ;
print " <td><ul class= \" unstyled \" > " ;
2013-01-25 07:37:19 +00:00
print " </ul> " ;
2019-01-18 12:07:39 +00:00
$previewer = new SeedDMS_Preview_Previewer ( $cachedir , $previewwidthdetail , $timeout , $xsendfile );
2021-10-06 13:03:03 +00:00
if ( $conversionmgr )
$previewer -> setConversionMgr ( $conversionmgr );
else
$previewer -> setConverters ( $previewconverters );
2013-01-25 07:37:19 +00:00
$previewer -> createPreview ( $version );
2021-04-18 05:08:00 +00:00
if ( $file_exists ) {
if ( $viewonlinefiletypes && ( in_array ( strtolower ( $version -> getFileType ()), $viewonlinefiletypes ) || in_array ( strtolower ( $version -> getMimeType ()), $viewonlinefiletypes ))) {
print " <a target= \" _blank \" href= \" ../op/op.ViewOnline.php?documentid= " . $version -> getDocument () -> getId () . " &version= " . $version -> getVersion () . " \" > " ;
} else {
print " <a href= \" ../op/op.Download.php?documentid= " . $version -> getDocument () -> getId () . " &version= " . $version -> getVersion () . " \" > " ;
}
}
2013-01-25 07:37:19 +00:00
if ( $previewer -> hasPreview ( $version )) {
2014-03-18 09:54:24 +00:00
print ( " <img class= \" mimeicon \" width= \" " . $previewwidthdetail . " \" src= \" ../op/op.Preview.php?documentid= " . $document -> getID () . " &version= " . $version -> getVersion () . " &width= " . $previewwidthdetail . " \" title= \" " . htmlspecialchars ( $version -> getMimeType ()) . " \" > " );
2021-04-18 05:08:00 +00:00
} else {
print " <img class= \" mimeicon \" width= \" " . $previewwidthdetail . " \" src= \" " . $this -> getMimeIcon ( $version -> getFileType ()) . " \" title= \" " . htmlspecialchars ( $version -> getMimeType ()) . " \" > " ;
}
if ( $file_exists ) {
print " </a> " ;
2013-01-25 07:37:19 +00:00
}
print " </td> \n " ;
2012-12-14 07:53:13 +00:00
print " <td><ul class= \" unstyled \" > \n " ;
2014-03-18 09:54:24 +00:00
print " <li> " . getMLText ( 'version' ) . " : " . $version -> getVersion () . " </li> \n " ;
2012-12-14 07:53:13 +00:00
2020-09-17 08:51:37 +00:00
if ( $file_exists )
print " <li> " . SeedDMS_Core_File :: format_filesize ( $version -> getFileSize ()) . " , " . htmlspecialchars ( $version -> getMimeType ()) . " </li> " ;
2012-12-14 07:53:13 +00:00
else print " <li><span class= \" warning \" > " . getMLText ( " document_deleted " ) . " </span></li> " ;
$updatingUser = $version -> getUser ();
2021-01-11 06:59:32 +00:00
print " <li> " . getMLText ( " uploaded_by " ) . " <a href= \" mailto: " . htmlspecialchars ( $updatingUser -> getEmail ()) . " \" > " . htmlspecialchars ( $updatingUser -> getFullName ()) . " </a></li> " ;
2012-12-14 07:53:13 +00:00
print " <li> " . getLongReadableDate ( $version -> getDate ()) . " </li> " ;
2020-09-17 08:51:37 +00:00
print " </ul> \n " ;
$txt = $this -> callHook ( 'showVersionComment' , $version );
if ( $txt ) {
echo $txt ;
} else {
if ( $version -> getComment ())
print " <p style= \" font-style: italic; \" > " . htmlspecialchars ( $version -> getComment ()) . " </p> " ;
}
print " <ul class= \" actions unstyled \" > \n " ;
$attributes = $version -> getAttributes ();
if ( $attributes ) {
foreach ( $attributes as $attribute ) {
$arr = $this -> callHook ( 'showDocumentContentAttribute' , $version , $attribute );
if ( is_array ( $arr )) {
print " <li> " . $arr [ 0 ] . " : " . $arr [ 1 ] . " </li> \n " ;
} else {
$attrdef = $attribute -> getAttributeDefinition ();
print " <li> " . htmlspecialchars ( $attrdef -> getName ()) . " : " . htmlspecialchars ( implode ( ', ' , $attribute -> getValueAsArray ())) . " </li> \n " ;
}
}
}
2012-12-14 07:53:13 +00:00
print " </ul></td> \n " ;
2020-09-17 08:51:37 +00:00
print " <td width='10%'> " ;
print 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 " </td> " ;
2012-12-14 07:53:13 +00:00
print " <td> " ;
//if (($document->getAccessMode($user) >= M_READWRITE)) {
2014-03-18 09:54:24 +00:00
if ( $file_exists ){
2020-09-17 08:51:37 +00:00
print " <ul class= \" actions unstyled \" > " ;
2016-08-11 11:25:27 +00:00
if ( $accessop -> check_controller_access ( 'Download' , array ( 'action' => 'run' )))
2020-08-27 06:27:19 +00:00
print " <li><a href= \" ../op/op.Download.php?documentid= " . $document -> getID () . " &version= " . $version -> getVersion () . " \" title= \" " . htmlspecialchars ( $version -> getMimeType ()) . " \" ><i class= \" fa fa-download \" ></i> " . getMLText ( " download " ) . " </a> " ;
2019-01-08 12:13:38 +00:00
if ( $viewonlinefiletypes && ( in_array ( strtolower ( $version -> getFileType ()), $viewonlinefiletypes ) || in_array ( strtolower ( $version -> getMimeType ()), $viewonlinefiletypes )))
2016-08-11 11:25:27 +00:00
if ( $accessop -> check_controller_access ( 'ViewOnline' , array ( 'action' => 'run' )))
2020-08-27 06:27:19 +00:00
print " <li><a target= \" _blank \" href= \" ../op/op.ViewOnline.php?documentid= " . $document -> getID () . " &version= " . $version -> getVersion () . " \" ><i class= \" fa fa-star \" ></i> " . getMLText ( " view_online " ) . " </a> " ;
2015-06-23 08:14:33 +00:00
print " </ul> " ;
}
2014-03-18 09:54:24 +00:00
2020-09-17 08:51:37 +00:00
print " <ul class= \" actions unstyled \" > " ;
if ( $file_exists ){
2020-09-17 13:57:41 +00:00
if ( $accessop -> mayEditVersion ( $version -> getDocument ())) {
2020-09-17 08:51:37 +00:00
print " <li><a href= \" ../out/out.EditOnline.php?documentid= " . $document -> getId () . " &version= " . $version -> getVersion () . " \" ><i class= \" fa fa-edit \" ></i> " . getMLText ( " edit_version " ) . " </a></li> " ;
2012-12-14 07:53:13 +00:00
}
}
2020-09-17 13:57:41 +00:00
if ( $accessop -> mayRemoveVersion ( $version -> getDocument ())) {
2020-09-17 08:51:37 +00:00
print " <li><a href= \" out.RemoveVersion.php?documentid= " . $document -> getID () . " &version= " . $version -> getVersion () . " \" ><i class= \" fa fa-remove \" ></i> " . getMLText ( " rm_version " ) . " </a></li> " ;
2012-12-14 07:53:13 +00:00
}
2020-09-17 13:57:41 +00:00
if ( $accessop -> mayOverrideStatus ( $version -> getDocument ())) {
2020-09-17 08:51:37 +00:00
print " <li><a href='../out/out.OverrideContentStatus.php?documentid= " . $document -> getID () . " &version= " . $version -> getVersion () . " '><i class= \" fa fa-align-justify \" ></i> " . getMLText ( " change_status " ) . " </a></li> " ;
2012-12-14 07:53:13 +00:00
}
2020-09-17 13:57:41 +00:00
if ( $accessop -> mayEditComment ( $version -> getDocument ())) {
2020-09-17 08:51:37 +00:00
print " <li><a href= \" out.EditComment.php?documentid= " . $document -> getID () . " &version= " . $version -> getVersion () . " \" ><i class= \" fa fa-comment \" ></i> " . getMLText ( " edit_comment " ) . " </a></li> " ;
2012-12-14 07:53:13 +00:00
}
2020-09-17 13:57:41 +00:00
if ( $accessop -> mayEditAttributes ( $version -> getDocument ())) {
2020-09-17 08:51:37 +00:00
print " <li><a href= \" out.EditAttributes.php?documentid= " . $document -> getID () . " &version= " . $version -> getVersion () . " \" ><i class= \" fa fa-edit \" ></i> " . getMLText ( " edit_attributes " ) . " </a></li> " ;
}
print " </ul> " ;
2012-12-14 07:53:13 +00:00
echo " </td> " ;
print " </tr></tbody> \n </table> \n " ;
2017-07-31 13:36:34 +00:00
$this -> contentContainerEnd ();
2012-12-14 07:53:13 +00:00
2020-10-08 05:57:23 +00:00
$this -> rowStart ();
$this -> columnStart ( 6 );
2012-12-14 07:53:13 +00:00
2020-09-17 08:51:37 +00:00
if ( is_array ( $reviewStatus ) && count ( $reviewStatus ) > 0 ) { /* {{{ */
2012-12-14 07:53:13 +00:00
2020-09-17 08:51:37 +00:00
print " <legend> " . getMLText ( 'reviewers' ) . " </legend> " ;
print " <table class= \" table table-condensed \" > \n " ;
2012-12-14 07:53:13 +00:00
print " <tr> \n " ;
2020-09-17 08:51:37 +00:00
print " <td><b> " . getMLText ( " name " ) . " </b></td> \n " ;
print " <td><b> " . getMLText ( " last_update " ) . " </b></td> \n " ;
// print "<td width='25%'><b>".getMLText("comment")."</b></td>";
print " <td><b> " . getMLText ( " status " ) . " </b></td> \n " ;
2012-12-14 07:53:13 +00:00
print " </tr> \n " ;
foreach ( $reviewStatus as $r ) {
$required = null ;
switch ( $r [ " type " ]) {
case 0 : // Reviewer is an individual.
$required = $dms -> getUser ( $r [ " required " ]);
if ( ! is_object ( $required )) {
$reqName = getMLText ( " unknown_user " ) . " ' " . $r [ " required " ] . " ' " ;
}
else {
2020-09-17 08:51:37 +00:00
$reqName = " <i class= \" fa fa-user \" ></i> " . htmlspecialchars ( $required -> getFullName () . " ( " . $required -> getLogin () . " ) " );
2012-12-14 07:53:13 +00:00
}
break ;
case 1 : // Reviewer is a group.
$required = $dms -> getGroup ( $r [ " required " ]);
if ( ! is_object ( $required )) {
$reqName = getMLText ( " unknown_group " ) . " ' " . $r [ " required " ] . " ' " ;
}
else {
2020-09-17 08:51:37 +00:00
$reqName = " <i class= \" fa fa-group \" ></i> " . htmlspecialchars ( $required -> getName ());
2012-12-14 07:53:13 +00:00
}
break ;
}
2020-09-17 08:51:37 +00:00
print " <tr " . ( $r [ 'status' ] == 1 ? ' class="success"' : ( $r [ 'status' ] == - 1 ? ' class="error"' : '' )) . " > \n " ;
2012-12-14 07:53:13 +00:00
print " <td> " . $reqName . " </td> \n " ;
2020-12-01 20:43:10 +00:00
print " <td><i style= \" font-size: 80%; \" > " . getLongReadableDate ( $r [ " date " ]) . " - " ;
2020-09-17 08:51:37 +00:00
/* $updateUser is the user who has done the review */
2012-12-14 07:53:13 +00:00
$updateUser = $dms -> getUser ( $r [ " userID " ]);
2020-09-17 08:51:37 +00:00
print ( is_object ( $updateUser ) ? htmlspecialchars ( $updateUser -> getFullName () . " ( " . $updateUser -> getLogin () . " ) " ) : " unknown user id ' " . $r [ " userID " ] . " ' " ) . " </i><br /> " ;
print htmlspecialchars ( $r [ " comment " ]);
if ( $r [ 'file' ]) {
echo " <br /> " ;
echo " <a href= \" ../op/op.Download.php?documentid= " . $documentid . " &reviewlogid= " . $r [ 'reviewLogID' ] . " \" class= \" btn btn-mini \" ><i class= \" fa fa-download \" ></i> " . getMLText ( 'download' ) . " </a> " ;
}
print " </td> \n " ;
2012-12-14 07:53:13 +00:00
print " <td> " . getReviewStatusText ( $r [ " status " ]) . " </td> \n " ;
print " </tr> \n " ;
}
2020-09-17 08:51:37 +00:00
print " </table> \n " ;
} /* }}} */
2012-12-14 07:53:13 +00:00
2020-10-08 05:57:23 +00:00
$this -> columnEnd ();
$this -> columnStart ( 6 );
2012-12-14 07:53:13 +00:00
2020-09-17 08:51:37 +00:00
if ( is_array ( $approvalStatus ) && count ( $approvalStatus ) > 0 ) { /* {{{ */
print " <legend> " . getMLText ( 'approvers' ) . " </legend> " ;
print " <table class= \" table table-condensed \" > \n " ;
2012-12-14 07:53:13 +00:00
print " <tr> \n " ;
2020-09-17 08:51:37 +00:00
print " <td><b> " . getMLText ( " name " ) . " </b></td> \n " ;
print " <td><b> " . getMLText ( " last_update " ) . " </b></td> \n " ;
// print "<td width='25%'><b>".getMLText("comment")."</b></td>";
print " <td><b> " . getMLText ( " status " ) . " </b></td> \n " ;
2012-12-14 07:53:13 +00:00
print " </tr> \n " ;
foreach ( $approvalStatus as $a ) {
$required = null ;
switch ( $a [ " type " ]) {
case 0 : // Approver is an individual.
$required = $dms -> getUser ( $a [ " required " ]);
if ( ! is_object ( $required )) {
2022-09-09 05:53:28 +00:00
$reqName = getMLText ( " unknown_user " ) . " ' " . $a [ " required " ] . " ' " ;
2012-12-14 07:53:13 +00:00
}
else {
2020-09-17 08:51:37 +00:00
$reqName = " <i class= \" fa fa-user \" ></i> " . htmlspecialchars ( $required -> getFullName () . " ( " . $required -> getLogin () . " ) " );
2012-12-14 07:53:13 +00:00
}
break ;
case 1 : // Approver is a group.
$required = $dms -> getGroup ( $a [ " required " ]);
if ( ! is_object ( $required )) {
2022-09-09 05:53:28 +00:00
$reqName = getMLText ( " unknown_group " ) . " ' " . $a [ " required " ] . " ' " ;
2012-12-14 07:53:13 +00:00
}
else {
2020-09-17 08:51:37 +00:00
$reqName = " <i class= \" fa fa-group \" ></i> " . htmlspecialchars ( $required -> getName ());
2012-12-14 07:53:13 +00:00
}
break ;
}
2020-09-17 08:51:37 +00:00
print " <tr " . ( $a [ 'status' ] == 1 ? ' class="success"' : ( $a [ 'status' ] == - 1 ? ' class="error"' : ( $a [ 'status' ] == - 2 ? ' class=""' : '' ))) . " > \n " ;
2012-12-14 07:53:13 +00:00
print " <td> " . $reqName . " </td> \n " ;
2020-12-01 20:43:10 +00:00
print " <td><i style= \" font-size: 80%; \" > " . getLongReadableDate ( $a [ " date " ]) . " - " ;
2020-09-17 08:51:37 +00:00
/* $updateUser is the user who has done the approval */
2012-12-14 07:53:13 +00:00
$updateUser = $dms -> getUser ( $a [ " userID " ]);
2020-09-17 08:51:37 +00:00
print ( is_object ( $updateUser ) ? htmlspecialchars ( $updateUser -> getFullName () . " ( " . $updateUser -> getLogin () . " ) " ) : " unknown user id ' " . $a [ " userID " ] . " ' " ) . " </i><br /> " ;
print htmlspecialchars ( $a [ " comment " ]);
if ( $a [ 'file' ]) {
echo " <br /> " ;
echo " <a href= \" ../op/op.Download.php?documentid= " . $documentid . " &approvelogid= " . $a [ 'approveLogID' ] . " \" class= \" btn btn-mini \" ><i class= \" fa fa-download \" ></i> " . getMLText ( 'download' ) . " </a> " ;
}
echo " </td> \n " ;
2012-12-14 07:53:13 +00:00
print " <td> " . getApprovalStatusText ( $a [ " status " ]) . " </td> \n " ;
print " </tr> \n " ;
}
2020-09-17 08:51:37 +00:00
print " </table> \n " ;
} /* }}} */
2012-12-14 07:53:13 +00:00
2020-10-08 05:57:23 +00:00
$this -> columnEnd ();
$this -> rowEnd ();
2015-06-23 08:02:45 +00:00
2020-09-17 08:51:37 +00:00
/* Get attachments exclusively for this version , without those
* attached to the document
2016-11-24 10:42:53 +00:00
*/
2020-09-17 08:51:37 +00:00
$files = $document -> getDocumentFiles ( $version -> getVersion (), false );
/* Do the regular filtering by isPublic and access rights */
$files = SeedDMS_Core_DMS :: filterDocumentFiles ( $user , $files );
2016-11-24 10:42:53 +00:00
2020-09-17 08:51:37 +00:00
if ( count ( $files ) > 0 ) { /* {{{ */
2016-11-24 10:42:53 +00:00
$this -> contentHeading ( getMLText ( " linked_files " ));
$this -> contentContainerStart ();
$documentid = $document -> getID ();
print " <table class= \" table \" > " ;
print " <thead> \n <tr> \n " ;
print " <th width='20%'></th> \n " ;
print " <th width='20%'> " . getMLText ( " file " ) . " </th> \n " ;
print " <th width='40%'> " . getMLText ( " comment " ) . " </th> \n " ;
print " <th width='20%'></th> \n " ;
print " </tr> \n </thead> \n <tbody> \n " ;
foreach ( $files as $file ) {
$file_exists = file_exists ( $dms -> contentDir . $file -> getPath ());
$responsibleUser = $file -> getUser ();
print " <tr> " ;
print " <td> " ;
$previewer -> createPreview ( $file , $previewwidthdetail );
if ( $file_exists ) {
2019-01-08 12:13:38 +00:00
if ( $viewonlinefiletypes && ( in_array ( strtolower ( $file -> getFileType ()), $viewonlinefiletypes ) || in_array ( strtolower ( $file -> getMimeType ()), $viewonlinefiletypes ))) {
2016-11-24 10:42:53 +00:00
print " <a target= \" _blank \" href= \" ../op/op.ViewOnline.php?documentid= " . $documentid . " &file= " . $file -> getID () . " \" > " ;
} else {
print " <a href= \" ../op/op.Download.php?documentid= " . $documentid . " &file= " . $file -> getID () . " \" > " ;
}
}
if ( $previewer -> hasPreview ( $file )) {
print ( " <img class= \" mimeicon \" width= \" " . $previewwidthdetail . " \" src= \" ../op/op.Preview.php?documentid= " . $document -> getID () . " &file= " . $file -> getID () . " &width= " . $previewwidthdetail . " \" title= \" " . htmlspecialchars ( $file -> getMimeType ()) . " \" > " );
} else {
print " <img class= \" mimeicon \" src= \" " . $this -> getMimeIcon ( $file -> getFileType ()) . " \" title= \" " . htmlspecialchars ( $file -> getMimeType ()) . " \" > " ;
}
if ( $file_exists ) {
print " </a> " ;
}
print " </td> " ;
print " <td><ul class= \" unstyled \" > \n " ;
print " <li> " . htmlspecialchars ( $file -> getName ()) . " </li> \n " ;
print " <li> " . htmlspecialchars ( $file -> getOriginalFileName ()) . " </li> \n " ;
if ( $file_exists )
print " <li> " . SeedDMS_Core_File :: format_filesize ( filesize ( $dms -> contentDir . $file -> getPath ())) . " bytes, " . htmlspecialchars ( $file -> getMimeType ()) . " </li> " ;
else print " <li> " . htmlspecialchars ( $file -> getMimeType ()) . " - <span class= \" warning \" > " . getMLText ( " document_deleted " ) . " </span></li> " ;
2021-01-11 06:59:32 +00:00
print " <li> " . getMLText ( " uploaded_by " ) . " <a href= \" mailto: " . htmlspecialchars ( $responsibleUser -> getEmail ()) . " \" > " . htmlspecialchars ( $responsibleUser -> getFullName ()) . " </a></li> " ;
2016-11-24 10:42:53 +00:00
print " <li> " . getLongReadableDate ( $file -> getDate ()) . " </li> " ;
if ( $file -> getVersion ())
print " <li> " . getMLText ( 'linked_to_this_version' ) . " </li> " ;
print " </ul></td> " ;
print " <td> " . htmlspecialchars ( $file -> getComment ()) . " </td> " ;
print " <td><ul class= \" unstyled actions \" > " ;
if ( $file_exists ) {
2020-08-27 05:52:52 +00:00
print " <li><a href= \" ../op/op.Download.php?documentid= " . $documentid . " &file= " . $file -> getID () . " \" ><i class= \" fa fa-download \" ></i> " . getMLText ( 'download' ) . " </a></li> " ;
2019-01-08 12:13:38 +00:00
if ( $viewonlinefiletypes && ( in_array ( strtolower ( $file -> getFileType ()), $viewonlinefiletypes ) || in_array ( strtolower ( $file -> getMimeType ()), $viewonlinefiletypes ))) {
2020-08-27 05:52:52 +00:00
print " <li><a target= \" _blank \" href= \" ../op/op.ViewOnline.php?documentid= " . $documentid . " &file= " . $file -> getID () . " \" ><i class= \" fa fa-star \" ></i> " . getMLText ( " view_online " ) . " </a></li> " ;
2016-11-24 10:42:53 +00:00
}
} else print " <li><img class= \" mimeicon \" src= \" images/icons/ " . $this -> getMimeIcon ( $file -> getFileType ()) . " \" title= \" " . htmlspecialchars ( $file -> getMimeType ()) . " \" > " ;
echo " </ul><ul class= \" unstyled actions \" > " ;
2017-12-05 07:28:03 +00:00
if (( $document -> getAccessMode ( $user ) == M_ALL ) || ( $file -> getUserID () == $user -> getID ())) {
2020-08-27 05:52:52 +00:00
print " <li><a href= \" out.RemoveDocumentFile.php?documentid= " . $documentid . " &fileid= " . $file -> getID () . " \" ><i class= \" fa fa-remove \" ></i> " . getMLText ( " delete " ) . " </a></li> " ;
print " <li><a href= \" out.EditDocumentFile.php?documentid= " . $documentid . " &fileid= " . $file -> getID () . " \" ><i class= \" fa fa-edit \" ></i> " . getMLText ( " edit " ) . " </a></li> " ;
2017-12-05 07:28:03 +00:00
}
2016-11-24 10:42:53 +00:00
print " </ul></td> " ;
print " </tr> " ;
}
print " </tbody> \n </table> \n " ;
$this -> contentContainerEnd ();
2020-09-17 08:51:37 +00:00
} /* }}} */
2016-11-24 10:42:53 +00:00
2017-07-31 13:36:34 +00:00
if ( $user -> isAdmin () || $user -> getId () == $document -> getOwner () -> getId ()) {
2015-11-11 09:29:49 +00:00
$this -> contentHeading ( getMLText ( " status " ));
$this -> contentContainerStart ();
$statuslog = $version -> getStatusLog ();
echo " <table class= \" table table-condensed \" ><thead> " ;
echo " <th> " . getMLText ( 'date' ) . " </th><th> " . getMLText ( 'status' ) . " </th><th> " . getMLText ( 'user' ) . " </th><th> " . getMLText ( 'comment' ) . " </th></tr> \n " ;
echo " </thead><tbody> " ;
foreach ( $statuslog as $entry ) {
if ( $suser = $dms -> getUser ( $entry [ 'userID' ]))
$fullname = $suser -> getFullName ();
else
$fullname = " -- " ;
2020-12-01 20:43:10 +00:00
echo " <tr><td> " . getLongReadableDate ( $entry [ 'date' ]) . " </td><td> " . getOverallStatusText ( $entry [ 'status' ]) . " </td><td> " . $fullname . " </td><td> " . $entry [ 'comment' ] . " </td></tr> \n " ;
2015-11-11 09:29:49 +00:00
}
print " </tbody> \n </table> \n " ;
$this -> contentContainerEnd ();
2017-02-27 07:58:10 +00:00
$wkflogs = $version -> getWorkflowLog ();
if ( $wkflogs ) {
$this -> contentHeading ( getMLText ( " workflow_summary " ));
$this -> contentContainerStart ();
echo " <table class= \" table table-condensed \" ><thead> " ;
echo " <th> " . getMLText ( 'date' ) . " </th><th> " . getMLText ( 'action' ) . " </th><th> " . getMLText ( 'user' ) . " </th><th> " . getMLText ( 'comment' ) . " </th></tr> \n " ;
echo " </thead><tbody> " ;
foreach ( $wkflogs as $wkflog ) {
echo " <tr> " ;
echo " <td> " . $wkflog -> getDate () . " </td> " ;
echo " <td> " . $wkflog -> getTransition () -> getAction () -> getName () . " </td> " ;
$loguser = $wkflog -> getUser ();
echo " <td> " . $loguser -> getFullName () . " </td> " ;
echo " <td> " . $wkflog -> getComment () . " </td> " ;
echo " </tr> " ;
}
print " </tbody> \n </table> \n " ;
$this -> contentContainerEnd ();
}
2020-10-08 05:57:23 +00:00
$this -> rowStart ();
2015-06-23 08:02:45 +00:00
/* Check for an existing review log , even if the workflowmode
* is set to traditional_only_approval . There may be old documents
* that still have a review log if the workflow mode has been
* changed afterwards .
*/
if ( $version -> getReviewStatus ( 10 )) {
2020-10-08 05:57:23 +00:00
$this -> columnStart ( 6 );
$this -> printProtocol ( $version , 'review' );
$this -> columnEnd ();
2015-06-23 08:02:45 +00:00
}
if ( $version -> getApprovalStatus ( 10 )) {
2020-10-08 05:57:23 +00:00
$this -> columnStart ( 6 );
$this -> printProtocol ( $version , 'approval' );
$this -> columnEnd ();
2015-06-23 08:02:45 +00:00
}
2020-10-08 05:57:23 +00:00
$this -> rowEnd ();
2020-10-08 07:36:41 +00:00
if ( $version -> getReceiptStatus ()) {
$this -> rowStart ();
$this -> columnStart ( 12 );
$this -> printProtocol ( $version , 'receipt' );
$this -> columnEnd ();
$this -> rowEnd ();
}
if ( $version -> getRevisionStatus ()) {
$this -> rowStart ();
$this -> columnStart ( 12 );
2017-01-20 13:28:30 +00:00
$this -> printProtocol ( $version , 'revision' );
2020-10-08 07:36:41 +00:00
$this -> columnEnd ();
$this -> rowEnd ();
}
2015-06-23 08:02:45 +00:00
}
2016-03-15 07:30:53 +00:00
$this -> contentEnd ();
2012-12-14 07:53:13 +00:00
$this -> htmlEndPage ();
} /* }}} */
}
?>