/*
* $Id: Dialogs.js,v 1.103 2014/02/11 14:08:15 gaudenz Exp $
* Copyright (c) 2006-2010, JGraph Ltd
*/
var StorageDialog = function(editorUi, fn)
{
var div = document.createElement('div');
div.style.textAlign = 'center';
div.style.whiteSpace = 'nowrap';
var elt = editorUi.addLanguageMenu(div);
var bottom = '28px';
if (elt != null)
{
elt.style.bottom = bottom;
}
if (!editorUi.isOffline())
{
var help = document.createElement('a');
help.setAttribute('href', 'https://support.draw.io/display/DO/Selecting+Storage');
help.setAttribute('title', mxResources.get('help'));
help.setAttribute('target', '_blank');
help.style.position = 'absolute';
help.style.textDecoration = 'none';
help.style.cursor = 'pointer';
help.style.fontSize = '12px';
help.style.bottom = bottom;
help.style.left = '26px';
help.style.color = 'gray';
mxUtils.write(help, mxResources.get('help'));
div.appendChild(help);
}
var demo = document.createElement('div');
demo.style.position = 'absolute';
demo.style.cursor = 'pointer';
demo.style.fontSize = '12px';
demo.style.bottom = bottom;
demo.style.color = 'gray';
mxUtils.write(demo, mxResources.get('decideLater'));
if (editorUi.isOfflineApp())
{
demo.style.right = '20px';
}
else
{
mxUtils.setPrefixedStyle(demo.style, 'transform', 'translate(-50%,0)');
demo.style.left = '50%';
}
this.init = function()
{
if (mxClient.IS_QUIRKS || document.documentMode == 8)
{
demo.style.marginLeft = -Math.round(demo.clientWidth / 2) + 'px';
}
};
div.appendChild(demo);
mxEvent.addListener(demo, 'click', function()
{
editorUi.hideDialog();
var prev = Editor.useLocalStorage;
editorUi.createFile(editorUi.defaultFilename, null, null, App.MODE_DEVICE);
editorUi.setMode(null);
Editor.useLocalStorage = prev;
});
var buttons = document.createElement('div');
if (mxClient.IS_QUIRKS)
{
buttons.style.whiteSpace = 'nowrap';
buttons.style.cssFloat = 'left';
}
buttons.style.border = '1px solid #d3d3d3';
buttons.style.borderWidth = '1px 0px 1px 0px';
buttons.style.padding = '26px 0px 12px 0px';
var cb = document.createElement('input');
cb.setAttribute('type', 'checkbox');
cb.setAttribute('checked', 'checked');
cb.defaultChecked = true;
function addLogo(img, title, mode, clientName)
{
var button = document.createElement('a');
button.style.overflow = 'hidden';
var logo = document.createElement('img');
logo.setAttribute('src', img);
logo.setAttribute('border', '0');
logo.setAttribute('align', 'absmiddle');
logo.style.width = '60px';
logo.style.height = '60px';
logo.style.paddingBottom = '6px';
button.style.display = (mxClient.IS_QUIRKS) ? 'inline' : 'inline-block';
button.className = 'geBaseButton';
button.style.position = 'relative';
button.style.margin = '4px';
button.style.padding = '8px 10px 12px 10px';
button.style.whiteSpace = 'nowrap';
// Workaround for quirks is a vertical list (limited to max 2 items)
if (mxClient.IS_QUIRKS)
{
button.style.cssFloat = 'left';
button.style.zoom = '1';
}
button.appendChild(logo);
var label = document.createElement('div');
button.appendChild(label);
mxUtils.write(label, title);
function initButton()
{
mxEvent.addListener(button, 'click', function()
{
// Special case: Redirect all drive users to draw.io pro
if (mode == App.MODE_GOOGLE && !editorUi.isDriveDomain())
{
window.location.hostname = DriveClient.prototype.newAppHostname;
}
else if (mode == App.MODE_GOOGLE && editorUi.spinner.spin(document.body, mxResources.get('authorizing')))
{
// Tries immediate authentication
editorUi.drive.checkToken(mxUtils.bind(this, function()
{
editorUi.spinner.stop();
editorUi.setMode(mode, cb.checked);
fn();
}));
}
else
{
editorUi.setMode(mode, cb.checked);
fn();
}
});
};
// Supports lazy loading
if (clientName != null && editorUi[clientName] == null)
{
logo.style.visibility = 'hidden';
mxUtils.setOpacity(label, 10);
var size = 12;
var spinner = new Spinner({
lines: 12, // The number of lines to draw
length: size, // The length of each line
width: 5, // The line thickness
radius: 10, // The radius of the inner circle
rotate: 0, // The rotation offset
color: '#000', // #rgb or #rrggbb
speed: 1.5, // Rounds per second
trail: 60, // Afterglow percentage
shadow: false, // Whether to render a shadow
hwaccel: false, // Whether to use hardware acceleration
top: '40%',
zIndex: 2e9 // The z-index (defaults to 2000000000)
});
spinner.spin(button);
// Timeout after 30 secs
var timeout = window.setTimeout(function()
{
if (editorUi[clientName] == null)
{
spinner.stop();
button.style.display = 'none';
}
}, 30000);
editorUi.addListener('clientLoaded', mxUtils.bind(this, function()
{
if (editorUi[clientName] != null)
{
window.clearTimeout(timeout);
mxUtils.setOpacity(label, 100);
logo.style.visibility = '';
spinner.stop();
initButton();
}
}));
}
else
{
initButton();
}
buttons.appendChild(button);
};
var hd = document.createElement('p');
hd.style.fontSize = '16pt';
hd.style.padding = '0px';
hd.style.paddingTop = '4px';
hd.style.paddingBottom = '20px';
hd.style.margin = '0px';
hd.style.color = 'gray';
mxUtils.write(hd, mxResources.get('saveDiagramsTo') + ':');
div.appendChild(hd);
if (typeof window.DriveClient === 'function')
{
addLogo(IMAGE_PATH + '/google-drive-logo.svg', mxResources.get('googleDrive'), App.MODE_GOOGLE, 'drive');
}
if (typeof window.DropboxClient === 'function')
{
addLogo(IMAGE_PATH + '/dropbox-logo.svg', mxResources.get('dropbox'), App.MODE_DROPBOX, 'dropbox');
}
if (typeof window.OneDriveClient === 'function')
{
addLogo(IMAGE_PATH + '/onedrive-logo.svg', mxResources.get('oneDrive'), App.MODE_ONEDRIVE, 'oneDrive');
}
if (!mxClient.IS_IOS || urlParams['storage'] == 'device')
{
addLogo(IMAGE_PATH + '/osa_drive-harddisk.png', mxResources.get('device'), App.MODE_DEVICE);
}
if (isLocalStorage && (urlParams['browser'] == '1' || urlParams['offline'] == '1'))
{
addLogo(IMAGE_PATH + '/osa_database.png', mxResources.get('browser'), App.MODE_BROWSER);
}
div.appendChild(buttons);
var p2 = document.createElement('p');
p2.style.paddingTop = '10px';
p2.appendChild(cb);
var span = document.createElement('span');
span.style.color = 'gray';
span.style.fontSize = '12px';
mxUtils.write(span, ' ' + mxResources.get('rememberThisSetting'));
p2.appendChild(span);
buttons.appendChild(p2);
mxEvent.addListener(span, 'click', function(evt)
{
cb.checked = !cb.checked;
mxEvent.consume(evt);
});
// Checks if Google Drive is missing after a 5 sec delay
if (mxClient.IS_SVG && isLocalStorage && urlParams['gapi'] != '0' &&
(document.documentMode == null || document.documentMode >= 10))
{
window.setTimeout(function()
{
if (editorUi.drive == null)
{
// To check for Disconnect plugin in chrome use mxClient.IS_GC and check for URL:
// chrome-extension://jeoacafpbcihiomhlakheieifhpjdfeo/scripts/vendor/jquery/jquery-2.0.3.min.map
var p3 = document.createElement('p');
p3.style.padding = '8px';
p3.style.fontSize = '9pt';
p3.style.marginTop = '-14px';
p3.innerHTML = '' +
' ' +
mxResources.get('googleDriveMissing') + '';
div.appendChild(p3);
}
}, 5000);
}
this.container = div;
};
/**
* Constructs a dialog for creating new files from templates.
*/
var SplashDialog = function(editorUi)
{
var div = document.createElement('div');
div.style.textAlign = 'center';
editorUi.addLanguageMenu(div);
var help = null;
if (!editorUi.isOffline())
{
help = document.createElement('a');
help.setAttribute('href', 'https://support.draw.io/display/DO/Selecting+Storage');
help.setAttribute('title', mxResources.get('help'));
help.setAttribute('target', '_blank');
help.style.position = 'absolute';
help.style.fontSize = '12px';
help.style.textDecoration = 'none';
help.style.cursor = 'pointer';
help.style.bottom = '22px';
help.style.left = '26px';
help.style.color = 'gray';
mxUtils.write(help, mxResources.get('help'));
div.appendChild(help);
}
var hd = document.createElement('p');
hd.style.fontSize = '16pt';
hd.style.padding = '0px';
hd.style.paddingTop = '2px';
hd.style.margin = '0px';
hd.style.color = 'gray';
var logo = document.createElement('img');
logo.setAttribute('border', '0');
logo.setAttribute('align', 'absmiddle');
logo.style.width = '40px';
logo.style.height = '40px';
logo.style.marginRight = '12px';
logo.style.paddingBottom = '4px';
var service = '';
if (editorUi.mode == App.MODE_GOOGLE)
{
logo.src = IMAGE_PATH + '/google-drive-logo.svg';
service = mxResources.get('googleDrive');
if (help != null)
{
help.setAttribute('href', 'https://support.draw.io/display/DO/Using+draw.io+with+Google+Drive');
}
}
else if (editorUi.mode == App.MODE_DROPBOX)
{
logo.src = IMAGE_PATH + '/dropbox-logo.svg';
service = mxResources.get('dropbox');
if (help != null)
{
help.setAttribute('href', 'https://support.draw.io/display/DO/Using+draw.io+with+Dropbox');
}
}
else if (editorUi.mode == App.MODE_ONEDRIVE)
{
logo.src = IMAGE_PATH + '/onedrive-logo.svg';
service = mxResources.get('oneDrive');
if (help != null)
{
help.setAttribute('href', 'https://support.draw.io/display/DO/Using+draw.io+with+OneDrive');
}
}
else if (editorUi.mode == App.MODE_BROWSER)
{
logo.src = IMAGE_PATH + '/osa_database.png';
service = mxResources.get('browser');
}
else
{
logo.src = IMAGE_PATH + '/osa_drive-harddisk.png';
service = mxResources.get('device');
}
hd.appendChild(logo);
mxUtils.write(hd, service);
div.appendChild(hd);
var buttons = document.createElement('div');
if (mxClient.IS_QUIRKS)
{
buttons.style.whiteSpace = 'nowrap';
buttons.style.cssFloat = 'left';
}
buttons.style.border = '1px solid #d3d3d3';
buttons.style.borderWidth = '1px 0px 1px 0px';
buttons.style.padding = '18px 0px 24px 0px';
buttons.style.margin = '4px 0px 0px 0px';
var btn = document.createElement('button');
btn.className = 'geBigButton';
btn.style.marginBottom = '8px';
btn.style.overflow = 'hidden';
btn.style.width = '340px';
if (mxClient.IS_QUIRKS)
{
btn.style.width = '340px';
}
mxUtils.write(btn, mxResources.get('createNewDiagram'));
mxEvent.addListener(btn, 'click', function()
{
editorUi.hideDialog();
editorUi.actions.get('new').funct();
});
buttons.appendChild(btn);
mxUtils.br(buttons);
var btn = document.createElement('button');
btn.className = 'geBigButton';
btn.style.marginBottom = '22px';
btn.style.overflow = 'hidden';
btn.style.width = '340px';
if (mxClient.IS_QUIRKS)
{
btn.style.width = '340px';
}
mxUtils.write(btn, mxResources.get('openExistingDiagram'));
mxEvent.addListener(btn, 'click', function()
{
editorUi.actions.get('open').funct();
});
buttons.appendChild(btn);
var storage = 'undefined';
if (editorUi.mode == App.MODE_GOOGLE)
{
storage = mxResources.get('googleDrive');
}
else if (editorUi.mode == App.MODE_DROPBOX)
{
storage = mxResources.get('dropbox');
}
else if (editorUi.mode == App.MODE_ONEDRIVE)
{
storage = mxResources.get('oneDrive');
}
else if (editorUi.mode == App.MODE_DEVICE)
{
storage = mxResources.get('device');
}
else if (editorUi.mode == App.MODE_BROWSER)
{
storage = mxResources.get('browser');
}
var serviceCount = 0;
if (editorUi.drive != null)
{
serviceCount++
}
if (editorUi.dropbox != null)
{
serviceCount++
}
if (isLocalStorage)
{
serviceCount++
}
if (!mxClient.IS_IOS)
{
serviceCount++
}
if (serviceCount > 1)
{
var link = document.createElement('a');
link.setAttribute('href', 'javascript:void(0)');
link.style.display = 'block';
link.style.marginTop = '6px';
mxUtils.write(link, mxResources.get('notUsingService', [storage]));
mxEvent.addListener(link, 'click', function()
{
editorUi.hideDialog(false);
editorUi.clearMode();
editorUi.showSplash(true);
});
buttons.appendChild(link);
var driveUser = (editorUi.drive != null) ? editorUi.drive.getUser() : null;
if (editorUi.mode == App.MODE_GOOGLE && driveUser != null)
{
btn.style.marginBottom = '24px';
var link = document.createElement('a');
link.setAttribute('href', 'javascript:void(0)');
link.style.display = 'block';
link.style.marginTop = '2px';
mxUtils.write(link, mxResources.get('changeUser') + ' (' + driveUser.displayName + ')');
// Makes room after last big buttons
btn.style.marginBottom = '16px';
buttons.style.paddingBottom = '18px';
mxEvent.addListener(link, 'click', function()
{
editorUi.hideDialog();
editorUi.drive.clearUserId();
editorUi.drive.setUser(null);
gapi.auth.signOut();
// Restores current dialog after clearing user
editorUi.setMode(App.MODE_GOOGLE);
editorUi.hideDialog();
editorUi.showSplash();
// FIXME: Does not force showing the auth dialog if only one user is logged in
editorUi.drive.authorize(false, mxUtils.bind(this, mxUtils.bind(this, function()
{
editorUi.hideDialog();
editorUi.showSplash();
})), mxUtils.bind(this, function(resp)
{
editorUi.handleError(resp, null, function()
{
editorUi.hideDialog();
editorUi.showSplash();
});
}));
});
buttons.appendChild(link);
}
}
div.appendChild(buttons);
// Changes Chrome App dialog
if (mxClient.IS_CHROMEAPP)
{
hd.style.paddingTop = '12px';
hd.innerHTML = '';
mxUtils.write(hd, mxResources.get('chooseAnOption') + ':');
buttons.style.border = 'none';
buttons.style.padding = '16px 0px 0px 0px';
btn.style.marginBottom = '0px';
}
this.init = function()
{
if (editorUi.mode == App.MODE_ONEDRIVE && editorUi.oneDrive != null)
{
var fn = function()
{
var oneDriveUser = editorUi.oneDrive.getUser();
if (oneDriveUser != null)
{
btn.style.marginBottom = '24px';
var link = document.createElement('a');
link.setAttribute('href', 'javascript:void(0)');
link.style.display = 'block';
link.style.marginTop = '2px';
mxUtils.write(link, mxResources.get('changeUser') + ' (' + oneDriveUser.displayName + ')');
// Makes room after last big buttons
btn.style.marginBottom = '16px';
buttons.style.paddingBottom = '18px';
mxEvent.addListener(link, 'click', function()
{
editorUi.oneDrive.logout();
link.parentNode.removeChild(link);
// NOTE: Could use userEvent=true here but it seems the logout
// call is asynchronous and the client isn't fully logged out
// when called immediately so we show the auth dialog to get
// a delay (sometimes event that is not enough so should use
// async callback on logout but that seems to be broken)
editorUi.oneDrive.execute(fn);
});
buttons.appendChild(link);
}
};
editorUi.oneDrive.execute(fn);
}
};
this.container = div;
};
/**
*
*/
var ConfirmDialog = function(editorUi, message, okFn, cancelFn)
{
var div = document.createElement('div');
div.style.textAlign = 'center';
var p2 = document.createElement('div');
p2.style.padding = '6px';
p2.style.overflow = 'auto';
p2.style.maxHeight = '40px';
if (mxClient.IS_QUIRKS)
{
p2.style.height = '60px';
}
mxUtils.write(p2, message);
div.appendChild(p2);
var btns = document.createElement('div');
btns.style.marginTop = '16px';
btns.style.textAlign = 'center';
var cancelBtn = mxUtils.button(mxResources.get('cancel'), function()
{
editorUi.hideDialog();
if (cancelFn != null)
{
cancelFn();
}
});
cancelBtn.className = 'geBtn';
if (editorUi.editor.cancelFirst)
{
btns.appendChild(cancelBtn);
}
var okBtn = mxUtils.button(mxResources.get('ok'), function()
{
editorUi.hideDialog();
if (okFn != null)
{
okFn();
}
});
btns.appendChild(okBtn);
okBtn.className = 'geBtn gePrimaryBtn';
if (!editorUi.editor.cancelFirst)
{
btns.appendChild(cancelBtn);
}
div.appendChild(btns);
this.container = div;
};
/**
*
*/
var ErrorDialog = function(editorUi, title, message, buttonText, fn, retry, buttonText2, fn2, hide)
{
hide = (hide != null) ? hide : true;
var div = document.createElement('div');
div.style.textAlign = 'center';
if (title != null)
{
var hd = document.createElement('div');
hd.style.padding = '0px';
hd.style.margin = '0px';
hd.style.fontSize = '18px';
hd.style.paddingBottom = '16px';
hd.style.marginBottom = '16px';
hd.style.borderBottom = '1px solid #c0c0c0';
hd.style.color = 'gray';
mxUtils.write(hd, title);
div.appendChild(hd);
}
var p2 = document.createElement('div');
p2.style.padding = '6px';
p2.innerHTML = message;
div.appendChild(p2);
var btns = document.createElement('div');
btns.style.marginTop = '16px';
btns.style.textAlign = 'right';
if (retry != null)
{
var retryBtn = mxUtils.button(mxResources.get('tryAgain'), function()
{
editorUi.hideDialog();
retry();
});
retryBtn.className = 'geBtn';
btns.appendChild(retryBtn);
btns.style.textAlign = 'center';
}
var btn = mxUtils.button(buttonText, function()
{
if (hide)
{
editorUi.hideDialog();
}
if (fn != null)
{
fn();
}
});
btn.className = 'geBtn';
btns.appendChild(btn);
if (buttonText2 != null)
{
var mainBtn = mxUtils.button(buttonText2, function()
{
if (hide)
{
editorUi.hideDialog();
}
if (fn2 != null)
{
fn2();
}
});
mainBtn.className = 'geBtn gePrimaryBtn';
btns.appendChild(mainBtn);
}
this.init = function()
{
btn.focus();
};
div.appendChild(btns);
this.container = div;
};
/**
* Constructs a new embed dialog
*/
var EmbedHtmlDialog = function(editorUi)
{
var file = editorUi.getCurrentFile();
var div = document.createElement('div');
var graph = editorUi.editor.graph;
var bounds = graph.getGraphBounds();
var scale = graph.view.scale;
var x0 = Math.floor(bounds.x / scale - graph.view.translate.x);
var y0 = Math.floor(bounds.y / scale - graph.view.translate.y);
mxUtils.write(div, mxResources.get('mainEmbedNotice') + ': ');
mxUtils.br(div);
var textarea = document.createElement('textarea');
textarea.style.marginTop = '6px';
textarea.style.width = '550px';
textarea.style.height = '160px';
textarea.style.marginBottom = '10px';
textarea.style.resize = 'none';
div.appendChild(textarea);
mxUtils.br(div);
mxUtils.write(div, mxResources.get('embedNotice') + ': ');
mxUtils.br(div);
var textarea2 = document.createElement('textarea');
textarea2.style.marginTop = '6px';
textarea2.style.width = '550px';
textarea2.style.height = '20px';
textarea2.style.resize = 'none';
textarea2.style.marginBottom = '10px';
div.appendChild(textarea2);
mxUtils.br(div);
mxUtils.write(div, mxResources.get('publicDiagramUrl') + ': ');
var urlInput = document.createElement('input');
urlInput.setAttribute('type', 'text');
urlInput.setAttribute('size', '28');
urlInput.style.width = '340px';
urlInput.style.marginBottom = '8px';
div.appendChild(urlInput);
mxUtils.br(div);
var options = document.createElement('div');
options.style.paddingTop = '10px';
options.style.textAlign = 'center';
var fitCheckBox = document.createElement('input');
fitCheckBox.setAttribute('type', 'checkbox');
fitCheckBox.setAttribute('checked', 'checked');
fitCheckBox.defaultChecked = true;
options.appendChild(fitCheckBox);
mxUtils.write(options, mxResources.get('fit'));
var label = document.createElement('span');
label.style.marginLeft = '10px';
mxUtils.write(label, mxResources.get('zoom') + ': ');
options.appendChild(label);
var zoomInput = document.createElement('input');
zoomInput.setAttribute('type', 'text');
zoomInput.setAttribute('size', '4');
zoomInput.style.width = '40px';
zoomInput.value = '100%';
options.appendChild(zoomInput);
var label = document.createElement('span');
label.style.marginLeft = '10px';
mxUtils.write(label, mxResources.get('link') + ': ');
options.appendChild(label);
var borderColorInput = document.createElement('input');
borderColorInput.setAttribute('type', 'text');
borderColorInput.setAttribute('size', '8');
borderColorInput.style.width = '50px';
borderColorInput.value = '#0000ff';
options.appendChild(borderColorInput);
mxUtils.br(options);
var lightboxCheckBox = document.createElement('input');
lightboxCheckBox.setAttribute('type', 'checkbox');
lightboxCheckBox.setAttribute('checked', 'checked');
lightboxCheckBox.defaultChecked = true;
lightboxCheckBox.style.marginTop = '14px';
options.appendChild(lightboxCheckBox);
mxUtils.write(options, mxResources.get('lightbox'));
var editCheckBox = document.createElement('input');
editCheckBox.setAttribute('type', 'checkbox');
editCheckBox.setAttribute('checked', 'checked');
editCheckBox.defaultChecked = true;
editCheckBox.style.marginLeft = '10px';
//options.appendChild(editCheckBox);
//mxUtils.write(options, mxResources.get('edit'));
var layersCheckBox = document.createElement('input');
layersCheckBox.setAttribute('type', 'checkbox');
layersCheckBox.style.marginLeft = '10px';
var model = editorUi.editor.graph.getModel();
if (editorUi.pages == null || editorUi.pages.length == 0 &&
(model.getChildCount(model.getRoot()) <= 1))
{
layersCheckBox.setAttribute('disabled', 'disabled');
}
else
{
layersCheckBox.setAttribute('checked', 'checked');
layersCheckBox.defaultChecked = true;
}
options.appendChild(layersCheckBox);
mxUtils.write(options, mxResources.get('layers'));
var zoomCheckBox = document.createElement('input');
zoomCheckBox.setAttribute('type', 'checkbox');
zoomCheckBox.style.marginLeft = '10px';
options.appendChild(zoomCheckBox);
mxUtils.write(options, mxResources.get('zoom'));
zoomCheckBox.setAttribute('checked', 'checked');
zoomCheckBox.defaultChecked = true;
var pagesCheckBox = document.createElement('input');
pagesCheckBox.setAttribute('type', 'checkbox');
pagesCheckBox.style.marginLeft = '10px';
if (editorUi.pages != null && editorUi.pages.length > 1)
{
pagesCheckBox.setAttribute('checked', 'checked');
pagesCheckBox.defaultChecked = true;
options.appendChild(pagesCheckBox);
}
mxUtils.write(options, mxResources.get('allPages'));
div.appendChild(options);
function update(force)
{
var s = [];
// Scans shapes for stencils
var stencilNames = new Object();
var states = graph.view.states.getValues();
function addName(name)
{
if (name != null)
{
var dot = name.lastIndexOf('.');
if (dot > 0)
{
name = name.substring(dot + 1, name.length);
}
if (stencilNames[name] == null)
{
stencilNames[name] = true;
s.push(name);
}
}
}
for (var i = 0; i < states.length; i++)
{
var state = states[i];
var shape = state.style[mxConstants.STYLE_SHAPE];
addName(mxStencilRegistry.getBasenameForStencil(shape));
// Adds package names for markers in edges
if (state.view.graph.model.isEdge(state.cell))
{
addName(mxMarker.getPackageForType(state.style[mxConstants.STYLE_STARTARROW]));
addName(mxMarker.getPackageForType(state.style[mxConstants.STYLE_ENDARROW]));
}
}
var data = {};
if (borderColorInput.value != '' && borderColorInput.value != mxConstants.NONE)
{
data.highlight = borderColorInput.value;
}
if (!lightboxCheckBox.checked)
{
data.lightbox = false;
}
data.nav = graph.foldingEnabled;
var zoom = parseInt(zoomInput.value);
if (!isNaN(zoom) && zoom != 100)
{
data.zoom = zoom / 100;
}
var tb = [];
if (pagesCheckBox.checked)
{
tb.push('pages');
data.resize = true;
if (editorUi.pages != null && editorUi.currentPage != null)
{
data.page = mxUtils.indexOf(editorUi.pages, editorUi.currentPage);
}
}
if (zoomCheckBox.checked)
{
tb.push('zoom');
data.resize = true;
}
if (layersCheckBox.checked)
{
tb.push('layers');
}
if (tb.length > 0)
{
if (lightboxCheckBox)
{
tb.push('lightbox');
}
data.toolbar = tb.join(' ');
}
if (editCheckBox.checked)
{
if (urlInput.value != '')
{
data.edit = urlInput.value;
}
else
{
data.edit = '_blank';
}
}
if (urlInput.value != '')
{
data.url = urlInput.value;
}
else
{
data.xml = editorUi.getFileData(true, null, null, null, null, !pagesCheckBox.checked);
}
textarea.value = '