mirror of
https://github.com/sartography/bpmn-js.git
synced 2025-02-17 03:16:32 +00:00
feat(app): allow opening files from web server.
With URL param 'bpmndoc' a filename of a document can be specified that will be loaded from the server and then rendered.
This commit is contained in:
parent
90e0d458b3
commit
46d60f9d64
@ -110,6 +110,33 @@
|
|||||||
createNewDiagram();
|
createNewDiagram();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//Special debug modus to open a file from web servers root.
|
||||||
|
(function loadFromServer() {
|
||||||
|
var bpmnDoc = getQueryVariable('bpmndoc');
|
||||||
|
|
||||||
|
if(bpmnDoc) {
|
||||||
|
var client = new XMLHttpRequest();
|
||||||
|
client.open('GET', bpmnDoc);
|
||||||
|
client.onreadystatechange = function () {
|
||||||
|
console.log('Opening: ' + bpmnDoc);
|
||||||
|
openDiagram(client.responseText);
|
||||||
|
}
|
||||||
|
client.send();
|
||||||
|
}
|
||||||
|
|
||||||
|
function getQueryVariable(variable) {
|
||||||
|
var query = window.location.search.substring(1);
|
||||||
|
var vars = query.split("&");
|
||||||
|
for (var i = 0; i < vars.length; i++) {
|
||||||
|
var pair = vars[i].split("=");
|
||||||
|
if (pair[0] === variable) {
|
||||||
|
return pair[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(false);
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
var downloadLink = $('#js-download-diagram');
|
var downloadLink = $('#js-download-diagram');
|
||||||
var downloadSvgLink = $('#js-download-svg');
|
var downloadSvgLink = $('#js-download-svg');
|
||||||
|
|
||||||
|
3680
example/complex.bpmn
Normal file
3680
example/complex.bpmn
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user