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
*/
2021-04-18 05:08:00 +00:00
//require_once("class.Bootstrap.php");
2012-12-14 07:53:13 +00:00
/**
* Class which outputs the html page for 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 @
*/
2021-04-18 05:08:00 +00:00
class SeedDMS_View_UpdateDocument extends SeedDMS_Theme_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' ];
2021-03-10 14:58:22 +00:00
header ( 'Content-Type: application/javascript; charset=UTF-8' );
2021-05-27 19:57:12 +00:00
parent :: jsTranslations ( array ( 'js_form_error' , 'js_form_errors' ));
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 );
2018-09-05 11:35:44 +00:00
$this -> printFileChooserJs ();
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 ({
2017-05-04 11:49:45 +00:00
debug : false ,
ignore : " :hidden:not(.do_validate) " ,
2017-01-31 16:27:53 +00:00
< ? php
if ( $enablelargefileupload ) {
?>
submitHandler : function ( form ) {
2017-05-04 11:49:45 +00:00
/* fileuploader may not have any files if drop folder is used */
if ( userfileuploader . getUploads () . length )
userfileuploader . uploadStoredFiles ();
else
form . submit ();
2017-01-31 16:27:53 +00:00
},
< ? php
}
?>
2016-08-30 05:59:03 +00:00
rules : {
2017-01-31 16:27:53 +00:00
< ? php
if ( $enablelargefileupload ) {
?>
2017-05-04 11:49:45 +00:00
'userfile-fine-uploader-uuids' : {
fineuploader : [ userfileuploader , $ ( '#dropfolderfileform1' ) ]
2017-01-31 16:27:53 +00:00
}
< ? php
} else {
?>
2016-08-30 05:59:03 +00:00
userfile : {
2024-05-02 12:24:43 +00:00
require_from_group : [ 1 , " .fileupload-group " ],
maxsize : < ? = $maxuploadsize ?>
2021-07-08 12:16:13 +00:00
// alternatives: $('#dropfolderfileform1')
2016-08-30 05:59:03 +00:00
},
dropfolderfileform1 : {
2021-07-08 12:16:13 +00:00
require_from_group : [ 1 , " .fileupload-group " ]
// alternatives: $('#userfile')
2016-08-30 05:59:03 +00:00
}
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' ];
2023-11-06 13:31:56 +00:00
$settings = $this -> params [ 'settings' ];
2015-12-14 14:16:32 +00:00
$folder = $this -> params [ 'folder' ];
$document = $this -> params [ 'document' ];
$strictformcheck = $this -> params [ 'strictformcheck' ];
2019-12-19 15:08:10 +00:00
$nodocumentformfields = $this -> params [ 'nodocumentformfields' ];
2015-12-14 14:16:32 +00:00
$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' ];
2018-04-03 07:32:36 +00:00
$enablereceiptworkflow = $this -> params [ 'enablereceiptworkflow' ];
2018-01-16 17:15:05 +00:00
$enableselfreceipt = $this -> params [ 'enableselfreceipt' ];
2023-10-13 17:33:25 +00:00
$enablehiddenrevapp = $this -> params [ 'enablehiddenrevapp' ];
2015-12-14 14:16:32 +00:00
$dropfolderdir = $this -> params [ 'dropfolderdir' ];
$workflowmode = $this -> params [ 'workflowmode' ];
$presetexpiration = $this -> params [ 'presetexpiration' ];
$documentid = $document -> getId ();
2024-05-02 05:49:16 +00:00
$accept = $this -> getParam ( 'accept' );
if ( $accept && is_array ( $accept ))
$accept = implode ( ',' , $accept );
2015-12-14 14:16:32 +00:00
2020-08-27 05:52:52 +00:00
$this -> htmlAddHeader ( '<script type="text/javascript" src="../views/' . $this -> theme . '/vendors/jquery-validation/jquery.validate.js"></script>' . " \n " , 'js' );
2021-07-08 12:16:13 +00:00
$this -> htmlAddHeader ( '<script type="text/javascript" src="../views/' . $this -> theme . '/vendors/jquery-validation/additional-methods.js"></script>' . " \n " , 'js' );
2021-05-27 19:57:12 +00:00
$this -> htmlAddHeader ( '<script type="text/javascript" src="../views/' . $this -> theme . '/styles/validation-default.js"></script>' . " \n " , 'js' );
2017-03-15 15:40:41 +00:00
if ( $enablelargefileupload ) {
2020-08-27 05:52:52 +00:00
$this -> htmlAddHeader ( '<script type="text/javascript" src="../views/' . $this -> theme . '/vendors/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 ();
2021-07-15 15:43:50 +00:00
$html = '' ;
$html .= getMLText ( " update_locked_msg " , array ( " username " => htmlspecialchars ( $lockingUser -> getFullName ()), " email " => $lockingUser -> getEmail ())) . ' ' ;
2012-12-14 07:53:13 +00:00
if ( $lockingUser -> getID () == $user -> getID ())
2021-07-15 15:43:50 +00:00
$html .= getMLText ( " unlock_cause_locking_user " );
2012-12-14 07:53:13 +00:00
else if ( $document -> getAccessMode ( $user ) == M_ALL )
2021-07-15 15:43:50 +00:00
$html .= getMLText ( " unlock_cause_access_mode_all " );
2012-12-14 07:53:13 +00:00
else
{
2021-07-15 15:43:50 +00:00
$html .= getMLText ( " no_update_cause_locked " );
$this -> warningMsg ( $html );
2016-03-15 07:30:53 +00:00
$this -> contentEnd ();
2012-12-14 07:53:13 +00:00
$this -> htmlEndPage ();
exit ;
}
2021-07-15 15:43:50 +00:00
$this -> warningMsg ( $html );
2012-12-14 07:53:13 +00:00
}
2015-02-13 16:41:50 +00:00
$latestContent = $document -> getLatestContent ();
$reviewStatus = $latestContent -> getReviewStatus ();
2018-01-16 17:15:05 +00:00
$receiptStatus = $latestContent -> getReceiptStatus ();
2015-02-13 16:41:50 +00:00
$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
2022-04-29 16:30:46 +00:00
$msg = getMLText ( " max_upload_size " ) . " : " . SeedDMS_Core_File :: format_filesize ( $maxuploadsize );
$this -> warningMsg ( $msg );
2015-04-23 14:45:19 +00:00
if ( $document -> isCheckedOut ()) {
2020-11-22 10:39:57 +00:00
$msg = getMLText ( 'document_is_checked_out_update' );
2015-04-23 14:45:19 +00:00
$this -> warningMsg ( $msg );
}
2012-12-14 07:53:13 +00:00
?>
2018-06-26 04:52:16 +00:00
< form class = " form-horizontal " action = " ../op/op.UpdateDocument.php " enctype = " multipart/form-data " method = " post " name = " form1 " id = " form1 " >
2017-05-04 11:49:45 +00:00
< ? php echo createHiddenFieldWithKey ( 'updatedocument' ); ?>
2012-12-14 07:53:13 +00:00
< input type = " hidden " name = " documentid " value = " <?php print $document->getID (); ?> " >
2014-05-16 07:19:36 +00:00
< ? php
2021-05-17 11:31:32 +00:00
$this -> contentContainerStart ();
2018-06-26 04:52:16 +00:00
$this -> formField (
getMLText ( " local_file " ),
2024-05-02 05:49:16 +00:00
$enablelargefileupload ? $this -> getFineUploaderHtml () : $this -> getFileChooserHtml ( 'userfile' , false , $accept )
2018-06-26 04:52:16 +00:00
);
if ( $dropfolderdir ) {
$this -> formField (
getMLText ( " dropfolder_file " ),
$this -> getDropFolderChooserHtml ( " form1 " )
);
}
2022-04-14 15:00:44 +00:00
if ( $arr = $this -> callHook ( 'addDocumentContentFile' , 'update' )) {
2021-10-25 10:52:13 +00:00
foreach ( $arr as $ar )
if ( is_array ( $ar )) {
2021-11-09 08:33:36 +00:00
$this -> formField ( $ar [ 0 ], $ar [ 1 ], isset ( $ar [ 2 ]) ? $ar [ 2 ] : null );
2021-10-25 10:52:13 +00:00
} elseif ( is_string ( $ar )) {
echo $ar ;
}
2021-07-08 12:16:13 +00:00
}
2019-12-19 15:08:10 +00:00
if ( ! $nodocumentformfields || ! in_array ( 'version_comment' , $nodocumentformfields )) {
2018-06-26 04:52:16 +00:00
$this -> formField (
getMLText ( " comment " ),
array (
'element' => 'textarea' ,
'name' => 'comment' ,
'rows' => 4 ,
'cols' => 80
)
);
2019-12-19 15:08:10 +00:00
}
if ( ! $nodocumentformfields || ! in_array ( 'expires' , $nodocumentformfields )) {
2018-06-26 04:52:16 +00:00
if ( $presetexpiration ) {
if ( ! ( $expts = strtotime ( $presetexpiration )))
2017-04-05 20:00:54 +00:00
$expts = false ;
2018-06-26 04:52:16 +00:00
} else {
$expts = false ;
}
$options = array ();
$options [] = array ( 'never' , getMLText ( 'does_not_expire' ));
$options [] = array ( 'date' , getMLText ( 'expire_by_date' ), $expts );
$options [] = array ( '1w' , getMLText ( 'expire_in_1w' ));
$options [] = array ( '1m' , getMLText ( 'expire_in_1m' ));
$options [] = array ( '1y' , getMLText ( 'expire_in_1y' ));
$options [] = array ( '2y' , getMLText ( 'expire_in_2y' ));
$this -> formField (
getMLText ( " preset_expires " ),
array (
'element' => 'select' ,
'id' => 'presetexpdate' ,
'name' => 'presetexpdate' ,
'options' => $options
)
);
$this -> formField (
getMLText ( " expires " ),
2020-12-17 12:41:00 +00:00
$this -> getDateChooser (( $expts ? getReadableDate ( $expts ) : '' ), " expdate " , $this -> params [ 'session' ] -> getLanguage ())
2018-06-26 04:52:16 +00:00
);
2019-12-19 15:08:10 +00:00
}
2018-06-26 04:52:16 +00:00
$attrdefs = $dms -> getAllAttributeDefinitions ( array ( SeedDMS_Core_AttributeDefinition :: objtype_documentcontent , SeedDMS_Core_AttributeDefinition :: objtype_all ));
if ( $attrdefs ) {
foreach ( $attrdefs as $attrdef ) {
$arr = $this -> callHook ( 'editDocumentContentAttribute' , $document , $attrdef );
if ( is_array ( $arr )) {
if ( $arr )
2021-03-19 09:49:51 +00:00
$this -> formField ( $arr [ 0 ], $arr [ 1 ], isset ( $arr [ 2 ]) ? $arr [ 2 ] : null );
2020-09-24 06:32:09 +00:00
} elseif ( is_string ( $arr )) {
echo $arr ;
2018-06-26 04:52:16 +00:00
} else {
2021-03-06 14:35:23 +00:00
$this -> formField ( htmlspecialchars ( $attrdef -> getName ()), $this -> getAttributeEditField ( $attrdef , $document -> getAttribute ( $attrdef ), 'attributes_version' ));
2016-10-20 16:28:25 +00:00
}
2015-04-27 06:27:19 +00:00
}
2012-12-14 07:53:13 +00:00
}
2021-03-05 17:46:20 +00:00
$arrs = $this -> callHook ( 'addDocumentContentAttributes' , $document );
2018-06-26 04:52:16 +00:00
if ( is_array ( $arrs )) {
foreach ( $arrs as $arr ) {
2021-03-19 09:49:51 +00:00
$this -> formField ( $arr [ 0 ], $arr [ 1 ], isset ( $arr [ 2 ]) ? $arr [ 2 ] : null );
2018-06-26 04:52:16 +00:00
}
2020-07-21 05:29:15 +00:00
} elseif ( is_string ( $arrs )) {
echo $arrs ;
2017-05-04 09:04:08 +00:00
}
2021-07-14 19:10:21 +00:00
$docAccess = $document -> getReadAccessList ( $enableadminrevapp , $enableownerrevapp );
2018-06-26 04:52:16 +00:00
if ( $workflowmode == 'advanced' ) {
$mandatoryworkflows = $user -> getMandatoryWorkflows ();
if ( $mandatoryworkflows ) {
if ( count ( $mandatoryworkflows ) == 1 ) {
$this -> formField (
getMLText ( " workflow " ),
htmlspecialchars ( $mandatoryworkflows [ 0 ] -> getName ()) . '<input type="hidden" name="workflow" value="' . $mandatoryworkflows [ 0 ] -> getID () . '">'
);
} else {
$options = array ();
$curworkflow = $latestContent -> getWorkflow ();
foreach ( $mandatoryworkflows as $workflow ) {
$options [] = array ( $workflow -> getID (), htmlspecialchars ( $workflow -> getName ()), $curworkflow && $curworkflow -> getID () == $workflow -> getID ());
}
$this -> formField (
getMLText ( " workflow " ),
array (
'element' => 'select' ,
'id' => 'workflow' ,
'name' => 'workflow' ,
'class' => 'chzn-select' ,
'attributes' => array ( array ( 'data-placeholder' , getMLText ( 'select_workflow' ))),
'options' => $options
)
);
}
} else {
$options = array ();
$options [] = array ( '' , '' );
$workflows = $dms -> getAllWorkflows ();
foreach ( $workflows as $workflow ) {
$options [] = array ( $workflow -> getID (), htmlspecialchars ( $workflow -> getName ()));
}
$this -> formField (
getMLText ( " workflow " ),
array (
'element' => 'select' ,
'id' => 'workflow' ,
'name' => 'workflow' ,
'class' => 'chzn-select' ,
'attributes' => array ( array ( 'data-allow-clear' , 'true' ), array ( 'data-placeholder' , getMLText ( 'select_workflow' ))),
'options' => $options
)
);
}
2023-03-30 10:26:35 +00:00
$this -> contentContainerEnd ();
2023-03-30 10:02:31 +00:00
if ( $settings -> _initialDocumentStatus == S_RELEASED )
$this -> warningMsg ( getMLText ( " add_doc_workflow_warning " ));
2020-01-16 12:08:22 +00:00
} elseif ( $workflowmode == 'traditional' || $workflowmode == 'traditional_only_approval' ) {
2018-06-26 04:52:16 +00:00
if ( $workflowmode == 'traditional' ) {
2023-03-30 10:26:35 +00:00
$this -> contentContainerEnd ();
2018-06-26 04:52:16 +00:00
$this -> contentSubHeading ( getMLText ( " assign_reviewers " ));
2023-03-30 10:26:35 +00:00
$this -> contentContainerStart ();
2024-02-08 20:02:12 +00:00
$mreviewers = getMandatoryReviewers ( $folder , $document , $user );
2018-06-26 04:52:16 +00:00
$options = array ();
2012-12-14 07:53:13 +00:00
foreach ( $docAccess [ " users " ] as $usr ) {
2023-10-13 17:33:25 +00:00
if ( ! $enablehiddenrevapp && $usr -> isHidden ()) continue ;
2024-02-08 20:02:12 +00:00
if ( ! $enableselfrevapp && $usr -> getID () == $user -> getID ()) continue ;
2012-12-14 07:53:13 +00:00
2018-06-26 04:52:16 +00:00
$option = array ( $usr -> getID (), htmlspecialchars ( $usr -> getLogin () . " - " . $usr -> getFullName ()), null );
2024-02-08 20:02:12 +00:00
if ( in_array ( $usr -> getId (), $mreviewers [ 'i' ]))
$option [] = array ( array ( 'disabled' , 'disabled' ), array ( 'data-subtitle' , getMLText ( 'user_is_mandatory_reviewer' )));
2018-06-26 04:52:16 +00:00
$options [] = $option ;
2012-12-14 07:53:13 +00:00
}
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 ) {
2024-02-08 20:02:12 +00:00
if ( $mreviewers ) {
if ( ! in_array ( $r [ 'required' ], $mreviewers [ 'i' ]))
2015-04-23 15:12:08 +00:00
$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
}
}
2018-06-27 20:13:38 +00:00
$fieldwrap = array ();
2015-02-13 16:41:50 +00:00
if ( $tmp ) {
2018-06-26 04:52:16 +00:00
$fieldwrap = array ( '' , $this -> getSelectPresetButtonHtml ( " IndReviewers " , $tmp ));
2015-02-13 16:41:50 +00:00
}
2014-06-17 17:07:51 +00:00
/* List all mandatory reviewers */
2024-02-08 20:02:12 +00:00
$tmp = array ();
foreach ( $mreviewers [ 'i' ] as $r ) {
$u = $dms -> getUser ( $r );
$tmp [] = htmlspecialchars ( $u -> getFullName () . ' (' . $u -> getLogin () . ')' );
}
if ( $tmp ) {
if ( isset ( $fieldwrap [ 1 ]))
$fieldwrap [ 1 ] .= '<div class="mandatories"><span>' . getMLText ( 'mandatory_reviewers' ) . ':</span> ' . implode ( ', ' , $tmp ) . " </div> \n " ;
else
$fieldwrap [ 1 ] = '<div class="mandatories"><span>' . getMLText ( 'mandatory_reviewers' ) . ':</span> ' . implode ( ', ' , $tmp ) . " </div> \n " ;
2014-06-17 17:07:51 +00:00
}
2018-06-27 20:13:38 +00:00
2018-06-26 04:52:16 +00:00
$this -> formField (
getMLText ( " individuals " ),
array (
'element' => 'select' ,
'name' => 'indReviewers[]' ,
'id' => 'IndReviewers' ,
'class' => 'chzn-select' ,
'attributes' => array ( array ( 'data-placeholder' , getMLText ( 'select_ind_reviewers' ))),
'multiple' => true ,
'options' => $options
),
array ( 'field_wrap' => $fieldwrap )
);
2014-03-03 13:46:16 +00:00
/* Check for mandatory reviewer without access */
2024-02-08 20:02:12 +00:00
foreach ( $mreviewers [ 'ni' ] as $r ) {
$hasAccess = false ;
foreach ( $docAccess [ " users " ] as $usr ) {
if ( $r == $usr -> getID ())
$hasAccess = true ;
}
if ( ! $hasAccess ) {
$noAccessUser = $dms -> getUser ( $r );
$this -> warningMsg ( getMLText ( " mandatory_reviewer_no_access " , array ( 'user' => htmlspecialchars ( $noAccessUser -> getFullName () . " ( " . $noAccessUser -> getLogin () . " ) " ))));
2014-03-03 13:46:16 +00:00
}
}
2018-07-03 08:54:26 +00:00
$options = array ();
foreach ( $docAccess [ " groups " ] as $grp ) {
$options [] = array ( $grp -> getID (), htmlspecialchars ( $grp -> getName ()));
}
$this -> formField (
getMLText ( " individuals_in_groups " ),
array (
'element' => 'select' ,
'name' => 'grpIndReviewers[]' ,
'id' => 'GrpIndReviewers' ,
'class' => 'chzn-select' ,
'attributes' => array ( array ( 'data-placeholder' , getMLText ( 'select_grp_ind_reviewers' ))),
'multiple' => true ,
'options' => $options
)
);
2018-06-26 04:52:16 +00:00
$options = array ();
2012-12-14 07:53:13 +00:00
foreach ( $docAccess [ " groups " ] as $grp ) {
2018-06-26 04:52:16 +00:00
$option = array ( $grp -> getID (), htmlspecialchars ( $grp -> getName ()), null );
2024-02-22 11:06:16 +00:00
if ( in_array ( $grp -> getId (), $mreviewers [ 'g' ]))
2024-02-08 20:02:12 +00:00
$option [] = array ( array ( 'disabled' , 'disabled' ), array ( 'data-subtitle' , getMLText ( 'group_is_mandatory_reviewer' )));
2018-06-26 04:52:16 +00:00
$options [] = $option ;
2012-12-14 07:53:13 +00:00
}
2024-02-08 20:02:12 +00:00
2015-04-23 15:12:08 +00:00
$tmp = array ();
foreach ( $reviewStatus as $r ) {
if ( $r [ 'type' ] == 1 ) {
2024-02-08 20:02:12 +00:00
if ( $mreviewers ) {
if ( ! in_array ( $r [ 'required' ], $mreviewers [ 'g' ]))
2015-04-23 15:12:08 +00:00
$tmp [] = $r [ 'required' ];
} else {
$tmp [] = $r [ 'required' ];
}
}
}
2019-06-27 12:18:58 +00:00
$fieldwrap = array ( '' , '' );
2015-04-23 15:12:08 +00:00
if ( $tmp ) {
2018-06-26 04:52:16 +00:00
$fieldwrap = array ( '' , $this -> getSelectPresetButtonHtml ( " GrpReviewers " , $tmp ));
2015-04-23 15:12:08 +00:00
}
2014-06-17 17:07:51 +00:00
/* List all mandatory groups of reviewers */
2024-02-08 20:02:12 +00:00
$tmp = array ();
foreach ( $mreviewers [ 'g' ] as $r ) {
$u = $dms -> getGroup ( $r );
$tmp [] = htmlspecialchars ( $u -> getName ());
}
if ( $tmp ) {
if ( isset ( $fieldwrap [ 1 ]))
2018-06-27 20:13:38 +00:00
$fieldwrap [ 1 ] .= '<div class="mandatories"><span>' . getMLText ( 'mandatory_reviewergroups' ) . ':</span> ' . implode ( ', ' , $tmp ) . " </div> \n " ;
2024-02-08 20:02:12 +00:00
else
$fieldwrap [ 1 ] = '<div class="mandatories"><span>' . getMLText ( 'mandatory_reviewergroups' ) . ':</span> ' . implode ( ', ' , $tmp ) . " </div> \n " ;
2014-06-17 17:07:51 +00:00
}
2024-02-08 20:02:12 +00:00
2018-06-26 04:52:16 +00:00
$this -> formField (
getMLText ( " groups " ),
array (
'element' => 'select' ,
'name' => 'grpReviewers[]' ,
'id' => 'GrpReviewers' ,
'class' => 'chzn-select' ,
'attributes' => array ( array ( 'data-placeholder' , getMLText ( 'select_grp_reviewers' ))),
'multiple' => true ,
'options' => $options
),
array ( 'field_wrap' => $fieldwrap )
);
2014-06-17 17:07:51 +00:00
2014-03-03 13:46:16 +00:00
/* Check for mandatory reviewer group without access */
2024-02-08 20:02:12 +00:00
foreach ( $mreviewers [ 'ng' ] as $r ) {
$hasAccess = false ;
foreach ( $docAccess [ " groups " ] as $grp ) {
if ( $r == $grp -> getID ())
$hasAccess = true ;
}
if ( ! $hasAccess ) {
$noAccessGroup = $dms -> getGroup ( $r [ 'reviewerGroupID' ]);
$this -> warningMsg ( getMLText ( " mandatory_reviewergroup_no_access " , array ( 'group' => htmlspecialchars ( $noAccessGroup -> getName ()))));
2014-03-03 13:46:16 +00:00
}
}
2023-03-30 10:26:35 +00:00
$this -> contentContainerEnd ();
2018-06-26 04:52:16 +00:00
}
2012-12-14 07:53:13 +00:00
2018-06-26 04:52:16 +00:00
$this -> contentSubHeading ( getMLText ( " assign_approvers " ));
2023-03-30 10:26:35 +00:00
$this -> contentContainerStart ();
2024-02-08 20:02:12 +00:00
$mapprovers = getMandatoryApprovers ( $folder , $document , $user );
2018-06-26 04:52:16 +00:00
$options = array ();
foreach ( $docAccess [ " users " ] as $usr ) {
2023-10-13 17:33:25 +00:00
if ( ! $enablehiddenrevapp && $usr -> isHidden ()) continue ;
2024-02-08 20:02:12 +00:00
if ( ! $enableselfrevapp && $usr -> getID () == $user -> getID ()) continue ;
2018-06-26 04:52:16 +00:00
$option = array ( $usr -> getID (), htmlspecialchars ( $usr -> getLogin () . " - " . $usr -> getFullName ()), null );
2024-02-08 20:02:12 +00:00
if ( in_array ( $usr -> getId (), $mapprovers [ 'i' ]))
$option [] = array ( array ( 'disabled' , 'disabled' ), array ( 'data-subtitle' , getMLText ( 'user_is_mandatory_approver' )));
2018-06-26 04:52:16 +00:00
$options [] = $option ;
}
2024-02-08 20:02:12 +00:00
2018-06-26 04:52:16 +00:00
$tmp = array ();
foreach ( $approvalStatus as $r ) {
if ( $r [ 'type' ] == 0 ) {
2024-02-08 20:02:12 +00:00
if ( $mapprovers ) {
if ( ! in_array ( $r [ 'required' ], $mapprovers [ 'i' ]))
2015-02-13 16:41:50 +00:00
$tmp [] = $r [ 'required' ];
2018-06-26 04:52:16 +00:00
} else {
$tmp [] = $r [ 'required' ];
2015-02-13 16:41:50 +00:00
}
2012-12-14 07:53:13 +00:00
}
2018-06-26 04:52:16 +00:00
}
2018-06-27 20:13:38 +00:00
$fieldwrap = array ();
2018-06-26 04:52:16 +00:00
if ( $tmp ) {
$fieldwrap = array ( '' , $this -> getSelectPresetButtonHtml ( " IndApprovers " , $tmp ));
}
2024-02-08 20:02:12 +00:00
2018-06-27 20:13:38 +00:00
/* List all mandatory approvers */
2024-02-08 20:02:12 +00:00
$tmp = array ();
foreach ( $mapprovers [ 'i' ] as $r ) {
$u = $dms -> getUser ( $r );
$tmp [] = htmlspecialchars ( $u -> getFullName () . ' (' . $u -> getLogin () . ')' );
}
if ( $tmp ) {
if ( isset ( $fieldwrap [ 1 ]))
2018-06-27 20:13:38 +00:00
$fieldwrap [ 1 ] .= '<div class="mandatories"><span>' . getMLText ( 'mandatory_approvers' ) . ':</span> ' . implode ( ', ' , $tmp ) . " </div> \n " ;
2024-02-08 20:02:12 +00:00
else
$fieldwrap [ 1 ] = '<div class="mandatories"><span>' . getMLText ( 'mandatory_approvers' ) . ':</span> ' . implode ( ', ' , $tmp ) . " </div> \n " ;
2018-06-27 20:13:38 +00:00
}
2018-06-26 04:52:16 +00:00
$this -> formField (
getMLText ( " individuals " ),
array (
'element' => 'select' ,
'name' => 'indApprovers[]' ,
'id' => 'IndApprovers' ,
'class' => 'chzn-select' ,
'attributes' => array ( array ( 'data-placeholder' , getMLText ( 'select_ind_approvers' ))),
'multiple' => true ,
'options' => $options
),
array ( 'field_wrap' => $fieldwrap )
);
2014-06-17 17:07:51 +00:00
2014-03-03 13:46:16 +00:00
/* Check for mandatory approvers without access */
2024-02-08 20:02:12 +00:00
foreach ( $mapprovers [ 'ni' ] as $r ) {
2014-03-03 13:46:16 +00:00
$hasAccess = false ;
foreach ( $docAccess [ " users " ] as $usr ) {
2024-02-08 20:02:12 +00:00
if ( $r == $usr -> getID ())
2014-03-03 13:46:16 +00:00
$hasAccess = true ;
}
if ( ! $hasAccess ) {
2024-02-08 20:02:12 +00:00
$noAccessUser = $dms -> getUser ( $r );
2018-06-26 04:52:16 +00:00
$this -> warningMsg ( getMLText ( " mandatory_approver_no_access " , array ( 'user' => htmlspecialchars ( $noAccessUser -> getFullName () . " ( " . $noAccessUser -> getLogin () . " ) " ))));
2014-03-03 13:46:16 +00:00
}
}
2018-06-26 04:52:16 +00:00
2018-07-03 08:54:26 +00:00
$options = array ();
foreach ( $docAccess [ " groups " ] as $grp ) {
$options [] = array ( $grp -> getID (), htmlspecialchars ( $grp -> getName ()));
}
$this -> formField (
getMLText ( " individuals_in_groups " ),
array (
'element' => 'select' ,
'name' => 'grpIndApprovers[]' ,
'id' => 'GrpIndApprovers' ,
'class' => 'chzn-select' ,
'attributes' => array ( array ( 'data-placeholder' , getMLText ( 'select_grp_ind_approvers' ))),
'multiple' => true ,
'options' => $options
)
);
2018-06-26 04:52:16 +00:00
$options = array ();
2012-12-14 07:53:13 +00:00
foreach ( $docAccess [ " groups " ] as $grp ) {
2018-06-26 04:52:16 +00:00
$option = array ( $grp -> getID (), htmlspecialchars ( $grp -> getName ()), null );
2024-02-08 20:02:12 +00:00
if ( in_array ( $grp -> getId (), $mapprovers [ 'g' ]))
$option [] = array ( array ( 'disabled' , 'disabled' ), array ( 'data-subtitle' , getMLText ( 'group_is_mandatory_approver' )));
2018-06-26 04:52:16 +00:00
$options [] = $option ;
2012-12-14 07:53:13 +00:00
}
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 ) {
2024-02-08 20:02:12 +00:00
if ( ! in_array ( $r [ 'required' ], $mapprovers [ 'g' ]))
2015-02-13 16:41:50 +00:00
$tmp [] = $r [ 'required' ];
2024-02-08 20:02:12 +00:00
} else {
$tmp [] = $r [ 'required' ];
2015-02-13 16:41:50 +00:00
}
}
2019-06-27 12:18:58 +00:00
$fieldwrap = array ( '' , '' );
2015-02-13 16:41:50 +00:00
if ( $tmp ) {
2018-06-26 04:52:16 +00:00
$fieldwrap = array ( '' , $this -> getSelectPresetButtonHtml ( " GrpApprovers " , $tmp ));
2015-02-13 16:41:50 +00:00
}
2014-06-17 17:07:51 +00:00
/* List all mandatory groups of approvers */
2024-02-08 20:02:12 +00:00
$tmp = array ();
foreach ( $mapprovers [ 'g' ] as $r ) {
$u = $dms -> getGroup ( $r );
$tmp [] = htmlspecialchars ( $u -> getName ());
}
if ( $tmp ) {
$fieldwrap [ 1 ] .= '<div class="mandatories"><span>' . getMLText ( 'mandatory_approvergroups' ) . ':</span> ' . implode ( ', ' , $tmp ) . " </div> \n " ;
2014-06-17 17:07:51 +00:00
}
2018-06-26 04:52:16 +00:00
$this -> formField (
getMLText ( " groups " ),
array (
'element' => 'select' ,
'name' => 'grpApprovers[]' ,
'id' => 'GrpApprovers' ,
'class' => 'chzn-select' ,
'attributes' => array ( array ( 'data-placeholder' , getMLText ( 'select_grp_approvers' ))),
'multiple' => true ,
'options' => $options
),
array ( 'field_wrap' => $fieldwrap )
);
2014-03-03 13:46:16 +00:00
/* Check for mandatory approver groups without access */
2024-02-08 20:02:12 +00:00
foreach ( $mapprovers [ 'ng' ] as $r ) {
$hasAccess = false ;
foreach ( $docAccess [ " groups " ] as $grp ) {
if ( $r == $grp -> getID ())
$hasAccess = true ;
}
if ( ! $hasAccess ) {
$noAccessGroup = $dms -> getGroup ( $r );
$this -> warningMsg ( getMLText ( " mandatory_approvergroup_no_access " , array ( 'group' => htmlspecialchars ( $noAccessGroup -> getName ()))));
2014-03-03 13:46:16 +00:00
}
}
2023-03-30 10:26:35 +00:00
$this -> contentContainerEnd ();
2018-06-26 04:52:16 +00:00
$this -> warningMsg ( getMLText ( " add_doc_reviewer_approver_warning " ));
2023-03-30 10:26:35 +00:00
} else {
$this -> contentContainerEnd ();
2018-06-26 04:52:16 +00:00
}
2018-07-03 08:54:26 +00:00
if ( $enablereceiptworkflow ) {
2023-03-30 10:33:46 +00:00
$this -> contentSubHeading ( getMLText ( " assign_recipients " ));
$this -> contentContainerStart ();
2018-07-03 08:54:26 +00:00
$options = array ();
foreach ( $docAccess [ " users " ] as $usr ) {
if ( ! $enableselfreceipt && $usr -> getID () == $user -> getID ()) continue ;
$options [] = array ( $usr -> getID (), htmlspecialchars ( $usr -> getLogin () . " - " . $usr -> getFullName ()));
}
$tmp = array ();
foreach ( $receiptStatus as $r ) {
if ( $r [ 'type' ] == 0 ) {
$tmp [] = $r [ 'required' ];
2018-01-16 17:15:05 +00:00
}
2018-07-03 08:54:26 +00:00
}
$fieldwrap = array ();
if ( $tmp ) {
$fieldwrap = array ( '' , $this -> getSelectPresetButtonHtml ( " IndRecipient " , $tmp ));
}
$this -> formField (
2023-03-30 10:33:46 +00:00
getMLText ( " individuals " ),
2018-07-03 08:54:26 +00:00
array (
'element' => 'select' ,
'name' => 'indRecipients[]' ,
'id' => 'IndRecipient' ,
'class' => 'chzn-select' ,
'attributes' => array ( array ( 'data-placeholder' , getMLText ( 'select_ind_recipients' )), array ( 'data-no_results_text' , getMLText ( 'unknown_owner' ))),
'multiple' => true ,
'options' => $options
),
array ( 'field_wrap' => $fieldwrap )
);
$options = array ();
2018-01-16 17:15:05 +00:00
foreach ( $docAccess [ " groups " ] as $grp ) {
2018-07-03 08:54:26 +00:00
$options [] = array ( $grp -> getID (), htmlspecialchars ( $grp -> getName ()));
2018-01-16 17:15:05 +00:00
}
2018-07-03 08:54:26 +00:00
$this -> formField (
getMLText ( " individuals_in_groups " ),
array (
'element' => 'select' ,
'name' => 'grpIndRecipients[]' ,
'id' => 'GrpIndRecipient' ,
'class' => 'chzn-select' ,
'attributes' => array ( array ( 'data-placeholder' , getMLText ( 'select_grp_ind_recipients' ))),
'multiple' => true ,
'options' => $options
)
);
$options = array ();
foreach ( $docAccess [ " groups " ] as $grp ) {
$options [] = array ( $grp -> getID (), htmlspecialchars ( $grp -> getName ()));
}
$tmp = array ();
foreach ( $receiptStatus as $r ) {
if ( $r [ 'type' ] == 1 ) {
$tmp [] = $r [ 'required' ];
2018-01-16 17:15:05 +00:00
}
2018-07-03 08:54:26 +00:00
}
$fieldwrap = array ();
if ( $tmp ) {
$fieldwrap = array ( '' , $this -> getSelectPresetButtonHtml ( " GrpRecipient " , $tmp ));
}
$this -> formField (
2023-03-30 10:33:46 +00:00
getMLText ( " groups " ),
2018-07-03 08:54:26 +00:00
array (
'element' => 'select' ,
'name' => 'grpRecipients[]' ,
'id' => 'GrpRecipient' ,
'class' => 'chzn-select' ,
'attributes' => array ( array ( 'data-placeholder' , getMLText ( 'select_grp_recipients' )), array ( 'data-no_results_text' , getMLText ( 'unknown_owner' ))),
'multiple' => true ,
'options' => $options
),
array ( 'field_wrap' => $fieldwrap )
);
2023-03-30 10:33:46 +00:00
$this -> contentContainerEnd ();
2018-07-03 08:54:26 +00:00
}
2018-06-26 04:52:16 +00:00
$this -> formSubmit ( getMLText ( 'update_document' ));
2018-01-16 17:15:05 +00:00
?>
2012-12-14 07:53:13 +00:00
</ form >
< ? php
2016-03-15 07:30:53 +00:00
$this -> contentEnd ();
2012-12-14 07:53:13 +00:00
$this -> htmlEndPage ();
} /* }}} */
}
?>