mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-03-12 08:55:54 +00:00
highlight currently possible transitions
if current transitions is passed to view
This commit is contained in:
parent
0548507829
commit
9312b83599
|
@ -33,6 +33,7 @@ class SeedDMS_View_WorkflowGraph extends SeedDMS_Bootstrap_Style {
|
||||||
|
|
||||||
function js() { /* {{{ */
|
function js() { /* {{{ */
|
||||||
$this->workflow = $this->params['workflow'];
|
$this->workflow = $this->params['workflow'];
|
||||||
|
$this->curtransitions = $this->params['transitions'];
|
||||||
header('Content-Type: application/javascript; charset=UTF-8');
|
header('Content-Type: application/javascript; charset=UTF-8');
|
||||||
|
|
||||||
$renderdata = '';
|
$renderdata = '';
|
||||||
|
@ -69,6 +70,20 @@ var cy = cytoscape({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
selector: 'node.current',
|
||||||
|
style: {
|
||||||
|
'font-weight': 'bold',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
selector: 'node.light',
|
||||||
|
style: {
|
||||||
|
'opacity': '0.3',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
selector: 'node.init',
|
selector: 'node.init',
|
||||||
style: {
|
style: {
|
||||||
|
@ -107,8 +122,15 @@ var cy = cytoscape({
|
||||||
'target-arrow-color': '#9dbaea',
|
'target-arrow-color': '#9dbaea',
|
||||||
'curve-style': 'bezier'
|
'curve-style': 'bezier'
|
||||||
}
|
}
|
||||||
}]
|
},
|
||||||
<?php if($renderdata) echo ",".$renderdata; ?>
|
|
||||||
|
{
|
||||||
|
selector: 'edge.light',
|
||||||
|
style: {
|
||||||
|
'opacity': '0.3',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
cy.gridGuide({
|
cy.gridGuide({
|
||||||
|
@ -143,10 +165,9 @@ cy.on('zoom', function(evt) {
|
||||||
});
|
});
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if(!$renderdata)
|
$this->printGraph();
|
||||||
$this->printGraph();
|
|
||||||
?>
|
?>
|
||||||
cy.layout({ name: '<?php echo $renderdata ? 'preset' : 'cose'; ?>', ready: function() {$('#png').attr('src', cy.png({'full': true}))} });
|
cy.layout({ name: 'cose', ready: function() {$('#png').attr('src', cy.png({'full': true}))} });
|
||||||
cy.maxZoom(2.5);
|
cy.maxZoom(2.5);
|
||||||
cy.minZoom(0.4);
|
cy.minZoom(0.4);
|
||||||
|
|
||||||
|
@ -178,20 +199,13 @@ $(document).ready(function() {
|
||||||
$nextstate = $transition->getNextState();
|
$nextstate = $transition->getNextState();
|
||||||
|
|
||||||
if(1 || !isset($this->actions[$action->getID()])) {
|
if(1 || !isset($this->actions[$action->getID()])) {
|
||||||
$color = "#4B4";
|
$iscurtransition = false;
|
||||||
$iscurtransition = $this->curtransition && $transition->getID() == $this->curtransition->getID();
|
if($this->curtransitions) {
|
||||||
if($iscurtransition) {
|
foreach($this->curtransitions as $tr)
|
||||||
$color = "#D00";
|
if($transition->getID() == $tr->getID())
|
||||||
} else {
|
$iscurtransition = true;
|
||||||
if($this->wkflog) {
|
|
||||||
foreach($this->wkflog as $entry) {
|
|
||||||
if($entry->getTransition()->getID() == $transition->getID()) {
|
|
||||||
$color = "#DDD";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->actions[$action->getID()] = $action->getID();
|
$this->actions[$action->getID()] = $action->getID();
|
||||||
$transusers = $transition->getUsers();
|
$transusers = $transition->getUsers();
|
||||||
$unames = array();
|
$unames = array();
|
||||||
|
@ -208,7 +222,7 @@ $(document).ready(function() {
|
||||||
id: 'A".$transition->getID()."-".$action->getID()."',
|
id: 'A".$transition->getID()."-".$action->getID()."',
|
||||||
name: \"".str_replace('"', "\\\"", $action->getName())/*.($unames ? "\\n(".str_replace('"', "\\\"", implode(", ", $unames)).")" : '').($gnames ? "\\n(".str_replace('"', "\\\"", implode(", ", $gnames)).")" : '')*/."\"
|
name: \"".str_replace('"', "\\\"", $action->getName())/*.($unames ? "\\n(".str_replace('"', "\\\"", implode(", ", $unames)).")" : '').($gnames ? "\\n(".str_replace('"', "\\\"", implode(", ", $gnames)).")" : '')*/."\"
|
||||||
},
|
},
|
||||||
classes: 'action',
|
classes: 'action".($iscurtransition ? " current" : ($this->curtransitions ? " light" : ""))."',
|
||||||
scratch: {
|
scratch: {
|
||||||
app: {groups: \"".str_replace('"', "\\\"", implode(", ", $gnames))."\", users: \"".str_replace('"', "\\\"", implode(", ", $unames))."\"}
|
app: {groups: \"".str_replace('"', "\\\"", implode(", ", $gnames))."\", users: \"".str_replace('"', "\\\"", implode(", ", $unames))."\"}
|
||||||
}
|
}
|
||||||
|
@ -247,21 +261,29 @@ $(document).ready(function() {
|
||||||
$state = $transition->getState();
|
$state = $transition->getState();
|
||||||
$nextstate = $transition->getNextState();
|
$nextstate = $transition->getNextState();
|
||||||
$action = $transition->getAction();
|
$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({
|
echo "cy.add({
|
||||||
data: {
|
data: {
|
||||||
id: 'E1-".$transition->getID()."',
|
id: 'E1-".$transition->getID()."',
|
||||||
source: 'S".$state->getID()."',
|
source: 'S".$state->getID()."',
|
||||||
target: 'A".$transition->getID()."-".$action->getID()."'
|
target: 'A".$transition->getID()."-".$action->getID()."'
|
||||||
}
|
},
|
||||||
|
classes: '".($iscurtransition ? " current" : ($this->curtransitions ? " light" : ""))."',
|
||||||
});\n";
|
});\n";
|
||||||
echo "cy.add({
|
echo "cy.add({
|
||||||
data: {
|
data: {
|
||||||
id: 'E2-".$transition->getID()."',
|
id: 'E2-".$transition->getID()."',
|
||||||
source: 'A".$transition->getID()."-".$action->getID()."',
|
source: 'A".$transition->getID()."-".$action->getID()."',
|
||||||
target: 'S".$nextstate->getID()."'
|
target: 'S".$nextstate->getID()."'
|
||||||
}
|
},
|
||||||
|
classes: '".($iscurtransition ? " current" : ($this->curtransitions ? " light" : ""))."',
|
||||||
});\n";
|
});\n";
|
||||||
$this->seentrans[] = $transition->getID();
|
$this->seentrans[] = $transition->getID();
|
||||||
}
|
}
|
||||||
|
@ -275,7 +297,6 @@ $(document).ready(function() {
|
||||||
$dms = $this->params['dms'];
|
$dms = $this->params['dms'];
|
||||||
$user = $this->params['user'];
|
$user = $this->params['user'];
|
||||||
$this->workflow = $this->params['workflow'];
|
$this->workflow = $this->params['workflow'];
|
||||||
$this->curtransition = $this->params['transition'];
|
|
||||||
$document = $this->params['document'];
|
$document = $this->params['document'];
|
||||||
|
|
||||||
if($document) {
|
if($document) {
|
||||||
|
@ -315,8 +336,8 @@ div.buttons #zoom {margin: 3px; _float: right;}
|
||||||
<i class="icon-sign-blank workflow-action"></i> <?php echo printMLText('global_workflow_actions'); ?>
|
<i class="icon-sign-blank workflow-action"></i> <?php echo printMLText('global_workflow_actions'); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="buttons">
|
<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="setlayout" data-layout="cose">Redraw</button>
|
<button class="btn btn-mini" id="setlayout" data-layout="cose"><?php printMLText('redraw'); ?></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
|
|
Loading…
Reference in New Issue
Block a user