- 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) { foreach ($workflows as $currWorkflow) {
print "<td id=\"keywords".$currWorkflow->getID()."\" style=\"display : none;\">"; 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();?>');"> <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'); ?> <?php echo createHiddenFieldWithKey('editworkflow'); ?>
@ -167,15 +178,15 @@ function showWorkflow(selectObj) {
<td></td> <td></td>
<td> <td>
<?php <?php
if($currWorkflow->isUsed()) { if($currWorkflow->isUsed()) {
?> ?>
<p><?php echo getMLText('workflow_in_use') ?></p> <p><?php echo getMLText('workflow_in_use') ?></p>
<?php <?php
} else { } else {
?> ?>
<a class="standardText btn" href="../out/out.RemoveWorkflow.php?workflowid=<?php print $currWorkflow->getID();?>"><i class="icon-remove"></i> <?php printMLText("rm_workflow");?></a> <a class="standardText btn" href="../out/out.RemoveWorkflow.php?workflowid=<?php print $currWorkflow->getID();?>"><i class="icon-remove"></i> <?php printMLText("rm_workflow");?></a>
<?php <?php
} }
?> ?>
</td> </td>
</tr> </tr>
@ -187,12 +198,12 @@ function showWorkflow(selectObj) {
<td><?php printMLText("workflow_initstate");?>:</td> <td><?php printMLText("workflow_initstate");?>:</td>
<td><select name="initstate"> <td><select name="initstate">
<?php <?php
foreach($workflowstates as $workflowstate) { foreach($workflowstates as $workflowstate) {
echo "<option value=\"".$workflowstate->getID()."\""; echo "<option value=\"".$workflowstate->getID()."\"";
if($currWorkflow->getInitState()->getID() == $workflowstate->getID()) if($currWorkflow->getInitState()->getID() == $workflowstate->getID())
echo " selected=\"selected\""; echo " selected=\"selected\"";
echo ">".htmlspecialchars($workflowstate->getName())."</option>\n"; echo ">".htmlspecialchars($workflowstate->getName())."</option>\n";
} }
?> ?>
</select></td> </select></td>
</tr> </tr>
@ -208,27 +219,32 @@ function showWorkflow(selectObj) {
if($actions) { if($actions) {
$transitions = $currWorkflow->getTransitions(); $transitions = $currWorkflow->getTransitions();
echo "<table class=\"table table-condensed\">"; 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) { if($transitions) {
foreach($transitions as $transition) { foreach($transitions as $transition) {
$state = $transition->getState(); $state = $transition->getState();
$nextstate = $transition->getNextState(); $nextstate = $transition->getNextState();
$action = $transition->getAction(); $action = $transition->getAction();
echo "<tr><td>".$state->getName()."</td><td>".$action->getName()."</td>"; $transusers = $transition->getUsers();
echo "<td>".$nextstate->getName(); $transgroups = $transition->getGroups();
echo "<tr";
if(!$transusers && !$transgroups) {
echo " class=\"error\"";
}
echo "><td>".$state->getName()."<br />";
echo $nextstate->getName();
$docstatus = $nextstate->getDocumentStatus(); $docstatus = $nextstate->getDocumentStatus();
if($docstatus == S_RELEASED || $docstatus == S_REJECTED) { if($docstatus == S_RELEASED || $docstatus == S_REJECTED) {
echo "<br /><i class=\"icon-arrow-right\"></i> ".getOverallStatusText($docstatus); echo "<br /><i class=\"icon-arrow-right\"></i> ".getOverallStatusText($docstatus);
} }
echo "</td>"; echo "</td>";
echo "<td>".$action->getName()."</td>";
echo "<td>"; echo "<td>";
$transusers = $transition->getUsers();
foreach($transusers as $transuser) { foreach($transusers as $transuser) {
$u = $transuser->getUser(); $u = $transuser->getUser();
echo "User ".$u->getFullName(); echo "User ".$u->getFullName();
echo "<br />"; echo "<br />";
} }
$transgroups = $transition->getGroups();
foreach($transgroups as $transgroup) { foreach($transgroups as $transgroup) {
$g = $transgroup->getGroup(); $g = $transgroup->getGroup();
echo "At least ".$transgroup->getNumOfUsers()." users of ".$g->getName(); echo "At least ".$transgroup->getNumOfUsers()." users of ".$g->getName();
@ -258,6 +274,12 @@ function showWorkflow(selectObj) {
foreach($states as $state) { foreach($states as $state) {
echo "<option value=\"".$state->getID()."\">".$state->getName()."</option>"; 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 "</select>";
echo "</td>"; echo "</td>";
echo "<td>"; echo "<td>";
@ -268,14 +290,6 @@ function showWorkflow(selectObj) {
echo "</select>"; echo "</select>";
echo "</td>"; echo "</td>";
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')."\">"; echo "<select class=\"chzn-select\" name=\"users[]\" multiple=\"multiple\" data-placeholder=\"".getMLText('select_users')."\">";
$allusers = $dms->getAllUsers(); $allusers = $dms->getAllUsers();
foreach($allusers as $usr) { foreach($allusers as $usr) {