UNPKG

mida

Version:

Muiltiple Instance and Data Animator for BPMN models.

140 lines (128 loc) 5.47 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <link rel="stylesheet" href="./css/properties.css" /> <link rel="stylesheet" href="./css/normalize.css" /> <link rel="stylesheet" href="./css/diagram-js.css" /> <link rel="stylesheet" href="./css/bpmn-embedded.css" /> <link rel="stylesheet" href="./css/navbar.css" /> <link rel="icon" type="image/png" href="./resources/favicon.ico"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"/> <title>MIDA - Modeler</title> <script type="text/javascript"> function change_visibility(el) { var x = document.getElementById(el); if (x.style.display === "none") { x.style.display = "block"; } else { x.style.display = "none"; } } function exportDiagram() { saveSvg() modeler.saveXML({ format : true }, function(err, xml) { if (err) { return console.error('could not save BPMN 2.0 diagram', err); } var file = new Blob([ xml ], { type : "bpmn" }); if (window.navigator.msSaveOrOpenBlob) // IE10+ window.navigator.msSaveOrOpenBlob(file, "NewDiagram.bpmn"); else { // Others var a = document.createElement("a"), url = URL .createObjectURL(file); a.href = url; a.download = "NewDiagram.bpmn"; document.body.appendChild(a); a.click(); setTimeout(function() { document.body.removeChild(a); window.URL.revokeObjectURL(url); }, 0); } }); } function saveSvg(){ modeler.saveSVG(function(err, svg) { if (err) { return console.error('could not save BPMN 2.0 diagram', err); } var file = new Blob([ svg ], { type : "svg" }); if (window.navigator.msSaveOrOpenBlob) // IE10+ window.navigator.msSaveOrOpenBlob(file, "NewDiagram.svg"); else { // Others var a = document.createElement("a"), url = URL .createObjectURL(file); a.href = url; a.download = "NewDiagram.svg"; document.body.appendChild(a); a.click(); setTimeout(function() { document.body.removeChild(a); window.URL.revokeObjectURL(url); }, 0); } }); } function loadDiagram(xml) { var file = xml[0]; if (file) { var reader = new FileReader(); reader.readAsText(file, "UTF-8"); reader.onload = function (evt) { var bpmnXML = evt.target.result; modeler.importXML(bpmnXML, function(err) { if (err) { return console.error('could not import BPMN 2.0 diagram', err); } // access modeler components var canvas = modeler.get('canvas'); var overlays = modeler.get('overlays'); // zoom to fit full viewport canvas.zoom('fit-viewport'); }); } reader.onerror = function (evt) { document.getElementById("fileContents").innerHTML = "error reading file"; } } } function myFunction() { var x = document.getElementById("myTopnav"); if (x.className === "topnav") { x.className += " responsive"; } else { x.className = "topnav"; } } </script> <style> </style> </head> <body> <div id="nav-bar" class="topnav" id="myTopnav"> <a href="index.html" class="active" style="padding: 4px 4px 4px 4px;"><img src="./resources/midaLogo.png" alt="Mida Web Client" style="height:42px"></img></a> <a href="#" id="animation-button" ></a> <a style="float:right" href="#" name="show/hide" id="show/hide" onclick="change_visibility('js-properties-panel');"><i class="fa fa-columns"></i> Property Panel</a> <a style="float:right" href="#" name="data-panel-button" id="data-panel-button" onclick="change_visibility('data-perspective');"><i class="fa fa-database"></i> Data Panel</a> <a style="float:right" href="#" id="save" onclick="exportDiagram();"><i class="fa fa-download"></i> Save</a> <a style="float:right; padding: 11px 16px 10px 0px;" href="#" id="load"><i class="fa fa-upload"></i> <input type="file" accept=".bpmn" name="newDiagram" id="newDiagram" multiple="false" onchange="loadDiagram(this.files)" style="margin-right: -50px; position: relative; color: #bca100;"></a> <a style="float:right" href="javascript:void(0);" style="font-size:15px;" class="icon" onclick="myFunction()">&#9776;</a> <a style="float:right; display:none;" href="#" id="animation-palette"></a> <a style="float:right; display:none" href="#" id="speed-palette"></a> </div> <div id="canvas"></div> <div style="display: none" class="properties-panel-parent" id="js-properties-panel"></div> <div style="display: none" class="data-perspective" id="data-perspective"></div> <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script> <script src="./modeler.bundle.js"></script> </body> </html>