diff --git a/views/bootstrap/class.WorkflowGraph.php b/views/bootstrap/class.WorkflowGraph.php index 974e55bea..8000e0cad 100644 --- a/views/bootstrap/class.WorkflowGraph.php +++ b/views/bootstrap/class.WorkflowGraph.php @@ -96,6 +96,8 @@ var cy = cytoscape({ { selector: 'edge', style: { + 'content': 'data(name)', + 'text-wrap': 'wrap', 'width': 4, 'curve-style': 'bezier', 'target-arrow-shape': 'triangle', @@ -109,6 +111,30 @@ var cy = cytoscape({ ); +function save_handler(evt) { +// console.log(JSON.stringify(cy.json().elements)); + $.ajax('../op/op.WorkflowMgr.php', { + type:"POST", + async:true, + dataType:"json", + data: { + action: 'setrenderdata', + workflowid: workflow->getID(); ?>, + data: JSON.stringify(cy.json().elements) + }, + success: function(data, textStatus) { + noty({ + text: data.message, + type: data.success ? 'success' : 'error', + dismissQueue: true, + layout: 'topRight', + theme: 'defaultTheme', + timeout: 1500, + }); + } + }); +}; + cy.on('free', 'node', function(evt) { $('#png').attr('src', cy.png({'full': true})); }); @@ -116,8 +142,20 @@ cy.on('free', 'node', function(evt) { if(!$renderdata) $this->printGraph(); ?> - cy.layout({ name: '', condense: true }); -$('#png').attr('src', cy.png({'full': true})); + cy.layout({ name: '', condense: true, ready: function() {$('#png').attr('src', cy.png({'full': true}))} }); +// $('#png').attr('src', cy.png({'full': true})); + +$(document).ready(function() { + $('body').on('click', '#savelayout', function(ev){ + ev.preventDefault(); + save_handler(); + }); + $('body').on('click', '#setlayout', function(ev){ + ev.preventDefault(); + var element = $(this); + cy.layout({name: element.data('layout'), ready: function() {$('#png').attr('src', cy.png({'full': true}))}}); + }); +}); htmlAddHeader(' ', 'css'); $this->htmlStartPage(getMLText("admin_tools")); @@ -252,6 +292,10 @@ body {padding: 0px;} ?>
+ contentContainerEnd(); if(method_exists($this, 'js'))