2012-12-14 07:53:13 +00:00
< ? php
/**
* Implementation of ViewDocument 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
*/
require_once ( " class.Bootstrap.php " );
2016-04-26 10:16:29 +00:00
/**
* Include class to preview documents
*/
require_once ( " SeedDMS/Preview.php " );
2012-12-14 07:53:13 +00:00
/**
* Class which outputs the html page for ViewDocument 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 @
*/
2013-02-14 11:10:53 +00:00
class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
2012-12-14 07:53:13 +00:00
2015-04-14 17:38:50 +00:00
protected function getAccessModeText ( $defMode ) { /* {{{ */
2013-02-06 13:58:15 +00:00
switch ( $defMode ) {
case M_NONE :
return getMLText ( " access_mode_none " );
break ;
case M_READ :
return getMLText ( " access_mode_read " );
break ;
case M_READWRITE :
return getMLText ( " access_mode_readwrite " );
break ;
case M_ALL :
return getMLText ( " access_mode_all " );
break ;
}
} /* }}} */
2015-04-14 17:38:50 +00:00
protected function printAccessList ( $obj ) { /* {{{ */
2013-02-06 13:58:15 +00:00
$accessList = $obj -> getAccessList ();
if ( count ( $accessList [ " users " ]) == 0 && count ( $accessList [ " groups " ]) == 0 )
return ;
2017-01-26 13:44:07 +00:00
$content = '' ;
2013-02-06 13:58:15 +00:00
for ( $i = 0 ; $i < count ( $accessList [ " groups " ]); $i ++ )
{
$group = $accessList [ " groups " ][ $i ] -> getGroup ();
$accesstext = $this -> getAccessModeText ( $accessList [ " groups " ][ $i ] -> getMode ());
2017-01-26 13:44:07 +00:00
$content .= $accesstext . " : " . htmlspecialchars ( $group -> getName ());
2013-02-06 13:58:15 +00:00
if ( $i + 1 < count ( $accessList [ " groups " ]) || count ( $accessList [ " users " ]) > 0 )
2017-01-26 13:44:07 +00:00
$content .= " <br /> " ;
2013-02-06 13:58:15 +00:00
}
for ( $i = 0 ; $i < count ( $accessList [ " users " ]); $i ++ )
{
$user = $accessList [ " users " ][ $i ] -> getUser ();
$accesstext = $this -> getAccessModeText ( $accessList [ " users " ][ $i ] -> getMode ());
2017-01-26 13:44:07 +00:00
$content .= $accesstext . " : " . htmlspecialchars ( $user -> getFullName ());
2013-02-06 13:58:15 +00:00
if ( $i + 1 < count ( $accessList [ " users " ]))
2017-01-26 13:44:07 +00:00
$content .= " <br /> " ;
}
if ( count ( $accessList [ " groups " ]) + count ( $accessList [ " users " ]) > 3 ) {
$this -> printPopupBox ( getMLText ( 'list_access_rights' ), $content );
} else {
echo $content ;
2013-02-06 13:58:15 +00:00
}
} /* }}} */
2015-04-14 17:38:50 +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>
2015-04-15 14:14:47 +00:00
< td >
< ? php
switch ( $attrdef -> getType ()) {
case SeedDMS_Core_AttributeDefinition :: type_url :
$attrs = $attribute -> getValueAsArray ();
$tmp = array ();
foreach ( $attrs as $attr ) {
$tmp [] = '<a href="' . htmlspecialchars ( $attr ) . '">' . htmlspecialchars ( $attr ) . '</a>' ;
}
echo implode ( '<br />' , $tmp );
break ;
case SeedDMS_Core_AttributeDefinition :: type_email :
$attrs = $attribute -> getValueAsArray ();
$tmp = array ();
foreach ( $attrs as $attr ) {
$tmp [] = '<a mailto="' . htmlspecialchars ( $attr ) . '">' . htmlspecialchars ( $attr ) . '</a>' ;
}
echo implode ( '<br />' , $tmp );
break ;
default :
echo htmlspecialchars ( implode ( ', ' , $attribute -> getValueAsArray ()));
}
?>
</ td >
2015-04-14 17:38:50 +00:00
</ tr >
< ? php
} /* }}} */
2017-03-10 19:08:01 +00:00
function documentListItem () { /* {{{ */
$dms = $this -> params [ 'dms' ];
$user = $this -> params [ 'user' ];
$previewwidth = $this -> params [ 'previewWidthList' ];
$cachedir = $this -> params [ 'cachedir' ];
$document = $this -> params [ 'document' ];
if ( $document ) {
if ( $document -> getAccessMode ( $user ) >= M_READ ) {
$previewer = new SeedDMS_Preview_Previewer ( $cachedir , $previewwidth );
2017-10-26 05:57:19 +00:00
$txt = $this -> callHook ( 'documentListItem' , $document , $previewer , 'viewitem' );
2017-03-10 19:08:01 +00:00
if ( is_string ( $txt ))
$content = $txt ;
else
$content = $this -> documentListRow ( $document , $previewer , true );
echo $content ;
}
}
} /* }}} */
2015-10-19 11:15:20 +00:00
function timelinedata () { /* {{{ */
$dms = $this -> params [ 'dms' ];
$user = $this -> params [ 'user' ];
$document = $this -> params [ 'document' ];
$jsondata = array ();
if ( $user -> isAdmin ()) {
$data = $document -> getTimeline ();
2015-10-20 16:36:24 +00:00
foreach ( $data as $i => $item ) {
2015-10-19 11:15:20 +00:00
switch ( $item [ 'type' ]) {
case 'add_version' :
$msg = getMLText ( 'timeline_' . $item [ 'type' ], array ( 'document' => htmlspecialchars ( $item [ 'document' ] -> getName ()), 'version' => $item [ 'version' ]));
break ;
case 'add_file' :
$msg = getMLText ( 'timeline_' . $item [ 'type' ], array ( 'document' => htmlspecialchars ( $item [ 'document' ] -> getName ())));
break ;
case 'status_change' :
$msg = getMLText ( 'timeline_' . $item [ 'type' ], array ( 'document' => htmlspecialchars ( $item [ 'document' ] -> getName ()), 'version' => $item [ 'version' ], 'status' => getOverallStatusText ( $item [ 'status' ])));
break ;
2018-01-18 16:29:10 +00:00
case 'scheduled_revision' :
2018-03-20 10:06:38 +00:00
$msg = getMLText ( 'timeline_' . $item [ 'type' ], array ( 'document' => htmlspecialchars ( $item [ 'document' ] -> getName ()), 'version' => $item [ 'version' ]));
2018-01-18 16:29:10 +00:00
break ;
2015-10-19 11:15:20 +00:00
default :
$msg = '???' ;
}
2015-10-20 16:36:24 +00:00
$data [ $i ][ 'msg' ] = $msg ;
2015-10-19 11:15:20 +00:00
}
foreach ( $data as $item ) {
if ( $item [ 'type' ] == 'status_change' )
$classname = $item [ 'type' ] . " _ " . $item [ 'status' ];
else
$classname = $item [ 'type' ];
$d = makeTsFromLongDate ( $item [ 'date' ]);
$jsondata [] = array ( 'start' => date ( 'c' , $d ) /*$item['date']*/ , 'content' => $item [ 'msg' ], 'className' => $classname );
}
}
header ( 'Content-Type: application/json' );
echo json_encode ( $jsondata );
} /* }}} */
2015-12-11 19:29:52 +00:00
function js () { /* {{{ */
2016-03-21 07:33:41 +00:00
$dms = $this -> params [ 'dms' ];
$user = $this -> params [ 'user' ];
2015-12-11 19:29:52 +00:00
$document = $this -> params [ 'document' ];
2016-01-28 15:50:06 +00:00
header ( 'Content-Type: application/javascript' );
2016-03-21 07:33:41 +00:00
if ( $user -> isAdmin ()) {
$this -> printTimelineJs ( 'out.ViewDocument.php?action=timelinedata&documentid=' . $document -> getID (), 300 , '' , date ( 'Y-m-d' ));
}
2015-12-11 19:29:52 +00:00
$this -> printDocumentChooserJs ( " form1 " );
2018-01-26 17:51:59 +00:00
$this -> printDeleteDocumentButtonJs ();
2015-12-11 19:29:52 +00:00
} /* }}} */
2016-12-22 08:31:46 +00:00
function documentInfos () { /* {{{ */
2012-12-14 07:53:13 +00:00
$dms = $this -> params [ 'dms' ];
$user = $this -> params [ 'user' ];
$document = $this -> params [ 'document' ];
2015-05-29 18:48:27 +00:00
$checkoutdir = $this -> params [ 'checkOutDir' ];
2012-12-14 07:53:13 +00:00
2013-01-28 10:44:53 +00:00
$this -> contentHeading ( getMLText ( " document_infos " ));
2015-11-30 19:44:33 +00:00
if ( $info = $document -> getCheckOutInfo ()) {
2015-05-29 18:48:27 +00:00
echo " <div class= \" alert alert-info \" > " ;
2015-12-01 17:06:41 +00:00
$session = $this -> params [ 'session' ];
if ( $session -> getSu ()) {
$origuser = $dms -> getUser ( $session -> getUser ());
$checkoutpath = sprintf ( $checkoutdir , preg_replace ( '/[^A-Za-z0-9_-]/' , '' , $origuser -> getLogin ()));
} else {
$checkoutpath = sprintf ( $checkoutdir , preg_replace ( '/[^A-Za-z0-9_-]/' , '' , $user -> getLogin ()));
}
echo " <a href= \" file:// " . $info [ 'filename' ] . " \" > " . getMLText ( 'copied_to_checkout_as' , array ( 'date' => $info [ 'date' ], 'filename' => substr ( $info [ 'filename' ], strlen ( $checkoutpath ) + 1 ))) . " </a> " ;
2015-05-29 18:48:27 +00:00
echo " </div> " ;
}
2012-12-14 07:53:13 +00:00
$this -> contentContainerStart ();
2015-08-07 08:13:47 +00:00
$txt = $this -> callHook ( 'preDocumentInfos' , $document );
if ( is_string ( $txt ))
echo $txt ;
2015-04-14 17:38:50 +00:00
$txt = $this -> callHook ( 'documentInfos' , $document );
if ( is_string ( $txt ))
echo $txt ;
else {
2012-12-14 07:53:13 +00:00
?>
< table class = " table-condensed " >
2013-02-07 21:40:46 +00:00
< ? php
if ( $user -> isAdmin ()) {
echo " <tr> " ;
echo " <td> " . getMLText ( " id " ) . " :</td> \n " ;
echo " <td> " . htmlspecialchars ( $document -> getID ()) . " </td> \n " ;
echo " </tr> " ;
}
?>
2012-12-14 07:53:13 +00:00
< tr >
2013-01-28 10:44:53 +00:00
< td >< ? php printMLText ( " name " ); ?> :</td>
< td >< ? php print htmlspecialchars ( $document -> getName ()); ?> </td>
</ tr >
< tr >
2012-12-14 07:53:13 +00:00
< td >< ? php printMLText ( " owner " ); ?> :</td>
< td >
2013-02-06 13:58:15 +00:00
< ? php
2012-12-14 07:53:13 +00:00
$owner = $document -> getOwner ();
print " <a class= \" infos \" href= \" mailto: " . $owner -> getEmail () . " \" > " . htmlspecialchars ( $owner -> getFullName ()) . " </a> " ;
2013-02-06 13:58:15 +00:00
?>
2012-12-14 07:53:13 +00:00
</ td >
</ tr >
2013-02-06 13:58:15 +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 >
2013-02-06 13:58:15 +00:00
< ? php
}
if ( $user -> isAdmin ()) {
2016-04-22 14:36:47 +00:00
echo " <tr> " ;
echo " <td> " . getMLText ( 'default_access' ) . " :</td> " ;
echo " <td> " . $this -> getAccessModeText ( $document -> getDefaultAccess ()) . " </td> " ;
echo " </tr> " ;
2013-02-06 13:58:15 +00:00
if ( $document -> inheritsAccess ()) {
echo " <tr> " ;
echo " <td> " . getMLText ( " access_mode " ) . " :</td> \n " ;
echo " <td> " ;
2016-04-22 14:36:47 +00:00
echo getMLText ( " inherited " ) . " <br /> " ;
$this -> printAccessList ( $document );
2013-02-06 13:58:15 +00:00
echo " </tr> " ;
} else {
echo " <tr> " ;
2013-02-16 18:43:39 +00:00
echo " <td> " . getMLText ( 'access_mode' ) . " :</td> " ;
2013-02-06 13:58:15 +00:00
echo " <td> " ;
$this -> printAccessList ( $document );
echo " </td> " ;
echo " </tr> " ;
}
}
?>
< tr >
< td >< ? php printMLText ( " used_discspace " ); ?> :</td>
2013-02-14 11:10:53 +00:00
< td >< ? php print SeedDMS_Core_File :: format_filesize ( $document -> getUsedDiskSpace ()); ?> </td>
2013-02-06 13:58:15 +00:00
</ tr >
2012-12-14 07:53:13 +00:00
< tr >
< td >< ? php printMLText ( " creation_date " ); ?> :</td>
< td >< ? php print getLongReadableDate ( $document -> getDate ()); ?> </td>
</ tr >
2013-02-06 13:58:15 +00:00
< ? php
2013-04-30 06:36:53 +00:00
if ( $document -> expires ()) {
?>
< tr >
< td >< ? php printMLText ( " expires " ); ?> :</td>
< td >< ? php print getReadableDate ( $document -> getExpires ()); ?> </td>
</ tr >
< ? php
}
2013-02-06 13:58:15 +00:00
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 >
2013-02-06 13:58:15 +00:00
< ? php
}
if ( $cats = $document -> getCategories ()) {
?>
2012-12-14 07:53:13 +00:00
< tr >
< td >< ? php printMLText ( " categories " ); ?> :</td>
< td >
< ? php
$ct = array ();
foreach ( $cats as $cat )
$ct [] = htmlspecialchars ( $cat -> getName ());
echo implode ( ', ' , $ct );
?>
</ td >
</ tr >
2013-02-06 13:58:15 +00:00
< ? php
}
?>
2012-12-14 07:53:13 +00:00
< ? php
$attributes = $document -> getAttributes ();
if ( $attributes ) {
foreach ( $attributes as $attribute ) {
2015-04-27 06:27:19 +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> " ;
} else {
$this -> printAttribute ( $attribute );
}
2012-12-14 07:53:13 +00:00
}
}
?>
</ table >
< ? php
2015-04-14 17:38:50 +00:00
}
2015-08-07 08:13:47 +00:00
$txt = $this -> callHook ( 'postDocumentInfos' , $document );
if ( is_string ( $txt ))
echo $txt ;
2012-12-14 07:53:13 +00:00
$this -> contentContainerEnd ();
2016-12-22 08:31:46 +00:00
} /* }}} */
2016-05-09 06:21:21 +00:00
function preview () { /* {{{ */
2017-01-04 16:14:45 +00:00
$dms = $this -> params [ 'dms' ];
2016-05-09 06:21:21 +00:00
$document = $this -> params [ 'document' ];
2016-11-07 08:25:55 +00:00
$timeout = $this -> params [ 'timeout' ];
$showfullpreview = $this -> params [ 'showFullPreview' ];
$converttopdf = $this -> params [ 'convertToPdf' ];
2017-11-22 12:53:30 +00:00
$pdfconverters = $this -> params [ 'pdfConverters' ];
2016-11-07 08:25:55 +00:00
$cachedir = $this -> params [ 'cachedir' ];
if ( ! $showfullpreview )
return ;
2017-01-04 16:11:39 +00:00
$accessop = $this -> params [ 'accessobject' ];
2017-06-26 08:20:48 +00:00
if ( $accessop -> check_controller_access ( 'ViewOnline' , array ( 'action' => 'version' ))) {
2017-01-04 16:11:39 +00:00
$latestContent = $document -> getLatestContent ();
2017-01-04 16:23:59 +00:00
$txt = $this -> callHook ( 'preDocumentPreview' , $latestContent );
2017-02-13 11:12:07 +00:00
if ( is_string ( $txt ))
echo $txt ;
$txt = $this -> callHook ( 'documentPreview' , $latestContent );
2017-01-04 16:23:59 +00:00
if ( is_string ( $txt ))
echo $txt ;
else {
switch ( $latestContent -> getMimeType ()) {
case 'audio/mpeg' :
case 'audio/mp3' :
case 'audio/ogg' :
case 'audio/wav' :
$this -> contentHeading ( getMLText ( " preview " ));
2017-01-04 16:11:39 +00:00
?>
< audio controls style = " width: 100%; " >
2017-06-26 08:20:48 +00:00
< source src = " ../op/op.ViewOnline.php?documentid=<?php echo $document->getID (); ?>&version=<?php echo $latestContent->getVersion (); ?> " type = " audio/mpeg " >
2017-01-04 16:11:39 +00:00
</ audio >
2017-11-24 08:30:22 +00:00
< ? php
break ;
2018-01-09 14:37:40 +00:00
case 'video/webm' :
2017-11-24 08:30:22 +00:00
case 'video/mp4' :
2018-02-08 13:26:36 +00:00
case 'video/avi' :
case 'video/msvideo' :
2018-01-30 07:05:00 +00:00
case 'video/x-msvideo' :
2017-11-24 08:30:22 +00:00
$this -> contentHeading ( getMLText ( " preview " ));
?>
2017-11-22 14:28:09 +00:00
< video controls style = " width: 100%; " >
< source src = " ../op/op.ViewOnline.php?documentid=<?php echo $document->getID (); ?>&version=<?php echo $latestContent->getVersion (); ?> " type = " video/mp4 " >
</ video >
2017-01-04 16:11:39 +00:00
< ? php
2017-01-04 16:23:59 +00:00
break ;
case 'application/pdf' :
$this -> contentHeading ( getMLText ( " preview " ));
2017-01-04 16:11:39 +00:00
?>
2017-06-26 08:20:48 +00:00
< iframe src = " ../pdfviewer/web/viewer.html?file=<?php echo urlencode('../../op/op.ViewOnline.php?documentid='. $document->getID ().'&version='. $latestContent->getVersion ()); ?> " width = " 100% " height = " 700px " ></ iframe >
2017-01-04 16:11:39 +00:00
< ? php
2017-01-04 16:23:59 +00:00
break ;
case 'image/svg+xml' :
$this -> contentHeading ( getMLText ( " preview " ));
2017-01-04 16:11:39 +00:00
?>
2017-06-26 08:20:48 +00:00
< img src = " ../op/op.ViewOnline.php?documentid=<?php echo $document->getID (); ?>&version=<?php echo $latestContent->getVersion (); ?> " width = " 100% " >
2017-01-04 16:11:39 +00:00
< ? php
2017-01-04 16:23:59 +00:00
break ;
default :
$txt = $this -> callHook ( 'additionalDocumentPreview' , $latestContent );
if ( is_string ( $txt ))
echo $txt ;
break ;
}
2016-12-22 08:11:40 +00:00
}
2017-01-04 16:23:59 +00:00
$txt = $this -> callHook ( 'postDocumentPreview' , $latestContent );
if ( is_string ( $txt ))
echo $txt ;
2017-01-04 16:11:39 +00:00
if ( $converttopdf ) {
$pdfpreviewer = new SeedDMS_Preview_PdfPreviewer ( $cachedir , $timeout );
2017-11-24 08:30:22 +00:00
$pdfpreviewer -> setConverters ( $pdfconverters );
2017-01-04 16:11:39 +00:00
if ( $pdfpreviewer -> hasConverter ( $latestContent -> getMimeType ())) {
2017-11-24 08:30:22 +00:00
$this -> contentHeading ( getMLText ( " preview_pdf " ));
2016-11-07 08:25:55 +00:00
?>
< iframe src = " ../pdfviewer/web/viewer.html?file=<?php echo urlencode('../../op/op.PdfPreview.php?documentid='. $document->getID ().'&version='. $latestContent->getVersion ()); ?> " width = " 100% " height = " 700px " ></ iframe >
< ? php
2017-01-04 16:11:39 +00:00
}
2016-11-07 08:25:55 +00:00
}
2016-05-09 06:21:21 +00:00
}
} /* }}} */
2012-12-14 07:53:13 +00:00
function show () { /* {{{ */
2013-04-18 20:20:28 +00:00
parent :: show ();
2012-12-14 07:53:13 +00:00
$dms = $this -> params [ 'dms' ];
$user = $this -> params [ 'user' ];
$folder = $this -> params [ 'folder' ];
$document = $this -> params [ 'document' ];
$accessop = $this -> params [ 'accessobject' ];
$viewonlinefiletypes = $this -> params [ 'viewonlinefiletypes' ];
2013-09-19 12:27:09 +00:00
$enableownerrevapp = $this -> params [ 'enableownerrevapp' ];
2017-01-04 16:11:39 +00:00
$enableownerreceipt = $this -> params [ 'enableownerreceipt' ];
2018-04-03 07:32:36 +00:00
$enablereceiptworkflow = $this -> params [ 'enablereceiptworkflow' ];
$enablerevisionworkflow = $this -> params [ 'enablerevisionworkflow' ];
2013-01-24 09:39:14 +00:00
$workflowmode = $this -> params [ 'workflowmode' ];
2012-12-19 10:28:36 +00:00
$cachedir = $this -> params [ 'cachedir' ];
2014-03-18 09:55:24 +00:00
$previewwidthlist = $this -> params [ 'previewWidthList' ];
$previewwidthdetail = $this -> params [ 'previewWidthDetail' ];
2017-01-04 16:11:39 +00:00
$previewconverters = $this -> params [ 'previewConverters' ];
2017-11-22 12:53:30 +00:00
$pdfconverters = $this -> params [ 'pdfConverters' ];
2012-12-14 07:53:13 +00:00
$documentid = $document -> getId ();
2015-06-09 07:18:29 +00:00
$currenttab = $this -> params [ 'currenttab' ];
2016-02-15 09:57:37 +00:00
$timeout = $this -> params [ 'timeout' ];
2012-12-14 07:53:13 +00:00
$versions = $document -> getContent ();
2018-01-26 17:51:59 +00:00
$this -> htmlAddHeader ( '<script type="text/javascript" src="../styles/' . $this -> theme . '/bootbox/bootbox.min.js"></script>' . " \n " , 'js' );
2015-09-18 05:55:24 +00:00
$this -> htmlAddHeader ( '<link href="../styles/' . $this -> theme . '/timeline/timeline.css" rel="stylesheet">' . " \n " , 'css' );
$this -> htmlAddHeader ( '<script type="text/javascript" src="../styles/' . $this -> theme . '/timeline/timeline-min.js"></script>' . " \n " , 'js' );
$this -> htmlAddHeader ( '<script type="text/javascript" src="../styles/' . $this -> theme . '/timeline/timeline-locales.js"></script>' . " \n " , 'js' );
2015-09-16 19:19:46 +00:00
2012-12-14 07:53:13 +00:00
$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 );
2012-12-14 07:53:13 +00:00
if ( $document -> isLocked ()) {
$lockingUser = $document -> getLockingUser ();
2015-04-14 17:38:50 +00:00
$txt = $this -> callHook ( 'documentIsLocked' , $document , $lockingUser );
if ( is_string ( $txt ))
echo $txt ;
else {
2012-12-14 07:53:13 +00:00
?>
< div class = " alert alert-warning " >
< ? php printMLText ( " lock_message " , array ( " email " => $lockingUser -> getEmail (), " username " => htmlspecialchars ( $lockingUser -> getFullName ()))); ?>
</ div >
< ? php
2015-04-14 17:38:50 +00:00
}
2012-12-14 07:53:13 +00:00
}
2013-03-28 09:18:49 +00:00
2017-10-16 07:07:04 +00:00
/* Retrieve latest content and attacheѕ files */
2016-11-24 10:42:53 +00:00
$latestContent = $document -> getLatestContent ();
$files = $document -> getDocumentFiles ( $latestContent -> getVersion ());
$files = SeedDMS_Core_DMS :: filterDocumentFiles ( $user , $files );
2013-03-28 09:18:49 +00:00
/* Retrieve linked documents */
$links = $document -> getDocumentLinks ();
2017-01-16 12:01:09 +00:00
$links = SeedDMS_Core_DMS :: filterDocumentLinks ( $user , $links , 'target' );
2013-03-28 09:18:49 +00:00
2014-03-18 06:07:12 +00:00
/* Retrieve reverse linked documents */
$reverselinks = $document -> getReverseDocumentLinks ();
2017-01-16 12:01:09 +00:00
$reverselinks = SeedDMS_Core_DMS :: filterDocumentLinks ( $user , $reverselinks , 'source' );
2014-03-18 06:07:12 +00:00
2013-04-18 11:38:02 +00:00
$needwkflaction = false ;
2015-03-16 07:58:10 +00:00
if ( $workflowmode == 'traditional' || $workflowmode == 'traditional_only_approval' ) {
2013-04-18 11:38:02 +00:00
} else {
$workflow = $latestContent -> getWorkflow ();
if ( $workflow ) {
$workflowstate = $latestContent -> getWorkflowState ();
$transitions = $workflow -> getNextTransitions ( $workflowstate );
$needwkflaction = $latestContent -> needsWorkflowAction ( $user );
}
}
if ( $needwkflaction ) {
$this -> infoMsg ( getMLText ( 'needs_workflow_action' ));
}
2013-04-30 16:14:05 +00:00
$status = $latestContent -> getStatus ();
$reviewStatus = $latestContent -> getReviewStatus ();
2014-05-22 04:46:44 +00:00
$approvalStatus = $latestContent -> getApprovalStatus ();
2017-01-04 16:11:39 +00:00
$receiptStatus = $latestContent -> getReceiptStatus ();
$revisionStatus = $latestContent -> getRevisionStatus ();
2012-12-14 07:53:13 +00:00
?>
2013-01-28 10:44:53 +00:00
< div class = " row-fluid " >
2016-11-07 08:25:55 +00:00
< div class = " span4 " >
2012-12-14 07:53:13 +00:00
< ? php
2016-12-22 08:31:46 +00:00
$this -> documentInfos ();
2016-11-09 18:54:00 +00:00
if ( $accessop -> check_controller_access ( 'ViewOnline' , array ( 'action' => 'run' ))) {
$this -> preview ();
}
2012-12-14 07:53:13 +00:00
?>
2013-01-28 10:44:53 +00:00
</ div >
2016-11-07 08:25:55 +00:00
< div class = " span8 " >
2013-04-30 17:26:33 +00:00
< ul class = " nav nav-tabs " id = " docinfotab " >
2015-06-09 07:00:22 +00:00
< li class = " <?php if(! $currenttab || $currenttab == 'docinfo') echo 'active'; ?> " >< a data - target = " #docinfo " data - toggle = " tab " >< ? php printMLText ( 'current_version' ); ?> </a></li>
2013-04-30 17:26:33 +00:00
< ? php if ( count ( $versions ) > 1 ) { ?>
2015-06-09 07:00:22 +00:00
< li class = " <?php if( $currenttab == 'previous') echo 'active'; ?> " >< a data - target = " #previous " data - toggle = " tab " >< ? php printMLText ( 'previous_versions' ); ?> </a></li>
2013-04-30 17:26:33 +00:00
< ? php
}
2015-03-16 07:58:10 +00:00
if ( $workflowmode == 'traditional' || $workflowmode == 'traditional_only_approval' ) {
2013-04-30 17:26:33 +00:00
if (( is_array ( $reviewStatus ) && count ( $reviewStatus ) > 0 ) ||
( is_array ( $approvalStatus ) && count ( $approvalStatus ) > 0 )) {
?>
2015-06-09 07:00:22 +00:00
< li class = " <?php if( $currenttab == 'revapp') echo 'active'; ?> " >< a data - target = " #revapp " data - toggle = " tab " >< ? php if ( $workflowmode == 'traditional' ) echo getMLText ( 'reviewers' ) . " / " ; echo getMLText ( 'approvers' ); ?> </a></li>
2013-04-30 17:26:33 +00:00
< ? php
}
} else {
if ( $workflow ) {
?>
2015-06-09 07:00:22 +00:00
< li class = " <?php if( $currenttab == 'workflow') echo 'active'; ?> " >< a data - target = " #workflow " data - toggle = " tab " >< ? php echo getMLText ( 'workflow' ); ?> </a></li>
2013-04-30 17:26:33 +00:00
< ? php
}
}
2015-04-28 10:18:35 +00:00
if ( is_array ( $receiptStatus ) && count ( $receiptStatus ) > 0 ) {
?>
2015-06-09 07:00:22 +00:00
< li class = " <?php if( $currenttab == 'recipients') echo 'active'; ?> " >< a data - target = " #recipients " data - toggle = " tab " >< ? php echo getMLText ( 'recipients' ); ?> </a></li>
2015-05-11 07:30:13 +00:00
< ? php
}
if ( is_array ( $revisionStatus ) && count ( $revisionStatus ) > 0 ) {
?>
2015-06-09 07:00:22 +00:00
< li class = " <?php if( $currenttab == 'revision') echo 'active'; ?> " >< a data - target = " #revision " data - toggle = " tab " >< ? php echo getMLText ( 'revise_document' ); ?> </a></li>
2015-04-28 10:18:35 +00:00
< ? php
}
2013-04-30 17:26:33 +00:00
?>
2015-06-09 07:00:22 +00:00
< li class = " <?php if( $currenttab == 'attachments') echo 'active'; ?> " >< a data - target = " #attachments " data - toggle = " tab " >< ? php printMLText ( 'linked_files' ); echo ( count ( $files )) ? " ( " . count ( $files ) . " ) " : " " ; ?> </a></li>
2017-03-06 07:53:36 +00:00
< li class = " <?php if( $currenttab == 'links') echo 'active'; ?> " >< a data - target = " #links " data - toggle = " tab " >< ? php printMLText ( 'linked_documents' ); echo ( count ( $links ) || count ( $reverselinks )) ? " ( " . count ( $links ) . " / " . count ( $reverselinks ) . " ) " : " " ; ?> </a></li>
2013-04-30 17:26:33 +00:00
</ ul >
< div class = " tab-content " >
2015-06-09 07:00:22 +00:00
< div class = " tab-pane <?php if(! $currenttab || $currenttab == 'docinfo') echo 'active'; ?> " id = " docinfo " >
2012-12-14 07:53:13 +00:00
< ? php
2013-04-18 11:38:02 +00:00
if ( ! $latestContent ) {
2012-12-14 07:53:13 +00:00
$this -> contentContainerStart ();
print getMLText ( 'document_content_missing' );
$this -> contentContainerEnd ();
2016-03-15 07:30:53 +00:00
$this -> contentEnd ();
2012-12-14 07:53:13 +00:00
$this -> htmlEndPage ();
exit ;
}
// verify if file exists
$file_exists = file_exists ( $dms -> contentDir . $latestContent -> getPath ());
$this -> contentContainerStart ();
print " <table class= \" table \" > " ;
print " <thead> \n <tr> \n " ;
2016-08-03 12:47:06 +00:00
print " <th colspan= \" 2 \" > " . htmlspecialchars ( $latestContent -> getOriginalFileName ()) . " </th> \n " ;
2015-07-14 08:00:39 +00:00
// print "<th width='*'>".getMLText("file")."</th>\n";
// print "<th width='25%'>".getMLText("comment")."</th>\n";
print " <th width='20%'> " . getMLText ( " status " ) . " </th> \n " ;
2015-06-24 15:28:17 +00:00
print " <th width='25%'></th> \n " ;
2012-12-14 07:53:13 +00:00
print " </tr></thead><tbody> \n " ;
print " <tr> \n " ;
2015-07-14 08:00:39 +00:00
print " <td style= \" width: " . $previewwidthdetail . " px; text-align: center; \" > " ;
2016-02-15 09:57:37 +00:00
$previewer = new SeedDMS_Preview_Previewer ( $cachedir , $previewwidthdetail , $timeout );
2015-06-25 17:52:02 +00:00
$previewer -> setConverters ( $previewconverters );
2012-12-14 07:53:13 +00:00
$previewer -> createPreview ( $latestContent );
2014-11-24 18:23:26 +00:00
if ( $file_exists ) {
if ( $viewonlinefiletypes && in_array ( strtolower ( $latestContent -> getFileType ()), $viewonlinefiletypes )) {
2016-08-11 10:05:36 +00:00
if ( $accessop -> check_controller_access ( 'ViewOnline' , array ( 'action' => 'run' ))) {
print " <a target= \" _blank \" href= \" ../op/op.ViewOnline.php?documentid= " . $documentid . " &version= " . $latestContent -> getVersion () . " \" > " ;
}
2014-11-24 18:23:26 +00:00
} else {
2016-08-12 10:43:21 +00:00
if ( $accessop -> check_controller_access ( 'Download' , array ( 'action' => 'version' ))) {
2016-08-11 10:05:36 +00:00
print " <a href= \" ../op/op.Download.php?documentid= " . $documentid . " &version= " . $latestContent -> getVersion () . " \" > " ;
}
2014-11-24 18:23:26 +00:00
}
}
2012-12-14 07:53:13 +00:00
if ( $previewer -> hasPreview ( $latestContent )) {
2014-03-18 09:55:24 +00:00
print ( " <img class= \" mimeicon \" width= \" " . $previewwidthdetail . " \" src= \" ../op/op.Preview.php?documentid= " . $document -> getID () . " &version= " . $latestContent -> getVersion () . " &width= " . $previewwidthdetail . " \" title= \" " . htmlspecialchars ( $latestContent -> getMimeType ()) . " \" > " );
2013-04-23 17:03:56 +00:00
} else {
2017-03-15 15:41:32 +00:00
print " <img class= \" mimeicon \" width= \" " . $previewwidthdetail . " \" src= \" " . $this -> getMimeIcon ( $latestContent -> getFileType ()) . " \" title= \" " . htmlspecialchars ( $latestContent -> getMimeType ()) . " \" > " ;
2012-12-14 07:53:13 +00:00
}
2014-11-24 18:23:26 +00:00
if ( $file_exists ) {
2016-08-11 10:05:36 +00:00
if ( $accessop -> check_controller_access ( 'Download' , array ( 'action' => 'run' )) || $accessop -> check_controller_access ( 'ViewOnline' , array ( 'action' => 'run' )))
print " </a> " ;
2014-11-24 18:23:26 +00:00
}
2012-12-14 07:53:13 +00:00
print " </td> \n " ;
2013-04-23 17:03:56 +00:00
print " <td><ul class= \" actions unstyled \" > \n " ;
2015-10-27 10:43:40 +00:00
// print "<li class=\"wordbreak\">".$latestContent->getOriginalFileName() ."</li>\n";
2013-04-23 17:03:56 +00:00
print " <li> " . getMLText ( 'version' ) . " : " . $latestContent -> getVersion () . " </li> \n " ;
2012-12-14 07:53:13 +00:00
if ( $file_exists )
2013-04-23 17:03:56 +00:00
print " <li> " . SeedDMS_Core_File :: format_filesize ( $latestContent -> getFileSize ()) . " , " . htmlspecialchars ( $latestContent -> getMimeType ()) . " </li> " ;
2012-12-14 07:53:13 +00:00
else print " <li><span class= \" warning \" > " . getMLText ( " document_deleted " ) . " </span></li> " ;
$updatingUser = $latestContent -> getUser ();
print " <li> " . getMLText ( " uploaded_by " ) . " <a href= \" mailto: " . $updatingUser -> getEmail () . " \" > " . htmlspecialchars ( $updatingUser -> getFullName ()) . " </a></li> " ;
print " <li> " . getLongReadableDate ( $latestContent -> getDate ()) . " </li> " ;
print " </ul> \n " ;
2015-07-14 08:00:39 +00:00
print " <p style= \" font-style: italic; \" > " . htmlspecialchars ( $latestContent -> getComment ()) . " </p> " ;
2013-04-23 17:03:56 +00:00
print " <ul class= \" actions unstyled \" > \n " ;
2012-12-14 07:53:13 +00:00
$attributes = $latestContent -> getAttributes ();
if ( $attributes ) {
foreach ( $attributes as $attribute ) {
2015-05-29 18:48:27 +00:00
$arr = $this -> callHook ( 'showDocumentContentAttribute' , $latestContent , $attribute );
2015-04-27 06:27:19 +00:00
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
}
}
2016-04-26 16:16:24 +00:00
print " </ul></td> \n " ;
2012-12-14 07:53:13 +00:00
2015-07-14 08:00:39 +00:00
// print "<td>".htmlspecialchars($latestContent->getComment())."</td>";
2012-12-14 07:53:13 +00:00
2013-01-24 09:39:14 +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 ){
2012-12-14 07:53:13 +00:00
print " <br><span " . ( $document -> hasExpired () ? " class= \" warning \" " : " " ) . " > " . ( ! $document -> getExpires () ? getMLText ( " does_not_expire " ) : getMLText ( " expires " ) . " : " . getReadableDate ( $document -> getExpires ())) . " </span> " ;
}
print " </td> " ;
print " <td> " ;
2013-04-23 17:03:56 +00:00
print " <ul class= \" unstyled actions \" > " ;
if ( $file_exists ){
2016-08-12 10:43:21 +00:00
if ( $accessop -> check_controller_access ( 'Download' , array ( 'action' => 'version' ))) {
2016-08-11 10:05:36 +00:00
print " <li><a href= \" ../op/op.Download.php?documentid= " . $documentid . " &version= " . $latestContent -> getVersion () . " \" ><i class= \" icon-download \" ></i> " . getMLText ( " download " ) . " </a></li> " ;
}
if ( $accessop -> check_controller_access ( 'ViewOnline' , array ( 'action' => 'run' ))) {
if ( $viewonlinefiletypes && in_array ( strtolower ( $latestContent -> getFileType ()), $viewonlinefiletypes ))
print " <li><a target= \" _blank \" href= \" ../op/op.ViewOnline.php?documentid= " . $documentid . " &version= " . $latestContent -> getVersion () . " \" ><i class= \" icon-star \" ></i> " . getMLText ( " view_online " ) . " </a></li> " ;
}
2013-04-23 17:03:56 +00:00
}
print " </ul> " ;
print " <ul class= \" unstyled actions \" > " ;
2016-11-09 18:54:00 +00:00
if ( $this -> check_access ( 'EditOnline' ))
if ( $accessop -> mayEditVersion ( $document )) {
print " <li> " . $this -> html_link ( 'EditOnline' , array ( 'documentid' => $documentid , 'version' => $latestContent -> getVersion ()), array (), " <i class= \" icon-edit \" ></i> " . getMLText ( " edit_version " ), false , true ) . " </li> " ;
}
2012-12-14 07:53:13 +00:00
/* Only admin has the right to remove version in any case or a regular
* user if enableVersionDeletion is on
*/
2018-01-16 17:13:41 +00:00
if ( $accessop -> check_controller_access ( 'RemoveVersion' ))
2016-11-09 18:54:00 +00:00
if ( $accessop -> mayRemoveVersion ( $document )) {
print " <li> " . $this -> html_link ( 'RemoveVersion' , array ( 'documentid' => $documentid , 'version' => $latestContent -> getVersion ()), array (), " <i class= \" icon-remove \" ></i> " . getMLText ( " rm_version " ), false , true ) . " </li> " ;
}
2018-01-16 17:13:41 +00:00
if ( $accessop -> check_controller_access ( 'OverrideContentStatus' ))
2016-11-09 18:54:00 +00:00
if ( $accessop -> mayOverrideStatus ( $document )) {
print " <li> " . $this -> html_link ( 'OverrideContentStatus' , array ( 'documentid' => $documentid , 'version' => $latestContent -> getVersion ()), array (), " <i class= \" icon-align-justify \" ></i> " . getMLText ( " change_status " ), false , true ) . " </li> " ;
}
2018-04-03 07:32:36 +00:00
if ( $enablereceiptworkflow && $accessop -> check_controller_access ( 'SetRecipients' ))
2016-11-09 18:54:00 +00:00
if ( $accessop -> maySetRecipients ( $document )) {
print " <li> " . $this -> html_link ( 'SetRecipients' , array ( 'documentid' => $documentid , 'version' => $latestContent -> getVersion ()), array (), " <i class= \" icon-check \" ></i> " . getMLText ( " change_recipients " ), false , true ) . " </li> " ;
}
2018-04-03 07:32:36 +00:00
if ( $enablerevisionworkflow && $accessop -> check_controller_access ( 'SetRevisors' ))
2016-11-09 18:54:00 +00:00
if ( $accessop -> maySetRevisors ( $document )) {
print " <li> " . $this -> html_link ( 'SetRevisors' , array ( 'documentid' => $documentid , 'version' => $latestContent -> getVersion ()), array (), " <i class= \" icon-refresh \" ></i> " . getMLText ( " change_revisors " ), false , true ) . " </li> " ;
}
2015-03-16 07:58:10 +00:00
if ( $workflowmode == 'traditional' || $workflowmode == 'traditional_only_approval' ) {
2013-01-24 09:39:14 +00:00
// Allow changing reviewers/approvals only if not reviewed
2018-01-16 17:13:41 +00:00
if ( $accessop -> check_controller_access ( 'SetReviewersApprovers' ))
2016-11-09 18:54:00 +00:00
if ( $accessop -> maySetReviewersApprovers ( $document )) {
print " <li> " . $this -> html_link ( 'SetReviewersApprovers' , array ( 'documentid' => $documentid , 'version' => $latestContent -> getVersion ()), array (), " <i class= \" icon-edit \" ></i> " . getMLText ( " change_assignments " ), false , true ) . " </li> " ;
}
2013-01-24 09:39:14 +00:00
} else {
2018-01-16 17:13:41 +00:00
if ( $accessop -> check_controller_access ( 'SetWorkflow' ))
2016-11-09 18:54:00 +00:00
if ( $accessop -> maySetWorkflow ( $document )) {
if ( ! $workflow ) {
print " <li> " . $this -> html_link ( 'SetWorkflow' , array ( 'documentid' => $documentid , 'version' => $latestContent -> getVersion ()), array (), " <i class= \" icon-random \" ></i> " . getMLText ( " set_workflow " ), false , true ) . " </li> " ;
}
2013-01-24 09:39:14 +00:00
}
2012-12-14 07:53:13 +00:00
}
2014-06-03 15:52:01 +00:00
/*
2016-03-03 06:39:04 +00:00
if ( $accessop -> maySetExpires ( $document )) {
2016-04-20 16:09:36 +00:00
print " <li> " . $this -> html_link ( 'SetExpires' , array ( 'documentid' => $documentid ), array (), " <i class= \" icon-time \" ></i> " . getMLText ( " set_expiry " ), false , true ) . " </li> " ;
2012-12-14 07:53:13 +00:00
}
2015-05-13 16:42:03 +00:00
*/
2018-01-16 17:13:41 +00:00
if ( $accessop -> check_controller_access ( 'AddToTransmittal' ))
2016-11-09 18:54:00 +00:00
if ( $dms -> getAllTransmittals ( $user )) {
if ( $this -> check_access ( 'AddToTransmittal' ))
print " <li> " . $this -> html_link ( 'AddToTransmittal' , array ( 'documentid' => $documentid , 'version' => $latestContent -> getVersion ()), array (), " <i class= \" icon-list \" ></i> " . getMLText ( " add_to_transmittal " ), false , true ) . " </li> " ;
}
2018-01-16 17:13:41 +00:00
if ( $accessop -> check_controller_access ( 'EditComment' ))
2016-11-09 18:54:00 +00:00
if ( $accessop -> mayEditComment ( $document )) {
print " <li> " . $this -> html_link ( 'EditComment' , array ( 'documentid' => $documentid , 'version' => $latestContent -> getVersion ()), array (), " <i class= \" icon-comment \" ></i> " . getMLText ( " edit_comment " ), false , true ) . " </li> " ;
}
2018-01-16 17:13:41 +00:00
if ( $accessop -> check_controller_access ( 'EditAttributes' ))
2016-11-09 18:54:00 +00:00
if ( $accessop -> mayEditAttributes ( $document )) {
print " <li> " . $this -> html_link ( 'EditAttributes' , array ( 'documentid' => $documentid , 'version' => $latestContent -> getVersion ()), array (), " <i class= \" icon-edit \" ></i> " . getMLText ( " edit_attributes " ), false , true ) . " </li> " ;
}
2012-12-14 07:53:13 +00:00
2017-03-15 17:09:11 +00:00
$items = $this -> callHook ( 'extraVersionActions' , $latestContent );
2017-03-15 17:02:25 +00:00
if ( $items ) {
foreach ( $items as $item ) {
2018-02-20 16:30:29 +00:00
if ( is_string ( $item ))
echo " <li> " . $item . " </li> " ;
elseif ( is_array ( $item ))
echo " <li><a href= \" " . $item [ 'link' ] . " \" > " . ( ! empty ( $item [ 'icon' ]) ? " <i class= \" icon- " . $item [ 'icon' ] . " \" ></i> " : " " ) . getMLText ( $item [ 'label' ]) . " </a></li> " ;
2017-03-15 17:02:25 +00:00
}
}
2012-12-14 07:53:13 +00:00
print " </ul> " ;
echo " </td> " ;
print " </tr></tbody> \n </table> \n " ;
2013-01-28 10:44:53 +00:00
$this -> contentContainerEnd ();
2013-01-24 09:39:14 +00:00
if ( $user -> isAdmin ()) {
2013-01-28 10:44:53 +00:00
$this -> contentHeading ( getMLText ( " status " ));
$this -> contentContainerStart ();
2013-05-17 07:27:15 +00:00
$statuslog = $latestContent -> getStatusLog ();
2013-01-24 09:39:14 +00:00
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> " ;
2013-05-17 07:27:15 +00:00
foreach ( $statuslog as $entry ) {
2013-03-26 19:30:39 +00:00
if ( $suser = $dms -> getUser ( $entry [ 'userID' ]))
$fullname = $suser -> getFullName ();
else
$fullname = " -- " ;
echo " <tr><td> " . $entry [ 'date' ] . " </td><td> " . getOverallStatusText ( $entry [ 'status' ]) . " </td><td> " . $fullname . " </td><td> " . $entry [ 'comment' ] . " </td></tr> \n " ;
2013-01-24 09:39:14 +00:00
}
print " </tbody> \n </table> \n " ;
2013-01-28 10:44:53 +00:00
$this -> contentContainerEnd ();
2013-03-08 13:21:33 +00:00
$wkflogs = $latestContent -> 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 ();
}
2013-01-24 09:39:14 +00:00
}
2012-12-14 07:53:13 +00:00
?>
2013-01-28 10:44:53 +00:00
</ div >
2013-01-24 09:39:14 +00:00
< ? php
2015-03-16 07:58:10 +00:00
if ( $workflowmode == 'traditional' || $workflowmode == 'traditional_only_approval' ) {
2013-04-30 16:14:05 +00:00
if (( is_array ( $reviewStatus ) && count ( $reviewStatus ) > 0 ) ||
( is_array ( $approvalStatus ) && count ( $approvalStatus ) > 0 )) {
2013-01-24 09:39:14 +00:00
?>
2015-06-09 07:00:22 +00:00
< div class = " tab-pane <?php if( $currenttab == 'revapp') echo 'active'; ?> " id = " revapp " >
2012-12-14 07:53:13 +00:00
< ? php
$this -> contentContainerstart ();
print " <table class= \" table-condensed \" > \n " ;
2015-06-02 08:18:37 +00:00
/* Just check fo an exting reviewStatus , even workflow mode is set
* to traditional_only_approval . There may be old documents which
* are still in S_DRAFT_REV .
*/
if ( /*$workflowmode != 'traditional_only_approval' &&*/ is_array ( $reviewStatus ) && count ( $reviewStatus ) > 0 ) {
2012-12-14 07:53:13 +00:00
print " <tr><td colspan=5> \n " ;
$this -> contentSubHeading ( getMLText ( " reviewers " ));
print " </tr> " ;
2013-05-17 07:27:15 +00:00
2012-12-14 07:53:13 +00:00
print " <tr> \n " ;
print " <td width='20%'><b> " . getMLText ( " name " ) . " </b></td> \n " ;
print " <td width='20%'><b> " . getMLText ( " last_update " ) . " </b></td> \n " ;
print " <td width='25%'><b> " . getMLText ( " comment " ) . " </b></td> " ;
print " <td width='15%'><b> " . getMLText ( " status " ) . " </b></td> \n " ;
print " <td width='20%'></td> \n " ;
print " </tr> \n " ;
foreach ( $reviewStatus as $r ) {
$required = null ;
$is_reviewer = false ;
2017-07-21 11:52:57 +00:00
$accesserr = '' ;
2012-12-14 07:53:13 +00:00
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 {
2017-07-21 11:52:57 +00:00
$reqName = " <i class= \" icon-user \" ></i> " . htmlspecialchars ( $required -> getFullName () . " ( " . $required -> getLogin () . " ) " );
if ( $user -> isAdmin ()) {
if ( $document -> getAccessMode ( $required ) < M_READ || $latestContent -> getAccessMode ( $required ) < M_READ )
$accesserr = getMLText ( " access_denied " );
elseif ( is_object ( $required ) && $required -> isDisabled ())
$accesserr = getMLText ( " login_disabled_title " );
}
2016-10-27 12:23:26 +00:00
if ( $required -> getId () == $user -> getId () /* && ($user->getId() != $owner->getId() || $enableownerrevapp == 1)*/ )
2016-03-08 15:07:42 +00:00
$is_reviewer = true ;
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 {
2017-07-21 11:52:57 +00:00
$reqName = " <i class= \" icon-group \" ></i> " . htmlspecialchars ( $required -> getName ());
if ( $user -> isAdmin ()) {
$grpusers = $required -> getUsers ();
if ( ! $grpusers )
$accesserr = getMLText ( " no_group_members " );
}
2016-10-27 12:23:26 +00:00
if ( $required -> isMember ( $user ) /* && ($user->getId() != $owner->getId() || $enableownerrevapp == 1)*/ )
2013-03-28 09:18:49 +00:00
$is_reviewer = true ;
2012-12-14 07:53:13 +00:00
}
break ;
}
2017-12-18 12:20:33 +00:00
if ( $user -> isAdmin () || $r [ " status " ] > - 2 ) {
print " <tr> \n " ;
print " <td> " . $reqName . " </td> \n " ;
print " <td><ul class= \" unstyled \" ><li> " . $r [ " date " ] . " </li> " ;
/* $updateUser is the user who has done the review */
$updateUser = $dms -> getUser ( $r [ " userID " ]);
print " <li> " . ( is_object ( $updateUser ) ? htmlspecialchars ( $updateUser -> getFullName () . " ( " . $updateUser -> getLogin () . " ) " ) : " unknown user id ' " . $r [ " userID " ] . " ' " ) . " </li></ul></td> " ;
print " <td> " . htmlspecialchars ( $r [ " comment " ]);
if ( $r [ 'file' ]) {
echo " <br /> " ;
if ( $accessop -> check_controller_access ( 'Download' , array ( 'action' => 'run' ))) {
echo " <a href= \" ../op/op.Download.php?documentid= " . $documentid . " &reviewlogid= " . $r [ 'reviewLogID' ] . " \" class= \" btn btn-mini \" ><i class= \" icon-download \" ></i> " . getMLText ( 'download' ) . " </a> " ;
}
2016-08-11 10:05:36 +00:00
}
2017-12-18 12:20:33 +00:00
print " </td> \n " ;
print " <td> " . getReviewStatusText ( $r [ " status " ]) . " </td> \n " ;
print " <td><ul class= \" unstyled \" > " ;
if ( $accesserr )
echo " <li><span class= \" alert alert-error \" > " . $accesserr . " </span></li> " ;
if ( $accessop -> mayReview ( $document )) {
if ( $is_reviewer ) {
if ( $r [ " status " ] == 0 ) {
print " <li> " . $this -> html_link ( 'ReviewDocument' , array ( 'documentid' => $documentid , 'version' => $latestContent -> getVersion (), 'reviewid' => $r [ 'reviewID' ]), array ( 'class' => 'btn btn-mini' ), getMLText ( " add_review " ), false , true ) . " </li> " ;
} elseif ( $accessop -> mayUpdateReview ( $document , $updateUser ) && (( $r [ " status " ] == 1 ) || ( $r [ " status " ] ==- 1 ))){
print " <li> " . $this -> html_link ( 'ReviewDocument' , array ( 'documentid' => $documentid , 'version' => $latestContent -> getVersion (), 'reviewid' => $r [ 'reviewID' ]), array ( 'class' => 'btn btn-mini' ), getMLText ( " edit " ), false , true ) . " </li> " ;
}
2017-01-16 12:02:15 +00:00
}
2012-12-14 07:53:13 +00:00
}
2013-05-17 07:27:15 +00:00
2017-12-18 12:20:33 +00:00
print " </ul></td> \n " ;
print " </tr> \n " ;
}
2012-12-14 07:53:13 +00:00
}
}
if ( is_array ( $approvalStatus ) && count ( $approvalStatus ) > 0 ) {
print " <tr><td colspan=5> \n " ;
$this -> contentSubHeading ( getMLText ( " approvers " ));
print " </tr> " ;
print " <tr> \n " ;
print " <td width='20%'><b> " . getMLText ( " name " ) . " </b></td> \n " ;
print " <td width='20%'><b> " . getMLText ( " last_update " ) . " </b></td> \n " ;
print " <td width='25%'><b> " . getMLText ( " comment " ) . " </b></td> " ;
print " <td width='15%'><b> " . getMLText ( " status " ) . " </b></td> \n " ;
print " <td width='20%'></td> \n " ;
print " </tr> \n " ;
foreach ( $approvalStatus as $a ) {
$required = null ;
$is_approver = false ;
2017-07-21 11:52:57 +00:00
$accesserr = '' ;
2012-12-14 07:53:13 +00:00
switch ( $a [ " type " ]) {
case 0 : // Approver is an individual.
$required = $dms -> getUser ( $a [ " required " ]);
if ( ! is_object ( $required )) {
2013-04-08 07:12:56 +00:00
$reqName = getMLText ( " unknown_user " ) . " ' " . $a [ " required " ] . " ' " ;
2012-12-14 07:53:13 +00:00
}
else {
2017-07-21 11:52:57 +00:00
$reqName = " <i class= \" icon-user \" ></i> " . htmlspecialchars ( $required -> getFullName () . " ( " . $required -> getLogin () . " ) " );
if ( $user -> isAdmin ()) {
if ( $document -> getAccessMode ( $required ) < M_READ || $latestContent -> getAccessMode ( $required ) < M_READ )
$accesserr = getMLText ( " access_denied " );
elseif ( is_object ( $required ) && $required -> isDisabled ())
$accesserr = getMLText ( " login_disabled_title " );
}
2016-03-08 15:07:42 +00:00
if ( $required -> getId () == $user -> getId ())
$is_approver = true ;
2012-12-14 07:53:13 +00:00
}
break ;
case 1 : // Approver is a group.
$required = $dms -> getGroup ( $a [ " required " ]);
if ( ! is_object ( $required )) {
2013-04-08 07:12:56 +00:00
$reqName = getMLText ( " unknown_group " ) . " ' " . $a [ " required " ] . " ' " ;
2012-12-14 07:53:13 +00:00
}
else {
2017-07-21 11:52:57 +00:00
$reqName = " <i class= \" icon-group \" ></i> " . htmlspecialchars ( $required -> getName ());
if ( $user -> isAdmin ()) {
$grpusers = $required -> getUsers ();
if ( ! $grpusers )
$accesserr = getMLText ( " no_group_members " );
}
2016-10-27 12:23:26 +00:00
if ( $required -> isMember ( $user ) /* && ($user->getId() != $owner->getId() || $enableownerrevapp == 1)*/ )
2016-03-08 15:07:42 +00:00
$is_approver = true ;
2012-12-14 07:53:13 +00:00
}
break ;
}
2018-02-05 13:10:18 +00:00
if ( $user -> isAdmin () || $a [ " status " ] > - 2 ) {
2017-12-18 12:20:33 +00:00
print " <tr> \n " ;
print " <td> " . $reqName . " </td> \n " ;
print " <td><ul class= \" unstyled \" ><li> " . $a [ " date " ] . " </li> " ;
/* $updateUser is the user who has done the approval */
$updateUser = $dms -> getUser ( $a [ " userID " ]);
print " <li> " . ( is_object ( $updateUser ) ? htmlspecialchars ( $updateUser -> getFullName () . " ( " . $updateUser -> getLogin () . " ) " ) : " unknown user id ' " . $a [ " userID " ] . " ' " ) . " </li></ul></td> " ;
print " <td> " . htmlspecialchars ( $a [ " comment " ]);
if ( $a [ 'file' ]) {
echo " <br /> " ;
if ( $accessop -> check_controller_access ( 'Download' , array ( 'action' => 'run' ))) {
echo " <a href= \" ../op/op.Download.php?documentid= " . $documentid . " &approvelogid= " . $a [ 'approveLogID' ] . " \" class= \" btn btn-mini \" ><i class= \" icon-download \" ></i> " . getMLText ( 'download' ) . " </a> " ;
}
2016-08-11 10:05:36 +00:00
}
2017-12-18 12:20:33 +00:00
echo " </td> \n " ;
print " <td> " . getApprovalStatusText ( $a [ " status " ]) . " </td> \n " ;
print " <td><ul class= \" unstyled \" > " ;
if ( $accesserr )
echo " <li><span class= \" alert alert-error \" > " . $accesserr . " </span></li> " ;
if ( $accessop -> mayApprove ( $document )) {
if ( $is_approver ) {
if ( $a [ 'status' ] == 0 ) {
print " <li> " . $this -> html_link ( 'ApproveDocument' , array ( 'documentid' => $documentid , 'version' => $latestContent -> getVersion (), 'approveid' => $a [ 'approveID' ]), array ( 'class' => 'btn btn-mini' ), getMLText ( " add_approval " ), false , true ) . " </li> " ;
} elseif ( $accessop -> mayUpdateApproval ( $document , $updateUser ) && (( $a [ " status " ] == 1 ) || ( $a [ " status " ] ==- 1 ))){
print " <li> " . $this -> html_link ( 'ApproveDocument' , array ( 'documentid' => $documentid , 'version' => $latestContent -> getVersion (), 'approveid' => $a [ 'approveID' ]), array ( 'class' => 'btn btn-mini' ), getMLText ( " edit " ), false , true ) . " </li> " ;
}
2017-01-16 12:02:15 +00:00
}
2012-12-14 07:53:13 +00:00
}
2013-05-17 07:27:15 +00:00
2017-12-18 12:20:33 +00:00
print " </ul> " ;
print " </td> \n " ;
print " </tr> \n " ;
}
2012-12-14 07:53:13 +00:00
}
}
print " </table> \n " ;
2015-05-12 17:14:25 +00:00
$this -> contentContainerEnd ();
2017-07-31 13:37:05 +00:00
if ( $user -> isAdmin () || $user -> getId () == $document -> getOwner () -> getId ()) {
2013-10-06 06:08:41 +00:00
?>
< div class = " row-fluid " >
2015-03-18 10:54:01 +00:00
< ? php
2015-06-02 08:18:37 +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 ( $latestContent -> getReviewStatus ( 10 ) /*$workflowmode != 'traditional_only_approval'*/ ) {
2015-03-18 10:54:01 +00:00
?>
2013-10-06 06:08:41 +00:00
< div class = " span6 " >
2015-05-12 17:14:25 +00:00
< ? php $this -> printProtocol ( $latestContent , 'review' ); ?>
2013-10-06 06:08:41 +00:00
</ div >
2015-03-16 07:58:10 +00:00
< ? php
2015-05-12 17:14:25 +00:00
}
2015-03-16 07:58:10 +00:00
?>
2013-10-06 06:08:41 +00:00
< div class = " span6 " >
2015-05-12 17:14:25 +00:00
< ? php $this -> printProtocol ( $latestContent , 'approval' ); ?>
2013-10-06 06:08:41 +00:00
</ div >
2015-05-12 17:14:25 +00:00
</ div >
2013-10-06 06:08:41 +00:00
< ? php
2015-05-12 17:14:25 +00:00
}
2012-12-14 07:53:13 +00:00
?>
</ div >
< ? php
2013-04-30 16:14:05 +00:00
}
2013-01-24 09:39:14 +00:00
} else {
if ( $workflow ) {
2016-09-06 06:21:44 +00:00
/* Check if user is involved in workflow */
$user_is_involved = false ;
foreach ( $transitions as $transition ) {
if ( $latestContent -> triggerWorkflowTransitionIsAllowed ( $user , $transition )) {
$user_is_involved = true ;
}
}
2013-01-24 09:39:14 +00:00
?>
2015-06-09 07:00:22 +00:00
< div class = " tab-pane <?php if( $currenttab == 'workflow') echo 'active'; ?> " id = " workflow " >
2013-01-24 09:39:14 +00:00
< ? php
2016-09-05 04:39:20 +00:00
echo " <div class= \" row-fluid \" > " ;
2016-09-06 06:43:52 +00:00
if ( $user_is_involved && $this -> check_access ( 'WorkflowGraph' ))
2016-09-05 08:05:54 +00:00
echo " <div class= \" span6 \" > " ;
else
echo " <div class= \" span12 \" > " ;
2013-01-24 09:39:14 +00:00
$this -> contentContainerStart ();
2013-02-02 16:00:37 +00:00
if ( $user -> isAdmin ()) {
2013-02-14 11:10:53 +00:00
if ( SeedDMS_Core_DMS :: checkIfEqual ( $workflow -> getInitState (), $latestContent -> getWorkflowState ())) {
2018-03-29 13:39:39 +00:00
print " <form action= \" ../out/out.RemoveWorkflowFromDocument.php \" method= \" get \" > " . createHiddenFieldWithKey ( 'removeworkflowfromdocument' ) . " <input type= \" hidden \" name= \" documentid \" value= \" " . $documentid . " \" /><input type= \" hidden \" name= \" version \" value= \" " . $latestContent -> getVersion () . " \" /><button type= \" submit \" class= \" btn \" ><i class= \" icon-remove \" ></i> " . getMLText ( 'rm_workflow' ) . " </button></form> " ;
2013-02-02 16:00:37 +00:00
} else {
2014-11-13 08:01:39 +00:00
print " <form action= \" ../out/out.RewindWorkflow.php \" method= \" post \" > " . createHiddenFieldWithKey ( 'rewindworkflow' ) . " <input type= \" hidden \" name= \" documentid \" value= \" " . $documentid . " \" /><input type= \" hidden \" name= \" version \" value= \" " . $latestContent -> getVersion () . " \" /><button type= \" submit \" class= \" btn \" ><i class= \" icon-refresh \" ></i> " . getMLText ( 'rewind_workflow' ) . " </button></form> " ;
2013-02-02 16:00:37 +00:00
}
2013-01-24 09:39:14 +00:00
}
echo " <h4> " . $workflow -> getName () . " </h4> " ;
if ( $parentworkflow = $latestContent -> getParentWorkflow ()) {
echo " <p>Sub workflow of ' " . $parentworkflow -> getName () . " '</p> " ;
}
2013-09-20 19:05:46 +00:00
echo " <h5> " . getMLText ( 'current_state' ) . " : " . $workflowstate -> getName () . " </h5> " ;
2013-01-24 09:39:14 +00:00
echo " <table class= \" table table-condensed \" > \n " ;
echo " <tr> " ;
2013-09-20 19:05:46 +00:00
echo " <td> " . getMLText ( 'next_state' ) . " :</td> " ;
2013-01-24 09:39:14 +00:00
foreach ( $transitions as $transition ) {
$nextstate = $transition -> getNextState ();
2016-09-05 04:39:20 +00:00
$docstatus = $nextstate -> getDocumentStatus ();
echo " <td><i class= \" icon-circle " . ( $docstatus == S_RELEASED ? " released " : ( $docstatus == S_REJECTED ? " rejected " : " in-workflow " )) . " \" ></i> " . $nextstate -> getName () . " </td> " ;
2013-01-24 09:39:14 +00:00
}
echo " </tr> " ;
echo " <tr> " ;
2013-09-20 19:05:46 +00:00
echo " <td> " . getMLText ( 'action' ) . " :</td> " ;
2013-01-24 09:39:14 +00:00
foreach ( $transitions as $transition ) {
$action = $transition -> getAction ();
2013-08-05 12:55:53 +00:00
echo " <td> " . getMLText ( 'action_' . strtolower ( $action -> getName ()), array (), $action -> getName ()) . " </td> " ;
2013-01-24 09:39:14 +00:00
}
echo " </tr> " ;
echo " <tr> " ;
2013-09-20 18:56:46 +00:00
echo " <td> " . getMLText ( 'users' ) . " :</td> " ;
2013-01-24 09:39:14 +00:00
foreach ( $transitions as $transition ) {
$transusers = $transition -> getUsers ();
echo " <td> " ;
foreach ( $transusers as $transuser ) {
$u = $transuser -> getUser ();
echo $u -> getFullName ();
if ( $document -> getAccessMode ( $u ) < M_READ ) {
echo " (no access) " ;
}
echo " <br /> " ;
}
echo " </td> " ;
}
echo " </tr> " ;
echo " <tr> " ;
2013-09-20 18:56:46 +00:00
echo " <td> " . getMLText ( 'groups' ) . " :</td> " ;
2013-01-24 09:39:14 +00:00
foreach ( $transitions as $transition ) {
$transgroups = $transition -> getGroups ();
echo " <td> " ;
foreach ( $transgroups as $transgroup ) {
$g = $transgroup -> getGroup ();
2013-09-20 18:56:46 +00:00
echo getMLText ( 'at_least_n_users_of_group' ,
array ( " number_of_users " => $transgroup -> getNumOfUsers (),
" group " => $g -> getName ()));
2013-01-24 09:39:14 +00:00
if ( $document -> getGroupAccessMode ( $g ) < M_READ ) {
echo " (no access) " ;
}
echo " <br /> " ;
}
echo " </td> " ;
}
echo " </tr> " ;
echo " <tr class= \" success \" > " ;
2013-09-20 19:05:46 +00:00
echo " <td> " . getMLText ( 'users_done_work' ) . " :</td> " ;
2013-01-24 09:39:14 +00:00
foreach ( $transitions as $transition ) {
echo " <td> " ;
if ( $latestContent -> executeWorkflowTransitionIsAllowed ( $transition )) {
2016-11-18 07:42:56 +00:00
/* If this is reached , then the transition should have been executed
* but for some reason the next state hasn ' t been reached . This can
* be causes , if a transition which was previously already executed
* is about to be executed again . E . g . there was already a transition
* T1 from state S1 to S2 triggered by user U1 .
* Then there was a second transition T2 from
* S2 back to S1 . If the state S1 has been reached again , then
* executeWorkflowTransitionIsAllowed () will think that T1 could be
* executed because there is already a log entry saying , that U1
* has triggered the workflow .
*/
echo " Done " ;
2013-01-24 09:39:14 +00:00
}
$wkflogs = $latestContent -> getWorkflowLog ( $transition );
foreach ( $wkflogs as $wkflog ) {
$loguser = $wkflog -> getUser ();
echo $loguser -> getFullName () . " ( " ;
$names = array ();
foreach ( $loguser -> getGroups () as $loggroup ) {
$names [] = $loggroup -> getName ();
}
echo implode ( " , " , $names );
echo " ) - " ;
echo $wkflog -> getDate ();
2016-01-27 05:49:19 +00:00
echo " <br /> " ;
2013-01-24 09:39:14 +00:00
}
echo " </td> " ;
}
echo " </tr> " ;
echo " <tr> " ;
echo " <td></td> " ;
2016-09-05 04:39:20 +00:00
$allowedtransitions = array ();
2013-01-24 09:39:14 +00:00
foreach ( $transitions as $transition ) {
echo " <td> " ;
if ( $latestContent -> triggerWorkflowTransitionIsAllowed ( $user , $transition )) {
$action = $transition -> getAction ();
2018-03-29 13:39:39 +00:00
print " <form action= \" ../out/out.TriggerWorkflow.php \" method= \" get \" > " . createHiddenFieldWithKey ( 'triggerworkflow' ) . " <input type= \" hidden \" name= \" documentid \" value= \" " . $documentid . " \" /><input type= \" hidden \" name= \" version \" value= \" " . $latestContent -> getVersion () . " \" /><input type= \" hidden \" name= \" transition \" value= \" " . $transition -> getID () . " \" /><input type= \" submit \" class= \" btn \" value= \" " . getMLText ( 'action_' . strtolower ( $action -> getName ()), array (), $action -> getName ()) . " \" /></form> " ;
2016-09-05 04:39:20 +00:00
$allowedtransitions [] = $transition ;
2013-01-24 09:39:14 +00:00
}
echo " </td> " ;
}
echo " </tr> " ;
echo " </table> " ;
$workflows = $dms -> getAllWorkflows ();
if ( $workflows ) {
$subworkflows = array ();
foreach ( $workflows as $wkf ) {
if ( $wkf -> getInitState () -> getID () == $workflowstate -> getID ()) {
if ( $workflow -> getID () != $wkf -> getID ()) {
$subworkflows [] = $wkf ;
}
}
}
if ( $subworkflows ) {
echo " <form action= \" ../out/out.RunSubWorkflow.php \" method= \" post \" > " . createHiddenFieldWithKey ( 'runsubworkflow' ) . " <input type= \" hidden \" name= \" documentid \" value= \" " . $documentid . " \" /><input type= \" hidden \" name= \" version \" value= \" " . $latestContent -> getVersion () . " \" /> " ;
echo " <select name= \" subworkflow \" > " ;
foreach ( $subworkflows as $subworkflow ) {
echo " <option value= \" " . $subworkflow -> getID () . " \" > " . $subworkflow -> getName () . " </option> " ;
}
echo " </select> " ;
echo " <label class= \" inline \" > " ;
echo " <input type= \" submit \" class= \" btn \" value= \" " . getMLText ( 'run_subworkflow' ) . " \" /> " ;
echo " </lable> " ;
echo " </form> " ;
}
}
/* If in a sub workflow , the check if return the parent workflow
* is possible .
*/
if ( $parentworkflow = $latestContent -> getParentWorkflow ()) {
$states = $parentworkflow -> getStates ();
foreach ( $states as $state ) {
/* Check if the current workflow state is also a state in the
* parent workflow
*/
if ( $latestContent -> getWorkflowState () -> getID () == $state -> getID ()) {
2013-09-20 19:05:46 +00:00
echo " Switching from sub workflow ' " . $workflow -> getName () . " ' into state " . $state -> getName () . " of parent workflow ' " . $parentworkflow -> getName () . " ' is possible<br /> " ;
2013-01-24 09:39:14 +00:00
/* Check if the transition from the state where the sub workflow
* starts into the current state is also allowed in the parent
* workflow . Checking at this point is actually too late , because
* the sub workflow shouldn ' t be entered in the first place ,
* but that is difficult to check .
*/
/* If the init state has not been left, return is always possible */
if ( $workflow -> getInitState () -> getID () == $latestContent -> getWorkflowState () -> getID ()) {
echo " Initial state of sub workflow has not been left. Return to parent workflow is possible<br /> " ;
echo " <form action= \" ../out/out.ReturnFromSubWorkflow.php \" method= \" post \" > " . createHiddenFieldWithKey ( 'returnfromsubworkflow' ) . " <input type= \" hidden \" name= \" documentid \" value= \" " . $documentid . " \" /><input type= \" hidden \" name= \" version \" value= \" " . $latestContent -> getVersion () . " \" /> " ;
echo " <input type= \" submit \" class= \" btn \" value= \" " . getMLText ( 'return_from_subworkflow' ) . " \" /> " ;
echo " </form> " ;
} else {
/* Get a transition from the last state in the parent workflow
* ( which is the initial state of the sub workflow ) into
* current state .
*/
echo " Check for transition from " . $workflow -> getInitState () -> getName () . " into " . $latestContent -> getWorkflowState () -> getName () . " is possible in parentworkflow " . $parentworkflow -> getID () . " <br /> " ;
$transitions = $parentworkflow -> getTransitionsByStates ( $workflow -> getInitState (), $latestContent -> getWorkflowState ());
if ( $transitions ) {
echo " Found transitions in workflow " . $parentworkflow -> getID () . " <br /> " ;
foreach ( $transitions as $transition ) {
if ( $latestContent -> triggerWorkflowTransitionIsAllowed ( $user , $transition )) {
echo " Triggering transition is allowed<br /> " ;
echo " <form action= \" ../out/out.ReturnFromSubWorkflow.php \" method= \" post \" > " . createHiddenFieldWithKey ( 'returnfromsubworkflow' ) . " <input type= \" hidden \" name= \" documentid \" value= \" " . $documentid . " \" /><input type= \" hidden \" name= \" version \" value= \" " . $latestContent -> getVersion () . " \" /><input type= \" hidden \" name= \" transition \" value= \" " . $transition -> getID () . " \" /> " ;
echo " <input type= \" submit \" class= \" btn \" value= \" " . getMLText ( 'return_from_subworkflow' ) . " \" /> " ;
echo " </form> " ;
}
}
}
}
}
}
}
2016-09-05 04:39:20 +00:00
$this -> contentContainerEnd ();
echo " </div> " ;
2016-09-06 06:43:52 +00:00
if ( $user_is_involved && $this -> check_access ( 'WorkflowGraph' )) {
2016-09-05 08:05:54 +00:00
echo " <div class= \" span6 \" > " ;
2016-09-05 04:39:20 +00:00
?>
< 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 >
< ? php
2016-09-05 08:05:54 +00:00
echo " </div> " ;
}
2013-01-24 09:39:14 +00:00
echo " </div> " ;
?>
</ div >
< ? php
}
}
2015-04-28 10:18:35 +00:00
if ( is_array ( $receiptStatus ) && count ( $receiptStatus ) > 0 ) {
?>
2015-06-09 07:00:22 +00:00
< div class = " tab-pane <?php if( $currenttab == 'recipients') echo 'active'; ?> " id = " recipients " >
2015-04-28 10:18:35 +00:00
< ? php
2018-01-16 17:13:41 +00:00
if ( $status [ " status " ] != S_RELEASED )
echo " <div class= \" alert alert-warning \" > " . getMLText ( 'info_recipients_tab_not_released' ) . " </div> " ;
2015-04-28 10:18:35 +00:00
$this -> contentContainerStart ();
print " <table class= \" table-condensed \" > \n " ;
print " <tr><td colspan=5> \n " ;
$this -> contentSubHeading ( getMLText ( " recipients " ));
print " </tr> " ;
print " <tr> \n " ;
print " <td width='20%'><b> " . getMLText ( " name " ) . " </b></td> \n " ;
print " <td width='20%'><b> " . getMLText ( " last_update " ) . " </b></td> \n " ;
print " <td width='25%'><b> " . getMLText ( " comment " ) . " </b></td> " ;
print " <td width='15%'><b> " . getMLText ( " status " ) . " </b></td> \n " ;
print " <td width='20%'></td> \n " ;
print " </tr> \n " ;
2016-10-05 10:05:19 +00:00
$stat = array ( '-1' => 0 , '0' => 0 , '1' => 0 , '-2' => 0 );
2015-04-28 10:18:35 +00:00
foreach ( $receiptStatus as $r ) {
$required = null ;
$is_recipient = false ;
2016-03-24 14:42:18 +00:00
$stat [ '' . $r [ 'status' ]] ++ ;
2017-07-05 08:49:39 +00:00
$accesserr = '' ;
2015-04-28 10:18:35 +00:00
switch ( $r [ " type " ]) {
2016-10-27 10:17:04 +00:00
case 0 : // Recipient is an individual.
2015-04-28 10:18:35 +00:00
$required = $dms -> getUser ( $r [ " required " ]);
if ( ! is_object ( $required )) {
$reqName = getMLText ( " unknown_user " ) . " ' " . $r [ " required " ] . " ' " ;
2017-07-21 11:52:57 +00:00
} else {
$reqName = " <i class= \" icon-user \" ></i> " . htmlspecialchars ( $required -> getFullName () . " ( " . $required -> getLogin () . " ) " );
if ( $user -> isAdmin ()) {
if ( $document -> getAccessMode ( $required ) < M_READ || $latestContent -> getAccessMode ( $required ) < M_READ )
$accesserr = getMLText ( " access_denied " );
elseif ( is_object ( $required ) && $required -> isDisabled ())
$accesserr = getMLText ( " login_disabled_title " );
}
2015-04-28 10:18:35 +00:00
}
2016-10-27 12:23:26 +00:00
if ( $r [ " required " ] == $user -> getId () /* && ($user->getId() != $owner->getId() || $enableownerreceipt == 1)*/ )
2015-04-28 10:18:35 +00:00
$is_recipient = true ;
break ;
2016-10-27 10:17:04 +00:00
case 1 : // Recipient is a group.
2015-04-28 10:18:35 +00:00
$required = $dms -> getGroup ( $r [ " required " ]);
if ( ! is_object ( $required )) {
$reqName = getMLText ( " unknown_group " ) . " ' " . $r [ " required " ] . " ' " ;
}
else {
2017-07-21 11:52:57 +00:00
$reqName = " <i class= \" icon-group \" ></i> " . htmlspecialchars ( $required -> getName ());
if ( $user -> isAdmin ()) {
$grpusers = $required -> getUsers ();
if ( ! $grpusers )
$accesserr = getMLText ( " no_group_members " );
}
2016-10-27 12:23:26 +00:00
if ( $required -> isMember ( $user ) /* && ($user->getId() != $owner->getId() || $enableownerreceipt == 1)*/ )
2015-04-28 10:18:35 +00:00
$is_recipient = true ;
}
break ;
}
2016-10-05 10:05:19 +00:00
/* Do not list users that has been removed from the list of recipients
* unless admin is logged in .
*/
if ( $user -> isAdmin () || $r [ " status " ] > - 2 ) {
print " <tr> \n " ;
print " <td> " . $reqName . " </td> \n " ;
print " <td><ul class= \" unstyled \" ><li> " . $r [ " date " ] . " </li> " ;
/* $updateUser is the user who has done the receipt */
$updateUser = $dms -> getUser ( $r [ " userID " ]);
print " <li> " . ( is_object ( $updateUser ) ? htmlspecialchars ( $updateUser -> getFullName () . " ( " . $updateUser -> getLogin () . " ) " ) : " unknown user id ' " . $r [ " userID " ] . " ' " ) . " </li></ul></td> " ;
print " <td> " . htmlspecialchars ( $r [ " comment " ]) . " </td> \n " ;
print " <td> " . getReceiptStatusText ( $r [ " status " ]) . " </td> \n " ;
print " <td><ul class= \" unstyled \" > " ;
2017-07-05 08:49:39 +00:00
if ( $accesserr )
echo " <li><span class= \" alert alert-error \" > " . $accesserr . " </span></li> " ;
2016-10-05 10:05:19 +00:00
if ( $accessop -> mayReceipt ( $document )) {
2017-01-17 13:20:33 +00:00
if ( $is_recipient ) {
if ( $r [ " status " ] == 0 ) {
print " <li> " . $this -> html_link ( 'ReceiptDocument' , array ( 'documentid' => $documentid , 'version' => $latestContent -> getVersion (), 'receiptid' => $r [ 'receiptID' ]), array ( 'class' => 'btn btn-mini' ), getMLText ( " add_receipt " ), false , true ) . " </li> " ;
} elseif ( $accessop -> mayUpdateReceipt ( $document , $updateUser ) && (( $r [ " status " ] == 1 ) || ( $r [ " status " ] ==- 1 ))) {
print " <li> " . $this -> html_link ( 'ReceiptDocument' , array ( 'documentid' => $documentid , 'version' => $latestContent -> getVersion (), 'receiptid' => $r [ 'receiptID' ]), array ( 'class' => 'btn btn-mini' ), getMLText ( " edit " ), false , true ) . " </li> " ;
}
2016-10-05 10:05:19 +00:00
}
2015-04-28 10:18:35 +00:00
}
2016-10-05 10:05:19 +00:00
print " </ul></td> \n " ;
print " </tr> \n " ;
}
2015-04-28 10:18:35 +00:00
}
?>
</ table >
< ? php
$this -> contentContainerEnd ();
2018-01-16 17:13:41 +00:00
if ( $accessop -> check_view_access ( 'ViewDocument' , array ( 'action' => 'receptionBar' )) /* $user->isAdmin() || $user->getId() == $document->getOwner()->getId()*/ ) {
2016-10-05 10:05:19 +00:00
/* Do not count entries '-2' as they are removed userѕ */
2016-10-05 09:16:26 +00:00
$totalreceipts = $stat [ '-1' ] + $stat [ '0' ] + $stat [ '1' ];
2015-05-12 17:14:25 +00:00
?>
< div class = " row-fluid " >
< div class = " span12 " >
2016-03-24 14:42:18 +00:00
< div class = " progress " >
2017-07-31 13:12:12 +00:00
< div class = " bar bar-success " style = " width: <?php echo round( $stat['1'] / $totalreceipts *100); ?>%; " >< ? php echo ( $stat [ '1' ] ? $stat [ '1' ] . " / " . $totalreceipts : '' ); ?> </div>
2016-10-05 09:16:26 +00:00
<!-- div class = " bar bar-warning " style = " width: <?php echo round( $stat['0'] / $totalreceipts *100); ?>%; " ></ div -->
2017-07-31 13:12:12 +00:00
< div class = " bar bar-danger " style = " width: <?php echo round( $stat['-1'] / $totalreceipts *100); ?>%; " >< ? php echo ( $stat [ '-1' ] ? $stat [ '-1' ] . " / " . $totalreceipts : '' ); ?> </div>
2016-03-24 14:42:18 +00:00
</ div >
</ div >
</ div >
< div class = " row-fluid " >
< div class = " span12 " >
2015-05-12 17:14:25 +00:00
< ? php
$this -> printProtocol ( $latestContent , 'receipt' );
?>
</ div >
</ div >
< ? php
}
2015-04-28 10:18:35 +00:00
?>
</ div >
2015-05-11 07:30:13 +00:00
< ? php
}
if ( is_array ( $revisionStatus ) && count ( $revisionStatus ) > 0 ) {
?>
2015-06-09 07:00:22 +00:00
< div class = " tab-pane <?php if( $currenttab == 'revision') echo 'active'; ?> " id = " revision " >
2015-05-12 17:14:25 +00:00
< ? php
if ( $status [ 'status' ] == S_RELEASED ) {
if ( $latestContent -> getRevisionDate ()) {
?>
< div class = " alert alert-warning " >
< ? php
print getMLText ( 'revise_document_on' , array ( 'date' => substr ( $latestContent -> getRevisionDate (), 0 , 10 )));
?>
</ div >
< ? php
}
2015-06-09 19:35:10 +00:00
} /* elseif ( $status [ 'status' ] != S_IN_REVISION ) {
2015-05-12 17:14:25 +00:00
?>
< div class = " alert alert-info " >< ? = getMLText ( 'no_revision_planed' ) ?> </div>
2015-05-11 07:30:13 +00:00
< ? php
2015-06-09 19:35:10 +00:00
} */
2015-05-11 07:30:13 +00:00
$this -> contentContainerStart ();
print " <table class= \" table-condensed \" > \n " ;
print " <tr><td colspan=5> \n " ;
$this -> contentSubHeading ( getMLText ( " revisors " ));
print " </tr> " ;
print " <tr> \n " ;
print " <td width='20%'><b> " . getMLText ( " name " ) . " </b></td> \n " ;
print " <td width='20%'><b> " . getMLText ( " last_update " ) . " </b></td> \n " ;
print " <td width='25%'><b> " . getMLText ( " comment " ) . " </b></td> " ;
print " <td width='15%'><b> " . getMLText ( " status " ) . " </b></td> \n " ;
print " <td width='20%'></td> \n " ;
print " </tr> \n " ;
foreach ( $revisionStatus as $r ) {
$required = null ;
$is_recipient = false ;
2017-07-20 15:02:09 +00:00
$accesserr = '' ;
2015-05-11 07:30:13 +00:00
switch ( $r [ " type " ]) {
case 0 : // Reviewer is an individual.
$required = $dms -> getUser ( $r [ " required " ]);
if ( ! is_object ( $required )) {
$reqName = getMLText ( " unknown_user " ) . " ' " . $r [ " required " ] . " ' " ;
2017-07-21 11:52:57 +00:00
} else {
$reqName = " <i class= \" icon-user \" ></i> " . htmlspecialchars ( $required -> getFullName () . " ( " . $required -> getLogin () . " ) " );
if ( $user -> isAdmin ()) {
if ( $document -> getAccessMode ( $required ) < M_READ || $latestContent -> getAccessMode ( $required ) < M_READ )
$accesserr = getMLText ( " access_denied " );
elseif ( is_object ( $required ) && $required -> isDisabled ())
$accesserr = getMLText ( " login_disabled_title " );
}
2015-05-11 07:30:13 +00:00
}
2016-10-27 12:23:26 +00:00
if ( $r [ " required " ] == $user -> getId () /* && ($user->getId() != $owner->getId() || $enableownerrevapp == 1)*/ )
2015-05-11 07:30:13 +00:00
$is_recipient = true ;
break ;
case 1 : // Reviewer is a group.
$required = $dms -> getGroup ( $r [ " required " ]);
if ( ! is_object ( $required )) {
$reqName = getMLText ( " unknown_group " ) . " ' " . $r [ " required " ] . " ' " ;
}
else {
2017-12-06 12:01:35 +00:00
$reqName = " <i class= \" icon-group \" ></i> " . htmlspecialchars ( $required -> getName ());
2016-10-27 12:23:26 +00:00
if ( $required -> isMember ( $user ) /* && ($user->getId() != $owner->getId() || $enableownerrevapp == 1)*/ )
2015-05-11 07:30:13 +00:00
$is_recipient = true ;
}
break ;
}
2017-12-18 12:20:33 +00:00
if ( $user -> isAdmin () || $r [ " status " ] != - 2 ) {
print " <tr> \n " ;
print " <td> " . $reqName . " </td> \n " ;
print " <td><ul class= \" unstyled \" ><li> " . $r [ " date " ] . " </li> " ;
/* $updateUser is the user who has done the revision */
$updateUser = $dms -> getUser ( $r [ " userID " ]);
print " <li> " . ( is_object ( $updateUser ) ? htmlspecialchars ( $updateUser -> getFullName () . " ( " . $updateUser -> getLogin () . " ) " ) : " unknown user id ' " . $r [ " userID " ] . " ' " ) . " </li></ul></td> " ;
print " <td> " . htmlspecialchars ( $r [ " comment " ]) . " </td> \n " ;
print " <td> " . getRevisionStatusText ( $r [ " status " ]) . " </td> \n " ;
print " <td><ul class= \" unstyled \" > " ;
if ( $accesserr )
echo " <li><span class= \" alert alert-error \" > " . $accesserr . " </span></li> " ;
if ( $accessop -> mayRevise ( $document )) {
if ( $is_recipient && $r [ " status " ] == 0 ) {
print " <li> " . $this -> html_link ( 'ReviseDocument' , array ( 'documentid' => $documentid , 'version' => $latestContent -> getVersion (), 'revisionid' => $r [ 'revisionID' ]), array ( 'class' => 'btn btn-mini' ), getMLText ( " add_revision " ), false , true ) . " </li> " ;
} elseif (( $updateUser == $user ) && (( $r [ " status " ] == 1 ) || ( $r [ " status " ] ==- 1 )) && ( ! $document -> hasExpired ())){
print " <li> " . $this -> html_link ( 'ReviseDocument' , array ( 'documentid' => $documentid , 'version' => $latestContent -> getVersion (), 'revisionid' => $r [ 'revisionID' ]), array ( 'class' => 'btn btn-mini' ), getMLText ( " edit " ), false , true ) . " </li> " ;
}
2015-05-11 07:30:13 +00:00
}
2017-12-18 12:20:33 +00:00
print " </ul></td> \n " ;
print " </tr> \n " ;
}
2015-05-11 07:30:13 +00:00
}
?>
</ table >
< ? php
2015-05-12 17:14:25 +00:00
$this -> contentContainerEnd ();
2017-07-31 13:37:05 +00:00
if ( $user -> isAdmin () || $user -> getId () == $document -> getOwner () -> getId ()) {
2015-05-11 07:30:13 +00:00
?>
2015-05-12 17:14:25 +00:00
< div class = " row-fluid " >
< div class = " span12 " >
< ? php
$this -> printProtocol ( $latestContent , 'revision' );
?>
</ div >
</ div >
< ? php
}
?>
</ div >
2015-04-28 10:18:35 +00:00
< ? php
}
2012-12-14 07:53:13 +00:00
if ( count ( $versions ) > 1 ) {
?>
2015-06-09 07:00:22 +00:00
< div class = " tab-pane <?php if( $currenttab == 'previous') echo 'active'; ?> " id = " previous " >
2012-12-14 07:53:13 +00:00
< ? php
$this -> contentContainerStart ();
print " <table class= \" table \" > " ;
print " <thead> \n <tr> \n " ;
2016-08-03 12:47:06 +00:00
print " <th colspan= \" 2 \" ></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 " ;
for ( $i = count ( $versions ) - 2 ; $i >= 0 ; $i -- ) {
$version = $versions [ $i ];
$vstat = $version -> getStatus ();
2013-01-24 09:39:14 +00:00
$workflow = $version -> getWorkflow ();
$workflowstate = $version -> getWorkflowState ();
2013-05-17 07:27:15 +00:00
2012-12-14 07:53:13 +00:00
// verify if file exists
$file_exists = file_exists ( $dms -> contentDir . $version -> getPath ());
2013-05-17 07:27:15 +00:00
2012-12-14 07:53:13 +00:00
print " <tr> \n " ;
2016-08-03 12:47:06 +00:00
print " <td style= \" width: " . $previewwidthdetail . " px; text-align: center; \" > " ;
2014-11-24 18:23:26 +00:00
if ( $file_exists ) {
if ( $viewonlinefiletypes && in_array ( strtolower ( $version -> getFileType ()), $viewonlinefiletypes )) {
2016-08-11 10:05:36 +00:00
if ( $accessop -> check_controller_access ( 'ViewOnline' , array ( 'action' => 'run' ))) {
2014-11-24 18:23:26 +00:00
print " <a target= \" _blank \" href= \" ../op/op.ViewOnline.php?documentid= " . $documentid . " &version= " . $version -> getVersion () . " \" > " ;
2016-08-11 10:05:36 +00:00
}
2014-11-24 18:23:26 +00:00
} else {
2016-08-12 10:43:21 +00:00
if ( $accessop -> check_controller_access ( 'Download' , array ( 'action' => 'version' ))) {
2016-08-11 10:05:36 +00:00
print " <a href= \" ../op/op.Download.php?documentid= " . $documentid . " &version= " . $version -> getVersion () . " \" > " ;
}
2014-11-24 18:23:26 +00:00
}
}
2012-12-14 07:53:13 +00:00
$previewer -> createPreview ( $version );
if ( $previewer -> hasPreview ( $version )) {
2014-03-18 09:55: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 ()) . " \" > " );
2013-04-23 17:03:56 +00:00
} else {
2017-03-15 15:41:32 +00:00
print " <img class= \" mimeicon \" width= \" " . $previewwidthdetail . " \" src= \" " . $this -> getMimeIcon ( $version -> getFileType ()) . " \" title= \" " . htmlspecialchars ( $version -> getMimeType ()) . " \" > " ;
2012-12-14 07:53:13 +00:00
}
2014-11-24 18:23:26 +00:00
if ( $file_exists ) {
2016-08-11 10:05:36 +00:00
if ( $accessop -> check_controller_access ( 'Download' , array ( 'action' => 'run' )) || $accessop -> check_controller_access ( 'ViewOnline' , array ( 'action' => 'run' )))
print " </a> \n " ;
2014-11-24 18:23:26 +00:00
}
2012-12-14 07:53:13 +00:00
print " </td> \n " ;
print " <td><ul class= \" unstyled \" > \n " ;
2016-08-03 12:47:06 +00:00
print " <li> " . htmlspecialchars ( $version -> getOriginalFileName ()) . " </li> \n " ;
2013-04-23 17:03:56 +00:00
print " <li> " . getMLText ( 'version' ) . " : " . $version -> getVersion () . " </li> \n " ;
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 ();
print " <li> " . getMLText ( " uploaded_by " ) . " <a href= \" mailto: " . $updatingUser -> getEmail () . " \" > " . htmlspecialchars ( $updatingUser -> getFullName ()) . " </a></li> " ;
print " <li> " . getLongReadableDate ( $version -> getDate ()) . " </li> " ;
print " </ul> \n " ;
2015-07-14 08:08:04 +00:00
if ( $version -> getComment ())
print " <p style= \" font-style: italic; \" > " . htmlspecialchars ( $version -> getComment ()) . " </p> " ;
2015-07-08 13:37:37 +00:00
print " <ul class= \" actions unstyled \" > \n " ;
2012-12-14 07:53:13 +00:00
$attributes = $version -> getAttributes ();
if ( $attributes ) {
foreach ( $attributes as $attribute ) {
2015-04-27 06:27:19 +00:00
$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
}
}
2016-04-26 16:20:22 +00:00
print " </ul></td> \n " ;
2015-07-14 08:08:04 +00:00
// print "<td>".htmlspecialchars($version->getComment())."</td>";
2012-12-14 07:53:13 +00:00
print " <td> " . getOverallStatusText ( $vstat [ " status " ]) . " </td> " ;
print " <td> " ;
2013-04-23 17:03:56 +00:00
print " <ul class= \" actions unstyled \" > " ;
if ( $file_exists ){
2016-08-12 10:43:21 +00:00
if ( $accessop -> check_controller_access ( 'Download' , array ( 'action' => 'version' ))) {
2016-08-11 10:05:36 +00:00
print " <li><a href= \" ../op/op.Download.php?documentid= " . $documentid . " &version= " . $version -> getVersion () . " \" ><i class= \" icon-download \" ></i> " . getMLText ( " download " ) . " </a> " ;
}
2013-04-23 17:03:56 +00:00
if ( $viewonlinefiletypes && in_array ( strtolower ( $version -> getFileType ()), $viewonlinefiletypes ))
2016-08-11 10:05:36 +00:00
if ( $accessop -> check_controller_access ( 'ViewOnline' , array ( 'action' => 'run' ))) {
print " <li><a target= \" _blank \" href= \" ../op/op.ViewOnline.php?documentid= " . $documentid . " &version= " . $version -> getVersion () . " \" ><i class= \" icon-star \" ></i> " . getMLText ( " view_online " ) . " </a> " ;
}
2015-06-23 08:14:33 +00:00
print " </ul> " ;
print " <ul class= \" actions unstyled \" > " ;
2013-04-23 17:03:56 +00:00
}
2012-12-14 07:53:13 +00:00
/* Only admin has the right to remove version in any case or a regular
* user if enableVersionDeletion is on
*/
2016-03-03 06:39:04 +00:00
if ( $accessop -> mayRemoveVersion ( $document )) {
2016-04-20 16:09:36 +00:00
print " <li> " . $this -> html_link ( 'RemoveVersion' , array ( 'documentid' => $documentid , 'version' => $version -> getVersion ()), array (), " <i class= \" icon-remove \" ></i> " . getMLText ( " rm_version " ), false , true ) . " </li> " ;
2012-12-14 07:53:13 +00:00
}
2018-01-16 17:13:41 +00:00
if ( $accessop -> check_controller_access ( 'AddToTransmittal' ))
2016-08-22 04:29:50 +00:00
print " <li> " . $this -> html_link ( 'AddToTransmittal' , array ( 'documentid' => $documentid , 'version' => $version -> getVersion ()), array (), " <i class= \" icon-list \" ></i> " . getMLText ( " add_to_transmittal " ), false , true ) . " </li> " ;
2016-03-03 06:39:04 +00:00
if ( $accessop -> mayEditComment ( $document )) {
2016-04-20 16:09:36 +00:00
print " <li> " . $this -> html_link ( 'EditComment' , array ( 'documentid' => $documentid , 'version' => $version -> getVersion ()), array (), " <i class= \" icon-comment \" ></i> " . getMLText ( " edit_comment " ), false , true ) . " </li> " ;
2013-01-28 10:44:53 +00:00
}
2016-03-03 06:39:04 +00:00
if ( $accessop -> mayEditAttributes ( $document )) {
2016-04-20 16:09:36 +00:00
print " <li> " . $this -> html_link ( 'EditAttributes' , array ( 'documentid' => $documentid , 'version' => $version -> getVersion ()), array (), " <i class= \" icon-edit \" ></i> " . getMLText ( " edit_attributes " ), false , true ) . " </li> " ;
2013-01-28 10:44:53 +00:00
}
2016-04-20 16:09:36 +00:00
print " <li> " . $this -> html_link ( 'DocumentVersionDetail' , array ( 'documentid' => $documentid , 'version' => $version -> getVersion ()), array (), " <i class= \" icon-info-sign \" ></i> " . getMLText ( " details " ), false , true ) . " </li> " ;
2017-03-15 17:09:11 +00:00
$items = $this -> callHook ( 'extraVersionActions' , $version );
if ( $items ) {
foreach ( $items as $item ) {
2018-02-27 17:12:59 +00:00
if ( is_string ( $item ))
echo " <li> " . $item . " </li> " ;
elseif ( is_array ( $item ))
echo " <li><a href= \" " . $item [ 'link' ] . " \" > " . ( ! empty ( $item [ 'icon' ]) ? " <i class= \" icon- " . $item [ 'icon' ] . " \" ></i> " : " " ) . getMLText ( $item [ 'label' ]) . " </a></li> " ;
2017-03-15 17:09:11 +00:00
}
}
2012-12-14 07:53:13 +00:00
print " </ul> " ;
print " </td> \n </tr> \n " ;
}
print " </tbody> \n </table> \n " ;
$this -> contentContainerEnd ();
?>
</ div >
< ? php
}
?>
2015-06-09 07:00:22 +00:00
< div class = " tab-pane <?php if( $currenttab == 'attachments') echo 'active'; ?> " id = " attachments " >
2012-12-14 07:53:13 +00:00
< ? php
$this -> contentContainerStart ();
if ( count ( $files ) > 0 ) {
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 ());
2013-05-17 07:27:15 +00:00
2012-12-14 07:53:13 +00:00
$responsibleUser = $file -> getUser ();
print " <tr> " ;
2013-04-29 17:32:55 +00:00
print " <td> " ;
2014-03-18 09:55:24 +00:00
$previewer -> createPreview ( $file , $previewwidthdetail );
2014-11-24 18:23:26 +00:00
if ( $file_exists ) {
2016-08-11 10:05:36 +00:00
if ( $viewonlinefiletypes && in_array ( strtolower ( $file -> getFileType ()), $viewonlinefiletypes )) {
if ( $accessop -> check_controller_access ( 'ViewOnline' , array ( 'action' => 'run' ))) {
print " <a target= \" _blank \" href= \" ../op/op.ViewOnline.php?documentid= " . $documentid . " &file= " . $file -> getID () . " \" > " ;
}
} else {
2016-08-12 10:43:21 +00:00
if ( $accessop -> check_controller_access ( 'Download' , array ( 'action' => 'file' ))) {
2016-08-11 10:05:36 +00:00
print " <a href= \" ../op/op.Download.php?documentid= " . $documentid . " &file= " . $file -> getID () . " \" > " ;
}
}
2014-11-24 18:23:26 +00:00
}
2013-04-29 17:32:55 +00:00
if ( $previewer -> hasPreview ( $file )) {
2014-03-18 09:55:24 +00:00
print ( " <img class= \" mimeicon \" width= \" " . $previewwidthdetail . " \" src= \" ../op/op.Preview.php?documentid= " . $document -> getID () . " &file= " . $file -> getID () . " &width= " . $previewwidthdetail . " \" title= \" " . htmlspecialchars ( $file -> getMimeType ()) . " \" > " );
2013-04-29 17:32:55 +00:00
} else {
2017-03-15 15:41:32 +00:00
print " <img class= \" mimeicon \" width= \" " . $previewwidthdetail . " \" src= \" " . $this -> getMimeIcon ( $file -> getFileType ()) . " \" title= \" " . htmlspecialchars ( $file -> getMimeType ()) . " \" > " ;
2013-04-29 17:32:55 +00:00
}
2014-11-24 18:23:26 +00:00
if ( $file_exists ) {
2016-08-11 10:05:36 +00:00
if ( $accessop -> check_controller_access ( 'Download' , array ( 'action' => 'run' )) || $accessop -> check_controller_access ( 'ViewOnline' , array ( 'action' => 'run' )))
print " </a> " ;
2014-11-24 18:23:26 +00:00
}
2013-04-29 17:32:55 +00:00
print " </td> " ;
2012-12-14 07:53:13 +00:00
print " <td><ul class= \" unstyled \" > \n " ;
2013-04-23 17:03:56 +00:00
print " <li> " . htmlspecialchars ( $file -> getName ()) . " </li> \n " ;
2017-04-04 16:28:37 +00:00
if ( $file -> getName () != $file -> getOriginalFileName ())
print " <li> " . htmlspecialchars ( $file -> getOriginalFileName ()) . " </li> \n " ;
2012-12-14 07:53:13 +00:00
if ( $file_exists )
2013-04-23 17:03:56 +00:00
print " <li> " . SeedDMS_Core_File :: format_filesize ( filesize ( $dms -> contentDir . $file -> getPath ())) . " bytes, " . htmlspecialchars ( $file -> getMimeType ()) . " </li> " ;
2012-12-14 07:53:13 +00:00
else print " <li> " . htmlspecialchars ( $file -> getMimeType ()) . " - <span class= \" warning \" > " . getMLText ( " document_deleted " ) . " </span></li> " ;
print " <li> " . getMLText ( " uploaded_by " ) . " <a href= \" mailto: " . $responsibleUser -> getEmail () . " \" > " . htmlspecialchars ( $responsibleUser -> getFullName ()) . " </a></li> " ;
print " <li> " . getLongReadableDate ( $file -> getDate ()) . " </li> " ;
2016-12-08 15:15:05 +00:00
if ( $file -> getVersion ())
print " <li> " . getMLText ( 'linked_to_current_version' ) . " </li> " ;
else
print " <li> " . getMLText ( 'linked_to_document' ) . " </li> " ;
2016-04-26 16:16:24 +00:00
print " </ul></td> " ;
2012-12-14 07:53:13 +00:00
print " <td> " . htmlspecialchars ( $file -> getComment ()) . " </td> " ;
2013-04-29 17:32:55 +00:00
print " <td><ul class= \" unstyled actions \" > " ;
if ( $file_exists ) {
2016-08-12 10:43:21 +00:00
if ( $accessop -> check_controller_access ( 'Download' , array ( 'action' => 'file' ))) {
2016-08-11 10:05:36 +00:00
print " <li><a href= \" ../op/op.Download.php?documentid= " . $documentid . " &file= " . $file -> getID () . " \" ><i class= \" icon-download \" ></i> " . getMLText ( 'download' ) . " </a></li> " ;
}
if ( $viewonlinefiletypes && in_array ( strtolower ( $file -> getFileType ()), $viewonlinefiletypes )) {
if ( $accessop -> check_controller_access ( 'ViewOnline' , array ( 'action' => 'run' ))) {
print " <li><a target= \" _blank \" href= \" ../op/op.ViewOnline.php?documentid= " . $documentid . " &file= " . $file -> getID () . " \" ><i class= \" icon-star \" ></i> " . getMLText ( " view_online " ) . " </a></li> " ;
}
}
2013-04-29 17:32:55 +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 ())) {
2013-04-29 17:32:55 +00:00
print " <li><a href= \" out.RemoveDocumentFile.php?documentid= " . $documentid . " &fileid= " . $file -> getID () . " \" ><i class= \" icon-remove \" ></i> " . getMLText ( " delete " ) . " </a></li> " ;
2017-12-05 07:28:03 +00:00
print " <li><a href= \" out.EditDocumentFile.php?documentid= " . $documentid . " &fileid= " . $file -> getID () . " \" ><i class= \" icon-edit \" ></i> " . getMLText ( " edit " ) . " </a></li> " ;
}
2013-04-29 17:32:55 +00:00
print " </ul></td> " ;
2012-12-14 07:53:13 +00:00
print " </tr> " ;
}
print " </tbody> \n </table> \n " ;
}
else printMLText ( " no_attached_files " );
2018-01-16 17:13:41 +00:00
if ( $accessop -> check_controller_access ( 'AddFile' )) {
2017-03-03 13:10:03 +00:00
if ( $document -> getAccessMode ( $user ) >= M_READWRITE ){
print " <ul class= \" unstyled \" ><li> " . $this -> html_link ( 'AddFile' , array ( 'documentid' => $documentid ), array ( 'class' => 'btn' ), getMLText ( " add " ), false , true ) . " </li></ul> \n " ;
}
2012-12-14 07:53:13 +00:00
}
$this -> contentContainerEnd ();
?>
</ div >
2015-06-09 07:00:22 +00:00
< div class = " tab-pane <?php if( $currenttab == 'links') echo 'active'; ?> " id = " links " >
2012-12-14 07:53:13 +00:00
< ? php
if ( count ( $links ) > 0 ) {
2018-01-26 17:51:59 +00:00
print " <table id= \" viewfolder-table \" class= \" table table-condensed table-hover \" > " ;
2012-12-14 07:53:13 +00:00
print " <thead> \n <tr> \n " ;
2018-01-26 17:51:59 +00:00
print " <th></th> \n " ;
print " <th> " . getMLText ( " name " ) . " </th> \n " ;
print " <th> " . getMLText ( " status " ) . " </th> \n " ;
print " <th> " . getMLText ( " action " ) . " </th> \n " ;
2013-01-24 09:39:14 +00:00
print " <th></th> \n " ;
2012-12-14 07:53:13 +00:00
print " </tr> \n </thead> \n <tbody> \n " ;
foreach ( $links as $link ) {
$responsibleUser = $link -> getUser ();
$targetDoc = $link -> getTarget ();
2016-08-11 10:05:36 +00:00
2018-01-26 17:51:59 +00:00
echo " <tr id= \" table-row-document- " . $targetDoc -> getId () . " \" class= \" table-row-document \" rel= \" document_ " . $targetDoc -> getId () . " \" formtoken= \" " . createFormKey ( 'movedocument' ) . " \" draggable= \" true \" > " ;
$targetDoc -> verifyLastestContentExpriry ();
$txt = $this -> callHook ( 'documentListItem' , $targetDoc , $previewer , 'reverselinks' );
if ( is_string ( $txt ))
echo $txt ;
else {
echo $this -> documentListRow ( $targetDoc , $previewer , true );
2013-01-24 09:39:14 +00:00
}
2018-01-26 17:51:59 +00:00
print " <td><span class= \" actions \" > " ;
print getMLText ( " document_link_by " ) . " " . htmlspecialchars ( $responsibleUser -> getFullName ());
2012-12-14 07:53:13 +00:00
if (( $user -> getID () == $responsibleUser -> getID ()) || ( $document -> getAccessMode ( $user ) == M_ALL ))
2013-04-23 17:03:56 +00:00
print " <br /> " . getMLText ( " document_link_public " ) . " : " . (( $link -> isPublic ()) ? getMLText ( " yes " ) : getMLText ( " no " ));
2012-12-14 07:53:13 +00:00
if (( $user -> getID () == $responsibleUser -> getID ()) || ( $document -> getAccessMode ( $user ) == M_ALL ))
2013-01-24 09:39:14 +00:00
print " <form action= \" ../op/op.RemoveDocumentLink.php \" method= \" post \" > " . createHiddenFieldWithKey ( 'removedocumentlink' ) . " <input type= \" hidden \" name= \" documentid \" value= \" " . $documentid . " \" /><input type= \" hidden \" name= \" linkid \" value= \" " . $link -> getID () . " \" /><button type= \" submit \" class= \" btn btn-mini \" ><i class= \" icon-remove \" ></i> " . getMLText ( " delete " ) . " </button></form> " ;
2012-12-14 07:53:13 +00:00
print " </span></td> " ;
print " </tr> " ;
}
print " </tbody> \n </table> \n " ;
}
else printMLText ( " no_linked_files " );
if ( ! $user -> isGuest ()){
2018-01-26 17:51:59 +00:00
$this -> contentContainerStart ();
2012-12-14 07:53:13 +00:00
?>
< br >
2018-01-26 17:51:59 +00:00
< form action = " ../op/op.AddDocumentLink.php " name = " form1 " class = " form-inline " >
2012-12-14 07:53:13 +00:00
< input type = " hidden " name = " documentid " value = " <?php print $documentid ;?> " >
2018-01-26 17:51:59 +00:00
< ? php printMLText ( " add_document_link " ); ?> :
< ? php $this -> printDocumentChooserHtml ( " form1 " ); ?>
2012-12-14 07:53:13 +00:00
< ? php
if ( $document -> getAccessMode ( $user ) >= M_READWRITE ) {
2018-01-26 17:51:59 +00:00
print " <label class= \" checkbox \" > " ;
2012-12-14 07:53:13 +00:00
print " <input type= \" checkbox \" name= \" public \" value= \" true \" checked /> " ;
2018-01-26 17:51:59 +00:00
print getMLText ( " document_link_public " );
print " </label> " ;
2012-12-14 07:53:13 +00:00
}
?>
2018-01-26 17:51:59 +00:00
< button type = " submit " class = " btn " >< i class = " icon-save " ></ i > < ? php printMLText ( " save " ) ?> </button>
2012-12-14 07:53:13 +00:00
</ form >
< ? php
2018-01-26 17:51:59 +00:00
$this -> contentContainerEnd ();
2012-12-14 07:53:13 +00:00
}
2014-03-18 06:07:12 +00:00
if ( count ( $reverselinks ) > 0 ) {
$this -> contentHeading ( getMLText ( " reverse_links " ));
2018-01-26 17:51:59 +00:00
// $this->contentContainerStart();
2014-03-18 06:07:12 +00:00
2018-01-26 17:51:59 +00:00
print " <table id= \" viewfolder-table \" class= \" table table-condensed table-hover \" > " ;
2014-03-18 06:07:12 +00:00
print " <thead> \n <tr> \n " ;
2018-01-26 17:51:59 +00:00
print " <th></th> \n " ;
print " <th> " . getMLText ( " name " ) . " </th> \n " ;
print " <th> " . getMLText ( " status " ) . " </th> \n " ;
print " <th> " . getMLText ( " action " ) . " </th> \n " ;
2014-03-18 06:07:12 +00:00
print " <th></th> \n " ;
print " </tr> \n </thead> \n <tbody> \n " ;
foreach ( $reverselinks as $link ) {
$responsibleUser = $link -> getUser ();
$sourceDoc = $link -> getDocument ();
2018-01-26 17:51:59 +00:00
echo " <tr id= \" table-row-document- " . $sourceDoc -> getId () . " \" class= \" table-row-document \" rel= \" document_ " . $sourceDoc -> getId () . " \" formtoken= \" " . createFormKey ( 'movedocument' ) . " \" draggable= \" true \" > " ;
$sourceDoc -> verifyLastestContentExpriry ();
$txt = $this -> callHook ( 'documentListItem' , $sourceDoc , $previewer , 'reverselinks' );
if ( is_string ( $txt ))
echo $txt ;
else {
echo $this -> documentListRow ( $sourceDoc , $previewer , true );
2014-03-18 06:07:12 +00:00
}
print " <td><span class= \" actions \" > " ;
if (( $user -> getID () == $responsibleUser -> getID ()) || ( $document -> getAccessMode ( $user ) == M_ALL ))
2018-01-26 17:51:59 +00:00
print getMLText ( " document_link_by " ) . " " . htmlspecialchars ( $responsibleUser -> getFullName ());
if (( $user -> getID () == $responsibleUser -> getID ()) || ( $document -> getAccessMode ( $user ) == M_ALL ))
print " <br /> " . getMLText ( " document_link_public " ) . " : " . (( $link -> isPublic ()) ? getMLText ( " yes " ) : getMLText ( " no " ));
print " <form action= \" ../op/op.RemoveDocumentLink.php \" method= \" post \" > " . createHiddenFieldWithKey ( 'removedocumentlink' ) . " <input type= \" hidden \" name= \" documentid \" value= \" " . $sourceDoc -> getId () . " \" /><input type= \" hidden \" name= \" linkid \" value= \" " . $link -> getID () . " \" /><button type= \" submit \" class= \" btn btn-mini \" ><i class= \" icon-remove \" ></i> " . getMLText ( " delete " ) . " </button></form> " ;
2014-03-18 06:07:12 +00:00
print " </span></td> " ;
print " </tr> " ;
}
print " </tbody> \n </table> \n " ;
2018-01-26 17:51:59 +00:00
// $this->contentContainerEnd();
2014-03-18 06:07:12 +00:00
}
2012-12-14 07:53:13 +00:00
?>
2016-11-07 08:25:55 +00:00
</ div >
2012-12-14 07:53:13 +00:00
</ div >
2015-09-18 05:55:24 +00:00
< ? php
if ( $user -> isAdmin ()) {
2015-09-21 14:47:47 +00:00
$timeline = $document -> getTimeline ();
2015-09-22 08:32:33 +00:00
if ( $timeline ) {
2018-01-18 16:29:10 +00:00
/*
2015-09-23 13:50:04 +00:00
$this -> contentHeading ( getMLText ( " timeline " ));
2015-09-22 08:32:33 +00:00
foreach ( $timeline as & $item ) {
switch ( $item [ 'type' ]) {
case 'add_version' :
$msg = getMLText ( 'timeline_' . $item [ 'type' ], array ( 'document' => $item [ 'document' ] -> getName (), 'version' => $item [ 'version' ]));
break ;
case 'add_file' :
$msg = getMLText ( 'timeline_' . $item [ 'type' ], array ( 'document' => $item [ 'document' ] -> getName ()));
break ;
case 'status_change' :
$msg = getMLText ( 'timeline_' . $item [ 'type' ], array ( 'document' => $item [ 'document' ] -> getName (), 'version' => $item [ 'version' ], 'status' => getOverallStatusText ( $item [ 'status' ])));
break ;
default :
2015-09-29 10:12:01 +00:00
$msg = $this -> callHook ( 'getTimelineMsg' , $document , $item );
if ( ! is_string ( $msg ))
$msg = '???' ;
2015-09-22 08:32:33 +00:00
}
$item [ 'msg' ] = $msg ;
2015-09-21 14:47:47 +00:00
}
2018-01-18 16:29:10 +00:00
*/
2015-12-11 19:29:52 +00:00
// $this->printTimeline('out.ViewDocument.php?action=timelinedata&documentid='.$document->getID(), 300, '', date('Y-m-d'));
$this -> printTimelineHtml ( 300 );
2015-09-21 14:47:47 +00:00
}
2015-09-18 05:55:24 +00:00
}
?>
2013-04-30 17:26:33 +00:00
</ div >
</ div >
2012-12-14 07:53:13 +00:00
< ? php
2016-03-15 07:30:53 +00:00
$this -> contentEnd ();
2012-12-14 07:53:13 +00:00
$this -> htmlEndPage ();
} /* }}} */
}
?>