added views for new workflow functions

This commit is contained in:
steinm 2013-01-24 10:35:33 +00:00
parent d8638caa34
commit 35d236871d
10 changed files with 1596 additions and 0 deletions

View File

@ -0,0 +1,111 @@
<?php
/**
* Implementation of RemoveWorkflow view
*
* @category DMS
* @package LetoDMS
* @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 Removeorkflow view
*
* @category DMS
* @package LetoDMS
* @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@
*/
class LetoDMS_View_RemoveWorkflow extends LetoDMS_Bootstrap_Style {
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
$document = $this->params['document'];
$latestContent = $document->getLatestContent();
$this->htmlStartPage(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))));
$this->globalNavigation($folder);
$this->contentStart();
$this->pageNavigation($this->getFolderPathHTML($folder, true, $document), "view_document");
$this->contentHeading(getMLText("rm_workflow"));
$currentstate = $latestContent->getWorkflowState();
$wkflog = $latestContent->getWorkflowLog();
$workflow = $latestContent->getWorkflow();
$msg = "The document is currently in state: ".$currentstate->getName()."<br />";
if($wkflog) {
foreach($wkflog as $entry) {
if($entry->getTransition()->getNextState()->getID() == $currentstate->getID()) {
$enterdate = $entry->getDate();
$d = strptime($enterdate, '%Y-%m-%d %H:%M:%S');
$enterts = mktime($d['tm_hour'], $d['tm_min'], $d['tm_sec'], $d['tm_mon']+1, $d['tm_mday'], $d['tm_year']+1900);
}
}
$msg .= "The state was entered at ".$enterdate." which was ";
$msg .= getReadableDuration((time()-$enterts))." ago.<br />";
}
$msg .= "The document may stay in this state for ".$currentstate->getMaxTime()." sec.";
$this->infoMsg($msg);
$this->contentContainerStart();
// Display the Workflow form.
?>
<div class="row-fluid">
<div class="span4">
<p><?php printMLText("rm_workflow_warning"); ?></p>
<form method="post" action="../op/op.RemoveWorkflow.php" name="form1" onsubmit="return checkForm();">
<?php echo createHiddenFieldWithKey('removeworkflow'); ?>
<table>
<tr><td></td><td>
<input type='hidden' name='documentid' value='<?php echo $document->getId(); ?>'/>
<input type='hidden' name='version' value='<?php echo $latestContent->getVersion(); ?>'/>
<button type='submit' class="btn"><i class="icon-remove"></i> <?php printMLText("rm_workflow"); ?></button>
</td></tr></table>
</form>
</div>
<div id="workflowgraph" class="span8">
<iframe src="out.WorkflowGraph.php?workflow=<?php echo $workflow->getID(); ?>" width="100%" height="500" style="border: 1px solid #AAA;"></iframe>
</div>
</div>
<?php
$this->contentContainerEnd();
if($wkflog) {
$this->contentContainerStart();
echo "<table class=\"table-condensed\">";
echo "<tr><th>".getMLText('action')."</th><th>Start state</th><th>End state</th><th>".getMLText('date')."</th><th>".getMLText('user')."</th><th>".getMLText('comment')."</th></tr>";
foreach($wkflog as $entry) {
echo "<tr>";
echo "<td>".getMLText('action_'.$entry->getTransition()->getAction()->getName())."</td>";
echo "<td>".$entry->getTransition()->getState()->getName()."</td>";
echo "<td>".$entry->getTransition()->getNextState()->getName()."</td>";
echo "<td>".$entry->getDate()."</td>";
echo "<td>".$entry->getUser()->getFullname()."</td>";
echo "<td>".$entry->getComment()."</td>";
echo "</tr>";
}
echo "</table>\n";
$this->contentContainerEnd();
}
$this->htmlEndPage();
} /* }}} */
}
?>

View File

@ -0,0 +1,137 @@
<?php
/**
* Implementation of ReturnFromSubWorkflow view
*
* @category DMS
* @package LetoDMS
* @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 ReturnFromSubWorkflow view
*
* @category DMS
* @package LetoDMS
* @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@
*/
class LetoDMS_View_ReturnFromSubWorkflow extends LetoDMS_Bootstrap_Style {
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
$document = $this->params['document'];
$transition = $this->params['transition'];
$latestContent = $document->getLatestContent();
$this->htmlStartPage(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))));
$this->globalNavigation($folder);
$this->contentStart();
$this->pageNavigation($this->getFolderPathHTML($folder, true, $document), "view_document");
$this->contentHeading(getMLText("return_from_subworkflow"));
?>
<script language="JavaScript">
function checkForm()
{
msg = "";
if (document.form1.comment.value == "") msg += "<?php printMLText("js_no_comment");?>\n";
if (msg != "")
{
alert(msg);
return false;
}
else
return true;
}
</script>
<?php
$currentstate = $latestContent->getWorkflowState();
$wkflog = $latestContent->getWorkflowLog();
$workflow = $latestContent->getWorkflow();
$parentworkflow = $latestContent->getParentWorkflow();
$msg = "The document is currently in state: ".$currentstate->getName()."<br />";
if($wkflog) {
foreach($wkflog as $entry) {
if($entry->getTransition()->getNextState()->getID() == $currentstate->getID()) {
$enterdate = $entry->getDate();
$d = strptime($enterdate, '%Y-%m-%d %H:%M:%S');
$enterts = mktime($d['tm_hour'], $d['tm_min'], $d['tm_sec'], $d['tm_mon']+1, $d['tm_mday'], $d['tm_year']+1900);
}
}
$msg .= "The state was entered at ".$enterdate." which was ";
$msg .= getReadableDuration((time()-$enterts))." ago.<br />";
}
$msg .= "The document may stay in this state for ".$currentstate->getMaxTime()." sec.";
$this->infoMsg($msg);
$this->contentContainerStart();
// Display the Workflow form.
?>
<div class="row-fluid">
<div class="span4">
<form method="post" action="../op/op.ReturnFromSubWorkflow.php" name="form1" onsubmit="return checkForm();">
<?php echo createHiddenFieldWithKey('returnfromsubworkflow'); ?>
<table>
<tr><td><?php printMLText("comment")?>:</td>
<td><textarea name="comment" cols="80" rows="4"></textarea>
</td></tr>
<tr><td></td><td>
<input type='hidden' name='documentid' value='<?php echo $document->getId(); ?>'/>
<input type='hidden' name='version' value='<?php echo $latestContent->getVersion(); ?>'/>
<?php if($transition) { ?>
<input type='hidden' name='transition' value='<?php echo $transition->getID(); ?>'/>
<?php } ?>
<input type='submit' class="btn" value='<?php printMLText("return_from_subworkflow"); ?>'/>
</td></tr></table>
</form>
</div>
<div id="workflowgraph" class="span8">
<iframe src="out.WorkflowGraph.php?workflow=<?php echo $parentworkflow->getID(); ?>&transition=<?php echo $transition->getID(); ?>&documentid=<?php echo $document->getID(); ?>" width="100%" height="500" style="border: 1px solid #AAA;"></iframe>
<h4>Workflow</h4>
</div>
</div>
<?php
$this->contentContainerEnd();
if($wkflog) {
$this->contentContainerStart();
echo "<table class=\"table-condensed\">";
echo "<tr><th>".getMLText('action')."</th><th>Start state</th><th>End state</th><th>".getMLText('date')."</th><th>".getMLText('user')."</th><th>".getMLText('comment')."</th></tr>";
foreach($wkflog as $entry) {
echo "<tr>";
echo "<td>".getMLText('action_'.$entry->getTransition()->getAction()->getName())."</td>";
echo "<td>".$entry->getTransition()->getState()->getName()."</td>";
echo "<td>".$entry->getTransition()->getNextState()->getName()."</td>";
echo "<td>".$entry->getDate()."</td>";
echo "<td>".$entry->getUser()->getFullname()."</td>";
echo "<td>".$entry->getComment()."</td>";
echo "</tr>";
}
echo "</table>\n";
$this->contentContainerEnd();
}
$this->htmlEndPage();
} /* }}} */
}
?>

View File

@ -0,0 +1,111 @@
<?php
/**
* Implementation of RewindWorkflow view
*
* @category DMS
* @package LetoDMS
* @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 Rewindorkflow view
*
* @category DMS
* @package LetoDMS
* @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@
*/
class LetoDMS_View_RewindWorkflow extends LetoDMS_Bootstrap_Style {
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
$document = $this->params['document'];
$latestContent = $document->getLatestContent();
$this->htmlStartPage(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))));
$this->globalNavigation($folder);
$this->contentStart();
$this->pageNavigation($this->getFolderPathHTML($folder, true, $document), "view_document");
$this->contentHeading(getMLText("rewind_workflow"));
$currentstate = $latestContent->getWorkflowState();
$wkflog = $latestContent->getWorkflowLog();
$workflow = $latestContent->getWorkflow();
$msg = "The document is currently in state: ".$currentstate->getName()."<br />";
if($wkflog) {
foreach($wkflog as $entry) {
if($entry->getTransition()->getNextState()->getID() == $currentstate->getID()) {
$enterdate = $entry->getDate();
$d = strptime($enterdate, '%Y-%m-%d %H:%M:%S');
$enterts = mktime($d['tm_hour'], $d['tm_min'], $d['tm_sec'], $d['tm_mon']+1, $d['tm_mday'], $d['tm_year']+1900);
}
}
$msg .= "The state was entered at ".$enterdate." which was ";
$msg .= getReadableDuration((time()-$enterts))." ago.<br />";
}
$msg .= "The document may stay in this state for ".$currentstate->getMaxTime()." sec.";
$this->infoMsg($msg);
$this->contentContainerStart();
// Display the Workflow form.
?>
<div class="row-fluid">
<div class="span4">
<p><?php printMLText("rewind_workflow_warning"); ?></p>
<form method="post" action="../op/op.RewindWorkflow.php" name="form1" onsubmit="return checkForm();">
<?php echo createHiddenFieldWithKey('rewindworkflow'); ?>
<table>
<tr><td></td><td>
<input type='hidden' name='documentid' value='<?php echo $document->getId(); ?>'/>
<input type='hidden' name='version' value='<?php echo $latestContent->getVersion(); ?>'/>
<input type='submit' class="btn" value='<?php printMLText("rewind_workflow"); ?>'/>
</td></tr></table>
</form>
</div>
<div id="workflowgraph" class="span8">
<iframe src="out.WorkflowGraph.php?workflow=<?php echo $workflow->getID(); ?>" width="100%" height="400" style="border: 1px solid #AAA;"></iframe>
</div>
</div>
<?php
$this->contentContainerEnd();
if($wkflog) {
$this->contentContainerStart();
echo "<table class=\"table-condensed\">";
echo "<tr><th>".getMLText('action')."</th><th>Start state</th><th>End state</th><th>".getMLText('date')."</th><th>".getMLText('user')."</th><th>".getMLText('comment')."</th></tr>";
foreach($wkflog as $entry) {
echo "<tr>";
echo "<td>".getMLText('action_'.$entry->getTransition()->getAction()->getName())."</td>";
echo "<td>".$entry->getTransition()->getState()->getName()."</td>";
echo "<td>".$entry->getTransition()->getNextState()->getName()."</td>";
echo "<td>".$entry->getDate()."</td>";
echo "<td>".$entry->getUser()->getFullname()."</td>";
echo "<td>".$entry->getComment()."</td>";
echo "</tr>";
}
echo "</table>\n";
$this->contentContainerEnd();
}
$this->htmlEndPage();
} /* }}} */
}
?>

View File

@ -0,0 +1,112 @@
<?php
/**
* Implementation of RunSubWorkflow view
*
* @category DMS
* @package LetoDMS
* @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 RunSubWorkflow view
*
* @category DMS
* @package LetoDMS
* @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@
*/
class LetoDMS_View_RunSubWorkflow extends LetoDMS_Bootstrap_Style {
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
$document = $this->params['document'];
$subworkflow = $this->params['subworkflow'];
$latestContent = $document->getLatestContent();
$this->htmlStartPage(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))));
$this->globalNavigation($folder);
$this->contentStart();
$this->pageNavigation($this->getFolderPathHTML($folder, true, $document), "view_document");
$this->contentHeading(getMLText("run_subworkflow"));
$currentstate = $latestContent->getWorkflowState();
$wkflog = $latestContent->getWorkflowLog();
$workflow = $latestContent->getWorkflow();
$msg = "The document is currently in state: ".$currentstate->getName()."<br />";
if($wkflog) {
foreach($wkflog as $entry) {
if($entry->getTransition()->getNextState()->getID() == $currentstate->getID()) {
$enterdate = $entry->getDate();
$d = strptime($enterdate, '%Y-%m-%d %H:%M:%S');
$enterts = mktime($d['tm_hour'], $d['tm_min'], $d['tm_sec'], $d['tm_mon']+1, $d['tm_mday'], $d['tm_year']+1900);
}
}
$msg .= "The state was entered at ".$enterdate." which was ";
$msg .= getReadableDuration((time()-$enterts))." ago.<br />";
}
$msg .= "The document may stay in this state for ".$currentstate->getMaxTime()." sec.";
$this->infoMsg($msg);
$this->contentContainerStart();
// Display the Workflow form.
?>
<div class="row-fluid">
<div class="span4">
<form method="POST" action="../op/op.RunSubWorkflow.php" name="form1">
<?php echo createHiddenFieldWithKey('runsubworkflow'); ?>
<table>
<tr><td></td><td>
<input type='hidden' name='documentid' value='<?php echo $document->getId(); ?>'/>
<input type='hidden' name='version' value='<?php echo $latestContent->getVersion(); ?>'/>
<input type='hidden' name='subworkflow' value='<?php echo $subworkflow->getID(); ?>'/>
<input type='submit' class="btn" value='<?php printMLText("run_subworkflow"); ?>'/>
</td></tr></table>
</form>
</div>
<div id="workflowgraph" class="span8">
<iframe src="out.WorkflowGraph.php?workflow=<?php echo $subworkflow->getID(); ?>" width="100%" height="400" style="border: 1px solid #AAA;"></iframe>
</div>
</div>
<?php
$this->contentContainerEnd();
if($wkflog) {
$this->contentContainerStart();
echo "<table class=\"table-condensed\">";
echo "<tr><th>".getMLText('action')."</th><th>Start state</th><th>End state</th><th>".getMLText('date')."</th><th>".getMLText('user')."</th><th>".getMLText('comment')."</th></tr>";
foreach($wkflog as $entry) {
echo "<tr>";
echo "<td>".getMLText('action_'.$entry->getTransition()->getAction()->getName())."</td>";
echo "<td>".$entry->getTransition()->getState()->getName()."</td>";
echo "<td>".$entry->getTransition()->getNextState()->getName()."</td>";
echo "<td>".$entry->getDate()."</td>";
echo "<td>".$entry->getUser()->getFullname()."</td>";
echo "<td>".$entry->getComment()."</td>";
echo "</tr>";
}
echo "</table>\n";
$this->contentContainerEnd();
}
$this->htmlEndPage();
} /* }}} */
}
?>

View File

@ -0,0 +1,109 @@
<?php
/**
* Implementation of SetWorkflow view
*
* @category DMS
* @package LetoDMS
* @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 SetWorkflow view
*
* @category DMS
* @package LetoDMS
* @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@
*/
class LetoDMS_View_SetWorkflow extends LetoDMS_Bootstrap_Style {
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
$document = $this->params['document'];
$latestContent = $document->getLatestContent();
$this->htmlStartPage(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))));
$this->globalNavigation($folder);
$this->contentStart();
$this->pageNavigation($this->getFolderPathHTML($folder, true, $document), "view_document");
$this->contentHeading(getMLText("set_workflow"));
$this->contentContainerStart();
// Display the Workflow form.
?>
<script language="JavaScript">
function showWorkflow(selectObj) {
id = selectObj.options[selectObj.selectedIndex].value;
if (id > 0) {
$('#workflowgraph').show();
$('#workflowgraph iframe').attr('src', 'out.WorkflowGraph.php?documentid=<?php echo $document->getID(); ?>&workflow='+id);
} else {
$('#workflowgraph').hide();
}
}
</script>
<div class="row-fluid">
<div class="span4">
<form action="../op/op.SetWorkflow.php" method="post" name="form1">
<?php echo createHiddenFieldWithKey('setworkflow'); ?>
<input type="hidden" name="documentid" value="<?php print $document->getID(); ?>">
<input type="hidden" name="version" value="<?php print $latestContent->getVersion(); ?>">
<input type="hidden" name="showtree" value="<?php echo showtree();?>">
<table class="table-condensed">
<tr>
<td>
<div class="cbSelectTitle"><?php printMLText("workflow");?>:</div>
</td>
<td>
<?php
$workflows = $dms->getAllWorkflows();
if($workflows) {
echo "<select onchange=\"showWorkflow(this)\" class=\"_chzn-select-deselect\" name=\"workflow\" data-placeholder=\"".getMLText('select_workflow')."\">";
$mandatoryworkflow = $user->getMandatoryWorkflow();
$workflows=$dms->getAllWorkflows();
foreach ($workflows as $workflow) {
print "<option value=\"".$workflow->getID()."\"";
if($mandatoryworkflow && $mandatoryworkflow->getID() == $workflow->getID())
echo " selected=\"selected\"";
print ">". htmlspecialchars($workflow->getName())."</option>";
}
echo "</select>";
}
?>
</td>
</tr>
<tr>
<td>
</td>
<td><input type="submit" class="btn" value="<?php printMLText("set_workflow");?>"></td>
</tr>
</table>
</div>
<div id="workflowgraph" class="span8" style="display: none;">
<iframe src="" width="100%" height="500" style="border: 1px solid #AAA;"></iframe>
</div>
</div>
<?php
$this->contentContainerEnd();
$this->htmlEndPage();
} /* }}} */
}
?>

View File

@ -0,0 +1,133 @@
<?php
/**
* Implementation of TriggerWorkflow view
*
* @category DMS
* @package LetoDMS
* @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 TriggerWorkflow view
*
* @category DMS
* @package LetoDMS
* @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@
*/
class LetoDMS_View_TriggerWorkflow extends LetoDMS_Bootstrap_Style {
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
$document = $this->params['document'];
$transition = $this->params['transition'];
$latestContent = $document->getLatestContent();
$this->htmlStartPage(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))));
$this->globalNavigation($folder);
$this->contentStart();
$this->pageNavigation($this->getFolderPathHTML($folder, true, $document), "view_document");
$this->contentHeading(getMLText("trigger_workflow"));
?>
<script language="JavaScript">
function checkForm()
{
msg = "";
if (document.form1.comment.value == "") msg += "<?php printMLText("js_no_comment");?>\n";
if (msg != "")
{
alert(msg);
return false;
}
else
return true;
}
</script>
<?php
$action = $transition->getAction();
$currentstate = $latestContent->getWorkflowState();
$wkflog = $latestContent->getWorkflowLog();
$workflow = $latestContent->getWorkflow();
$msg = "The document is currently in state: ".$currentstate->getName()."<br />";
if($wkflog) {
foreach($wkflog as $entry) {
if($entry->getTransition()->getNextState()->getID() == $currentstate->getID()) {
$enterdate = $entry->getDate();
$d = strptime($enterdate, '%Y-%m-%d %H:%M:%S');
$enterts = mktime($d['tm_hour'], $d['tm_min'], $d['tm_sec'], $d['tm_mon']+1, $d['tm_mday'], $d['tm_year']+1900);
}
}
$msg .= "The state was entered at ".$enterdate." which was ";
$msg .= getReadableDuration((time()-$enterts))." ago.<br />";
}
$msg .= "The document may stay in this state for ".$currentstate->getMaxTime()." sec.";
$this->infoMsg($msg);
$this->contentContainerStart();
// Display the Workflow form.
?>
<div class="row-fluid">
<div class="span4">
<form method="POST" action="../op/op.TriggerWorkflow.php" name="form1" onsubmit="return checkForm();">
<?php echo createHiddenFieldWithKey('triggerworkflow'); ?>
<table>
<tr><td><?php printMLText("comment")?>:</td>
<td><textarea name="comment" cols="80" rows="4"></textarea>
</td></tr>
<tr><td></td><td>
<input type='hidden' name='documentid' value='<?php echo $document->getId(); ?>'/>
<input type='hidden' name='version' value='<?php echo $latestContent->getVersion(); ?>'/>
<input type='hidden' name='transition' value='<?php echo $transition->getID(); ?>'/>
<input type='submit' class="btn" value='<?php printMLText("action_".$action->getName()); ?>'/>
</td></tr></table>
</form>
</div>
<div id="workflowgraph" class="span8">
<iframe src="out.WorkflowGraph.php?workflow=<?php echo $workflow->getID(); ?>&transition=<?php echo $transition->getID(); ?>&documentid=<?php echo $document->getID(); ?>" width="100%" height="500" style="border: 1px solid #AAA;"></iframe>
</div>
</div>
<?php
$this->contentContainerEnd();
if($wkflog) {
$this->contentContainerStart();
echo "<table class=\"table-condensed\">";
echo "<tr><th>".getMLText('action')."</th><th>Start state</th><th>End state</th><th>".getMLText('date')."</th><th>".getMLText('user')."</th><th>".getMLText('comment')."</th></tr>";
foreach($wkflog as $entry) {
echo "<tr>";
echo "<td>".getMLText('action_'.$entry->getTransition()->getAction()->getName())."</td>";
echo "<td>".$entry->getTransition()->getState()->getName()."</td>";
echo "<td>".$entry->getTransition()->getNextState()->getName()."</td>";
echo "<td>".$entry->getDate()."</td>";
echo "<td>".$entry->getUser()->getFullname()."</td>";
echo "<td>".$entry->getComment()."</td>";
echo "</tr>";
}
echo "</table>\n";
$this->contentContainerEnd();
}
$this->htmlEndPage();
} /* }}} */
}
?>

View File

@ -0,0 +1,192 @@
<?php
/**
* Implementation of WorkspaceActionsMgr view
*
* @category DMS
* @package LetoDMS
* @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 WorkspaceActionsMgr view
*
* @category DMS
* @package LetoDMS
* @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@
*/
class LetoDMS_View_WorkflowActionsMgr extends LetoDMS_Bootstrap_Style {
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$selworkflowaction = $this->params['selworkflowaction'];
$workflowactions = $dms->getAllWorkflowActions();
$this->htmlStartPage(getMLText("admin_tools"));
$this->globalNavigation();
$this->contentStart();
$this->pageNavigation(getMLText("admin_tools"), "admin_tools");
?>
<script language="JavaScript">
function checkForm(num)
{
msg = "";
eval("var formObj = document.form" + num + ";");
if (formObj.login.value == "") msg += "<?php printMLText("js_no_login");?>\n";
if ((num == '0') && (formObj.pwd.value == "")) msg += "<?php printMLText("js_no_pwd");?>\n";
if ((formObj.pwd.value != formObj.pwdconf.value)&&(formObj.pwd.value != "" )&&(formObj.pwd.value != "" )) msg += "<?php printMLText("js_pwd_not_conf");?>\n";
if (formObj.name.value == "") msg += "<?php printMLText("js_no_name");?>\n";
if (formObj.email.value == "") msg += "<?php printMLText("js_no_email");?>\n";
//if (formObj.comment.value == "") msg += "<?php printMLText("js_no_comment");?>\n";
if (msg != "")
{
alert(msg);
return false;
}
else
return true;
}
obj = -1;
function showWorkflowAction(selectObj) {
if (obj != -1) {
obj.style.display = "none";
}
id = selectObj.options[selectObj.selectedIndex].value;
if (id == -1)
return;
obj = document.getElementById("keywords" + id);
obj.style.display = "";
}
</script>
<?php
$this->contentHeading(getMLText("workflow_actions_management"));
?>
<div class="row-fluid">
<div class="span4">
<div class="well">
<?php echo getMLText("selection")?>:
<select onchange="showWorkflowAction(this)" id="selector">
<option value="-1"><?php echo getMLText("choose_workflow_action")?>
<option value="0"><?php echo getMLText("add_workflow_action")?>
<?php
$selected=0;
$count=2;
foreach ($workflowactions as $currWorkflowAction) {
if ($selworkflowaction && $currWorkflowAction->getID()==$selworkflowaction->getID()) $selected=$count;
print "<option value=\"".$currWorkflowAction->getID()."\">" . htmlspecialchars($currWorkflowAction->getName());
$count++;
}
?>
</select>
</div>
</div>
<div class="span8">
<div class="well">
<table class="table-condensed">
<tr>
<td id="keywords0" style="display : none;">
<form action="../op/op.WorkflowActionsMgr.php" method="post" name="form0" onsubmit="return checkForm('0');">
<?php echo createHiddenFieldWithKey('addworkflowaction'); ?>
<input type="Hidden" name="action" value="addworkflowaction">
<table class="table-condensed">
<tr>
<td><?php printMLText("workflow_action_name");?>:</td>
<td><input type="text" name="name"></td>
</tr>
<tr>
<td></td>
<td><input type="submit" class="btn" value="<?php printMLText("add_workflow_action");?>"></td>
</tr>
</table>
</form>
</td>
<?php
foreach ($workflowactions as $currWorkflowAction) {
print "<td id=\"keywords".$currWorkflowAction->getID()."\" style=\"display : none;\">";
?>
<table class="table-condensed">
<tr>
<td></td>
<td>
<?php
if($currWorkflowAction->isUsed()) {
?>
<p><?php echo getMLText('workflow_action_in_use') ?></p>
<?php
} else {
?>
<form class="form-inline" action="../op/op.RemoveWorkflowAction.php" method="post">
<?php echo createHiddenFieldWithKey('removeworkflowaction'); ?>
<input type="hidden" name="workflowactionid" value="<?php print $currWorkflowAction->getID();?>">
<input type="submit" class="btn" value="<?php printMLText("rm_workflow_action");?>">
</form>
<?php
}
?>
</td>
</tr>
<form action="../op/op.WorkflowActionsMgr.php" method="post" name="form<?php print $currWorkflowAction->getID();?>" onsubmit="return checkForm('<?php print $currWorkflowAction->getID();?>');">
<?php echo createHiddenFieldWithKey('editworkflowaction'); ?>
<input type="Hidden" name="workflowactionid" value="<?php print $currWorkflowAction->getID();?>">
<input type="Hidden" name="action" value="editworkflowaction">
<tr>
<td><?php printMLText("workflow_action_name");?>:</td>
<td><input type="text" name="name" value="<?php print htmlspecialchars($currWorkflowAction->getName());?>"></td>
</tr>
<tr>
<td></td>
<td><input type="submit" class="btn" value="<?php printMLText("save");?>"></td>
</tr>
</form>
</table>
</td>
<?php } ?>
</tr></table>
</div>
</div>
</div>
<script language="JavaScript">
sel = document.getElementById("selector");
sel.selectedIndex=<?php print $selected ?>;
showWorkflowAction(sel);
</script>
<?php
$this->htmlEndPage();
} /* }}} */
}
?>

View File

@ -0,0 +1,154 @@
<?php
/**
* Implementation of WorkspaceMgr view
*
* @category DMS
* @package LetoDMS
* @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 WorkspaceMgr view
*
* @category DMS
* @package LetoDMS
* @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@
*/
class LetoDMS_View_WorkflowGraph extends LetoDMS_Bootstrap_Style {
function printGraph() { /* {{{ */
$transitions = $this->workflow->getTransitions();
if($transitions) {
foreach($transitions as $transition) {
$action = $transition->getAction();
$maxtime = $transition->getMaxTime();
$state = $transition->getState();
$nextstate = $transition->getNextState();
if(1 || !isset($this->actions[$action->getID()])) {
$color = "#4B4";
$iscurtransition = $this->curtransition && $transition->getID() == $this->curtransition->getID();
if($iscurtransition) {
$color = "#D00";
} else {
if($this->wkflog) {
foreach($this->wkflog as $entry) {
if($entry->getTransition()->getID() == $transition->getID()) {
$color = "#DDD";
break;
}
}
}
}
$this->actions[$action->getID()] = $action->getID();
$transusers = $transition->getUsers();
$unames = array();
foreach($transusers as $transuser) {
$unames[] = $transuser->getUser()->getFullName();
}
echo "ggg.addNode(\"A".$transition->getID()."-".$action->getID()."\", { render: render_action, maxtime: '".implode(", ", $unames)."', label : \"".$action->getName()."\", color: '".$color."' });\n";
}
if(!isset($this->states[$state->getID()])) {
$this->states[$state->getID()] = $state;
$initstate = '';
if($state == $this->workflow->getInitState())
$initstate = " (START)";
echo "ggg.addNode(\"S".$state->getID()."\", { label : \"".$state->getName()." ".$initstate."\" });\n";
}
if(!isset($this->states[$nextstate->getID()])) {
$this->states[$state->getID()] = $nextstate;
echo "ggg.addNode(\"S".$nextstate->getID()."\", { label : \"".$nextstate->getName()."\" });\n";
}
}
foreach($transitions as $transition) {
if(!in_array($transition->getID(), $this->seentrans)) {
$state = $transition->getState();
$nextstate = $transition->getNextState();
$action = $transition->getAction();
$iscurtransition = $this->curtransition && $transition->getID() == $this->curtransition->getID();
echo "ggg.addEdge(\"S".$state->getID()."\",\"A".$transition->getID()."-".$action->getID()."\", { ".($iscurtransition ? "stroke: '#D00', 'stroke-width': '2px'" : "")." });\n";
echo "ggg.addEdge(\"A".$transition->getID()."-".$action->getID()."\",\"S".$nextstate->getID()."\", { ".($iscurtransition ? "stroke: '#D00', 'stroke-width': '2px'" : "")." });\n";
$this->seentrans[] = $transition->getID();
}
}
}
} /* }}} */
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$this->workflow = $this->params['workflow'];
$this->curtransition = $this->params['transition'];
$document = $this->params['document'];
if($document) {
$latestContent = $document->getLatestContent();
$this->wkflog = $latestContent->getWorkflowLog();
} else {
$this->wkflog = array();
}
$this->htmlAddHeader(
'<script type="text/javascript" src="../styles/bootstrap/dracula/raphael-min.js"></script>'."\n".
'<script type="text/javascript" src="../styles/bootstrap/dracula/dracula_graffle.js"></script>'."\n".
'<script type="text/javascript" src="../styles/bootstrap/dracula/dracula_graph.js"></script>'."\n".
'<script type="text/javascript" src="../styles/bootstrap/dracula/dracula_algorithms.js"></script>'."\n");
$this->htmlStartPage(getMLText("admin_tools"));
// $this->contentContainerStart();
?>
<div id="canvas" style="width: 100%; height:480px; _border: 1px solid #bbb;"></div>
<script language="JavaScript">
$(document).ready(function() {
var width = $('#canvas').width();
var height = $('#canvas').height();;
var ggg = new Graph();
ggg.edgeFactory.template.style.directed = true;
var render_action = function(r, n) {
/* the Raphael set is obligatory, containing all you want to display */
var set = r.set().push(
/* custom objects go here */
r.rect(n.point[0]-45, n.point[1]-13, 90, 44).attr({"fill": (n.color == undefined ? "#feb" : n.color), r : "12px", "stroke-width" : "1px" })).push(
r.text(n.point[0], n.point[1] + 10, (n.label || n.id) + "\n(" + (n.maxtime == undefined ? "Infinity" : n.maxtime) + ")"));
return set;
};
<?php
$this->seentrans = array();
$state = $this->workflow->getInitState();
$this->states = array();
$this->actions = array();
$this->printGraph();
?>
var layouter = new Graph.Layout.Spring(ggg);
var renderer = new Graph.Renderer.Raphael('canvas', ggg, width, height);
});
</script>
<?php
// $this->contentContainerEnd();
echo "</body>\n</html>\n";
} /* }}} */
}
?>

View File

@ -0,0 +1,328 @@
<?php
/**
* Implementation of WorkspaceMgr view
*
* @category DMS
* @package LetoDMS
* @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 WorkspaceMgr view
*
* @category DMS
* @package LetoDMS
* @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@
*/
class LetoDMS_View_WorkflowMgr extends LetoDMS_Bootstrap_Style {
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$selworkflow = $this->params['selworkflow'];
$workflows = $this->params['allworkflows'];
$workflowstates = $this->params['allworkflowstates'];
$this->htmlStartPage(getMLText("admin_tools"));
$this->globalNavigation();
$this->contentStart();
$this->pageNavigation(getMLText("admin_tools"), "admin_tools");
?>
<script language="JavaScript">
function checkForm(num)
{
msg = "";
eval("var formObj = document.form" + num + ";");
if (formObj.login.value == "") msg += "<?php printMLText("js_no_login");?>\n";
if ((num == '0') && (formObj.pwd.value == "")) msg += "<?php printMLText("js_no_pwd");?>\n";
if ((formObj.pwd.value != formObj.pwdconf.value)&&(formObj.pwd.value != "" )&&(formObj.pwd.value != "" )) msg += "<?php printMLText("js_pwd_not_conf");?>\n";
if (formObj.name.value == "") msg += "<?php printMLText("js_no_name");?>\n";
if (formObj.email.value == "") msg += "<?php printMLText("js_no_email");?>\n";
//if (formObj.comment.value == "") msg += "<?php printMLText("js_no_comment");?>\n";
if (msg != "")
{
alert(msg);
return false;
}
else
return true;
}
obj = -1;
function showWorkflow(selectObj) {
if (obj != -1) {
obj.style.display = "none";
}
id = selectObj.options[selectObj.selectedIndex].value;
if (id > 0) {
$('#workflowgraph').show();
$('#workflowgraph iframe').attr('src', 'out.WorkflowGraph.php?workflow='+id);
} else {
$('#workflowgraph').hide();
}
if (id == -1)
return;
obj = document.getElementById("keywords" + id);
obj.style.display = "";
}
</script>
<?php
$this->contentHeading(getMLText("workflow_management"));
?>
<div class="row-fluid">
<div class="span4">
<div class="well">
<?php echo getMLText("selection")?>:
<select onchange="showWorkflow(this)" id="selector">
<option value="-1"><?php echo getMLText("choose_workflow")?>
<option value="0"><?php echo getMLText("add_workflow")?>
<?php
$selected=0;
$count=2;
foreach ($workflows as $currWorkflow) {
if (isset($selworkflow) && $currWorkflow->getID()==$selworkflow->getID()) $selected=$count;
print "<option value=\"".$currWorkflow->getID()."\">" . htmlspecialchars($currWorkflow->getName());
$count++;
}
?>
</select>
</div>
<div id="workflowgraph" class="well">
<iframe src="out.WorkflowGraph.php?workflow=1" width="100%" height="500" style="border: 1px solid #AAA;"></iframe>
</div>
</div>
<div class="span8">
<div class="well">
<table class="table-condensed">
<tr>
<td id="keywords0" style="display : none;">
<form action="../op/op.WorkflowMgr.php" method="post" enctype="multipart/form-data" name="form0" onsubmit="return checkForm('0');">
<?php echo createHiddenFieldWithKey('addworkflow'); ?>
<input type="Hidden" name="action" value="addworkflow">
<table class="table-condensed">
<tr>
<td><?php printMLText("workflow_name");?>:</td>
<td><input type="text" name="name"></td>
</tr>
<tr>
<td><?php printMLText("workflow_initstate");?>:</td>
<td><select name="initstate">
<?php
foreach($workflowstates as $workflowstate) {
echo "<option value=\"".$workflowstate->getID()."\"";
echo ">".htmlspecialchars($workflowstate->getName())."</option>\n";
}
?>
</select></td>
</tr>
<tr>
<td></td>
<td><input type="submit" class="btn" value="<?php printMLText("add_workflow");?>"></td>
</tr>
</table>
</form>
</td>
<?php
foreach ($workflows as $currWorkflow) {
print "<td id=\"keywords".$currWorkflow->getID()."\" style=\"display : none;\">";
?>
<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'); ?>
<input type="Hidden" name="workflowid" value="<?php print $currWorkflow->getID();?>">
<input type="Hidden" name="action" value="editworkflow">
<table class="table-condensed">
<tr>
<td></td>
<td>
<?php
if($currWorkflow->isUsed()) {
?>
<p><?php echo getMLText('workflow_in_use') ?></p>
<?php
} 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>
<?php
}
?>
</td>
</tr>
<tr>
<td><?php printMLText("workflow_name");?>:</td>
<td><input type="text" name="name" value="<?php print htmlspecialchars($currWorkflow->getName());?>"></td>
</tr>
<tr>
<td><?php printMLText("workflow_initstate");?>:</td>
<td><select name="initstate">
<?php
foreach($workflowstates as $workflowstate) {
echo "<option value=\"".$workflowstate->getID()."\"";
if($currWorkflow->getInitState()->getID() == $workflowstate->getID())
echo " selected=\"selected\"";
echo ">".htmlspecialchars($workflowstate->getName())."</option>\n";
}
?>
</select></td>
</tr>
<tr>
<td></td>
<td><input type="submit" class="btn" value="<?php printMLText("save");?>"></td>
</tr>
</table>
</form>
<?php
$transitions = $currWorkflow->getTransitions();
if($transitions) {
echo "<table class=\"table table-condensed\">";
echo "<tr><th>State</th><th>Action</th><th>Next state</th><th>".getMLText('user')."/".getMLText('group')."</th><th>Document status</th></tr>";
foreach($transitions as $transition) {
$state = $transition->getState();
$nextstate = $transition->getNextState();
$action = $transition->getAction();
echo "<tr><td>".$state->getName()."</td><td>".$action->getName()."</td><td>".$nextstate->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();
echo "<br />";
}
echo "</td>";
$docstatus = $nextstate->getDocumentStatus();
if($docstatus == S_RELEASED || $docstatus == S_REJECTED) {
echo "<td>".getOverallStatusText($docstatus)."</td>";
} else {
echo "<td></td>";
}
echo "<td>";
?>
<form class="form-inline" action="../op/op.RemoveTransitionFromWorkflow.php" method="post">
<?php echo createHiddenFieldWithKey('removetransitionfromworkflow'); ?>
<input type="hidden" name="workflow" value="<?php print $currWorkflow->getID();?>">
<input type="hidden" name="transition" value="<?php print $transition->getID(); ?>">
<button type="submit" class="btn"><i class="icon-remove"></i> <?php printMLText("delete");?></button>
</form>
<?php
echo "</td>";
echo "</tr>\n";
}
?>
<form class="form-inline" action="../op/op.AddTransitionToWorkflow.php" method="post">
<?php
echo "<tr>";
echo "<td>";
echo "<select name=\"state\">";
$states = $dms->getAllWorkflowStates();
foreach($states as $state) {
echo "<option value=\"".$state->getID()."\">".$state->getName()."</option>";
}
echo "</select>";
echo "</td>";
echo "<td>";
echo "<select name=\"action\">";
$actions = $dms->getAllWorkflowActions();
foreach($actions as $action) {
echo "<option value=\"".$action->getID()."\">".$action->getName()."</option>";
}
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_ind_reviewers')."\">";
$allusers = $dms->getAllUsers();
foreach($allusers as $usr) {
print "<option value=\"".$usr->getID()."\">". htmlspecialchars($usr->getLogin()." - ".$usr->getFullName())."</option>";
}
echo "</select>";
echo "<br />";
echo "<select class=\"chzn-select\" name=\"groups[]\" multiple=\"multiple\" data-placeholder=\"".getMLText('select_ind_reviewers')."\">";
$allgroups = $dms->getAllGroups();
foreach($allgroups as $grp) {
print "<option value=\"".$grp->getID()."\">". htmlspecialchars($grp->getName())."</option>";
}
echo "</select>";
echo "</td>";
echo "<td>";
echo "<select name=\"documenstatus\">";
echo "<option value=\"\">"."</option>";
echo "<option value=\"".S_RELEASED."\">".getMLText('released')."</option>";
echo "<option value=\"".S_REJECTED."\">".getMLText('rejected')."</option>";
echo "</select>";
echo "</td>";
echo "<td>";
?>
<?php echo createHiddenFieldWithKey('addtransitiontoworkflow'); ?>
<input type="hidden" name="workflow" value="<?php print $currWorkflow->getID();?>">
<input type="submit" class="btn" value="<?php printMLText("add");?>">
<?php
echo "</td>";
echo "</tr>\n";
?>
</form>
<?php
echo "</table>";
}
?>
</td>
<?php } ?>
</tr></table>
</div>
</div>
</div>
<script language="JavaScript">
sel = document.getElementById("selector");
sel.selectedIndex=<?php print $selected ?>;
showWorkflow(sel);
</script>
<?php
$this->htmlEndPage();
} /* }}} */
}
?>

View File

@ -0,0 +1,209 @@
<?php
/**
* Implementation of WorkspaceStatesMgr view
*
* @category DMS
* @package LetoDMS
* @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 WorkspaceStatesMgr view
*
* @category DMS
* @package LetoDMS
* @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@
*/
class LetoDMS_View_WorkflowStatesMgr extends LetoDMS_Bootstrap_Style {
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$selworkflowstate = $this->params['selworkflowstate'];
$workflowstates = $dms->getAllWorkflowStates();
$this->htmlStartPage(getMLText("admin_tools"));
$this->globalNavigation();
$this->contentStart();
$this->pageNavigation(getMLText("admin_tools"), "admin_tools");
?>
<script language="JavaScript">
function checkForm(num)
{
msg = "";
eval("var formObj = document.form" + num + ";");
if (formObj.login.value == "") msg += "<?php printMLText("js_no_login");?>\n";
if ((num == '0') && (formObj.pwd.value == "")) msg += "<?php printMLText("js_no_pwd");?>\n";
if ((formObj.pwd.value != formObj.pwdconf.value)&&(formObj.pwd.value != "" )&&(formObj.pwd.value != "" )) msg += "<?php printMLText("js_pwd_not_conf");?>\n";
if (formObj.name.value == "") msg += "<?php printMLText("js_no_name");?>\n";
if (formObj.email.value == "") msg += "<?php printMLText("js_no_email");?>\n";
//if (formObj.comment.value == "") msg += "<?php printMLText("js_no_comment");?>\n";
if (msg != "")
{
alert(msg);
return false;
}
else
return true;
}
obj = -1;
function showWorkflowState(selectObj) {
if (obj != -1) {
obj.style.display = "none";
}
id = selectObj.options[selectObj.selectedIndex].value;
if (id == -1)
return;
obj = document.getElementById("keywords" + id);
obj.style.display = "";
}
</script>
<?php
$this->contentHeading(getMLText("workflow_states_management"));
?>
<div class="row-fluid">
<div class="span4">
<div class="well">
<?php echo getMLText("selection")?>:
<select onchange="showWorkflowState(this)" id="selector">
<option value="-1"><?php echo getMLText("choose_workflow_state")?>
<option value="0"><?php echo getMLText("add_workflow_state")?>
<?php
$selected=0;
$count=2;
foreach ($workflowstates as $currWorkflowState) {
if ($selworkflowstate && $currWorkflowState->getID()==$selworkflowstate->getID()) $selected=$count;
print "<option value=\"".$currWorkflowState->getID()."\">" . htmlspecialchars($currWorkflowState->getName());
$count++;
}
?>
</select>
</div>
</div>
<div class="span8">
<div class="well">
<table class="table-condensed">
<tr>
<td id="keywords0" style="display : none;">
<form action="../op/op.WorkflowStatesMgr.php" method="post" name="form0" onsubmit="return checkForm('0');">
<?php echo createHiddenFieldWithKey('addworkflowstate'); ?>
<input type="Hidden" name="action" value="addworkflowstate">
<table class="table-condensed">
<tr>
<td><?php printMLText("workflow_state_name");?>:</td>
<td><input type="text" name="name"></td>
</tr>
<tr>
<td><?php printMLText("workflow_state_docstatus");?>:</td>
<td><select name="docstatus">
<option value=""></option>
<option value="<?php echo S_RELEASED; ?>" <?php if($currWorkflowState->getDocumentStatus() == S_RELEASED) echo "selected"; ?>><?php printMLText('released'); ?></option>
<option value="<?php echo S_REJECTED; ?>" <?php if($currWorkflowState->getDocumentStatus() == S_REJECTED) echo "selected"; ?>><?php printMLText('rejected'); ?></option>
</select></td>
</tr>
<tr>
<td></td>
<td><input type="submit" class="btn" value="<?php printMLText("add_workflow_state");?>"></td>
</tr>
</table>
</form>
</td>
<?php
foreach ($workflowstates as $currWorkflowState) {
print "<td id=\"keywords".$currWorkflowState->getID()."\" style=\"display : none;\">";
?>
<table class="table-condensed">
<tr>
<td></td>
<td>
<?php
if($currWorkflowState->isUsed()) {
?>
<p><?php echo getMLText('workflow_state_in_use') ?></p>
<?php
} else {
?>
<form class="form-inline" action="../op/op.RemoveWorkflowState.php" method="post">
<?php echo createHiddenFieldWithKey('removeworkflowstate'); ?>
<input type="hidden" name="workflowstateid" value="<?php print $currWorkflowState->getID();?>">
<input type="submit" class="btn" value="<?php printMLText("rm_workflow_state");?>">
</form>
<?php
}
?>
</td>
</tr>
<form action="../op/op.WorkflowStatesMgr.php" method="post" name="form<?php print $currWorkflowState->getID();?>" onsubmit="return checkForm('<?php print $currWorkflowState->getID();?>');">
<?php echo createHiddenFieldWithKey('editworkflowstate'); ?>
<input type="Hidden" name="workflowstateid" value="<?php print $currWorkflowState->getID();?>">
<input type="Hidden" name="action" value="editworkflowstate">
<tr>
<td><?php printMLText("workflow_state_name");?>:</td>
<td><input type="text" name="name" value="<?php print htmlspecialchars($currWorkflowState->getName());?>"></td>
</tr>
<tr>
<td><?php printMLText("workflow_state_docstatus");?>:</td>
<td><select name="docstatus">
<option value=""></option>
<option value="<?php echo S_RELEASED; ?>" <?php if($currWorkflowState->getDocumentStatus() == S_RELEASED) echo "selected"; ?>><?php printMLText('released'); ?></option>
<option value="<?php echo S_REJECTED; ?>" <?php if($currWorkflowState->getDocumentStatus() == S_REJECTED) echo "selected"; ?>><?php printMLText('rejected'); ?></option>
</select></td>
</tr>
<tr>
<td></td>
<td><input type="submit" class="btn" value="<?php printMLText("save");?>"></td>
</tr>
</form>
</table>
</td>
<?php } ?>
</tr></table>
</div>
</div>
</div>
<script language="JavaScript">
sel = document.getElementById("selector");
sel.selectedIndex=<?php print $selected ?>;
showWorkflowState(sel);
</script>
<?php
$this->htmlEndPage();
} /* }}} */
}
?>