- check if each transition has a user or group, issue warning if not

- put states of a transition into one column
This commit is contained in:
steinm 2013-02-05 09:23:17 +00:00
parent b3d296b1aa
commit 275ecc04a2

View File

@ -157,6 +157,17 @@ function showWorkflow(selectObj) {
foreach ($workflows as $currWorkflow) {
print "<td id=\"keywords".$currWorkflow->getID()."\" style=\"display : none;\">";
$transitions = $currWorkflow->getTransitions();
if($transitions) {
foreach($transitions as $transition) {
$transusers = $transition->getUsers();
$transgroups = $transition->getGroups();
if(!$transusers && !$transgroups) {
$this->errorMsg('One of the transitions has neither a user nor a group!');
break;
}
}
}
?>
<form action="../op/op.WorkflowMgr.php" method="post" enctype="multipart/form-data" name="form<?php print $currWorkflow->getID();?>" onsubmit="return checkForm('<?php print $currWorkflow->getID();?>');">
<?php echo createHiddenFieldWithKey('editworkflow'); ?>
@ -208,27 +219,32 @@ function showWorkflow(selectObj) {
if($actions) {
$transitions = $currWorkflow->getTransitions();
echo "<table class=\"table table-condensed\">";
echo "<tr><th>State</th><th>Action</th><th>Next state</th><th>".getMLText('user')."/".getMLText('group')."</th></tr>";
echo "<tr><th>State/Next state</th><th>Action</th><th>".getMLText('user')."/".getMLText('group')."</th></tr>";
if($transitions) {
foreach($transitions as $transition) {
$state = $transition->getState();
$nextstate = $transition->getNextState();
$action = $transition->getAction();
echo "<tr><td>".$state->getName()."</td><td>".$action->getName()."</td>";
echo "<td>".$nextstate->getName();
$transusers = $transition->getUsers();
$transgroups = $transition->getGroups();
echo "<tr";
if(!$transusers && !$transgroups) {
echo " class=\"error\"";
}
echo "><td>".$state->getName()."<br />";
echo $nextstate->getName();
$docstatus = $nextstate->getDocumentStatus();
if($docstatus == S_RELEASED || $docstatus == S_REJECTED) {
echo "<br /><i class=\"icon-arrow-right\"></i> ".getOverallStatusText($docstatus);
}
echo "</td>";
echo "<td>".$action->getName()."</td>";
echo "<td>";
$transusers = $transition->getUsers();
foreach($transusers as $transuser) {
$u = $transuser->getUser();
echo "User ".$u->getFullName();
echo "<br />";
}
$transgroups = $transition->getGroups();
foreach($transgroups as $transgroup) {
$g = $transgroup->getGroup();
echo "At least ".$transgroup->getNumOfUsers()." users of ".$g->getName();
@ -258,6 +274,12 @@ function showWorkflow(selectObj) {
foreach($states as $state) {
echo "<option value=\"".$state->getID()."\">".$state->getName()."</option>";
}
echo "</select><br />";
echo "<select name=\"nextstate\">";
$states = $dms->getAllWorkflowStates();
foreach($states as $state) {
echo "<option value=\"".$state->getID()."\">".$state->getName()."</option>";
}
echo "</select>";
echo "</td>";
echo "<td>";
@ -268,14 +290,6 @@ function showWorkflow(selectObj) {
echo "</select>";
echo "</td>";
echo "<td>";
echo "<select name=\"nextstate\">";
$states = $dms->getAllWorkflowStates();
foreach($states as $state) {
echo "<option value=\"".$state->getID()."\">".$state->getName()."</option>";
}
echo "</select>";
echo "</td>";
echo "<td>";
echo "<select class=\"chzn-select\" name=\"users[]\" multiple=\"multiple\" data-placeholder=\"".getMLText('select_users')."\">";
$allusers = $dms->getAllUsers();
foreach($allusers as $usr) {