2012-12-14 07:53:13 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Implementation of SetReviewersApprovers 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 SetReviewersApprovers 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_SetReviewersApprovers extends SeedDMS_Bootstrap_Style {
|
2012-12-14 07:53:13 +00:00
|
|
|
|
|
|
|
function show() { /* {{{ */
|
|
|
|
$dms = $this->params['dms'];
|
|
|
|
$user = $this->params['user'];
|
|
|
|
$folder = $this->params['folder'];
|
|
|
|
$document = $this->params['document'];
|
|
|
|
$content = $this->params['version'];
|
2015-03-16 07:58:10 +00:00
|
|
|
$workflowmode = $this->params['workflowmode'];
|
2013-02-27 16:17:36 +00:00
|
|
|
$enableadminrevapp = $this->params['enableadminrevapp'];
|
|
|
|
$enableownerrevapp = $this->params['enableownerrevapp'];
|
|
|
|
$enableselfrevapp = $this->params['enableselfrevapp'];
|
2012-12-14 07:53:13 +00:00
|
|
|
|
|
|
|
$overallStatus = $content->getStatus();
|
2017-08-02 08:56:28 +00:00
|
|
|
$owner = $document->getOwner();
|
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
|
|
|
$this->contentHeading(getMLText("change_assignments"));
|
|
|
|
|
|
|
|
// Retrieve a list of all users and groups that have review / approve privileges.
|
2015-04-20 11:42:38 +00:00
|
|
|
$docAccess = $document->getReadAccessList($enableadminrevapp, $enableownerrevapp);
|
2012-12-14 07:53:13 +00:00
|
|
|
|
|
|
|
// Retrieve list of currently assigned reviewers and approvers, along with
|
|
|
|
// their latest status.
|
|
|
|
$reviewStatus = $content->getReviewStatus();
|
|
|
|
$approvalStatus = $content->getApprovalStatus();
|
|
|
|
|
|
|
|
// Index the review results for easy cross-reference with the Approvers List.
|
|
|
|
$reviewIndex = array("i"=>array(), "g"=>array());
|
|
|
|
foreach ($reviewStatus as $i=>$rs) {
|
|
|
|
if ($rs["type"]==0) {
|
|
|
|
$reviewIndex["i"][$rs["required"]] = array("status"=>$rs["status"], "idx"=>$i);
|
2013-02-27 16:17:36 +00:00
|
|
|
} elseif ($rs["type"]==1) {
|
2012-12-14 07:53:13 +00:00
|
|
|
$reviewIndex["g"][$rs["required"]] = array("status"=>$rs["status"], "idx"=>$i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Index the approval results for easy cross-reference with the Approvers List.
|
|
|
|
$approvalIndex = array("i"=>array(), "g"=>array());
|
|
|
|
foreach ($approvalStatus as $i=>$rs) {
|
|
|
|
if ($rs["type"]==0) {
|
|
|
|
$approvalIndex["i"][$rs["required"]] = array("status"=>$rs["status"], "idx"=>$i);
|
2013-02-27 16:17:36 +00:00
|
|
|
} elseif ($rs["type"]==1) {
|
2012-12-14 07:53:13 +00:00
|
|
|
$approvalIndex["g"][$rs["required"]] = array("status"=>$rs["status"], "idx"=>$i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
|
|
|
|
<?php $this->contentContainerStart(); ?>
|
|
|
|
|
|
|
|
<form action="../op/op.SetReviewersApprovers.php" method="post" name="form1">
|
|
|
|
|
2015-03-16 07:58:10 +00:00
|
|
|
<?php
|
|
|
|
if($workflowmode != 'traditional_only_approval') {
|
|
|
|
?>
|
2012-12-14 07:53:13 +00:00
|
|
|
<?php $this->contentSubHeading(getMLText("update_reviewers"));?>
|
|
|
|
|
|
|
|
<div class="cbSelectTitle"><?php printMLText("individuals")?>:</div>
|
2013-09-09 05:31:06 +00:00
|
|
|
<select 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
|
|
|
|
|
2017-08-02 08:56:28 +00:00
|
|
|
if($user->getID() != $owner->getID()) {
|
|
|
|
$res=$owner->getMandatoryReviewers();
|
|
|
|
if($user->isAdmin())
|
|
|
|
$res = array();
|
|
|
|
} else
|
|
|
|
$res=$user->getMandatoryReviewers();
|
2012-12-14 07:53:13 +00:00
|
|
|
foreach ($docAccess["users"] as $usr) {
|
|
|
|
$mandatory=false;
|
|
|
|
foreach ($res as $r) if ($r['reviewerUserID']==$usr->getID()) $mandatory=true;
|
|
|
|
|
|
|
|
if ($mandatory){
|
|
|
|
|
|
|
|
print "<option value=\"".$usr->getID()."\" disabled=\"disabled\">". htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName())." <".$usr->getEmail()."></option>";
|
2017-08-02 08:56:28 +00:00
|
|
|
// print "<input id='revInd".$usr->getID()."' type='hidden' name='indReviewers[]' value='". $usr->getID() ."'>";
|
2012-12-14 07:53:13 +00:00
|
|
|
|
2013-02-27 16:17:36 +00:00
|
|
|
} elseif (isset($reviewIndex["i"][$usr->getID()])) {
|
2012-12-14 07:53:13 +00:00
|
|
|
|
|
|
|
switch ($reviewIndex["i"][$usr->getID()]["status"]) {
|
|
|
|
case 0:
|
|
|
|
print "<option value='". $usr->getID() ."' selected='selected'>".htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName())."</option>";
|
|
|
|
break;
|
|
|
|
case -2:
|
|
|
|
print "<option value='". $usr->getID() ."'>".htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName())."</option>";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
print "<option value='". $usr->getID() ."' disabled='disabled'>".htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName())."</option>";
|
|
|
|
break;
|
|
|
|
}
|
2013-02-27 16:17:36 +00:00
|
|
|
} else {
|
|
|
|
if (!$enableselfrevapp && $usr->getID()==$user->getID()) continue;
|
2012-12-14 07:53:13 +00:00
|
|
|
print "<option value='". $usr->getID() ."'>". htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName())."</option>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</select>
|
|
|
|
|
2019-02-01 08:01:18 +00:00
|
|
|
<div class="cbSelectTitle"><?php printMLText("individuals_in_groups")?>:</div>
|
2016-03-24 14:57:10 +00:00
|
|
|
<select class="chzn-select span9" name="grpIndReviewers[]" multiple="multiple" data-placeholder="<?php printMLText('select_grp_ind_reviewers'); ?>" data-no_results_text="<?php printMLText('unknown_owner'); ?>">
|
2015-12-04 07:00:50 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
foreach ($docAccess["groups"] as $group) {
|
|
|
|
|
|
|
|
print "<option value='". $group->getID() ."'>".htmlspecialchars($group->getName())."</option>";
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</select>
|
|
|
|
|
2017-08-02 08:56:28 +00:00
|
|
|
<?php
|
|
|
|
/* 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";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
2017-08-02 10:14:14 +00:00
|
|
|
|
2012-12-14 07:53:13 +00:00
|
|
|
<div class="cbSelectTitle"><?php printMLText("groups")?>:</div>
|
2013-09-09 05:31:06 +00:00
|
|
|
<select 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 $group) {
|
|
|
|
|
|
|
|
$mandatory=false;
|
|
|
|
foreach ($res as $r) if ($r['reviewerGroupID']==$group->getID()) $mandatory=true;
|
|
|
|
|
2018-03-19 10:32:24 +00:00
|
|
|
if ($mandatory || !$group->getUsers()){
|
2012-12-14 07:53:13 +00:00
|
|
|
|
|
|
|
print "<option value=\"".$group->getID()."\" disabled='disabled'>".htmlspecialchars($group->getName())."</option>";
|
2017-08-02 08:56:28 +00:00
|
|
|
// print "<input id='revGrp".$group->getID()."' type='hidden' name='grpReviewers[]' value='". $group->getID() ."' />";
|
2012-12-14 07:53:13 +00:00
|
|
|
|
2013-02-27 16:17:36 +00:00
|
|
|
} elseif (isset($reviewIndex["g"][$group->getID()])) {
|
2012-12-14 07:53:13 +00:00
|
|
|
|
|
|
|
switch ($reviewIndex["g"][$group->getID()]["status"]) {
|
|
|
|
case 0:
|
|
|
|
print "<option value='". $group->getID() ."' selected='selected'>".htmlspecialchars($group->getName())."</option>";
|
|
|
|
break;
|
|
|
|
case -2:
|
|
|
|
print "<option value='". $group->getID() ."'>".htmlspecialchars($group->getName())."</option>";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
print "<option id='revGrp".$group->getID()."' type='checkbox' name='grpReviewers[]' value='". $group->getID() ."' disabled='disabled'>".htmlspecialchars($group->getName())."</option>";
|
|
|
|
break;
|
|
|
|
}
|
2013-02-27 16:17:36 +00:00
|
|
|
} else {
|
2012-12-14 07:53:13 +00:00
|
|
|
print "<option value='". $group->getID() ."'>".htmlspecialchars($group->getName())."</option>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
2017-08-02 08:56:28 +00:00
|
|
|
</select>
|
|
|
|
<?php
|
|
|
|
/* 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";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
2012-12-14 07:53:13 +00:00
|
|
|
|
|
|
|
<?php $this->contentSubHeading(getMLText("update_approvers"));?>
|
|
|
|
|
|
|
|
<div class="cbSelectTitle cbSelectMargin"><?php printMLText("individuals")?>:</div>
|
2013-09-09 05:31:06 +00:00
|
|
|
<select 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
|
|
|
|
|
2017-08-02 08:56:28 +00:00
|
|
|
if($user->getID() != $owner->getID()) {
|
|
|
|
$res=$owner->getMandatoryApprovers();
|
|
|
|
if($user->isAdmin())
|
|
|
|
$res = array();
|
|
|
|
} else
|
|
|
|
$res=$user->getMandatoryApprovers();
|
2012-12-14 07:53:13 +00:00
|
|
|
foreach ($docAccess["users"] as $usr) {
|
|
|
|
|
|
|
|
$mandatory=false;
|
|
|
|
foreach ($res as $r) if ($r['approverUserID']==$usr->getID()) $mandatory=true;
|
|
|
|
|
|
|
|
if ($mandatory){
|
|
|
|
|
|
|
|
print "<option value='". $usr->getID() ."' disabled='disabled'>". htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName())." <".$usr->getEmail()."></option>";
|
2017-08-02 08:56:28 +00:00
|
|
|
// print "<input id='appInd".$usr->getID()."' type='hidden' name='indApprovers[]' value='". $usr->getID() ."'>";
|
2012-12-14 07:53:13 +00:00
|
|
|
|
2013-02-27 16:17:36 +00:00
|
|
|
} elseif (isset($approvalIndex["i"][$usr->getID()])) {
|
2012-12-14 07:53:13 +00:00
|
|
|
|
|
|
|
switch ($approvalIndex["i"][$usr->getID()]["status"]) {
|
|
|
|
case 0:
|
|
|
|
print "<option value='". $usr->getID() ."' selected='selected'>".htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName())."</option>";
|
|
|
|
break;
|
|
|
|
case -2:
|
|
|
|
print "<option value='". $usr->getID() ."'>".htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName())."</option>";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
print "<option value='". $usr->getID() ."' disabled='disabled'>".htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName())."</option>";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2013-02-27 16:17:36 +00:00
|
|
|
if (!$enableselfrevapp && $usr->getID()==$user->getID()) continue;
|
2012-12-14 07:53:13 +00:00
|
|
|
print "<option value='". $usr->getID() ."'>". htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName())."</option>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
2017-08-02 08:56:28 +00:00
|
|
|
</select>
|
|
|
|
<?php
|
|
|
|
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";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
2012-12-14 07:53:13 +00:00
|
|
|
<div class="cbSelectTitle"><?php printMLText("groups")?>:</div>
|
|
|
|
|
2019-02-01 08:01:18 +00:00
|
|
|
<div class="cbSelectTitle"><?php printMLText("individuals_in_groups")?>:</div>
|
2016-03-24 14:57:10 +00:00
|
|
|
<select class="chzn-select span9" name="grpIndApprovers[]" multiple="multiple" data-placeholder="<?php printMLText('select_grp_ind_approvers'); ?>" data-no_results_text="<?php printMLText('unknown_owner'); ?>">
|
2015-12-04 07:00:50 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
foreach ($docAccess["groups"] as $group) {
|
|
|
|
|
|
|
|
print "<option value='". $group->getID() ."'>".htmlspecialchars($group->getName())."</option>";
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<div class="cbSelectTitle"><?php printMLText("groups")?>:</div>
|
2013-09-09 05:31:06 +00:00
|
|
|
<select 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 $group) {
|
|
|
|
|
|
|
|
$mandatory=false;
|
|
|
|
foreach ($res as $r) if ($r['approverGroupID']==$group->getID()) $mandatory=true;
|
|
|
|
|
2018-03-19 10:32:24 +00:00
|
|
|
if ($mandatory || !$group->getUsers()){
|
2012-12-14 07:53:13 +00:00
|
|
|
|
|
|
|
print "<option type='checkbox' checked='checked' disabled='disabled'>".htmlspecialchars($group->getName())."</option>";
|
2017-08-02 08:56:28 +00:00
|
|
|
// print "<input id='appGrp".$group->getID()."' type='hidden' name='grpApprovers[]' value='". $group->getID() ."'>";
|
2012-12-14 07:53:13 +00:00
|
|
|
|
2013-02-27 16:17:36 +00:00
|
|
|
} elseif (isset($approvalIndex["g"][$group->getID()])) {
|
2012-12-14 07:53:13 +00:00
|
|
|
|
|
|
|
switch ($approvalIndex["g"][$group->getID()]["status"]) {
|
|
|
|
case 0:
|
|
|
|
print "<option value='". $group->getID() ."' selected='selected'>".htmlspecialchars($group->getName())."</option>";
|
|
|
|
break;
|
|
|
|
case -2:
|
|
|
|
print "<option value='". $group->getID() ."'>".htmlspecialchars($group->getName())."</option>";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
print "<option value='". $group->getID() ."' disabled='disabled'>".htmlspecialchars($group->getName())."</option>";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
print "<option value='". $group->getID() ."'>".htmlspecialchars($group->getName())."</option>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
2017-08-02 08:56:28 +00:00
|
|
|
</select>
|
|
|
|
<?php
|
|
|
|
/* 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";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
2012-12-14 07:53:13 +00:00
|
|
|
<p>
|
|
|
|
<input type='hidden' name='documentid' value='<?php echo $document->getID() ?>'/>
|
|
|
|
<input type='hidden' name='version' value='<?php echo $content->getVersion() ?>'/>
|
|
|
|
<input type="submit" class="btn" value="<?php printMLText("update");?>">
|
|
|
|
</p>
|
|
|
|
</form>
|
|
|
|
<?php
|
|
|
|
$this->contentContainerEnd();
|
2016-03-15 07:30:53 +00:00
|
|
|
$this->contentEnd();
|
2012-12-14 07:53:13 +00:00
|
|
|
$this->htmlEndPage();
|
|
|
|
} /* }}} */
|
|
|
|
}
|
|
|
|
?>
|