2013-01-24 10:35:33 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Implementation of WorkspaceActionsMgr view
|
|
|
|
*
|
|
|
|
* @category DMS
|
2013-02-14 11:10:53 +00:00
|
|
|
* @package SeedDMS
|
2013-01-24 10:35:33 +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 WorkspaceActionsMgr view
|
|
|
|
*
|
|
|
|
* @category DMS
|
2013-02-14 11:10:53 +00:00
|
|
|
* @package SeedDMS
|
2013-01-24 10:35:33 +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_WorkflowActionsMgr extends SeedDMS_Bootstrap_Style {
|
2013-01-24 10:35:33 +00:00
|
|
|
|
2016-03-18 14:33:18 +00:00
|
|
|
function js() { /* {{{ */
|
|
|
|
header('Content-Type: application/javascript; charset=UTF-8');
|
2013-01-24 10:35:33 +00:00
|
|
|
?>
|
|
|
|
function checkForm(num)
|
|
|
|
{
|
2013-05-23 14:07:00 +00:00
|
|
|
msg = new Array()
|
2013-01-24 10:35:33 +00:00
|
|
|
|
2016-03-18 14:33:18 +00:00
|
|
|
if($("#name").val() == "") msg.push("<?php printMLText("js_no_name");?>");
|
2013-01-24 10:35:33 +00:00
|
|
|
if (msg != "")
|
|
|
|
{
|
2013-05-23 14:07:00 +00:00
|
|
|
noty({
|
|
|
|
text: msg.join('<br />'),
|
|
|
|
type: 'error',
|
|
|
|
dismissQueue: true,
|
|
|
|
layout: 'topRight',
|
|
|
|
theme: 'defaultTheme',
|
|
|
|
_timeout: 1500,
|
|
|
|
});
|
2013-01-24 10:35:33 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-03-18 14:33:18 +00:00
|
|
|
$(document).ready( function() {
|
|
|
|
$('body').on('submit', '#form', function(ev){
|
|
|
|
if(checkForm()) return;
|
2016-03-22 13:47:13 +00:00
|
|
|
ev.preventDefault();
|
2016-03-18 14:33:18 +00:00
|
|
|
});
|
|
|
|
$( "#selector" ).change(function() {
|
|
|
|
$('div.ajax').trigger('update', {workflowactionid: $(this).val()});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
<?php
|
|
|
|
} /* }}} */
|
2013-01-24 10:35:33 +00:00
|
|
|
|
2016-03-18 14:33:18 +00:00
|
|
|
function info() { /* {{{ */
|
|
|
|
$dms = $this->params['dms'];
|
|
|
|
$user = $this->params['user'];
|
2016-11-02 17:00:26 +00:00
|
|
|
$selworkflowaction = $this->params['selworkflowaction'];
|
|
|
|
|
|
|
|
if($selworkflowaction) {
|
|
|
|
if($selworkflowaction->isUsed()) {
|
|
|
|
$transitions = $selworkflowaction->getTransitions();
|
|
|
|
if($transitions) {
|
|
|
|
echo "<table class=\"table table-condensed\">";
|
|
|
|
echo "<thead><tr><th>".getMLText('workflow')."</th><th>".getMLText('previous_state')."</th><th>".getMLText('next_state')."</th></tr></thead>\n";
|
|
|
|
echo "<tbody>";
|
|
|
|
foreach($transitions as $transition) {
|
|
|
|
$state = $transition->getState();
|
|
|
|
$nextstate = $transition->getNextState();
|
|
|
|
$docstatus = $nextstate->getDocumentStatus();
|
|
|
|
$workflow = $transition->getWorkflow();
|
|
|
|
echo "<tr>";
|
|
|
|
echo "<td>";
|
|
|
|
echo $workflow->getName();
|
|
|
|
echo "</td><td>";
|
|
|
|
echo '<i class="icon-circle'.($workflow->getInitState()->getId() == $state->getId() ? ' initstate' : ' in-workflow').'"></i> '.$state->getName();
|
|
|
|
echo "</td><td>";
|
|
|
|
echo '<i class="icon-circle'.($docstatus == S_RELEASED ? ' released' : ($docstatus == S_REJECTED ? ' rejected' : ' in-workflow')).'"></i> '.$nextstate->getName();
|
|
|
|
echo "</td></tr>";
|
|
|
|
}
|
|
|
|
echo "</tbody>";
|
|
|
|
echo "</table>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-03-18 14:33:18 +00:00
|
|
|
} /* }}} */
|
2013-01-24 10:35:33 +00:00
|
|
|
|
2016-03-18 14:33:18 +00:00
|
|
|
function showWorkflowActionForm($action) { /* {{{ */
|
|
|
|
if($action) {
|
|
|
|
if($action->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 $action->getID();?>">
|
|
|
|
<button type="submit" class="btn"><i class="icon-remove"></i> <?php printMLText("rm_workflow_action");?></button>
|
|
|
|
</form>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
<form action="../op/op.WorkflowActionsMgr.php" method="post" class="form-horizontal">
|
|
|
|
<?php
|
|
|
|
if($action) {
|
|
|
|
echo createHiddenFieldWithKey('editworkflowaction');
|
|
|
|
?>
|
|
|
|
<input type="hidden" name="workflowactionid" value="<?php print $action->getID();?>">
|
|
|
|
<input type="hidden" name="action" value="editworkflowaction">
|
|
|
|
<?php
|
|
|
|
} else {
|
|
|
|
echo createHiddenFieldWithKey('addworkflowaction');
|
|
|
|
?>
|
|
|
|
<input type="hidden" name="action" value="addworkflowaction">
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
<div class="control-group">
|
|
|
|
<label class="control-label" for="login"><?php printMLText("workflow_action_name");?>:</label>
|
|
|
|
<div class="controls">
|
|
|
|
<input type="text" id="name" name="name" value="<?php print $action ? htmlspecialchars($action->getName()) : '';?>">
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="control-group">
|
|
|
|
<label class="control-label" for="login"></label>
|
|
|
|
<div class="controls">
|
|
|
|
<button type="submit" class="btn"><i class="icon-save"></i> <?php printMLText("save")?></button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
<?php
|
|
|
|
} /* }}} */
|
2013-01-24 10:35:33 +00:00
|
|
|
|
2016-03-18 14:33:18 +00:00
|
|
|
function form() { /* {{{ */
|
|
|
|
$selworkflowaction = $this->params['selworkflowaction'];
|
2013-01-24 10:35:33 +00:00
|
|
|
|
2016-03-18 14:33:18 +00:00
|
|
|
$this->showWorkflowActionForm($selworkflowaction);
|
|
|
|
} /* }}} */
|
|
|
|
|
|
|
|
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");
|
2013-01-24 10:35:33 +00:00
|
|
|
$this->contentHeading(getMLText("workflow_actions_management"));
|
|
|
|
?>
|
|
|
|
|
|
|
|
<div class="row-fluid">
|
|
|
|
<div class="span4">
|
|
|
|
<div class="well">
|
2016-11-02 17:00:26 +00:00
|
|
|
<form class="form-horizontal">
|
|
|
|
<div class="control-group">
|
|
|
|
<label class="control-label" for="login"><?php printMLText("selection");?>:</label>
|
|
|
|
<div class="controls">
|
2016-03-18 14:33:18 +00:00
|
|
|
<select id="selector" class="span9">
|
2013-01-24 10:35:33 +00:00
|
|
|
<option value="-1"><?php echo getMLText("choose_workflow_action")?>
|
|
|
|
<option value="0"><?php echo getMLText("add_workflow_action")?>
|
|
|
|
<?php
|
|
|
|
foreach ($workflowactions as $currWorkflowAction) {
|
2016-03-18 14:33:18 +00:00
|
|
|
print "<option value=\"".$currWorkflowAction->getID()."\" ".($selworkflowaction && $currWorkflowAction->getID()==$selworkflowaction->getID() ? 'selected' : '').">" . htmlspecialchars($currWorkflowAction->getName());
|
2013-01-24 10:35:33 +00:00
|
|
|
}
|
|
|
|
?>
|
|
|
|
</select>
|
2016-11-02 17:00:26 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>
|
2013-01-24 10:35:33 +00:00
|
|
|
</div>
|
2016-03-18 14:33:18 +00:00
|
|
|
<div class="ajax" data-view="WorkflowActionsMgr" data-action="info" <?php echo ($selworkflowaction ? "data-query=\"workflowactionid=".$selworkflowaction->getID()."\"" : "") ?>></div>
|
2013-01-24 10:35:33 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="span8">
|
2016-03-18 14:33:18 +00:00
|
|
|
<div class="well">
|
|
|
|
<div class="ajax" data-view="WorkflowActionsMgr" data-action="form" <?php echo ($selworkflowaction ? "data-query=\"workflowactionid=".$selworkflowaction->getID()."\"" : "") ?>></div>
|
|
|
|
</div>
|
2013-01-24 10:35:33 +00:00
|
|
|
</div>
|
|
|
|
|
2016-03-18 14:33:18 +00:00
|
|
|
</div>
|
2013-01-24 10:35:33 +00:00
|
|
|
<?php
|
2016-03-15 07:30:53 +00:00
|
|
|
$this->contentEnd();
|
2013-01-24 10:35:33 +00:00
|
|
|
$this->htmlEndPage();
|
|
|
|
} /* }}} */
|
|
|
|
}
|
|
|
|
?>
|