2015-04-22 08:33:49 +00:00
|
|
|
<?php
|
|
|
|
/**
|
2015-05-11 07:30:13 +00:00
|
|
|
* Implementation of SetRevisors view
|
2015-04-22 08:33:49 +00:00
|
|
|
*
|
|
|
|
* @category DMS
|
|
|
|
* @package SeedDMS
|
|
|
|
* @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-2015 Uwe Steinmann
|
|
|
|
* @version Release: @package_version@
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Include parent class
|
|
|
|
*/
|
2021-04-19 17:45:40 +00:00
|
|
|
//require_once("class.Bootstrap.php");
|
2015-04-22 08:33:49 +00:00
|
|
|
|
|
|
|
/**
|
2015-05-11 07:30:13 +00:00
|
|
|
* Class which outputs the html page for SetRevisors view
|
2015-04-22 08:33:49 +00:00
|
|
|
*
|
|
|
|
* @category DMS
|
|
|
|
* @package SeedDMS
|
|
|
|
* @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-2015 Uwe Steinmann
|
|
|
|
* @version Release: @package_version@
|
|
|
|
*/
|
2021-04-19 17:45:40 +00:00
|
|
|
class SeedDMS_View_SetRevisors extends SeedDMS_Theme_Style {
|
2015-04-22 08:33:49 +00:00
|
|
|
|
|
|
|
function show() { /* {{{ */
|
|
|
|
$dms = $this->params['dms'];
|
|
|
|
$user = $this->params['user'];
|
|
|
|
$folder = $this->params['folder'];
|
|
|
|
$document = $this->params['document'];
|
|
|
|
$content = $this->params['version'];
|
2016-10-27 12:22:49 +00:00
|
|
|
$enableadminrevapp = $this->params['enableadminrevapp'];
|
|
|
|
$enableownerrevapp = $this->params['enableownerrevapp'];
|
|
|
|
$enableselfrevapp = $this->params['enableselfrevapp'];
|
2015-04-22 08:33:49 +00:00
|
|
|
|
|
|
|
$overallStatus = $content->getStatus();
|
|
|
|
|
|
|
|
$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);
|
2021-05-06 12:22:50 +00:00
|
|
|
$this->contentHeading(getMLText("update_revisors"));
|
2015-04-22 08:33:49 +00:00
|
|
|
|
2016-10-27 12:22:49 +00:00
|
|
|
// Retrieve a list of all users and groups that have review / approve privileges.
|
|
|
|
$docAccess = $document->getReadAccessList($enableadminrevapp, $enableownerrevapp);
|
2015-04-22 08:33:49 +00:00
|
|
|
|
2015-05-11 07:30:13 +00:00
|
|
|
// Retrieve list of currently assigned revisors, along with
|
2015-04-22 08:33:49 +00:00
|
|
|
// their latest status.
|
|
|
|
$revisionStatus = $content->getRevisionStatus();
|
2021-05-06 12:22:50 +00:00
|
|
|
$startdate = getReadableDate(makeTsFromDate($content->getRevisionDate()));
|
2015-04-22 08:33:49 +00:00
|
|
|
|
2015-05-11 07:30:13 +00:00
|
|
|
// Index the revision results for easy cross-reference with the revisor list.
|
2015-04-22 08:33:49 +00:00
|
|
|
$revisionIndex = array("i"=>array(), "g"=>array());
|
|
|
|
foreach ($revisionStatus as $i=>$rs) {
|
|
|
|
if ($rs["type"]==0) {
|
|
|
|
$revisionIndex["i"][$rs["required"]] = array("status"=>$rs["status"], "idx"=>$i);
|
|
|
|
} elseif ($rs["type"]==1) {
|
|
|
|
$revisionIndex["g"][$rs["required"]] = array("status"=>$rs["status"], "idx"=>$i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
|
2017-01-04 17:08:18 +00:00
|
|
|
<form class="form-horizontal" action="../op/op.SetRevisors.php" method="post" name="form1">
|
2021-06-01 04:49:55 +00:00
|
|
|
<input type='hidden' name='documentid' value='<?php echo $document->getID() ?>'/>
|
|
|
|
<input type='hidden' name='version' value='<?php echo $content->getVersion() ?>'/>
|
2015-04-22 08:33:49 +00:00
|
|
|
|
2021-05-06 12:22:50 +00:00
|
|
|
<?php
|
|
|
|
$this->contentContainerStart();
|
2022-05-25 09:33:44 +00:00
|
|
|
if($content->getStatus()['status'] == S_IN_REVISION) {
|
|
|
|
echo '<input type="hidden" name="startdate" value="" />';
|
|
|
|
} else {
|
|
|
|
$this->formField(
|
|
|
|
getMLText("revision_date"),
|
|
|
|
$this->getDateChooser($startdate, "startdate", $this->params['session']->getLanguage())
|
|
|
|
);
|
|
|
|
}
|
2015-04-22 08:33:49 +00:00
|
|
|
|
2022-09-21 08:09:40 +00:00
|
|
|
$options = [];
|
2015-04-22 08:33:49 +00:00
|
|
|
foreach ($docAccess["users"] as $usr) {
|
|
|
|
if (isset($revisionIndex["i"][$usr->getID()])) {
|
|
|
|
|
|
|
|
switch ($revisionIndex["i"][$usr->getID()]["status"]) {
|
2015-05-11 07:30:13 +00:00
|
|
|
case S_LOG_WAITING:
|
|
|
|
case S_LOG_SLEEPING:
|
2016-03-24 14:43:00 +00:00
|
|
|
case S_LOG_ACCEPTED:
|
|
|
|
case S_LOG_REJECTED:
|
2022-09-21 08:09:40 +00:00
|
|
|
$options[] = array($usr->getID(), htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName()), true);
|
2015-04-22 08:33:49 +00:00
|
|
|
break;
|
2015-05-11 07:30:13 +00:00
|
|
|
case S_LOG_USER_REMOVED:
|
2022-09-21 08:09:40 +00:00
|
|
|
$options[] = array($usr->getID(), htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName()), false, array(array('data-subtitle', getMLText('user_previously_removed_from_revisors'))));
|
2015-04-22 08:33:49 +00:00
|
|
|
break;
|
|
|
|
default:
|
2022-09-21 08:09:40 +00:00
|
|
|
$options[] = array($usr->getID(), htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName()), false, ['disabled', 'disabled']);
|
2015-04-22 08:33:49 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
2016-10-27 12:22:49 +00:00
|
|
|
if (!$enableselfrevapp && $usr->getID()==$user->getID()) continue;
|
2022-09-21 08:09:40 +00:00
|
|
|
$options[] = array($usr->getID(), htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName()));
|
2015-04-22 08:33:49 +00:00
|
|
|
}
|
|
|
|
}
|
2022-09-21 08:09:40 +00:00
|
|
|
$this->formField(
|
|
|
|
getMLText("individuals"),
|
|
|
|
array(
|
|
|
|
'element'=>'select',
|
|
|
|
'id'=>'indRevisors',
|
|
|
|
'name'=>'indRevisors[]',
|
|
|
|
'class'=>'chzn-select',
|
|
|
|
'multiple'=>true,
|
|
|
|
'attributes'=>array(array('data-allow-clear', 'true'), array('data-placeholder', getMLText('select_ind_revisors')), array('data-no_results_text', getMLText('unknown_user'))),
|
|
|
|
'options'=>$options
|
|
|
|
)
|
|
|
|
);
|
|
|
|
$options = [];
|
2017-12-18 07:41:31 +00:00
|
|
|
foreach ($docAccess["groups"] as $group) {
|
2022-09-21 08:09:40 +00:00
|
|
|
$optopt = [];
|
|
|
|
$grpusers = $group->getUsers();
|
|
|
|
if(count($grpusers) == 0)
|
|
|
|
$optopt[] = ['disabled', 'disabled'];
|
|
|
|
$options[] = array($group->getID(), htmlspecialchars($group->getName().' ('.count($grpusers).')'), false, $optopt);
|
2017-12-18 07:41:31 +00:00
|
|
|
}
|
2022-09-21 08:09:40 +00:00
|
|
|
$this->formField(
|
|
|
|
getMLText("individuals_in_groups"),
|
|
|
|
array(
|
|
|
|
'element'=>'select',
|
|
|
|
'id'=>'grpIndRevisors',
|
|
|
|
'name'=>'grpIndRevisors[]',
|
|
|
|
'class'=>'chzn-select',
|
|
|
|
'multiple'=>true,
|
|
|
|
'attributes'=>array(array('data-allow-clear', 'true'), array('data-placeholder', getMLText('select_grp_ind_revisors')), array('data-no_results_text', getMLText('unknown_group'))),
|
|
|
|
'options'=>$options
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
$options = [];
|
2015-04-22 08:33:49 +00:00
|
|
|
foreach ($docAccess["groups"] as $group) {
|
2022-09-21 08:09:40 +00:00
|
|
|
$grpusers = $group->getUsers();
|
2015-04-22 08:33:49 +00:00
|
|
|
if (isset($revisionIndex["g"][$group->getID()])) {
|
|
|
|
switch ($revisionIndex["g"][$group->getID()]["status"]) {
|
2015-05-11 07:30:13 +00:00
|
|
|
case S_LOG_WAITING:
|
|
|
|
case S_LOG_SLEEPING:
|
2022-09-21 08:09:40 +00:00
|
|
|
$options[] = array($group->getID(), htmlspecialchars($group->getName().' ('.count($grpusers).')'), true);
|
2015-04-22 08:33:49 +00:00
|
|
|
break;
|
2015-05-11 07:30:13 +00:00
|
|
|
case S_LOG_USER_REMOVED:
|
2022-09-21 08:09:40 +00:00
|
|
|
$options[] = array($group->getID(), htmlspecialchars($group->getName().' ('.count($grpusers).')'), false, array(array('data-subtitle', getMLText('group_previously_removed_from_revisors'))));
|
2015-04-22 08:33:49 +00:00
|
|
|
break;
|
|
|
|
default:
|
2022-09-21 08:09:40 +00:00
|
|
|
$options[] = array($group->getID(), htmlspecialchars($group->getName().' ('.count($grpusers).')'), false, array(array('disabled', 'disabled')));
|
2015-04-22 08:33:49 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
2022-09-21 08:09:40 +00:00
|
|
|
$options[] = array($group->getID(), htmlspecialchars($group->getName().' ('.count($grpusers).')'));
|
2015-04-22 08:33:49 +00:00
|
|
|
}
|
|
|
|
}
|
2022-09-21 08:09:40 +00:00
|
|
|
$this->formField(
|
|
|
|
getMLText("groups"),
|
|
|
|
array(
|
|
|
|
'element'=>'select',
|
|
|
|
'id'=>'grpRevisors',
|
|
|
|
'name'=>'grpRevisors[]',
|
|
|
|
'class'=>'chzn-select',
|
|
|
|
'multiple'=>true,
|
|
|
|
'attributes'=>array(array('data-allow-clear', 'true'), array('data-placeholder', getMLText('select_grp_revisors')), array('data-no_results_text', getMLText('unknown_group'))),
|
|
|
|
'options'=>$options
|
|
|
|
)
|
|
|
|
);
|
2015-04-22 08:33:49 +00:00
|
|
|
$this->contentContainerEnd();
|
2021-05-06 12:22:50 +00:00
|
|
|
$this->formSubmit("<i class=\"fa fa-save\"></i> ".getMLText('update'));
|
|
|
|
?>
|
|
|
|
</form>
|
|
|
|
<?php
|
2016-03-21 05:20:19 +00:00
|
|
|
$this->contentEnd();
|
2015-04-22 08:33:49 +00:00
|
|
|
$this->htmlEndPage();
|
|
|
|
} /* }}} */
|
|
|
|
}
|
|
|
|
?>
|