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
|
|
|
|
*/
|
2021-04-18 05:08:00 +00:00
|
|
|
//require_once("class.Bootstrap.php");
|
2013-01-24 10:35:33 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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@
|
|
|
|
*/
|
2021-04-18 05:08:00 +00:00
|
|
|
class SeedDMS_View_WorkflowActionsMgr extends SeedDMS_Theme_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');
|
2021-05-31 17:38:26 +00:00
|
|
|
parent::jsTranslations(array('js_form_error', 'js_form_errors'));
|
2013-01-24 10:35:33 +00:00
|
|
|
?>
|
2021-05-31 17:38:26 +00:00
|
|
|
function runValidation() {
|
|
|
|
$("#form1").validate({
|
|
|
|
rules: {
|
|
|
|
name: {
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
},
|
|
|
|
messages: {
|
|
|
|
name: "<?php printMLText("js_no_name");?>",
|
|
|
|
}
|
|
|
|
});
|
2013-01-24 10:35:33 +00:00
|
|
|
}
|
|
|
|
|
2016-03-18 14:33:18 +00:00
|
|
|
$(document).ready( function() {
|
|
|
|
$( "#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) {
|
2021-04-18 05:08:00 +00:00
|
|
|
echo "<table class=\"table table-condensed table-sm\">";
|
2016-11-02 17:00:26 +00:00
|
|
|
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>";
|
2020-03-26 06:54:27 +00:00
|
|
|
echo htmlspecialchars($workflow->getName());
|
2016-11-02 17:00:26 +00:00
|
|
|
echo "</td><td>";
|
2020-08-27 05:52:52 +00:00
|
|
|
echo '<i class="fa fa-circle'.($workflow->getInitState()->getId() == $state->getId() ? ' initstate' : ' in-workflow').'"></i> '.htmlspecialchars($state->getName());
|
2016-11-02 17:00:26 +00:00
|
|
|
echo "</td><td>";
|
2020-08-27 05:52:52 +00:00
|
|
|
echo '<i class="fa fa-circle'.($docstatus == S_RELEASED ? ' released' : ($docstatus == S_REJECTED ? ' rejected' : ' in-workflow')).'"></i> '.htmlspecialchars($nextstate->getName());
|
2016-11-02 17:00:26 +00:00
|
|
|
echo "</td></tr>";
|
|
|
|
}
|
|
|
|
echo "</tbody>";
|
|
|
|
echo "</table>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-03-18 14:33:18 +00:00
|
|
|
} /* }}} */
|
2013-01-24 10:35:33 +00:00
|
|
|
|
2018-12-03 06:40:58 +00:00
|
|
|
function actionmenu() { /* {{{ */
|
|
|
|
$dms = $this->params['dms'];
|
|
|
|
$user = $this->params['user'];
|
|
|
|
$selworkflowaction = $this->params['selworkflowaction'];
|
|
|
|
|
|
|
|
if($selworkflowaction && !$selworkflowaction->isUsed()) {
|
2021-05-31 17:38:26 +00:00
|
|
|
$button = array(
|
|
|
|
'label'=>getMLText('action'),
|
|
|
|
'menuitems'=>array(
|
|
|
|
)
|
|
|
|
);
|
|
|
|
$button['menuitems'][] = array('label'=>'<i class="fa fa-remove"></i> '.getMLText("rm_workflow_action"), 'link'=>'../op/op.RemoveWorkflowAction.php?workflowactionid='.$selworkflowaction->getID().'&formtoken='.createFormKey('removeworkflowaction'));
|
|
|
|
self::showButtonwithMenu($button);
|
2018-12-03 06:40:58 +00:00
|
|
|
}
|
|
|
|
} /* }}} */
|
|
|
|
|
2016-03-18 14:33:18 +00:00
|
|
|
function showWorkflowActionForm($action) { /* {{{ */
|
|
|
|
if($action) {
|
|
|
|
if($action->isUsed()) {
|
2018-04-26 06:50:44 +00:00
|
|
|
$this->infoMsg(getMLText('workflow_action_in_use'));
|
2016-03-18 14:33:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
2021-05-31 17:38:26 +00:00
|
|
|
<form action="../op/op.WorkflowActionsMgr.php" method="post" class="form-horizontal" id="form1" name="form1">
|
2016-03-18 14:33:18 +00:00
|
|
|
<?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
|
|
|
|
}
|
2021-04-18 05:08:00 +00:00
|
|
|
$this->contentContainerStart();
|
2018-04-26 06:50:44 +00:00
|
|
|
$this->formField(
|
|
|
|
getMLText("workflow_action_name"),
|
2018-06-07 05:46:19 +00:00
|
|
|
array(
|
|
|
|
'element'=>'input',
|
|
|
|
'type'=>'text',
|
|
|
|
'id'=>'name',
|
|
|
|
'name'=>'name',
|
|
|
|
'value'=>($action ? htmlspecialchars($action->getName()) : '')
|
|
|
|
)
|
2018-04-26 06:50:44 +00:00
|
|
|
);
|
2021-04-18 05:08:00 +00:00
|
|
|
$this->contentContainerEnd();
|
2020-08-27 05:52:52 +00:00
|
|
|
$this->formSubmit('<i class="fa fa-save"></i> '.getMLText("save"));
|
2016-03-18 14:33:18 +00:00
|
|
|
?>
|
|
|
|
</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();
|
|
|
|
|
2021-05-31 17:38:26 +00:00
|
|
|
$this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/vendors/jquery-validation/jquery.validate.js"></script>'."\n", 'js');
|
|
|
|
$this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/styles/validation-default.js"></script>'."\n", 'js');
|
|
|
|
|
2016-03-18 14:33:18 +00:00
|
|
|
$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"));
|
2020-10-08 05:57:23 +00:00
|
|
|
$this->rowStart();
|
|
|
|
$this->columnStart(4);
|
2013-01-24 10:35:33 +00:00
|
|
|
?>
|
2018-12-03 06:40:58 +00:00
|
|
|
<form class="form-horizontal">
|
2013-01-24 10:35:33 +00:00
|
|
|
<?php
|
2018-06-07 05:46:19 +00:00
|
|
|
$options = array();
|
|
|
|
$options[] = array('-1', getMLText("choose_workflow_action"));
|
|
|
|
$options[] = array('0', getMLText("add_workflow_action"));
|
2013-01-24 10:35:33 +00:00
|
|
|
foreach ($workflowactions as $currWorkflowAction) {
|
2018-06-07 05:46:19 +00:00
|
|
|
$options[] = array($currWorkflowAction->getID(), htmlspecialchars($currWorkflowAction->getName()), $selworkflowaction && $currWorkflowAction->getID()==$selworkflowaction->getID());
|
2013-01-24 10:35:33 +00:00
|
|
|
}
|
2018-04-26 06:50:44 +00:00
|
|
|
$this->formField(
|
2018-12-03 06:40:58 +00:00
|
|
|
null, //getMLText("selection"),
|
2018-06-07 05:46:19 +00:00
|
|
|
array(
|
|
|
|
'element'=>'select',
|
|
|
|
'id'=>'selector',
|
2018-12-03 06:40:58 +00:00
|
|
|
'class'=>'chzn-select',
|
2018-06-07 05:46:19 +00:00
|
|
|
'options'=>$options
|
|
|
|
)
|
2018-04-26 06:50:44 +00:00
|
|
|
);
|
2013-01-24 10:35:33 +00:00
|
|
|
?>
|
2018-12-03 06:40:58 +00:00
|
|
|
</form>
|
|
|
|
<div class="ajax" style="margin-bottom: 15px;" data-view="WorkflowActionsMgr" data-action="actionmenu" <?php echo ($selworkflowaction ? "data-query=\"workflowactionid=".$selworkflowaction->getID()."\"" : "") ?>></div>
|
2018-04-26 06:50:44 +00:00
|
|
|
<div class="ajax" data-view="WorkflowActionsMgr" data-action="info" <?php echo ($selworkflowaction ? "data-query=\"workflowactionid=".$selworkflowaction->getID()."\"" : "") ?>></div>
|
2020-10-08 05:57:23 +00:00
|
|
|
<?php
|
|
|
|
$this->columnEnd();
|
|
|
|
$this->columnStart(8);
|
|
|
|
?>
|
2021-05-31 17:38:26 +00:00
|
|
|
<div class="ajax" data-view="WorkflowActionsMgr" data-action="form" data-afterload="()=>{runValidation();}" <?php echo ($selworkflowaction ? "data-query=\"workflowactionid=".$selworkflowaction->getID()."\"" : "") ?>></div>
|
2016-03-18 14:33:18 +00:00
|
|
|
</div>
|
2013-01-24 10:35:33 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<?php
|
2020-10-08 05:57:23 +00:00
|
|
|
$this->columnEnd();
|
|
|
|
$this->rowEnd();
|
2016-03-15 07:30:53 +00:00
|
|
|
$this->contentEnd();
|
2013-01-24 10:35:33 +00:00
|
|
|
$this->htmlEndPage();
|
|
|
|
} /* }}} */
|
|
|
|
}
|
|
|
|
?>
|