Merge branch 'seeddms-5.0.x' into seeddms-5.1.x

This commit is contained in:
Uwe Steinmann 2016-09-05 08:57:18 +02:00
commit a1ccc60729
5 changed files with 66 additions and 34 deletions

View File

@ -41,20 +41,20 @@ if(isset($_GET['documentid']) && $_GET['documentid']) {
$document = null;
}
if(isset($_GET['transition']) && $_GET['transition']) {
$transition = $dms->getWorkflowTransition($_GET['transition']);
if (is_bool($transition)) {
UI::exitError(getMLText("admin_tools"),getMLText("internal_error"));
$transitions = array();
if(isset($_GET['transitions']) && $_GET['transitions']) {
foreach($_GET['transitions'] as $tr) {
$transition = $dms->getWorkflowTransition($tr);
if ($transition)
$transitions[] = $transition;
}
} else {
$transition = null;
}
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user));
if($view) {
$view->setParam('workflow', $workflow);
$view->setParam('transition', $transition);
$view->setParam('transitions', $transitions);
$view->setParam('document', $document);
$view($_GET);
exit;

View File

@ -57,7 +57,7 @@ class SeedDMS_View_RemoveWorkflow extends SeedDMS_Bootstrap_Style {
</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>
<iframe src="out.WorkflowGraph.php?workflow=<?php echo $workflow->getID(); ?>" width="100%" height="661" style="border: 1px solid #AAA;"></iframe>
</div>
</div>
<?php

View File

@ -832,6 +832,8 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
?>
<div class="tab-pane <?php if($currenttab == 'workflow') echo 'active'; ?>" id="workflow">
<?php
echo "<div class=\"row-fluid\">";
echo "<div class=\"span6\">";
$this->contentContainerStart();
if($user->isAdmin()) {
if(SeedDMS_Core_DMS::checkIfEqual($workflow->getInitState(), $latestContent->getWorkflowState())) {
@ -845,15 +847,14 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
if($parentworkflow = $latestContent->getParentWorkflow()) {
echo "<p>Sub workflow of '".$parentworkflow->getName()."'</p>";
}
echo "<div class=\"row-fluid\">";
echo "<div class=\"span8\">";
echo "<h5>".getMLText('current_state').": ".$workflowstate->getName()."</h5>";
echo "<table class=\"table table-condensed\">\n";
echo "<tr>";
echo "<td>".getMLText('next_state').":</td>";
foreach($transitions as $transition) {
$nextstate = $transition->getNextState();
echo "<td>".$nextstate->getName()."</td>";
$docstatus = $nextstate->getDocumentStatus();
echo "<td><i class=\"icon-circle".($docstatus == S_RELEASED ? " released" : ($docstatus == S_REJECTED ? " rejected" : " in-workflow"))."\"></i> ".$nextstate->getName()."</td>";
}
echo "</tr>";
echo "<tr>";
@ -922,11 +923,13 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
echo "</tr>";
echo "<tr>";
echo "<td></td>";
$allowedtransitions = array();
foreach($transitions as $transition) {
echo "<td>";
if($latestContent->triggerWorkflowTransitionIsAllowed($user, $transition)) {
$action = $transition->getAction();
print "<form action=\"../out/out.TriggerWorkflow.php\" method=\"post\">".createHiddenFieldWithKey('triggerworkflow')."<input type=\"hidden\" name=\"documentid\" value=\"".$documentid."\" /><input type=\"hidden\" name=\"version\" value=\"".$latestContent->getVersion()."\" /><input type=\"hidden\" name=\"transition\" value=\"".$transition->getID()."\" /><input type=\"submit\" class=\"btn\" value=\"".getMLText('action_'.strtolower($action->getName()), array(), $action->getName())."\" /></form>";
$allowedtransitions[] = $transition;
}
echo "</td>";
}
@ -1002,9 +1005,14 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
}
}
}
echo "</div>";
echo "</div>";
$this->contentContainerEnd();
echo "</div>";
echo "<div class=\"span6\">";
?>
<iframe src="out.WorkflowGraph.php?workflow=<?php echo $workflow->getID(); ?><?php if($allowedtransitions) foreach($allowedtransitions as $tr) {echo "&transitions[]=".$tr->getID();} ?>" width="99%" height="661" style="border: 1px solid #AAA;"></iframe>
<?php
echo "</div>";
echo "</div>";
?>
</div>
<?php

View File

@ -33,6 +33,7 @@ class SeedDMS_View_WorkflowGraph extends SeedDMS_Bootstrap_Style {
function js() { /* {{{ */
$this->workflow = $this->params['workflow'];
$this->curtransitions = $this->params['transitions'];
header('Content-Type: application/javascript; charset=UTF-8');
$renderdata = $this->workflow->getLayoutData();
@ -78,6 +79,20 @@ var cy = cytoscape({
}
},
{
selector: 'node.current',
style: {
'font-weight': 'bold',
}
},
{
selector: 'node.light',
style: {
'opacity': '0.3',
}
},
{
selector: 'node.init',
style: {
@ -118,7 +133,15 @@ var cy = cytoscape({
'target-arrow-color': '#9dbaea',
'curve-style': 'bezier'
}
}]
},
{
selector: 'edge.light',
style: {
'opacity': '0.3',
}
}
]
});
cy.gridGuide({
@ -215,20 +238,13 @@ $(document).ready(function() {
$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;
}
}
}
$iscurtransition = false;
if($this->curtransitions) {
foreach($this->curtransitions as $tr)
if($transition->getID() == $tr->getID())
$iscurtransition = true;
}
$this->actions[$action->getID()] = $action->getID();
$transusers = $transition->getUsers();
$unames = array();
@ -247,7 +263,7 @@ $(document).ready(function() {
name: \"".str_replace('"', "\\\"", $action->getName())/*.($unames ? "\\n(".str_replace('"', "\\\"", implode(", ", $unames)).")" : '').($gnames ? "\\n(".str_replace('"', "\\\"", implode(", ", $gnames)).")" : '')*/."\"
},".(isset($positions[$nodeid]) ? "
position: {x: ".$positions[$nodeid]->x.", y: ".$positions[$nodeid]->y."}," : "")."
classes: 'action',
classes: 'action".($iscurtransition ? " current" : ($this->curtransitions ? " light" : ""))."',
scratch: {
app: {groups: \"".str_replace('"', "\\\"", implode(", ", $gnames))."\", users: \"".str_replace('"', "\\\"", implode(", ", $unames))."\"}
}
@ -290,21 +306,29 @@ $(document).ready(function() {
$state = $transition->getState();
$nextstate = $transition->getNextState();
$action = $transition->getAction();
$iscurtransition = $this->curtransition && $transition->getID() == $this->curtransition->getID();
$iscurtransition = false;
if($this->curtransitions) {
foreach($this->curtransitions as $tr)
if($transition->getID() == $tr->getID())
$iscurtransition = true;
}
echo "cy.add({
data: {
id: 'E1-".$transition->getID()."',
source: 'S".$state->getID()."',
target: 'A".$transition->getID()."-".$action->getID()."'
}
},
classes: '".($iscurtransition ? " current" : ($this->curtransitions ? " light" : ""))."',
});\n";
echo "cy.add({
data: {
id: 'E2-".$transition->getID()."',
source: 'A".$transition->getID()."-".$action->getID()."',
target: 'S".$nextstate->getID()."'
}
},
classes: '".($iscurtransition ? " current" : ($this->curtransitions ? " light" : ""))."',
});\n";
$this->seentrans[] = $transition->getID();
}
@ -318,7 +342,6 @@ $(document).ready(function() {
$dms = $this->params['dms'];
$user = $this->params['user'];
$this->workflow = $this->params['workflow'];
$this->curtransition = $this->params['transition'];
$document = $this->params['document'];
if($document) {
@ -358,9 +381,9 @@ div.buttons #zoom {margin: 3px; _float: right;}
<i class="icon-sign-blank workflow-action"></i> <?php echo printMLText('global_workflow_actions'); ?>
</div>
<div class="buttons">
<div id="zoom"><button class="btn btn-mini btn-default">kkk</button></div>
<div id="zoom"><button class="btn btn-mini btn-default">Zoom</button></div>
<button class="btn btn-mini" id="savelayout">Save layout</button>
<button class="btn btn-mini" id="setlayout" data-layout="cose">Redraw</button>
<button class="btn btn-mini" id="setlayout" data-layout="cose"><?php printMLText('redraw'); ?></button>
</div>
</div>
<?php

View File

@ -288,6 +288,7 @@ $(document).ready(function() {
function form() { /* {{{ */
$selworkflow = $this->params['selworkflow'];
if($selworkflow)
$this->showWorkflowForm($selworkflow);
} /* }}} */