diff --git a/ChangeLog b/ChangeLog index f5ed058e..bd205b1b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +30-JAN-2017: 6.0.2.16 + +- Adds CSV import plugin + 29-JAN-2017: 6.0.2.15 - Uses mxGraph 3.7.0.1 diff --git a/VERSION b/VERSION index 2e9dd777..12941cb5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -6.0.2.15 \ No newline at end of file +6.0.2.16 \ No newline at end of file diff --git a/war/cache.manifest b/war/cache.manifest index 40e6e576..2dc17266 100644 --- a/war/cache.manifest +++ b/war/cache.manifest @@ -1,7 +1,7 @@ CACHE MANIFEST # THIS FILE WAS GENERATED. DO NOT MODIFY! -# 01/29/2017 10:16 AM +# 01/30/2017 04:08 PM /app.html /index.html?offline=1 diff --git a/war/js/app.min.js b/war/js/app.min.js index 91c02bb7..5bfeb3ea 100644 --- a/war/js/app.min.js +++ b/war/js/app.min.js @@ -3083,25 +3083,25 @@ var FilenameDialog=function(a,c,f,d,b,e,g,k,l){l=null!=l?l:!0;var n,m,p=document d(t.value)});q.className="geBtn gePrimaryBtn";this.init=function(){if(!(null==b&&null!=g)&&(t.focus(),mxClient.IS_FF||5<=document.documentMode||mxClient.IS_QUIRKS?t.select():document.execCommand("selectAll",!1,null),Graph.fileSupport)){var a=p.parentNode,d=null;mxEvent.addListener(a,"dragleave",function(b){null!=d&&(d.style.backgroundColor="",d=null);b.stopPropagation();b.preventDefault()});mxEvent.addListener(a,"dragover",mxUtils.bind(this,function(b){if(null==d&&(!mxClient.IS_IE||10MAX_AREA||0>=t.value?"red":"";q.style.backgroundColor=t.value*q.value>MAX_AREA||0>=q.value?"red":""}var d=a.editor.graph,b=d.getGraphBounds(),e=d.view.scale,g=Math.ceil(b.width/e),k= -Math.ceil(b.height/e),l,e=document.createElement("table"),n=document.createElement("tbody");e.setAttribute("cellpadding",mxClient.IS_SF?"0":"2");b=document.createElement("tr");l=document.createElement("td");l.style.fontSize="10pt";l.style.width="100px";mxUtils.write(l,mxResources.get("filename")+":");b.appendChild(l);var m=document.createElement("input");m.setAttribute("value",a.editor.getOrCreateFilename());m.style.width="180px";l=document.createElement("td");l.appendChild(m);b.appendChild(l);n.appendChild(b); -b=document.createElement("tr");l=document.createElement("td");l.style.fontSize="10pt";mxUtils.write(l,mxResources.get("format")+":");b.appendChild(l);var p=document.createElement("select");p.style.width="180px";l=document.createElement("option");l.setAttribute("value","png");mxUtils.write(l,mxResources.get("formatPng"));p.appendChild(l);l=document.createElement("option");ExportDialog.showGifOption&&(l.setAttribute("value","gif"),mxUtils.write(l,mxResources.get("formatGif")),p.appendChild(l));l=document.createElement("option"); -l.setAttribute("value","jpg");mxUtils.write(l,mxResources.get("formatJpg"));p.appendChild(l);l=document.createElement("option");l.setAttribute("value","pdf");mxUtils.write(l,mxResources.get("formatPdf"));p.appendChild(l);l=document.createElement("option");l.setAttribute("value","svg");mxUtils.write(l,mxResources.get("formatSvg"));p.appendChild(l);ExportDialog.showXmlOption&&(l=document.createElement("option"),l.setAttribute("value","xml"),mxUtils.write(l,mxResources.get("formatXml")),p.appendChild(l)); -l=document.createElement("td");l.appendChild(p);b.appendChild(l);n.appendChild(b);b=document.createElement("tr");l=document.createElement("td");l.style.fontSize="10pt";mxUtils.write(l,mxResources.get("zoom")+" (%):");b.appendChild(l);var s=document.createElement("input");s.setAttribute("type","number");s.setAttribute("value","100");s.style.width="180px";l=document.createElement("td");l.appendChild(s);b.appendChild(l);n.appendChild(b);b=document.createElement("tr");l=document.createElement("td");l.style.fontSize= -"10pt";mxUtils.write(l,mxResources.get("width")+":");b.appendChild(l);var t=document.createElement("input");t.setAttribute("value",g);t.style.width="180px";l=document.createElement("td");l.appendChild(t);b.appendChild(l);n.appendChild(b);b=document.createElement("tr");l=document.createElement("td");l.style.fontSize="10pt";mxUtils.write(l,mxResources.get("height")+":");b.appendChild(l);var q=document.createElement("input");q.setAttribute("value",k);q.style.width="180px";l=document.createElement("td"); -l.appendChild(q);b.appendChild(l);n.appendChild(b);b=document.createElement("tr");l=document.createElement("td");l.style.fontSize="10pt";mxUtils.write(l,mxResources.get("background")+":");b.appendChild(l);var v=document.createElement("input");v.setAttribute("type","checkbox");v.checked=null==d.background||d.background==mxConstants.NONE;l=document.createElement("td");l.appendChild(v);mxUtils.write(l,mxResources.get("transparent"));b.appendChild(l);n.appendChild(b);b=document.createElement("tr");l= -document.createElement("td");l.style.fontSize="10pt";mxUtils.write(l,mxResources.get("borderWidth")+":");b.appendChild(l);var u=document.createElement("input");u.setAttribute("type","number");u.setAttribute("value","0");u.style.width="180px";l=document.createElement("td");l.appendChild(u);b.appendChild(l);n.appendChild(b);e.appendChild(n);mxEvent.addListener(p,"change",c);c();mxEvent.addListener(s,"change",function(){var b=Math.max(0,parseFloat(s.value)||100)/100;s.value=parseFloat((100*b).toFixed(2)); -0=parseInt(s.value))mxUtils.alert(mxResources.get("drawingEmpty"));else{var b=m.value,c=p.value,e=Math.max(0,parseFloat(s.value)||100)/100,f=Math.max(0,parseInt(u.value)),g=d.background;if(("svg"==c||"png"==c)&&v.checked)g=null;else if(null==g||g==mxConstants.NONE)g="#ffffff";ExportDialog.exportFile(a,b,c,g,e,f)}}));x.className="geBtn gePrimaryBtn"; -var A=mxUtils.button(mxResources.get("cancel"),function(){a.hideDialog()});A.className="geBtn";a.editor.cancelFirst?(l.appendChild(A),l.appendChild(x)):(l.appendChild(x),l.appendChild(A));b.appendChild(l);n.appendChild(b);e.appendChild(n);this.container=e};ExportDialog.showGifOption=!0;ExportDialog.showXmlOption=!0; +mxEvent.addListener(t,"keypress",function(b){13==b.keyCode&&q.click()});m.appendChild(q);a.editor.cancelFirst||m.appendChild(c);n.appendChild(m);s.appendChild(n);p.appendChild(s);this.container=p},TextareaDialog=function(a,c,f,d,b,e,g,k,l,n,m){g=null!=g?g:300;k=null!=k?k:120;n=null!=n?n:!1;var p,s,t=document.createElement("table"),q=document.createElement("tbody");p=document.createElement("tr");s=document.createElement("td");s.style.fontSize="10pt";s.style.width="100px";mxUtils.write(s,c);p.appendChild(s); +q.appendChild(p);p=document.createElement("tr");s=document.createElement("td");var v=document.createElement("textarea");m&&v.setAttribute("wrap","off");mxUtils.write(v,f||"");v.style.resize="none";v.style.width=g+"px";v.style.height=k+"px";this.textarea=v;this.init=function(){v.focus();v.scrollTop=0};s.appendChild(v);p.appendChild(s);q.appendChild(p);p=document.createElement("tr");s=document.createElement("td");s.style.paddingTop="14px";s.style.whiteSpace="nowrap";s.setAttribute("align","right"); +c=mxUtils.button(e||mxResources.get("cancel"),function(){a.hideDialog();null!=b&&b()});c.className="geBtn";a.editor.cancelFirst&&s.appendChild(c);null!=l&&l(s);null!=d&&(l=mxUtils.button(mxResources.get("apply"),function(){n||a.hideDialog();d(v.value)}),l.className="geBtn gePrimaryBtn",s.appendChild(l));a.editor.cancelFirst||s.appendChild(c);p.appendChild(s);q.appendChild(p);t.appendChild(q);this.container=t},EditDiagramDialog=function(a){var c=document.createElement("div");c.style.textAlign="right"; +var f=document.createElement("textarea");f.setAttribute("wrap","off");f.style.overflow="auto";f.style.resize="none";f.style.width="600px";f.style.height="370px";f.style.marginBottom="16px";f.value=mxUtils.getPrettyXml(a.editor.getGraphXml());c.appendChild(f);this.init=function(){f.focus()};Graph.fileSupport&&(f.addEventListener("dragover",function(b){b.stopPropagation();b.preventDefault()},!1),f.addEventListener("drop",function(b){b.stopPropagation();b.preventDefault();if(0MAX_AREA||0>=t.value?"red":"";q.style.backgroundColor=t.value*q.value>MAX_AREA||0>=q.value?"red":""}var d=a.editor.graph,b= +d.getGraphBounds(),e=d.view.scale,g=Math.ceil(b.width/e),k=Math.ceil(b.height/e),l,e=document.createElement("table"),n=document.createElement("tbody");e.setAttribute("cellpadding",mxClient.IS_SF?"0":"2");b=document.createElement("tr");l=document.createElement("td");l.style.fontSize="10pt";l.style.width="100px";mxUtils.write(l,mxResources.get("filename")+":");b.appendChild(l);var m=document.createElement("input");m.setAttribute("value",a.editor.getOrCreateFilename());m.style.width="180px";l=document.createElement("td"); +l.appendChild(m);b.appendChild(l);n.appendChild(b);b=document.createElement("tr");l=document.createElement("td");l.style.fontSize="10pt";mxUtils.write(l,mxResources.get("format")+":");b.appendChild(l);var p=document.createElement("select");p.style.width="180px";l=document.createElement("option");l.setAttribute("value","png");mxUtils.write(l,mxResources.get("formatPng"));p.appendChild(l);l=document.createElement("option");ExportDialog.showGifOption&&(l.setAttribute("value","gif"),mxUtils.write(l,mxResources.get("formatGif")), +p.appendChild(l));l=document.createElement("option");l.setAttribute("value","jpg");mxUtils.write(l,mxResources.get("formatJpg"));p.appendChild(l);l=document.createElement("option");l.setAttribute("value","pdf");mxUtils.write(l,mxResources.get("formatPdf"));p.appendChild(l);l=document.createElement("option");l.setAttribute("value","svg");mxUtils.write(l,mxResources.get("formatSvg"));p.appendChild(l);ExportDialog.showXmlOption&&(l=document.createElement("option"),l.setAttribute("value","xml"),mxUtils.write(l, +mxResources.get("formatXml")),p.appendChild(l));l=document.createElement("td");l.appendChild(p);b.appendChild(l);n.appendChild(b);b=document.createElement("tr");l=document.createElement("td");l.style.fontSize="10pt";mxUtils.write(l,mxResources.get("zoom")+" (%):");b.appendChild(l);var s=document.createElement("input");s.setAttribute("type","number");s.setAttribute("value","100");s.style.width="180px";l=document.createElement("td");l.appendChild(s);b.appendChild(l);n.appendChild(b);b=document.createElement("tr"); +l=document.createElement("td");l.style.fontSize="10pt";mxUtils.write(l,mxResources.get("width")+":");b.appendChild(l);var t=document.createElement("input");t.setAttribute("value",g);t.style.width="180px";l=document.createElement("td");l.appendChild(t);b.appendChild(l);n.appendChild(b);b=document.createElement("tr");l=document.createElement("td");l.style.fontSize="10pt";mxUtils.write(l,mxResources.get("height")+":");b.appendChild(l);var q=document.createElement("input");q.setAttribute("value",k);q.style.width= +"180px";l=document.createElement("td");l.appendChild(q);b.appendChild(l);n.appendChild(b);b=document.createElement("tr");l=document.createElement("td");l.style.fontSize="10pt";mxUtils.write(l,mxResources.get("background")+":");b.appendChild(l);var v=document.createElement("input");v.setAttribute("type","checkbox");v.checked=null==d.background||d.background==mxConstants.NONE;l=document.createElement("td");l.appendChild(v);mxUtils.write(l,mxResources.get("transparent"));b.appendChild(l);n.appendChild(b); +b=document.createElement("tr");l=document.createElement("td");l.style.fontSize="10pt";mxUtils.write(l,mxResources.get("borderWidth")+":");b.appendChild(l);var u=document.createElement("input");u.setAttribute("type","number");u.setAttribute("value","0");u.style.width="180px";l=document.createElement("td");l.appendChild(u);b.appendChild(l);n.appendChild(b);e.appendChild(n);mxEvent.addListener(p,"change",c);c();mxEvent.addListener(s,"change",function(){var b=Math.max(0,parseFloat(s.value)||100)/100; +s.value=parseFloat((100*b).toFixed(2));0=parseInt(s.value))mxUtils.alert(mxResources.get("drawingEmpty"));else{var b=m.value,c=p.value,e=Math.max(0,parseFloat(s.value)||100)/100,f=Math.max(0,parseInt(u.value)),g=d.background;if(("svg"==c||"png"==c)&&v.checked)g=null;else if(null==g||g==mxConstants.NONE)g="#ffffff";ExportDialog.exportFile(a,b,c,g,e,f)}}));x.className= +"geBtn gePrimaryBtn";var A=mxUtils.button(mxResources.get("cancel"),function(){a.hideDialog()});A.className="geBtn";a.editor.cancelFirst?(l.appendChild(A),l.appendChild(x)):(l.appendChild(x),l.appendChild(A));b.appendChild(l);n.appendChild(b);e.appendChild(n);this.container=e};ExportDialog.showGifOption=!0;ExportDialog.showXmlOption=!0; ExportDialog.exportFile=function(a,c,f,d,b,e){var g=a.editor.graph;if("xml"==f)ExportDialog.saveLocalFile(a,mxUtils.getXml(a.editor.getGraphXml()),c,f);else if("svg"==f)ExportDialog.saveLocalFile(a,mxUtils.getXml(g.getSvg(d,b,e)),c,f);else{var k=g.getGraphBounds(),l=mxUtils.createXmlDocument(),n=l.createElement("output");l.appendChild(n);l=new mxXmlCanvas2D(n);l.translate(Math.floor((e/b-k.x)/g.view.scale),Math.floor((e/b-k.y)/g.view.scale));l.scale(b/g.view.scale);(new mxImageExport).drawState(g.getView().getState(g.model.root), l);n="xml\x3d"+encodeURIComponent(mxUtils.getXml(n));l=Math.ceil(k.width*b/g.view.scale+2*e);b=Math.ceil(k.height*b/g.view.scale+2*e);n.length<=MAX_REQUEST_SIZE&&l*b=u.scrollHeight&&(a(),mxEvent.consume(b))});var c=null,d;for(d in y){var e=document.createElement("div"),f=mxResources.get(d), -k=y[d];null==f&&(f=d.substring(0,1).toUpperCase()+d.substring(1));18c.lastIndexOf(".")&&(!v||0>e)){b=null!=b?b:z.value; -var f="";b==App.MODE_GOOGLE?f=a.drive.extension:b==App.MODE_DROPBOX?f=a.dropbox.extension:b==App.MODE_ONEDRIVE?f=a.oneDrive.extension:b==App.MODE_DEVICE&&(f=".xml");0<=e&&(d=d.substring(0,e));x.value=d+f}}}function t(b){var c=x.value;if(null==b||null!=c&&0=u.scrollHeight&&(a(),mxEvent.consume(b))});var c=null,d;for(d in y){var e=document.createElement("div"),f=mxResources.get(d),k=y[d];null==f&&(f=d.substring(0,1).toUpperCase()+d.substring(1));18c.lastIndexOf(".")&&(!v||0>e)){b=null!=b?b:z.value;var f="";b==App.MODE_GOOGLE?f=a.drive.extension:b==App.MODE_DROPBOX?f=a.dropbox.extension:b==App.MODE_ONEDRIVE?f=a.oneDrive.extension:b==App.MODE_DEVICE&&(f=".xml");0<=e&&(d=d.substring(0,e));x.value= +d+f}}}function t(b){var c=x.value;if(null==b||null!=c&&0=d;)c.push(String.fromCharCode(a e+=1,4===e&&(a(c,e,g),c=e=0);return 0a;g=++a)c.push(909522486^b[g]);return c}(),l=function(){var a,c;c=[];for(g=a=0;16>a;g=++a)c.push(1549556828^b[g]);return c}(),f=d(k.concat(a),64+c),d(l.concat(f),84)},d=function(a,b){var c,d,e,f,g,k,l,m,n,p,q,u,v,s,t,x,z;a[b>>2]|=1<<31-((3&b)<<3);a[(b+8>> 6<<4)+15]=b<<3;t=Array(80);c=1732584193;e=4023233417;g=2562383102;l=271733878;n=3285377520;q=0;for(v=a.length;v>q;){d=c;f=e;k=g;m=l;p=n;for(u=z=0;80>z;u=++z)16>u?t[u]=0|a[q+u<<2>>2]:(s=(0|t[u-3<<2>>2])^(0|t[u-8<<2>>2])^(0|t[u-14<<2>>2])^(0|t[u-16<<2>>2]),t[u]=s<<1|s>>>31),x=((c<<5|c>>>27)+n|0)+t[u<<2>>2]|0,x=20>u?x+((e&g|~e&l)+1518500249|0)|0:40>u?x+((e^g^l)+1859775393|0)|0:60>u?x+((e&g|e&l|g&l)-1894007588)|0:x+((e^g^l)-899497514|0)|0,n=l,l=g,g=e<<30|e>>>2,e=c,c=x;c=d+c|0;e=f+e|0;g=k+g|0;l=m+l|0; -n=p+n|0;q=q+16|0}return[c,e,g,l,n]},e=function(a,b){var c,d,e,k,l,m,n,p,q,u,v,s,t,x,z,A,B,C,F,Y,ba,W,S,ha,da,$,fa,ja,ca,la;a[b>>2]|=1<<31-((3&b)<<3);a[(b+8>>6<<4)+15]=b<<3;ca=Array(80);c=f[0];e=f[1];l=f[2];p=f[3];u=f[4];s=f[5];x=f[6];Y=f[7];W=0;for(ha=a.length;ha>W;){d=c;k=e;m=l;q=p;v=u;t=s;z=x;ba=Y;for(S=la=0;64>la;S=++la)16>S?ja=ca[S]=0|a[W+S<<2>>2]:(B=0|ca[S-15<<2>>2],A=(B<<25|B>>>7)^(B<<14|B>>>18)^B>>>3,F=0|ca[S-2<<2>>2],C=(F<<15|F>>>17)^(F<<13|F>>>19)^F>>>10,ja=ca[S]=(A+(0|ca[S-7<<2>>2])|0)+ -(C+(0|ca[S-16<<2>>2])|0)|0),n=u&s^~u&x,da=c&e^c&l^e&l,$=(c<<30|c>>>2)^(c<<19|c>>>13)^(c<<10|c>>>22),fa=(u<<26|u>>>6)^(u<<21|u>>>11)^(u<<7|u>>>25),n=((Y+fa|0)+(n+ja|0)|0)+(0|g[S<<2>>2])|0,da=$+da|0,Y=x,x=s,s=u,u=p+n|0,p=l,l=e,e=c,c=n+da|0;c=d+c|0;e=k+e|0;l=m+l|0;p=q+p|0;u=v+u|0;s=t+s|0;x=z+x|0;Y=ba+Y|0;W+=16}return[c,e,l,p,u,s,x,Y]},f=[],g=[],function(){var a,b,c,d,e,k,l;b=function(a){return 4294967296*(a-Math.floor(a))|0};e=2;l=[];for(c=k=0;64>k;c=++k){for(;;){d=!0;for(a=2;e>=a*a;){if(0===e%a){d= +n=p+n|0;q=q+16|0}return[c,e,g,l,n]},e=function(a,b){var c,d,e,k,l,n,m,p,q,u,v,s,t,x,z,A,B,C,F,Y,ba,W,S,ha,da,$,fa,ja,ca,la;a[b>>2]|=1<<31-((3&b)<<3);a[(b+8>>6<<4)+15]=b<<3;ca=Array(80);c=f[0];e=f[1];l=f[2];p=f[3];u=f[4];s=f[5];x=f[6];Y=f[7];W=0;for(ha=a.length;ha>W;){d=c;k=e;n=l;q=p;v=u;t=s;z=x;ba=Y;for(S=la=0;64>la;S=++la)16>S?ja=ca[S]=0|a[W+S<<2>>2]:(B=0|ca[S-15<<2>>2],A=(B<<25|B>>>7)^(B<<14|B>>>18)^B>>>3,F=0|ca[S-2<<2>>2],C=(F<<15|F>>>17)^(F<<13|F>>>19)^F>>>10,ja=ca[S]=(A+(0|ca[S-7<<2>>2])|0)+ +(C+(0|ca[S-16<<2>>2])|0)|0),m=u&s^~u&x,da=c&e^c&l^e&l,$=(c<<30|c>>>2)^(c<<19|c>>>13)^(c<<10|c>>>22),fa=(u<<26|u>>>6)^(u<<21|u>>>11)^(u<<7|u>>>25),m=((Y+fa|0)+(m+ja|0)|0)+(0|g[S<<2>>2])|0,da=$+da|0,Y=x,x=s,s=u,u=p+m|0,p=l,l=e,e=c,c=m+da|0;c=d+c|0;e=k+e|0;l=n+l|0;p=q+p|0;u=v+u|0;s=t+s|0;x=z+x|0;Y=ba+Y|0;W+=16}return[c,e,l,p,u,s,x,Y]},f=[],g=[],function(){var a,b,c,d,e,k,l;b=function(a){return 4294967296*(a-Math.floor(a))|0};e=2;l=[];for(c=k=0;64>k;c=++k){for(;;){d=!0;for(a=2;e>=a*a;){if(0===e%a){d= !1;break}a+=1}if(d)break;e+=1}8>c&&(f[c]=b(Math.pow(e,0.5)));g[c]=b(Math.pow(e,1/3));l.push(e+=1)}return l}(),a=function(a){var b,c,d,e,f;e="";b=0;for(d=4*a.length;d>b;)c=b,f=(a[c>>2]>>(3-(3&c)<<3)&255)<<16,c+=1,f|=(a[c>>2]>>(3-(3&c)<<3)&255)<<8,c+=1,f|=a[c>>2]>>(3-(3&c)<<3)&255,e+=l[f>>18&63],e+=l[f>>12&63],b+=1,e+=b>=d?"\x3d":l[f>>6&63],b+=1,e+=b>=d?"\x3d":l[63&f],b+=1;return e},l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",k=function(a){var b,c,d,e;b=[];c=d=0;for(e=a.length;0<= e?e>d:d>e;c=0<=e?++d:--d)b[c>>2]|=(a.charCodeAt(c)&255)<<(3-(3&c)<<3);return b}}(),m.Util.Oauth=function(){function a(b){this._loaded=this._appHash=this._error=this._tokenKid=this._tokenKey=this._token=this._authCode=this._stateParam=this._secret=this._id=null;this.setCredentials(b)}return a.prototype.setCredentials=function(a){if(a.key)this._id=a.key;else{if(!a.token)throw Error("No API key supplied");this._id=null}return this._secret=a.secret||null,this._appHash=null,this._error=null,this._loaded= !0,this.reset(),a.token?(this._token=a.token,a.tokenKey&&(this._tokenKey=a.tokenKey,this._tokenKid=a.tokenKid)):a.oauthCode?this._authCode=a.oauthCode:a.oauthStateParam&&(this._stateParam=a.oauthStateParam),this},a.prototype.credentials=function(){var a;return a={},this._id&&(a.key=this._id),this._secret&&(a.secret=this._secret),null!==this._token?(a.token=this._token,this._tokenKey&&(a.tokenKey=this._tokenKey,a.tokenKid=this._tokenKid)):null!==this._authCode?a.oauthCode=this._authCode:null!==this._stateParam&& @@ -8126,7 +8125,7 @@ ChatWindow.prototype.htmlEscape=function(a){return a.replace(/&/g,"\x26amp;").re (new Image).src=mxGraph.prototype.warningImage.src;window.openWindow=mxUtils.bind(this,function(a,c,d){var f=window.open(a);null==f||void 0===f?this.showDialog((new PopupDialog(this,a,c,d)).container,320,140,!0,!0):null!=c&&c()});this.updateUi();a=document.createElement("canvas");this.canvasSupported=!(!a.getContext||!a.getContext("2d"));window.showOpenAlert=mxUtils.bind(this,function(a){null!=window.openFile&&window.openFile.cancel(!0);this.handleError(a)});this.isOffline()||(EditDataDialog.placeholderHelpLink= "https://support.draw.io/questions/9338941");ColorDialog.recentColors=mxSettings.getRecentColors(ColorDialog.recentColors);this.addFileDropHandler([document]);if(null!=App.DrawPlugins){for(a=0;aMAX_AREA||0>=t.value?"red":"";q.style.backgroundColor=t.value*q.value>MAX_AREA||0>=q.value?"red":""}var d=a.editor.graph,b=d.getGraphBounds(),e=d.view.scale,g=Math.ceil(b.width/e),k= -Math.ceil(b.height/e),l,e=document.createElement("table"),m=document.createElement("tbody");e.setAttribute("cellpadding",mxClient.IS_SF?"0":"2");b=document.createElement("tr");l=document.createElement("td");l.style.fontSize="10pt";l.style.width="100px";mxUtils.write(l,mxResources.get("filename")+":");b.appendChild(l);var n=document.createElement("input");n.setAttribute("value",a.editor.getOrCreateFilename());n.style.width="180px";l=document.createElement("td");l.appendChild(n);b.appendChild(l);m.appendChild(b); -b=document.createElement("tr");l=document.createElement("td");l.style.fontSize="10pt";mxUtils.write(l,mxResources.get("format")+":");b.appendChild(l);var p=document.createElement("select");p.style.width="180px";l=document.createElement("option");l.setAttribute("value","png");mxUtils.write(l,mxResources.get("formatPng"));p.appendChild(l);l=document.createElement("option");ExportDialog.showGifOption&&(l.setAttribute("value","gif"),mxUtils.write(l,mxResources.get("formatGif")),p.appendChild(l));l=document.createElement("option"); -l.setAttribute("value","jpg");mxUtils.write(l,mxResources.get("formatJpg"));p.appendChild(l);l=document.createElement("option");l.setAttribute("value","pdf");mxUtils.write(l,mxResources.get("formatPdf"));p.appendChild(l);l=document.createElement("option");l.setAttribute("value","svg");mxUtils.write(l,mxResources.get("formatSvg"));p.appendChild(l);ExportDialog.showXmlOption&&(l=document.createElement("option"),l.setAttribute("value","xml"),mxUtils.write(l,mxResources.get("formatXml")),p.appendChild(l)); -l=document.createElement("td");l.appendChild(p);b.appendChild(l);m.appendChild(b);b=document.createElement("tr");l=document.createElement("td");l.style.fontSize="10pt";mxUtils.write(l,mxResources.get("zoom")+" (%):");b.appendChild(l);var s=document.createElement("input");s.setAttribute("type","number");s.setAttribute("value","100");s.style.width="180px";l=document.createElement("td");l.appendChild(s);b.appendChild(l);m.appendChild(b);b=document.createElement("tr");l=document.createElement("td");l.style.fontSize= -"10pt";mxUtils.write(l,mxResources.get("width")+":");b.appendChild(l);var t=document.createElement("input");t.setAttribute("value",g);t.style.width="180px";l=document.createElement("td");l.appendChild(t);b.appendChild(l);m.appendChild(b);b=document.createElement("tr");l=document.createElement("td");l.style.fontSize="10pt";mxUtils.write(l,mxResources.get("height")+":");b.appendChild(l);var q=document.createElement("input");q.setAttribute("value",k);q.style.width="180px";l=document.createElement("td"); -l.appendChild(q);b.appendChild(l);m.appendChild(b);b=document.createElement("tr");l=document.createElement("td");l.style.fontSize="10pt";mxUtils.write(l,mxResources.get("background")+":");b.appendChild(l);var u=document.createElement("input");u.setAttribute("type","checkbox");u.checked=null==d.background||d.background==mxConstants.NONE;l=document.createElement("td");l.appendChild(u);mxUtils.write(l,mxResources.get("transparent"));b.appendChild(l);m.appendChild(b);b=document.createElement("tr");l= -document.createElement("td");l.style.fontSize="10pt";mxUtils.write(l,mxResources.get("borderWidth")+":");b.appendChild(l);var v=document.createElement("input");v.setAttribute("type","number");v.setAttribute("value","0");v.style.width="180px";l=document.createElement("td");l.appendChild(v);b.appendChild(l);m.appendChild(b);e.appendChild(m);mxEvent.addListener(p,"change",c);c();mxEvent.addListener(s,"change",function(){var b=Math.max(0,parseFloat(s.value)||100)/100;s.value=parseFloat((100*b).toFixed(2)); -0=parseInt(s.value))mxUtils.alert(mxResources.get("drawingEmpty"));else{var b=n.value,e=p.value,c=Math.max(0,parseFloat(s.value)||100)/100,f=Math.max(0,parseInt(v.value)),g=d.background;if(("svg"==e||"png"==e)&&u.checked)g=null;else if(null==g||g==mxConstants.NONE)g="#ffffff";ExportDialog.exportFile(a,b,e,g,c,f)}}));x.className="geBtn gePrimaryBtn"; -var z=mxUtils.button(mxResources.get("cancel"),function(){a.hideDialog()});z.className="geBtn";a.editor.cancelFirst?(l.appendChild(z),l.appendChild(x)):(l.appendChild(x),l.appendChild(z));b.appendChild(l);m.appendChild(b);e.appendChild(m);this.container=e};ExportDialog.showGifOption=!0;ExportDialog.showXmlOption=!0; +mxEvent.addListener(t,"keypress",function(b){13==b.keyCode&&q.click()});n.appendChild(q);a.editor.cancelFirst||n.appendChild(c);m.appendChild(n);s.appendChild(m);p.appendChild(s);this.container=p},TextareaDialog=function(a,c,f,d,b,e,g,k,l,m,n){g=null!=g?g:300;k=null!=k?k:120;m=null!=m?m:!1;var p,s,t=document.createElement("table"),q=document.createElement("tbody");p=document.createElement("tr");s=document.createElement("td");s.style.fontSize="10pt";s.style.width="100px";mxUtils.write(s,c);p.appendChild(s); +q.appendChild(p);p=document.createElement("tr");s=document.createElement("td");var u=document.createElement("textarea");n&&u.setAttribute("wrap","off");mxUtils.write(u,f||"");u.style.resize="none";u.style.width=g+"px";u.style.height=k+"px";this.textarea=u;this.init=function(){u.focus();u.scrollTop=0};s.appendChild(u);p.appendChild(s);q.appendChild(p);p=document.createElement("tr");s=document.createElement("td");s.style.paddingTop="14px";s.style.whiteSpace="nowrap";s.setAttribute("align","right"); +c=mxUtils.button(e||mxResources.get("cancel"),function(){a.hideDialog();null!=b&&b()});c.className="geBtn";a.editor.cancelFirst&&s.appendChild(c);null!=l&&l(s);null!=d&&(l=mxUtils.button(mxResources.get("apply"),function(){m||a.hideDialog();d(u.value)}),l.className="geBtn gePrimaryBtn",s.appendChild(l));a.editor.cancelFirst||s.appendChild(c);p.appendChild(s);q.appendChild(p);t.appendChild(q);this.container=t},EditDiagramDialog=function(a){var c=document.createElement("div");c.style.textAlign="right"; +var f=document.createElement("textarea");f.setAttribute("wrap","off");f.style.overflow="auto";f.style.resize="none";f.style.width="600px";f.style.height="370px";f.style.marginBottom="16px";f.value=mxUtils.getPrettyXml(a.editor.getGraphXml());c.appendChild(f);this.init=function(){f.focus()};Graph.fileSupport&&(f.addEventListener("dragover",function(b){b.stopPropagation();b.preventDefault()},!1),f.addEventListener("drop",function(b){b.stopPropagation();b.preventDefault();if(0MAX_AREA||0>=t.value?"red":"";q.style.backgroundColor=t.value*q.value>MAX_AREA||0>=q.value?"red":""}var d=a.editor.graph,b= +d.getGraphBounds(),e=d.view.scale,g=Math.ceil(b.width/e),k=Math.ceil(b.height/e),l,e=document.createElement("table"),m=document.createElement("tbody");e.setAttribute("cellpadding",mxClient.IS_SF?"0":"2");b=document.createElement("tr");l=document.createElement("td");l.style.fontSize="10pt";l.style.width="100px";mxUtils.write(l,mxResources.get("filename")+":");b.appendChild(l);var n=document.createElement("input");n.setAttribute("value",a.editor.getOrCreateFilename());n.style.width="180px";l=document.createElement("td"); +l.appendChild(n);b.appendChild(l);m.appendChild(b);b=document.createElement("tr");l=document.createElement("td");l.style.fontSize="10pt";mxUtils.write(l,mxResources.get("format")+":");b.appendChild(l);var p=document.createElement("select");p.style.width="180px";l=document.createElement("option");l.setAttribute("value","png");mxUtils.write(l,mxResources.get("formatPng"));p.appendChild(l);l=document.createElement("option");ExportDialog.showGifOption&&(l.setAttribute("value","gif"),mxUtils.write(l,mxResources.get("formatGif")), +p.appendChild(l));l=document.createElement("option");l.setAttribute("value","jpg");mxUtils.write(l,mxResources.get("formatJpg"));p.appendChild(l);l=document.createElement("option");l.setAttribute("value","pdf");mxUtils.write(l,mxResources.get("formatPdf"));p.appendChild(l);l=document.createElement("option");l.setAttribute("value","svg");mxUtils.write(l,mxResources.get("formatSvg"));p.appendChild(l);ExportDialog.showXmlOption&&(l=document.createElement("option"),l.setAttribute("value","xml"),mxUtils.write(l, +mxResources.get("formatXml")),p.appendChild(l));l=document.createElement("td");l.appendChild(p);b.appendChild(l);m.appendChild(b);b=document.createElement("tr");l=document.createElement("td");l.style.fontSize="10pt";mxUtils.write(l,mxResources.get("zoom")+" (%):");b.appendChild(l);var s=document.createElement("input");s.setAttribute("type","number");s.setAttribute("value","100");s.style.width="180px";l=document.createElement("td");l.appendChild(s);b.appendChild(l);m.appendChild(b);b=document.createElement("tr"); +l=document.createElement("td");l.style.fontSize="10pt";mxUtils.write(l,mxResources.get("width")+":");b.appendChild(l);var t=document.createElement("input");t.setAttribute("value",g);t.style.width="180px";l=document.createElement("td");l.appendChild(t);b.appendChild(l);m.appendChild(b);b=document.createElement("tr");l=document.createElement("td");l.style.fontSize="10pt";mxUtils.write(l,mxResources.get("height")+":");b.appendChild(l);var q=document.createElement("input");q.setAttribute("value",k);q.style.width= +"180px";l=document.createElement("td");l.appendChild(q);b.appendChild(l);m.appendChild(b);b=document.createElement("tr");l=document.createElement("td");l.style.fontSize="10pt";mxUtils.write(l,mxResources.get("background")+":");b.appendChild(l);var u=document.createElement("input");u.setAttribute("type","checkbox");u.checked=null==d.background||d.background==mxConstants.NONE;l=document.createElement("td");l.appendChild(u);mxUtils.write(l,mxResources.get("transparent"));b.appendChild(l);m.appendChild(b); +b=document.createElement("tr");l=document.createElement("td");l.style.fontSize="10pt";mxUtils.write(l,mxResources.get("borderWidth")+":");b.appendChild(l);var v=document.createElement("input");v.setAttribute("type","number");v.setAttribute("value","0");v.style.width="180px";l=document.createElement("td");l.appendChild(v);b.appendChild(l);m.appendChild(b);e.appendChild(m);mxEvent.addListener(p,"change",c);c();mxEvent.addListener(s,"change",function(){var b=Math.max(0,parseFloat(s.value)||100)/100; +s.value=parseFloat((100*b).toFixed(2));0=parseInt(s.value))mxUtils.alert(mxResources.get("drawingEmpty"));else{var b=n.value,e=p.value,c=Math.max(0,parseFloat(s.value)||100)/100,f=Math.max(0,parseInt(v.value)),g=d.background;if(("svg"==e||"png"==e)&&u.checked)g=null;else if(null==g||g==mxConstants.NONE)g="#ffffff";ExportDialog.exportFile(a,b,e,g,c,f)}}));x.className= +"geBtn gePrimaryBtn";var z=mxUtils.button(mxResources.get("cancel"),function(){a.hideDialog()});z.className="geBtn";a.editor.cancelFirst?(l.appendChild(z),l.appendChild(x)):(l.appendChild(x),l.appendChild(z));b.appendChild(l);m.appendChild(b);e.appendChild(m);this.container=e};ExportDialog.showGifOption=!0;ExportDialog.showXmlOption=!0; ExportDialog.exportFile=function(a,c,f,d,b,e){var g=a.editor.graph;if("xml"==f)ExportDialog.saveLocalFile(a,mxUtils.getXml(a.editor.getGraphXml()),c,f);else if("svg"==f)ExportDialog.saveLocalFile(a,mxUtils.getXml(g.getSvg(d,b,e)),c,f);else{var k=g.getGraphBounds(),l=mxUtils.createXmlDocument(),m=l.createElement("output");l.appendChild(m);l=new mxXmlCanvas2D(m);l.translate(Math.floor((e/b-k.x)/g.view.scale),Math.floor((e/b-k.y)/g.view.scale));l.scale(b/g.view.scale);(new mxImageExport).drawState(g.getView().getState(g.model.root), l);m="xml\x3d"+encodeURIComponent(mxUtils.getXml(m));l=Math.ceil(k.width*b/g.view.scale+2*e);b=Math.ceil(k.height*b/g.view.scale+2*e);m.length<=MAX_REQUEST_SIZE&&l*b=v.scrollHeight&&(a(),mxEvent.consume(b))});var c=null,d;for(d in y){var e=document.createElement("div"),f=mxResources.get(d), -k=y[d];null==f&&(f=d.substring(0,1).toUpperCase()+d.substring(1));18c.lastIndexOf(".")&&(!u||0>e)){b=null!=b?b:A.value; -var f="";b==App.MODE_GOOGLE?f=a.drive.extension:b==App.MODE_DROPBOX?f=a.dropbox.extension:b==App.MODE_ONEDRIVE?f=a.oneDrive.extension:b==App.MODE_DEVICE&&(f=".xml");0<=e&&(d=d.substring(0,e));x.value=d+f}}}function t(b){var c=x.value;if(null==b||null!=c&&0=v.scrollHeight&&(a(),mxEvent.consume(b))});var c=null,d;for(d in y){var e=document.createElement("div"),f=mxResources.get(d),k=y[d];null==f&&(f=d.substring(0,1).toUpperCase()+d.substring(1));18c.lastIndexOf(".")&&(!u||0>e)){b=null!=b?b:A.value;var f="";b==App.MODE_GOOGLE?f=a.drive.extension:b==App.MODE_DROPBOX?f=a.dropbox.extension:b==App.MODE_ONEDRIVE?f=a.oneDrive.extension:b==App.MODE_DEVICE&&(f=".xml");0<=e&&(d=d.substring(0,e));x.value= +d+f}}}function t(b){var c=x.value;if(null==b||null!=c&&0b};EditorUi.prototype.resizeImage=function(a,b,c,d,e,f){e=null!=e?e:this.maxImageSize;var g=Math.max(1,a.width),q=Math.max(1,a.height);if(d&&this.isResampleImage(b, @@ -7786,7 +7785,7 @@ App=function(a,c,f){EditorUi.call(this,a,c,null!=f?f:"1"==urlParams.lightbox);mx (new Image).src=mxGraph.prototype.warningImage.src;window.openWindow=mxUtils.bind(this,function(a,c,d){var f=window.open(a);null==f||void 0===f?this.showDialog((new PopupDialog(this,a,c,d)).container,320,140,!0,!0):null!=c&&c()});this.updateUi();a=document.createElement("canvas");this.canvasSupported=!(!a.getContext||!a.getContext("2d"));window.showOpenAlert=mxUtils.bind(this,function(a){null!=window.openFile&&window.openFile.cancel(!0);this.handleError(a)});this.isOffline()||(EditDataDialog.placeholderHelpLink= "https://support.draw.io/questions/9338941");ColorDialog.recentColors=mxSettings.getRecentColors(ColorDialog.recentColors);this.addFileDropHandler([document]);if(null!=App.DrawPlugins){for(a=0;anavigator.userAgent.indexOf("MSIE")&& +window.STYLE_PATH=window.STYLE_PATH||"styles";window.CSS_PATH=window.CSS_PATH||"styles";window.OPEN_FORM=window.OPEN_FORM||"open.html";window.mxBasePath=window.mxBasePath||"../../../src";window.mxLanguage=window.mxLanguage||urlParams.lang;window.mxLanguages=window.mxLanguages||["de"];var mxClient={VERSION:"6.0.2.16",IS_IE:0<=navigator.userAgent.indexOf("MSIE"),IS_IE6:0<=navigator.userAgent.indexOf("MSIE 6"),IS_IE11:!!navigator.userAgent.match(/Trident\/7\./),IS_EDGE:!!navigator.userAgent.match(/Edge\//),IS_QUIRKS:0<=navigator.userAgent.indexOf("MSIE")&&(null==document.documentMode||5==document.documentMode),IS_EM:"spellcheck"in document.createElement("textarea")&&8==document.documentMode,VML_PREFIX:"v",OFFICE_PREFIX:"o",IS_NS:0<=navigator.userAgent.indexOf("Mozilla/")&&0>navigator.userAgent.indexOf("MSIE")&& 0>navigator.userAgent.indexOf("Edge/"),IS_OP:0<=navigator.userAgent.indexOf("Opera/")||0<=navigator.userAgent.indexOf("OPR/"),IS_OT:0<=navigator.userAgent.indexOf("Presto/")&&0>navigator.userAgent.indexOf("Presto/2.4.")&&0>navigator.userAgent.indexOf("Presto/2.3.")&&0>navigator.userAgent.indexOf("Presto/2.2.")&&0>navigator.userAgent.indexOf("Presto/2.1.")&&0>navigator.userAgent.indexOf("Presto/2.0.")&&0>navigator.userAgent.indexOf("Presto/1."),IS_SF:0<=navigator.userAgent.indexOf("AppleWebKit/")&& 0>navigator.userAgent.indexOf("Chrome/")&&0>navigator.userAgent.indexOf("Edge/"),IS_IOS:navigator.userAgent.match(/(iPad|iPhone|iPod)/g)?!0:!1,IS_GC:0<=navigator.userAgent.indexOf("Chrome/")&&0>navigator.userAgent.indexOf("Edge/"),IS_CHROMEAPP:null!=window.chrome&&null!=chrome.app&&null!=chrome.app.runtime,IS_FF:0<=navigator.userAgent.indexOf("Firefox/"),IS_MT:0<=navigator.userAgent.indexOf("Firefox/")&&0>navigator.userAgent.indexOf("Firefox/1.")&&0>navigator.userAgent.indexOf("Firefox/2.")||0<=navigator.userAgent.indexOf("Iceweasel/")&& 0>navigator.userAgent.indexOf("Iceweasel/1.")&&0>navigator.userAgent.indexOf("Iceweasel/2.")||0<=navigator.userAgent.indexOf("SeaMonkey/")&&0>navigator.userAgent.indexOf("SeaMonkey/1.")||0<=navigator.userAgent.indexOf("Iceape/")&&0>navigator.userAgent.indexOf("Iceape/1."),IS_SVG:0<=navigator.userAgent.indexOf("Firefox/")||0<=navigator.userAgent.indexOf("Iceweasel/")||0<=navigator.userAgent.indexOf("Seamonkey/")||0<=navigator.userAgent.indexOf("Iceape/")||0<=navigator.userAgent.indexOf("Galeon/")|| diff --git a/war/js/mxgraph/Dialogs.js b/war/js/mxgraph/Dialogs.js index c40794db..7dde86a0 100644 --- a/war/js/mxgraph/Dialogs.js +++ b/war/js/mxgraph/Dialogs.js @@ -1411,7 +1411,7 @@ var FilenameDialog = function(editorUi, filename, buttonText, fn, label, validat /** * Constructs a new textarea dialog. */ -var TextareaDialog = function(editorUi, title, url, fn, cancelFn, cancelTitle, w, h, addButtons, noHide) +var TextareaDialog = function(editorUi, title, url, fn, cancelFn, cancelTitle, w, h, addButtons, noHide, noWrap) { w = (w != null) ? w : 300; h = (h != null) ? h : 120; @@ -1435,6 +1435,12 @@ var TextareaDialog = function(editorUi, title, url, fn, cancelFn, cancelTitle, w td = document.createElement('td'); var nameInput = document.createElement('textarea'); + + if (noWrap) + { + nameInput.setAttribute('wrap', 'off'); + } + mxUtils.write(nameInput, url || ''); nameInput.style.resize = 'none'; nameInput.style.width = w + 'px'; diff --git a/war/js/reader.min.js b/war/js/reader.min.js index 9bdd2425..f48dfca7 100644 --- a/war/js/reader.min.js +++ b/war/js/reader.min.js @@ -184,7 +184,7 @@ f)+"\n"+t+"}":"{"+v.join(",")+"}";f=t;return r}}"function"!==typeof Date.prototy e=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,f,g,h={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},k;"function"!==typeof JSON.stringify&&(JSON.stringify=function(a,b,d){var e;g=f="";if("number"===typeof d)for(e=0;enavigator.userAgent.indexOf("MSIE")&& +window.STYLE_PATH=window.STYLE_PATH||"styles";window.CSS_PATH=window.CSS_PATH||"styles";window.OPEN_FORM=window.OPEN_FORM||"open.html";window.mxBasePath=window.mxBasePath||"../../../src";window.mxLanguage=window.mxLanguage||urlParams.lang;window.mxLanguages=window.mxLanguages||["de"];var mxClient={VERSION:"6.0.2.16",IS_IE:0<=navigator.userAgent.indexOf("MSIE"),IS_IE6:0<=navigator.userAgent.indexOf("MSIE 6"),IS_IE11:!!navigator.userAgent.match(/Trident\/7\./),IS_EDGE:!!navigator.userAgent.match(/Edge\//),IS_QUIRKS:0<=navigator.userAgent.indexOf("MSIE")&&(null==document.documentMode||5==document.documentMode),IS_EM:"spellcheck"in document.createElement("textarea")&&8==document.documentMode,VML_PREFIX:"v",OFFICE_PREFIX:"o",IS_NS:0<=navigator.userAgent.indexOf("Mozilla/")&&0>navigator.userAgent.indexOf("MSIE")&& 0>navigator.userAgent.indexOf("Edge/"),IS_OP:0<=navigator.userAgent.indexOf("Opera/")||0<=navigator.userAgent.indexOf("OPR/"),IS_OT:0<=navigator.userAgent.indexOf("Presto/")&&0>navigator.userAgent.indexOf("Presto/2.4.")&&0>navigator.userAgent.indexOf("Presto/2.3.")&&0>navigator.userAgent.indexOf("Presto/2.2.")&&0>navigator.userAgent.indexOf("Presto/2.1.")&&0>navigator.userAgent.indexOf("Presto/2.0.")&&0>navigator.userAgent.indexOf("Presto/1."),IS_SF:0<=navigator.userAgent.indexOf("AppleWebKit/")&& 0>navigator.userAgent.indexOf("Chrome/")&&0>navigator.userAgent.indexOf("Edge/"),IS_IOS:navigator.userAgent.match(/(iPad|iPhone|iPod)/g)?!0:!1,IS_GC:0<=navigator.userAgent.indexOf("Chrome/")&&0>navigator.userAgent.indexOf("Edge/"),IS_CHROMEAPP:null!=window.chrome&&null!=chrome.app&&null!=chrome.app.runtime,IS_FF:0<=navigator.userAgent.indexOf("Firefox/"),IS_MT:0<=navigator.userAgent.indexOf("Firefox/")&&0>navigator.userAgent.indexOf("Firefox/1.")&&0>navigator.userAgent.indexOf("Firefox/2.")||0<=navigator.userAgent.indexOf("Iceweasel/")&& 0>navigator.userAgent.indexOf("Iceweasel/1.")&&0>navigator.userAgent.indexOf("Iceweasel/2.")||0<=navigator.userAgent.indexOf("SeaMonkey/")&&0>navigator.userAgent.indexOf("SeaMonkey/1.")||0<=navigator.userAgent.indexOf("Iceape/")&&0>navigator.userAgent.indexOf("Iceape/1."),IS_SVG:0<=navigator.userAgent.indexOf("Firefox/")||0<=navigator.userAgent.indexOf("Iceweasel/")||0<=navigator.userAgent.indexOf("Seamonkey/")||0<=navigator.userAgent.indexOf("Iceape/")||0<=navigator.userAgent.indexOf("Galeon/")|| diff --git a/war/plugins/csv.js b/war/plugins/csv.js new file mode 100644 index 00000000..7001460f --- /dev/null +++ b/war/plugins/csv.js @@ -0,0 +1,492 @@ +/** + * Explore plugin. + */ +Draw.loadPlugin(function(ui) +{ + // Adds resource for action + mxResources.parse('fromCsv=From CSV...'); + + // Return array of string values, or NULL if CSV string not well formed. + function CSVtoArray(text) + { + var re_valid = /^\s*(?:'[^'\\]*(?:\\[\S\s][^'\\]*)*'|"[^"\\]*(?:\\[\S\s][^"\\]*)*"|[^,'"\s\\]*(?:\s+[^,'"\s\\]+)*)\s*(?:,\s*(?:'[^'\\]*(?:\\[\S\s][^'\\]*)*'|"[^"\\]*(?:\\[\S\s][^"\\]*)*"|[^,'"\s\\]*(?:\s+[^,'"\s\\]+)*)\s*)*$/; + var re_value = /(?!\s*$)\s*(?:'([^'\\]*(?:\\[\S\s][^'\\]*)*)'|"([^"\\]*(?:\\[\S\s][^"\\]*)*)"|([^,'"\s\\]*(?:\s+[^,'"\s\\]+)*))\s*(?:,|$)/g; + // Return NULL if input string is not well formed CSV string. + if (!re_valid.test(text)) return null; + var a = []; // Initialize array to receive values. + text.replace(re_value, // "Walk" the string using replace with callback. + function(m0, m1, m2, m3) { + // Remove backslash from \' in single quoted values. + if (m1 !== undefined) a.push(m1.replace(/\\'/g, "'")); + // Remove backslash from \" in double quoted values. + else if (m2 !== undefined) a.push(m2.replace(/\\"/g, '"')); + else if (m3 !== undefined) a.push(m3); + return ''; // Return empty string. + }); + // Handle special case of empty last value. + if (/,\s*$/.test(text)) a.push(''); + return a; + }; + + + var defaultCsvValue = '##\n' + + '## Example CSV import. Use ## for comments and # for configuration. Paste CSV below.\n' + + '##\n' + + '#\n' + + '## Node label with placeholders and HTML.\n' + + '## Default is \'%name_of_first_column%\'.\n' + + '#\n' + + '# label: %name%
%position%
Email\n' + + '#\n' + + '## Node style (placeholders are replaced once).\n' + + '## Default is the current style for nodes.\n' + + '#\n' + + '# style: label;image=%image%;whiteSpace=wrap;html=1;rounded=1;fillColor=%fill%;strokeColor=%stroke%;\n' + + '#\n' + + '## Connections between rows ("from": source colum, "to": target column).\n' + + '## Label, style and invert are optional. Defaults are \'\', current style and false.\n' + + '## The target column may contain a comma-separated list of values.\n' + + '## Multiple connect entries are allowed.\n' + + '#\n' + + '# connect: {"from": "manager", "to": "name", "invert": true, "label": "manages", \\\n' + + '# "style": "curved=1;endArrow=blockThin;endFill=1;fontSize=11;"}\n' + + '# connect: {"from": "refs", "to": "id", "style": "curved=1;fontSize=11;"}\n' + + '#\n' + + '## Node width. Possible value are px or auto. Default is auto.\n' + + '#\n' + + '# width: auto\n' + + '#\n' + + '## Node height. Possible value are px or auto. Default is auto.\n' + + '#\n' + + '# height: auto\n' + + '#\n' + + '## Padding for autosize. Default is 0.\n' + + '#\n' + + '# padding: -26\n' + + '#\n' + + '## Comma-separated list of ignored columns for metadata.\n' + + '#\n' + + '# ignore: id,image,fill,stroke\n' + + '#\n' + + '## Column to be renamed to link attribute (used as link).\n' + + '#\n' + + '# link: url\n' + + '#\n' + + '## Spacing between nodes. Default is 40.\n' + + '#\n' + + '# nodespacing: 40\n' + + '#\n' + + '## Spacing between parallel edges. Default is 40.\n' + + '#\n' + + '# edgespacing: 40\n' + + '#\n' + + '## Name of layout. Possible values are auto, none, verticaltree, horizontaltree,\n' + + '## verticalflow, horizontalflow, organic, circle. Default is auto.\n' + + '#\n' + + '# layout: auto\n' + + '#\n' + + '## ---- CSV below this line ----\n' + + 'name,position,id,location,manager,email,fill,stroke,refs,url,image\n' + + 'Evan Miller,CFO,emi,Office 1,,me@example.com,#dae8fc,#6c8ebf,,https://www.draw.io,https://cdn3.iconfinder.com/data/icons/user-avatars-1/512/users-9-2-128.png\n' + + 'Edward Morrison,Brand Manager,emo,Office 2,Evan Miller,me@example.com,#d5e8d4,#82b366,,https://www.draw.io,https://cdn3.iconfinder.com/data/icons/user-avatars-1/512/users-10-3-128.png\n' + + 'Ron Donovan,System Admin,rdo,Office 3,Evan Miller,me@example.com,#d5e8d4,#82b366,"emo,tva",https://www.draw.io,https://cdn3.iconfinder.com/data/icons/user-avatars-1/512/users-2-128.png\n' + + 'Tessa Valet,HR Director,tva,Office 4,Evan Miller,me@example.com,#d5e8d4,#82b366,,https://www.draw.io,https://cdn3.iconfinder.com/data/icons/user-avatars-1/512/users-3-128.png\n'; + + var dlg = null; + + // Adds action + ui.actions.addAction('fromCsv', function() + { + if (dlg == null) + { + dlg = new TextareaDialog(ui, mxResources.get('fromCsv') + ':', + defaultCsvValue, function(newValue) + { + try + { + var lines = newValue.split('\n'); + var cells = []; + + if (lines.length > 0) + { + // Internal lookup table + var lookups = {}; + + // Default values + var style = null; + var width = 'auto'; + var height = 'auto'; + var edgespacing = 40; + var nodespacing = 40; + var padding = 0; + + var graph = ui.editor.graph; + var view = graph.view; + var bds = graph.getGraphBounds(); + + // Delayed after optional layout + var afterInsert = function() + { + graph.setSelectionCells(select); + graph.scrollCellToVisible(graph.getSelectionCell()); + }; + + // Computes unscaled, untranslated graph bounds + var pt = graph.getFreeInsertPoint(); + var x0 = pt.x; + var y0 = pt.y; + var y = y0; + + // Default label value depends on column names + var label = null; + + // Default layout to run. + var layout = 'auto'; + + // Name of the attribute that contains the parent reference + var parent = null; + + // Name of the attribute that contains the references for creating edges + var edges = []; + + // Name of the column for hyperlinks + var link = null; + + // String array of names to remove from metadata + var ignore = null; + + // Read processing instructions first + var index = 0; + + while (index < lines.length && lines[index].charAt(0) == '#') + { + var text = lines[index]; + index++; + + while (index < lines.length && text.charAt(text.length - 1) == '\\' && + lines[index].charAt(0) == '#') + { + text = text.substring(0, text.length - 1) + mxUtils.trim(lines[index].substring(1)); + index++; + } + + if (text.charAt(1) != '#') + { + // Processing instruction + var idx = text.indexOf(':'); + + if (idx > 0) + { + var key = mxUtils.trim(text.substring(1, idx)); + var value = mxUtils.trim(text.substring(idx + 1)); + + if (key == 'label') + { + label = graph.sanitizeHtml(value); + } + else if (key == 'style') + { + style = value; + } + else if (key == 'width') + { + width = value; + } + else if (key == 'height') + { + height = value; + } + else if (key == 'ignore') + { + ignore = value.split(','); + } + else if (key == 'connect') + { + edges.push(JSON.parse(value)); + } + else if (key == 'link') + { + link = value; + } + else if (key == 'padding') + { + padding = parseFloat(value); + } + else if (key == 'edgespacing') + { + edgespacing = parseFloat(value); + } + else if (key == 'nodespacing') + { + nodespacing = parseFloat(value); + } + else if (key == 'layout') + { + layout = value; + } + } + } + } + + var keys = CSVtoArray(lines[index]); + + if (label == null) + { + label = '%' + keys[0] + '%'; + } + + if (edges != null) + { + for (var e = 0; e < edges.length; e++) + { + if (lookups[edges[e].to] == null) + { + lookups[edges[e].to] = {}; + } + } + } + + graph.model.beginUpdate(); + try + { + for (var i = index + 1; i < lines.length; i++) + { + var values = CSVtoArray(lines[i]); + + if (values.length == keys.length) + { + var cell = new mxCell(label, new mxGeometry(x0, y, + 0, 0), style || 'whiteSpace=wrap;html=1;'); + cell.vertex = true; + + for (var j = 0; j < values.length; j++) + { + graph.setAttributeForCell(cell, keys[j], values[j]); + } + + graph.setAttributeForCell(cell, 'placeholders', '1'); + cell.style = graph.replacePlaceholders(cell, cell.style); + + for (var e = 0; e < edges.length; e++) + { + lookups[edges[e].to][cell.getAttribute(edges[e].to)] = cell; + } + + if (link != null && link != 'link') + { + graph.setLinkForCell(cell, cell.getAttribute(link)); + + // Removes attribute + graph.setAttributeForCell(cell, link, null); + } + + // Removes ignored attributes after processing above + if (ignore != null) + { + for (var j = 0; j < ignore.length; j++) + { + graph.setAttributeForCell(cell, ignore[j], null); + } + } + + // Sets the size + var size = ui.editor.graph.getPreferredSizeForCell(cell); + + cell.geometry.width = (width == 'auto') ? size.width + padding : parseFloat(width); + cell.geometry.height = (height == 'auto') ? size.height + padding : parseFloat(height); + y += cell.geometry.height + nodespacing; + + cells.push(graph.addCell(cell)); + } + } + + if (style == null) + { + graph.fireEvent(new mxEventObject('cellsInserted', 'cells', cells)); + } + + var roots = cells.slice(); + var select = cells.slice(); + + for (var e = 0; e < edges.length; e++) + { + var edge = edges[e]; + + for (var i = 0; i < cells.length; i++) + { + var cell = cells[i]; + + var tmp = cell.getAttribute(edge.from); + + if (tmp != null) + { + // Removes attribute + graph.setAttributeForCell(cell, edge.from, null); + var refs = tmp.split(','); + + for (var j = 0; j < refs.length; j++) + { + var ref = lookups[edge.to][refs[j]]; + + if (ref != null) + { + select.push(graph.insertEdge(null, null, edge.label || '', + (edge.invert) ? ref : cell, (edge.invert) ? cell : ref, + edge.style || graph.createCurrentEdgeStyle())); + mxUtils.remove((edge.invert) ? cell : ref, roots); + } + } + } + } + } + + var edgeLayout = new mxParallelEdgeLayout(graph); + edgeLayout.spacing = edgespacing; + + var postProcess = function() + { + edgeLayout.execute(graph.getDefaultParent()); + + // Aligns cells to grid and/or rounds positions + for (var i = 0; i < cells.length; i++) + { + var geo = graph.getCellGeometry(cells[i]); + geo.x = Math.round(graph.snap(geo.x)); + geo.y = Math.round(graph.snap(geo.y)); + + if (width == 'auto') + { + geo.width = Math.round(graph.snap(geo.width)); + } + + if (height == 'auto') + { + geo.height = Math.round(graph.snap(geo.height)); + } + } + }; + + if (layout == 'circle') + { + var circleLayout = new mxCircleLayout(graph); + circleLayout.resetEdges = false; + + var circleLayoutIsVertexIgnored = circleLayout.isVertexIgnored; + + // Ignore other cells + circleLayout.isVertexIgnored = function(vertex) + { + return circleLayoutIsVertexIgnored.apply(this, arguments) || + mxUtils.indexOf(cells, vertex) < 0; + }; + + ui.executeLayout(function() + { + circleLayout.execute(graph.getDefaultParent()); + postProcess(); + }, true, afterInsert); + + afterInsert = null; + } + else if (layout == 'horizontaltree' || layout == 'verticaltree' || + (layout == 'auto' && select.length == 2 * cells.length - 1 && roots.length == 1)) + { + // Required for layouts to work with new cells + graph.view.validate(); + + var treeLayout = new mxCompactTreeLayout(graph, layout == 'horizontaltree'); + treeLayout.levelDistance = nodespacing; + treeLayout.edgeRouting = false; + + ui.executeLayout(function() + { + treeLayout.execute(graph.getDefaultParent(), (roots.length > 0) ? roots[0] : null); + }, true, afterInsert); + + afterInsert = null; + } + else if (layout == 'horizontalflow' || layout == 'verticalflow' || + (layout == 'auto' && roots.length == 1)) + { + // Required for layouts to work with new cells + graph.view.validate(); + + var flowLayout = new mxHierarchicalLayout(graph, + (layout == 'horizontalflow') ? mxConstants.DIRECTION_WEST : mxConstants.DIRECTION_NORTH); + flowLayout.intraCellSpacing = nodespacing; + + ui.executeLayout(function() + { + flowLayout.execute(graph.getDefaultParent(), select); + + // Workaround for flow layout moving cells to origin + graph.moveCells(select, x0, y0); + }, true, afterInsert); + + afterInsert = null; + } + else if (layout == 'organic' || (layout == 'auto' && + select.length > cells.length)) + { + // Required for layouts to work with new cells + graph.view.validate(); + + var organicLayout = new mxFastOrganicLayout(graph); + organicLayout.forceConstant = nodespacing * 3; + organicLayout.resetEdges = false; + + var organicLayoutIsVertexIgnored = organicLayout.isVertexIgnored; + + // Ignore other cells + organicLayout.isVertexIgnored = function(vertex) + { + return organicLayoutIsVertexIgnored.apply(this, arguments) || + mxUtils.indexOf(cells, vertex) < 0; + }; + + var edgeLayout = new mxParallelEdgeLayout(graph); + edgeLayout.spacing = edgespacing; + + ui.executeLayout(function() + { + organicLayout.execute(graph.getDefaultParent()); + postProcess(); + }, true, afterInsert); + + afterInsert = null; + } + + ui.hideDialog(); + } + finally + { + graph.model.endUpdate(); + } + + if (afterInsert != null) + { + afterInsert(); + } + } + } + catch (e) + { + ui.handleError(e); + } + }, null, null, 620, 430, null, true, true); + } + + ui.showDialog(dlg.container, 640, 520, true, true); + dlg.init(); + }); + + var menu = ui.menus.get('insert'); + var oldFunct = menu.funct; + + menu.funct = function(menu, parent) + { + oldFunct.apply(this, arguments); + + ui.menus.addMenuItems(menu, ['fromCsv'], parent); + }; +});