2012-12-14 07:53:13 +00:00
< ? php
/**
* Implementation of UpdateDocument 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 " );
/**
* Class which outputs the html page for UpdateDocument 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_UpdateDocument extends SeedDMS_Bootstrap_Style {
2012-12-14 07:53:13 +00:00
2015-12-14 14:16:32 +00:00
function js () { /* {{{ */
2012-12-14 07:53:13 +00:00
$strictformcheck = $this -> params [ 'strictformcheck' ];
$dropfolderdir = $this -> params [ 'dropfolderdir' ];
2017-01-31 16:27:53 +00:00
$enablelargefileupload = $this -> params [ 'enablelargefileupload' ];
$partitionsize = $this -> params [ 'partitionsize' ];
2017-03-15 15:40:41 +00:00
$maxuploadsize = $this -> params [ 'maxuploadsize' ];
2016-02-17 10:43:19 +00:00
header ( 'Content-Type: application/javascript' );
2015-12-14 14:16:32 +00:00
$this -> printDropFolderChooserJs ( " form1 " );
2016-03-21 06:40:17 +00:00
$this -> printSelectPresetButtonJs ();
2016-10-20 16:28:25 +00:00
$this -> printInputPresetButtonJs ();
$this -> printCheckboxPresetButtonJs ();
2017-01-31 16:27:53 +00:00
if ( $enablelargefileupload )
2017-03-15 15:40:41 +00:00
$this -> printFineUploaderJs ( '../op/op.UploadChunks.php' , $partitionsize , $maxuploadsize , false );
2012-12-14 07:53:13 +00:00
?>
2015-12-14 14:16:32 +00:00
$ ( document ) . ready ( function () {
2016-08-30 05:59:03 +00:00
jQuery . validator . addMethod ( " alternatives " , function ( value , element , params ) {
if ( value == '' && params . val () == '' )
return false ;
return true ;
}, " <?php printMLText( " js_no_file " );?> " );
2017-01-31 16:27:53 +00:00
/* The fineuploader validation is actually checking all fields that can contain
* a file to be uploaded . First checks if an alternative input field is set ,
* second loops through the list of scheduled uploads , checking if at least one
* file will be submitted .
*/
jQuery . validator . addMethod ( " fineuploader " , function ( value , element , params ) {
if ( params [ 1 ] . val () != '' )
return true ;
uploader = params [ 0 ];
arr = uploader . getUploads ();
for ( var i in arr ) {
if ( arr [ i ] . status == 'submitted' )
return true ;
}
return false ;
}, " <?php printMLText( " js_no_file " );?> " );
2016-09-06 13:34:05 +00:00
$ ( " #form1 " ) . validate ({
invalidHandler : function ( e , validator ) {
noty ({
text : ( validator . numberOfInvalids () == 1 ) ? " <?php printMLText( " js_form_error " );?> " . replace ( '#' , validator . numberOfInvalids ()) : " <?php printMLText( " js_form_errors " );?> " . replace ( '#' , validator . numberOfInvalids ()),
type : 'error' ,
dismissQueue : true ,
layout : 'topRight' ,
theme : 'defaultTheme' ,
timeout : 1500 ,
});
},
2017-01-31 16:27:53 +00:00
< ? php
if ( $enablelargefileupload ) {
?>
submitHandler : function ( form ) {
manualuploader . uploadStoredFiles ();
},
< ? php
}
?>
2016-08-30 05:59:03 +00:00
rules : {
2017-01-31 16:27:53 +00:00
< ? php
if ( $enablelargefileupload ) {
?>
fineuploaderuuids : {
fineuploader : [ manualuploader , $ ( '#dropfolderfileform1' ) ]
}
< ? php
} else {
?>
2016-08-30 05:59:03 +00:00
userfile : {
alternatives : $ ( '#dropfolderfileform1' )
},
dropfolderfileform1 : {
alternatives : $ ( '#userfile' )
}
2017-01-31 16:27:53 +00:00
< ? php
}
?>
2016-08-30 05:59:03 +00:00
},
2016-08-29 07:44:49 +00:00
messages : {
comment : " <?php printMLText( " js_no_comment " );?> " ,
2016-08-30 05:59:03 +00:00
},
errorPlacement : function ( error , element ) {
if ( element . is ( " :file " ) ) {
error . appendTo ( element . parent () . parent () . parent ());
console . log ( element );
} else {
error . appendTo ( element . parent ());
}
2016-08-29 07:44:49 +00:00
}
});
2017-04-05 20:00:54 +00:00
$ ( '#presetexpdate' ) . on ( 'change' , function ( ev ){
if ( $ ( this ) . val () == 'date' )
$ ( '#control_expdate' ) . show ();
else
$ ( '#control_expdate' ) . hide ();
});
2015-12-14 14:16:32 +00:00
});
2012-12-14 07:53:13 +00:00
< ? php
2015-12-14 14:16:32 +00:00
} /* }}} */
function show () { /* {{{ */
$dms = $this -> params [ 'dms' ];
$user = $this -> params [ 'user' ];
$folder = $this -> params [ 'folder' ];
$document = $this -> params [ 'document' ];
$strictformcheck = $this -> params [ 'strictformcheck' ];
$enablelargefileupload = $this -> params [ 'enablelargefileupload' ];
2017-03-15 15:40:41 +00:00
$maxuploadsize = $this -> params [ 'maxuploadsize' ];
2015-12-14 14:16:32 +00:00
$enableadminrevapp = $this -> params [ 'enableadminrevapp' ];
$enableownerrevapp = $this -> params [ 'enableownerrevapp' ];
$enableselfrevapp = $this -> params [ 'enableselfrevapp' ];
$dropfolderdir = $this -> params [ 'dropfolderdir' ];
$workflowmode = $this -> params [ 'workflowmode' ];
$presetexpiration = $this -> params [ 'presetexpiration' ];
$documentid = $document -> getId ();
2016-08-29 07:44:49 +00:00
$this -> htmlAddHeader ( '<script type="text/javascript" src="../styles/' . $this -> theme . '/validate/jquery.validate.js"></script>' . " \n " , 'js' );
2017-03-15 15:40:41 +00:00
if ( $enablelargefileupload ) {
2017-01-31 16:27:53 +00:00
$this -> htmlAddHeader ( '<script type="text/javascript" src="../styles/' . $this -> theme . '/fine-uploader/jquery.fine-uploader.min.js"></script>' . " \n " , 'js' );
2017-03-15 15:40:41 +00:00
$this -> htmlAddHeader ( $this -> getFineUploaderTemplate (), 'js' );
}
2016-08-29 07:44:49 +00:00
2015-12-14 14:16:32 +00:00
$this -> htmlStartPage ( getMLText ( " document_title " , array ( " documentname " => htmlspecialchars ( $document -> getName ()))));
$this -> globalNavigation ( $folder );
$this -> contentStart ();
$this -> pageNavigation ( $this -> getFolderPathHTML ( $folder , true , $document ), " view_document " , $document );
$this -> contentHeading ( getMLText ( " update_document " ));
2012-12-14 07:53:13 +00:00
if ( $document -> isLocked ()) {
$lockingUser = $document -> getLockingUser ();
print " <div class= \" alert alert-warning \" > " ;
printMLText ( " update_locked_msg " , array ( " username " => htmlspecialchars ( $lockingUser -> getFullName ()), " email " => $lockingUser -> getEmail ()));
if ( $lockingUser -> getID () == $user -> getID ())
printMLText ( " unlock_cause_locking_user " );
else if ( $document -> getAccessMode ( $user ) == M_ALL )
printMLText ( " unlock_cause_access_mode_all " );
else
{
printMLText ( " no_update_cause_locked " );
print " </div> " ;
2016-03-15 07:30:53 +00:00
$this -> contentEnd ();
2012-12-14 07:53:13 +00:00
$this -> htmlEndPage ();
exit ;
}
print " </div> " ;
}
2015-02-13 16:41:50 +00:00
$latestContent = $document -> getLatestContent ();
$reviewStatus = $latestContent -> getReviewStatus ();
$approvalStatus = $latestContent -> getApprovalStatus ();
2015-03-16 07:58:10 +00:00
if ( $workflowmode == 'advanced' ) {
2013-02-06 13:59:10 +00:00
if ( $status = $latestContent -> getStatus ()) {
if ( $status [ " status " ] == S_IN_WORKFLOW ) {
$this -> warningMsg ( " The current version of this document is in a workflow. This will be interrupted and cannot be completed if you upload a new version. " );
}
}
}
2012-12-14 07:53:13 +00:00
2013-02-06 13:59:10 +00:00
if ( $enablelargefileupload ) {
2017-03-15 15:40:41 +00:00
if ( $maxuploadsize ) {
$msg = getMLText ( " max_upload_size " ) . " : " . SeedDMS_Core_File :: format_filesize ( $maxuploadsize );
2017-03-20 11:42:29 +00:00
} else {
$msg = '' ;
2017-03-15 15:40:41 +00:00
}
} else {
$msg = getMLText ( " max_upload_size " ) . " : " . ini_get ( " upload_max_filesize " );
}
if ( 0 && $enablelargefileupload ) {
2013-02-06 13:59:10 +00:00
$msg .= " <p> " . sprintf ( getMLText ( 'link_alt_updatedocument' ), " out.AddMultiDocument.php?folderid= " . $folder -> getID () . " &showtree= " . showtree ()) . " </p> " ;
}
2017-03-20 11:42:29 +00:00
if ( $msg )
$this -> warningMsg ( $msg );
2012-12-14 07:53:13 +00:00
$this -> contentContainerStart ();
?>
2015-12-14 14:16:32 +00:00
< form action = " ../op/op.UpdateDocument.php " enctype = " multipart/form-data " method = " post " name = " form1 " id = " form1 " >
2012-12-14 07:53:13 +00:00
< input type = " hidden " name = " documentid " value = " <?php print $document->getID (); ?> " >
< table class = " table-condensed " >
< tr >
< td >< ? php printMLText ( " local_file " ); ?> :</td>
2017-01-31 16:27:53 +00:00
< td >
2014-05-16 07:19:36 +00:00
< ? php
2017-01-31 16:27:53 +00:00
if ( $enablelargefileupload )
$this -> printFineUploaderHtml ();
else
$this -> printFileChooser ( 'userfile' , false );
2014-05-16 07:19:36 +00:00
?>
</ td >
2012-12-14 07:53:13 +00:00
</ tr >
< ? php if ( $dropfolderdir ) { ?>
< tr >
< td >< ? php printMLText ( " dropfolder_file " ); ?> :</td>
2015-12-14 14:16:32 +00:00
< td >< ? php $this -> printDropFolderChooserHtml ( " form1 " ); ?> </td>
2012-12-14 07:53:13 +00:00
</ tr >
< ? php } ?>
< tr >
< td >< ? php printMLText ( " comment " ); ?> :</td>
< td class = " standardText " >
2016-08-29 07:44:49 +00:00
< textarea name = " comment " rows = " 4 " cols = " 80 " < ? php echo $strictformcheck ? ' required' : '' ; ?> ></textarea>
2012-12-14 07:53:13 +00:00
</ td >
</ tr >
2015-01-29 17:31:37 +00:00
< ? php
if ( $presetexpiration ) {
if ( ! ( $expts = strtotime ( $presetexpiration )))
2017-04-05 20:00:54 +00:00
$expts = false ;
2015-01-29 17:31:37 +00:00
} else {
2017-04-05 20:00:54 +00:00
$expts = false ;
2015-01-29 17:31:37 +00:00
}
?>
2012-12-14 07:53:13 +00:00
< tr >
2017-04-05 20:00:54 +00:00
< td >< ? php printMLText ( " preset_expires " ); ?> :</td>
< td >
< select class = " span6 " name = " presetexpdate " id = " presetexpdate " >
< option value = " never " >< ? php printMLText ( 'does_not_expire' ); ?> </option>
< option value = " date " < ? php echo ( $expts != '' ? " selected " : " " ); ?> ><?php printMLText('expire_by_date');?></option>
< option value = " 1w " >< ? php printMLText ( 'expire_in_1w' ); ?> </option>
< option value = " 1m " >< ? php printMLText ( 'expire_in_1m' ); ?> </option>
< option value = " 1y " >< ? php printMLText ( 'expire_in_1y' ); ?> </option>
< option value = " 2y " >< ? php printMLText ( 'expire_in_2y' ); ?> </option>
</ select >
</ td >
</ tr >
< tr id = " control_expdate " < ? php echo ( $expts == false ? 'style="display: none;"' : '' ); ?> >
2012-12-14 07:53:13 +00:00
< td >< ? php printMLText ( " expires " ); ?> :</td>
< td class = " standardText " >
2017-04-05 20:00:54 +00:00
< span class = " input-append date span12 " id = " expirationdate " data - date = " <?php echo ( $expts ? date('Y-m-d', $expts ) : ''); ?> " data - date - format = " yyyy-mm-dd " data - date - language = " <?php echo str_replace('_', '-', $this->params ['session']->getLanguage()); ?> " >
< input class = " span6 " size = " 16 " name = " expdate " type = " text " value = " <?php echo ( $expts ? date('Y-m-d', $expts ) : ''); ?> " >
2013-01-29 08:18:49 +00:00
< span class = " add-on " >< i class = " icon-calendar " ></ i ></ span >
2017-04-05 20:00:54 +00:00
</ span >
2012-12-14 07:53:13 +00:00
</ td >
</ tr >
< ? php
2013-02-14 11:10:53 +00:00
$attrdefs = $dms -> getAllAttributeDefinitions ( array ( SeedDMS_Core_AttributeDefinition :: objtype_documentcontent , SeedDMS_Core_AttributeDefinition :: objtype_all ));
2012-12-14 07:53:13 +00:00
if ( $attrdefs ) {
foreach ( $attrdefs as $attrdef ) {
2015-04-27 06:27:19 +00:00
$arr = $this -> callHook ( 'editDocumentContentAttribute' , null , $attrdef );
if ( is_array ( $arr )) {
echo $txt ;
echo " <tr> " ;
echo " <td> " . $arr [ 0 ] . " :</td> " ;
echo " <td> " . $arr [ 1 ] . " </td> " ;
echo " </tr> " ;
} else {
2012-12-14 07:53:13 +00:00
?>
2013-01-24 09:34:11 +00:00
< tr >
< td >< ? php echo htmlspecialchars ( $attrdef -> getName ()); ?> :</td>
2016-10-20 16:28:25 +00:00
< td >< ? php $this -> printAttributeEditField ( $attrdef , '' ) ?>
< ? php
if ( $latestContent -> getAttributeValue ( $attrdef )) {
switch ( $attrdef -> getType ()) {
case SeedDMS_Core_AttributeDefinition :: type_string :
case SeedDMS_Core_AttributeDefinition :: type_date :
case SeedDMS_Core_AttributeDefinition :: type_int :
case SeedDMS_Core_AttributeDefinition :: type_float :
$this -> printInputPresetButtonHtml ( 'attributes_' . $attrdef -> getID (), $latestContent -> getAttributeValue ( $attrdef ), $attrdef -> getValueSetSeparator ());
break ;
case SeedDMS_Core_AttributeDefinition :: type_boolean :
$this -> printCheckboxPresetButtonHtml ( 'attributes_' . $attrdef -> getID (), $latestContent -> getAttributeValue ( $attrdef ));
break ;
}
// print_r($latestContent->getAttributeValue($attrdef));
}
?> </td>
2013-01-24 09:34:11 +00:00
</ tr >
2012-12-14 07:53:13 +00:00
< ? php
2015-04-27 06:27:19 +00:00
}
2012-12-14 07:53:13 +00:00
}
}
2015-03-16 07:58:10 +00:00
if ( $workflowmode == 'traditional' || $workflowmode == 'traditional_only_approval' ) {
2013-02-06 13:59:10 +00:00
// Retrieve a list of all users and groups that have review / approve
// privileges.
2013-02-27 16:18:08 +00:00
$docAccess = $folder -> getReadAccessList ( $enableadminrevapp , $enableownerrevapp );
2015-03-16 07:58:10 +00:00
if ( $workflowmode != 'traditional_only_approval' ) {
2012-12-14 07:53:13 +00:00
?>
< tr >
< td colspan = " 2 " >
< ? php $this -> contentSubHeading ( getMLText ( " assign_reviewers " )); ?>
</ td >
</ tr >
< tr >
< td >
< div class = " cbSelectTitle " >< ? php printMLText ( " individuals " ); ?> :</div>
</ td >
2015-02-13 16:41:50 +00:00
< td >
< select id = " IndReviewer " class = " chzn-select span9 " name = " indReviewers[] " multiple = " multiple " data - placeholder = " <?php printMLText('select_ind_reviewers'); ?> " data - no_results_text = " <?php printMLText('unknown_owner'); ?> " >
2012-12-14 07:53:13 +00:00
< ? php
$res = $user -> getMandatoryReviewers ();
foreach ( $docAccess [ " users " ] as $usr ) {
2013-02-27 16:18:08 +00:00
if ( ! $enableselfrevapp && $usr -> getID () == $user -> getID ()) continue ;
2012-12-14 07:53:13 +00:00
$mandatory = false ;
foreach ( $res as $r ) if ( $r [ 'reviewerUserID' ] == $usr -> getID ()) $mandatory = true ;
if ( $mandatory ) print " <option disabled= \" disabled \" value= \" " . $usr -> getID () . " \" > " . htmlspecialchars ( $usr -> getLogin () . " - " . $usr -> getFullName ()) . " </option> " ;
else print " <option value= \" " . $usr -> getID () . " \" > " . htmlspecialchars ( $usr -> getLogin () . " - " . $usr -> getFullName ()) . " </option> " ;
}
?>
2015-02-13 16:41:50 +00:00
</ select >
2014-03-03 13:46:16 +00:00
< ? php
2015-02-13 16:41:50 +00:00
$tmp = array ();
foreach ( $reviewStatus as $r ) {
2015-04-23 15:12:08 +00:00
if ( $r [ 'type' ] == 0 ) {
if ( $res ) {
$mandatory = false ;
foreach ( $res as $rr )
if ( $rr [ 'reviewerUserID' ] == $r [ 'required' ]) {
$mandatory = true ;
}
if ( ! $mandatory )
$tmp [] = $r [ 'required' ];
} else {
2015-02-13 16:41:50 +00:00
$tmp [] = $r [ 'required' ];
2015-04-23 15:12:08 +00:00
}
2015-02-13 16:41:50 +00:00
}
}
if ( $tmp ) {
2016-03-21 06:40:17 +00:00
$this -> printSelectPresetButtonHtml ( " IndReviewer " , $tmp );
2015-02-13 16:41:50 +00:00
}
2014-06-17 17:07:51 +00:00
/* List all mandatory reviewers */
if ( $res ) {
$tmp = array ();
foreach ( $res as $r ) {
if ( $r [ 'reviewerUserID' ] > 0 ) {
$u = $dms -> getUser ( $r [ 'reviewerUserID' ]);
$tmp [] = htmlspecialchars ( $u -> getFullName () . ' (' . $u -> getLogin () . ')' );
}
}
if ( $tmp ) {
echo '<div class="mandatories"><span>' . getMLText ( 'mandatory_reviewers' ) . ':</span> ' ;
echo implode ( ', ' , $tmp );
echo " </div> \n " ;
}
}
2014-03-03 13:46:16 +00:00
/* Check for mandatory reviewer without access */
foreach ( $res as $r ) {
if ( $r [ 'reviewerUserID' ]) {
$hasAccess = false ;
foreach ( $docAccess [ " users " ] as $usr ) {
if ( $r [ 'reviewerUserID' ] == $usr -> getID ())
$hasAccess = true ;
}
if ( ! $hasAccess ) {
$noAccessUser = $dms -> getUser ( $r [ 'reviewerUserID' ]);
echo " <div class= \" alert alert-warning \" > " . getMLText ( " mandatory_reviewer_no_access " , array ( 'user' => htmlspecialchars ( $noAccessUser -> getFullName () . " ( " . $noAccessUser -> getLogin () . " ) " ))) . " </div> " ;
}
}
}
?>
2012-12-14 07:53:13 +00:00
</ td >
</ tr >
< tr >
< td >
< div class = " cbSelectTitle " >< ? php printMLText ( " groups " ); ?> :</div>
</ td >
2015-04-23 15:12:08 +00:00
< td >
2015-02-13 16:41:50 +00:00
< select id = " GrpReviewer " class = " chzn-select span9 " name = " grpReviewers[] " multiple = " multiple " data - placeholder = " <?php printMLText('select_grp_reviewers'); ?> " data - no_results_text = " <?php printMLText('unknown_group'); ?> " >
2012-12-14 07:53:13 +00:00
< ? php
foreach ( $docAccess [ " groups " ] as $grp ) {
$mandatory = false ;
foreach ( $res as $r ) if ( $r [ 'reviewerGroupID' ] == $grp -> getID ()) $mandatory = true ;
if ( $mandatory ) print " <option value= \" " . $grp -> getID () . " \" disabled= \" disabled \" > " . htmlspecialchars ( $grp -> getName ()) . " </option> " ;
else print " <option value= \" " . $grp -> getID () . " \" > " . htmlspecialchars ( $grp -> getName ()) . " </option> " ;
}
2014-03-03 13:46:16 +00:00
?>
</ select >
< ? php
2015-04-23 15:12:08 +00:00
$tmp = array ();
foreach ( $reviewStatus as $r ) {
if ( $r [ 'type' ] == 1 ) {
if ( $res ) {
$mandatory = false ;
foreach ( $res as $rr )
if ( $rr [ 'reviewerGroupID' ] == $r [ 'required' ]) {
$mandatory = true ;
}
if ( ! $mandatory )
$tmp [] = $r [ 'required' ];
} else {
$tmp [] = $r [ 'required' ];
}
}
}
if ( $tmp ) {
2016-03-21 06:40:17 +00:00
$this -> printSelectPresetButtonHtml ( " GrpReviewer " , $tmp );
2015-04-23 15:12:08 +00:00
}
2014-06-17 17:07:51 +00:00
/* List all mandatory groups of reviewers */
if ( $res ) {
$tmp = array ();
foreach ( $res as $r ) {
if ( $r [ 'reviewerGroupID' ] > 0 ) {
$u = $dms -> getGroup ( $r [ 'reviewerGroupID' ]);
$tmp [] = htmlspecialchars ( $u -> getName ());
}
}
if ( $tmp ) {
echo '<div class="mandatories"><span>' . getMLText ( 'mandatory_reviewergroups' ) . ':</span> ' ;
echo implode ( ', ' , $tmp );
echo " </div> \n " ;
}
}
2014-03-03 13:46:16 +00:00
/* Check for mandatory reviewer group without access */
foreach ( $res as $r ) {
if ( $r [ 'reviewerGroupID' ]) {
$hasAccess = false ;
foreach ( $docAccess [ " groups " ] as $grp ) {
if ( $r [ 'reviewerGroupID' ] == $grp -> getID ())
$hasAccess = true ;
}
if ( ! $hasAccess ) {
$noAccessGroup = $dms -> getGroup ( $r [ 'reviewerGroupID' ]);
echo " <div class= \" alert alert-warning \" > " . getMLText ( " mandatory_reviewergroup_no_access " , array ( 'group' => htmlspecialchars ( $noAccessGroup -> getName ()))) . " </div> " ;
}
}
}
2012-12-14 07:53:13 +00:00
?>
</ td >
2015-03-16 07:58:10 +00:00
</ tr >
< ? php } ?>
2012-12-14 07:53:13 +00:00
< tr >
< td colspan = 2 >
< ? php $this -> contentSubHeading ( getMLText ( " assign_approvers " )); ?>
</ td >
</ tr >
< tr >
< td >
< div class = " cbSelectTitle " >< ? php printMLText ( " individuals " ); ?> :</div>
</ td >
< td >
2015-02-13 16:41:50 +00:00
< select id = " IndApprover " class = " chzn-select span9 " name = " indApprovers[] " multiple = " multiple " data - placeholder = " <?php printMLText('select_ind_approvers'); ?> " data - no_results_text = " <?php printMLText('unknown_owner'); ?> " >
2012-12-14 07:53:13 +00:00
< ? php
$res = $user -> getMandatoryApprovers ();
foreach ( $docAccess [ " users " ] as $usr ) {
2013-02-27 16:18:08 +00:00
if ( ! $enableselfrevapp && $usr -> getID () == $user -> getID ()) continue ;
2012-12-14 07:53:13 +00:00
$mandatory = false ;
foreach ( $res as $r ) if ( $r [ 'approverUserID' ] == $usr -> getID ()) $mandatory = true ;
if ( $mandatory ) print " <option value= \" " . $usr -> getID () . " \" disabled='disabled'> " . htmlspecialchars ( $usr -> getFullName ()) . " </option> " ;
else print " <option value= \" " . $usr -> getID () . " \" > " . htmlspecialchars ( $usr -> getLogin () . " - " . $usr -> getFullName ()) . " </option> " ;
}
?>
</ select >
2014-03-03 13:46:16 +00:00
< ? php
2015-02-13 16:41:50 +00:00
$tmp = array ();
foreach ( $approvalStatus as $r ) {
2015-04-23 15:12:08 +00:00
if ( $r [ 'type' ] == 0 ) {
if ( $res ) {
$mandatory = false ;
foreach ( $res as $rr )
if ( $rr [ 'approverUserID' ] == $r [ 'required' ]) {
$mandatory = true ;
}
if ( ! $mandatory )
$tmp [] = $r [ 'required' ];
} else {
2015-02-13 16:41:50 +00:00
$tmp [] = $r [ 'required' ];
2015-04-23 15:12:08 +00:00
}
2015-02-13 16:41:50 +00:00
}
}
if ( $tmp ) {
2016-03-21 06:40:17 +00:00
$this -> printSelectPresetButtonHtml ( " IndApprover " , $tmp );
2015-02-13 16:41:50 +00:00
}
2014-06-17 17:07:51 +00:00
/* List all mandatory approvers */
if ( $res ) {
$tmp = array ();
foreach ( $res as $r ) {
if ( $r [ 'approverUserID' ] > 0 ) {
$u = $dms -> getUser ( $r [ 'approverUserID' ]);
$tmp [] = htmlspecialchars ( $u -> getFullName () . ' (' . $u -> getLogin () . ')' );
}
}
if ( $tmp ) {
echo '<div class="mandatories"><span>' . getMLText ( 'mandatory_approvers' ) . ':</span> ' ;
echo implode ( ', ' , $tmp );
echo " </div> \n " ;
}
}
2014-03-03 13:46:16 +00:00
/* Check for mandatory approvers without access */
foreach ( $res as $r ) {
if ( $r [ 'approverUserID' ]) {
$hasAccess = false ;
foreach ( $docAccess [ " users " ] as $usr ) {
if ( $r [ 'approverUserID' ] == $usr -> getID ())
$hasAccess = true ;
}
if ( ! $hasAccess ) {
$noAccessUser = $dms -> getUser ( $r [ 'approverUserID' ]);
echo " <div class= \" alert alert-warning \" > " . getMLText ( " mandatory_approver_no_access " , array ( 'user' => htmlspecialchars ( $noAccessUser -> getFullName () . " ( " . $noAccessUser -> getLogin () . " ) " ))) . " </div> " ;
}
}
}
?>
2012-12-14 07:53:13 +00:00
</ td >
</ tr >
< td >
< div class = " cbSelectTitle " >< ? php printMLText ( " groups " ); ?> :</div>
</ td >
< td >
2015-02-13 16:41:50 +00:00
< select id = " GrpApprover " class = " chzn-select span9 " name = " grpApprovers[] " multiple = " multiple " data - placeholder = " <?php printMLText('select_grp_approvers'); ?> " data - no_results_text = " <?php printMLText('unknown_group'); ?> " >
2012-12-14 07:53:13 +00:00
< ? php
foreach ( $docAccess [ " groups " ] as $grp ) {
$mandatory = false ;
foreach ( $res as $r ) if ( $r [ 'approverGroupID' ] == $grp -> getID ()) $mandatory = true ;
if ( $mandatory ) print " <option value= \" " . $grp -> getID () . " \" disabled= \" disabled \" > " . htmlspecialchars ( $grp -> getName ()) . " </option> " ;
else print " <option value= \" " . $grp -> getID () . " \" > " . htmlspecialchars ( $grp -> getName ()) . " </option> " ;
}
?>
</ select >
2014-03-03 13:46:16 +00:00
< ? php
2015-02-13 16:41:50 +00:00
$tmp = array ();
foreach ( $approvalStatus as $r ) {
2015-04-23 15:12:08 +00:00
if ( $r [ 'type' ] == 1 ) {
if ( $res ) {
$mandatory = false ;
foreach ( $res as $rr )
if ( $rr [ 'approverGroupID' ] == $r [ 'required' ]) {
$mandatory = true ;
}
if ( ! $mandatory )
$tmp [] = $r [ 'required' ];
} else {
2015-02-13 16:41:50 +00:00
$tmp [] = $r [ 'required' ];
2015-04-23 15:12:08 +00:00
}
2015-02-13 16:41:50 +00:00
}
}
if ( $tmp ) {
2016-03-21 06:40:17 +00:00
$this -> printSelectPresetButtonHtml ( " GrpApprover " , $tmp );
2015-02-13 16:41:50 +00:00
}
2014-06-17 17:07:51 +00:00
/* List all mandatory groups of approvers */
if ( $res ) {
$tmp = array ();
foreach ( $res as $r ) {
if ( $r [ 'approverGroupID' ] > 0 ) {
$u = $dms -> getGroup ( $r [ 'approverGroupID' ]);
$tmp [] = htmlspecialchars ( $u -> getName ());
}
}
if ( $tmp ) {
echo '<div class="mandatories"><span>' . getMLText ( 'mandatory_approvergroups' ) . ':</span> ' ;
echo implode ( ', ' , $tmp );
echo " </div> \n " ;
}
}
2014-03-03 13:46:16 +00:00
/* Check for mandatory approver groups without access */
foreach ( $res as $r ) {
if ( $r [ 'approverGroupID' ]) {
$hasAccess = false ;
foreach ( $docAccess [ " groups " ] as $grp ) {
if ( $r [ 'approverGroupID' ] == $grp -> getID ())
$hasAccess = true ;
}
if ( ! $hasAccess ) {
$noAccessGroup = $dms -> getGroup ( $r [ 'approverGroupID' ]);
echo " <div class= \" alert alert-warning \" > " . getMLText ( " mandatory_approvergroup_no_access " , array ( 'group' => htmlspecialchars ( $noAccessGroup -> getName ()))) . " </div> " ;
}
}
}
?>
2012-12-14 07:53:13 +00:00
</ td >
</ tr >
< tr >
< td colspan = " 2 " >< div class = " alert " >< ? php printMLText ( " add_doc_reviewer_approver_warning " ) ?> </div></td>
</ tr >
2013-01-24 09:34:11 +00:00
< ? php
} else {
?>
< tr >
< td >
< div class = " cbSelectTitle " >< ? php printMLText ( " workflow " ); ?> :</div>
</ td >
< td >
< ? php
2016-01-27 15:20:51 +00:00
$mandatoryworkflows = $user -> getMandatoryWorkflows ();
if ( $mandatoryworkflows ) {
if ( count ( $mandatoryworkflows ) == 1 ) {
2013-08-06 12:21:40 +00:00
?>
2016-01-27 15:20:51 +00:00
< ? php echo htmlspecialchars ( $mandatoryworkflows [ 0 ] -> getName ()); ?>
< input type = " hidden " name = " workflow " value = " <?php echo $mandatoryworkflows[0] ->getID(); ?> " >
2013-08-06 12:21:40 +00:00
< ? php
2016-01-27 15:20:51 +00:00
} else {
?>
< select class = " _chzn-select-deselect span9 " name = " workflow " data - placeholder = " <?php printMLText('select_workflow'); ?> " >
< ? php
$curworkflow = $latestContent -> getWorkflow ();
foreach ( $mandatoryworkflows as $workflow ) {
print " <option value= \" " . $workflow -> getID () . " \" " ;
if ( $curworkflow && $curworkflow -> getID () == $workflow -> getID ())
echo " selected= \" selected \" " ;
print " > " . htmlspecialchars ( $workflow -> getName ()) . " </option> " ;
}
?>
</ select >
< ? php
}
2013-08-06 12:21:40 +00:00
} else {
?>
< select class = " _chzn-select-deselect span9 " name = " workflow " data - placeholder = " <?php printMLText('select_workflow'); ?> " >
< ? php
$workflows = $dms -> getAllWorkflows ();
print " <option value= \" \" > " . " </option> " ;
foreach ( $workflows as $workflow ) {
print " <option value= \" " . $workflow -> getID () . " \" " ;
print " > " . htmlspecialchars ( $workflow -> getName ()) . " </option> " ;
}
2013-01-24 09:34:11 +00:00
?>
</ select >
2013-08-06 12:21:40 +00:00
< ? php
}
?>
2013-01-24 09:34:11 +00:00
</ td >
</ tr >
< tr >
< td colspan = " 2 " >
< ? php $this -> warningMsg ( getMLText ( " add_doc_workflow_warning " )); ?>
</ td >
</ tr >
< ? php
}
?>
2012-12-14 07:53:13 +00:00
< tr >
< td ></ td >
< td >< input type = " submit " class = " btn " value = " <?php printMLText( " update_document " )?> " ></ td >
</ tr >
</ table >
</ form >
< ? php
$this -> contentContainerEnd ();
2016-03-15 07:30:53 +00:00
$this -> contentEnd ();
2012-12-14 07:53:13 +00:00
$this -> htmlEndPage ();
} /* }}} */
}
?>