Browse Source

6.7.11 release

Former-commit-id: 6b380bf3d9ca283d5281569f7afe6d403b0571d7
Gaudenz Alder 8 years ago
parent
commit
783276366d

+ 8 - 0
ChangeLog

@@ -1,3 +1,11 @@
+13-JUN-2017: 6.7.11
+
+- Fixes possible NPE in DriveFile
+- Fixes Document Read-Only error in Google Drive
+- Fixes OneDrive button in LinkDialog
+- Adds more UML relation notations
+- Inserts custom libraries after scratchpad
+
 12-JUN-2017: 6.7.10
 
 - Fixes Java compliance issue in Gliffy import

+ 1 - 1
VERSION

@@ -1 +1 @@
-6.7.10
+6.7.11

+ 2 - 2
src/com/mxgraph/io/gliffy/model/GliffyObject.java

@@ -351,7 +351,7 @@ public class GliffyObject implements PostDeserializable
 				child.x += -xMin;
 		}
 
-		//sorts the list to find the leftmost child and it's Y
+		//sorts the list to find the uppermost child and it's Y
 		Comparator<GliffyObject> cy = new Comparator<GliffyObject>()
 		{
 			@Override
@@ -361,7 +361,7 @@ public class GliffyObject implements PostDeserializable
 			}
 		};
 
-		children.sort(cy);
+		Collections.sort(children, cy);
 		float yMin = children.get(0).y;
 
 		if (yMin < 0)

+ 9 - 2
src/com/mxgraph/io/vsdx/VsdxShape.java

@@ -119,8 +119,15 @@ public class VsdxShape extends Shape
 			mxResources.add("com/mxgraph/io/vdx/resources/edgeNameU");
 			mxResources.add("com/mxgraph/io/vdx/resources/nameU");
 			
-			DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
-			docBuilder = docFactory.newDocumentBuilder();
+			DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+
+			dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
+			dbf.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
+			dbf.setFeature("http://xml.org/sax/features/external-general-entities", false);
+			dbf.setExpandEntityReferences(false);
+			dbf.setXIncludeAware(false);
+			
+			docBuilder = dbf.newDocumentBuilder();
 		}
 		catch (Exception e)
 		{

+ 9 - 3
src/com/mxgraph/io/vsdx/export/mxVsdxExporter.java

@@ -256,9 +256,15 @@ public class mxVsdxExporter
 		{
 		    ZipOutputStream zip = new ZipOutputStream(out);
 		    
-			DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory
-					.newInstance();
-			DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
+			DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+
+			dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
+			dbf.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
+			dbf.setFeature("http://xml.org/sax/features/external-general-entities", false);
+			dbf.setExpandEntityReferences(false);
+			dbf.setXIncludeAware(false);
+			
+			DocumentBuilder docBuilder = dbf.newDocumentBuilder();
 	        
 			LinkedHashMap<String, Document> pages = new LinkedHashMap<>();
 			LinkedHashMap<String, ModelExtAttrib> modelsAttr = new LinkedHashMap<>();

+ 1 - 1
war/WEB-INF/appengine-web.xml

@@ -2,7 +2,7 @@
 <appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
 	<application>drawdotio</application>
 	<!-- IMPORTANT! DO NOT CHANGE THIS VALUE IN SOURCE CONTROL! -->
-	<version>6-7-10</version>
+	<version>test</version>
 	
 	<!-- Configure java.util.logging -->
 	<system-properties>

BIN
war/WEB-INF/lib/mxgraph-core.jar


+ 1 - 1
war/cache.manifest

@@ -1,7 +1,7 @@
 CACHE MANIFEST
 
 # THIS FILE WAS GENERATED. DO NOT MODIFY!
-# 06/12/2017 02:42 PM
+# 06/13/2017 03:41 PM
 
 app.html
 index.html?offline=1

+ 186 - 0
war/electron.js

@@ -0,0 +1,186 @@
+const fs = require('fs')
+const path = require('path')
+const url = require('url')
+const electron = require('electron')
+const ipcMain = electron.ipcMain
+const dialog = electron.dialog
+const app = electron.app
+const BrowserWindow = electron.BrowserWindow
+
+const autoUpdater = require('electron-updater').autoUpdater
+const log = require('electron-log')
+autoUpdater.logger = log
+autoUpdater.logger.transports.file.level = 'info'
+// autoUpdater.autoDownload = false
+autoUpdater.autoDownload = true
+
+const __DEV__ = process.env.NODE_ENV === 'development'
+
+let windowsRegistry = []
+
+function createWindow (opt = {}) {
+	let options = Object.assign({
+		width: 1600,
+		height: 1200,
+		'web-security': false,
+		webPreferences: {
+			// preload: path.resolve('./preload.js'),
+		},
+	}, opt)
+
+	let mainWindow = new BrowserWindow(options)
+	windowsRegistry.push(mainWindow)
+
+	console.log('createWindow', opt)
+
+	let wurl = url.format({
+		pathname: `${__dirname}/index.html`,
+		protocol: 'file:',
+		query: {
+			'dev': __DEV__ ? 1 : 0,
+			'test': 1,
+			'db': 0,
+			'gapi': 0,
+			'od': 0,
+			'gh': 0,
+			'analytics': 0,
+			'picker': 0,
+			'mode': 'device',
+			'browser': 0,
+			'p': 'electron',
+		},
+		slashes: true,
+	})
+
+//`file://${__dirname}/index.html?dev=1&test=1&db=0&gapi=0&od=0&analytics=0&picker=0&mode=device&browser=0&p=electron`
+	// and load the index.html of the app.
+	mainWindow.loadURL(wurl)
+
+	// Open the DevTools.
+	mainWindow.webContents.openDevTools()
+
+	mainWindow.on('close', (event/*:WindowEvent*/) => {
+		const win = event.sender
+		const index = windowsRegistry.indexOf(win)
+		console.log('Window on close idx:%d', index)
+		const contents = win.webContents
+		if (contents != null) {
+			contents.executeJavaScript(`global.__emt_isModified()`, true,
+				isModified => {
+					console.log('__emt_isModified', isModified)
+					if (isModified) {
+						var choice = dialog.showMessageBox(
+							win,
+							{
+								type: 'question',
+								buttons: ['Cancel', 'Discard Changes'],
+								title: 'Confirm',
+								message: 'The document has unsaved changes. Do you really want to quit without saving?' //mxResources.get('allChangesLost')
+							})
+						if (choice === 1) {
+							win.destroy()
+						}
+					} else {
+						win.destroy()
+					}
+				})
+			event.preventDefault()
+		}
+	})
+
+	// Emitted when the window is closed.
+	mainWindow.on('closed', (event/*:WindowEvent*/) => {
+		const index = windowsRegistry.indexOf(event.sender)
+		console.log('Window closed idx:%d', index)
+		windowsRegistry.splice(index, 1)
+	})
+
+	return mainWindow.id
+}
+
+// This method will be called when Electron has finished
+// initialization and is ready to create browser windows.
+// Some APIs can only be used after this event occurs.
+app.on('ready', e => {
+	//asynchronous
+	ipcMain.on('asynchronous-message', (event, arg) => {
+		console.log(arg)  // prints "ping"
+		event.sender.send('asynchronous-reply', 'pong')
+	})
+	//synchronous
+	ipcMain.on('winman', (event, arg) => {
+		console.log('ipcMain.on winman', arg)
+		if (arg.action === 'newfile') {
+			event.returnValue = createWindow(arg.opt)
+			return
+		}
+		event.returnValue = 'pong'
+	})
+	createWindow()
+	// checkUpdate()
+	if (!__DEV__)
+	{
+		autoUpdater.checkForUpdates()
+	}
+})
+
+// Quit when all windows are closed.
+app.on('window-all-closed', function () {
+	console.log('window-all-closed', windowsRegistry.length)
+	// On OS X it is common for applications and their menu bar
+	// to stay active until the user quits explicitly with Cmd + Q
+	if (process.platform !== 'darwin') {
+		app.quit()
+	}
+})
+
+app.on('activate', function () {
+	console.log('app on activate', windowsRegistry.length)
+	// On OS X it's common to re-create a window in the app when the
+	// dock icon is clicked and there are no other windows open.
+	if (windowsRegistry.length === 0) {
+		createWindow()
+	}
+})
+
+function checkUpdate () {
+	autoUpdater.checkForUpdates().then(UpdateCheckResult => {
+		if (UpdateCheckResult) {
+			let idx = dialog.showMessageBox({
+				type: 'question',
+				buttons: ['Ok', 'Cancel'],
+				title: 'Confirm Update',
+				message: 'Update available.\n\nWould you like to download and install new version?',
+				detail: 'Application will automatically restart to apply update after download',
+			})
+			if (idx === 0) return autoUpdater.downloadUpdate()
+		}
+	}).then((a, b) => {
+		log.info('@cfu update-downloaded@\n', a, b)
+	}).catch(e => {
+		log.error('@cfu then error@\n', e)
+	})
+}
+
+autoUpdater.on('error', e => log.error('@error@\n', e))
+
+autoUpdater.on('update-available',
+	(a, b) => log.info('@update-available@\n', a, b))
+
+/**/
+autoUpdater.on('update-downloaded', (event, info) => {
+	log.info('@update-downloaded@\n', info, event)
+	// Ask user to update the app
+	dialog.showMessageBox({
+		type: 'question',
+		buttons: ['Install and Relaunch', 'Later'],
+		defaultId: 0,
+		message: 'A new version of ' + app.getName() + ' has been downloaded',
+		detail: 'It will be installed the next time you restart the application',
+	}, response => {
+		if (response === 0) {
+			setTimeout(() => autoUpdater.quitAndInstall(), 1)
+		}
+	})
+})
+/**/

File diff suppressed because it is too large
+ 63 - 62
war/js/app.min.js


File diff suppressed because it is too large
+ 44 - 44
war/js/atlas-viewer.min.js


File diff suppressed because it is too large
+ 60 - 59
war/js/atlas.min.js


+ 9 - 15
war/js/diagramly/Dialogs.js

@@ -3950,6 +3950,7 @@ var LinkDialog = function(editorUi, initialValue, btnLabel, fn, showPages)
     		}
     		
     		linkInput.value = href;
+    		linkInput.focus();
         }
 		else
 		{
@@ -4043,29 +4044,21 @@ var LinkDialog = function(editorUi, initialValue, btnLabel, fn, showPages)
 				success : function(files)
 				{
 					linkInput.value = files[0].link;
+					linkInput.focus();
 				}
 			});
 		});
 	}
 	
-	if (typeof(WL) != 'undefined' && typeof(WL.fileDialog) != 'undefined' && editorUi.oneDrive != null)
+	if (editorUi.oneDrive != null)
 	{
 		addButton(IMAGE_PATH + '/onedrive-logo.svg', mxResources.get('oneDrive'), function()
 		{
-		    WL.fileDialog(
-	        {
-	            mode: 'open',
-	            select: 'single'
-	        }).then(
-	            function (resp)
-	            {
-	            	if (resp != null && resp.data != null && resp.data.files != null && resp.data.files.length > 0)
-	            	{
-            			linkInput.value = resp.data.files[0].link;
-	            	}
-	            },
-	            function (responseFailed) {}
-	        );
+			editorUi.oneDrive.pickFile(function(files)
+			{
+				linkInput.value = files.value[0].webUrl;
+				linkInput.focus();
+			}, true);
 		});
 	}
 	
@@ -4085,6 +4078,7 @@ var LinkDialog = function(editorUi, initialValue, btnLabel, fn, showPages)
 					
 					linkInput.value = 'https://github.com/' + org + '/' +
 						repo + '/blob/' + ref + '/' + path;
+					linkInput.focus();
 				}
 			});
 		});

+ 1 - 1
war/js/diagramly/DriveFile.js

@@ -52,7 +52,7 @@ DriveFile.prototype.getPublicUrl = function(fn)
 		'fileId': this.desc.id
 	}).execute(mxUtils.bind(this, function(resp)
 	{
-		if (resp != null)
+		if (resp != null && resp.items != null)
 		{
 			for (var i = 0; i < resp.items.length; i++)
 			{

+ 9 - 4
war/js/diagramly/DriveRealtime.js

@@ -345,13 +345,18 @@ DriveRealtime.prototype.start = function()
 			var page = new DiagramPage(node);
 			page.mapping = new RealtimeMapping(this, diagramMap, page);
 			
-			if (this.file.isEditable() && !page.mapping.diagramMap.has('name'))
+			if (this.file.isEditable() && !diagramMap.has('name'))
+			{
+				diagramMap.set('name', mxResources.get('pageWithNumber', [i + 1]));
+			}
+			
+			page.setName(diagramMap.get('name') || mxResources.get('pageWithNumber', [i + 1]));
+			
+			if (this.file.isEditable() && !diagramMap.has('id'))
 			{
-				page.mapping.diagramMap.set('name', mxResources.get('pageWithNumber', [i + 1]));
+				diagramMap.set('id', page.getId());
 			}
 			
-			page.setName(page.mapping.diagramMap.get('name') || mxResources.get('pageWithNumber', [i + 1]));
-			diagramMap.set('id', page.getId());
 			this.ui.pages.push(page);
 		}
 

+ 16 - 0
war/js/diagramly/EditorUi.js

@@ -1511,6 +1511,22 @@
 	EditorUi.prototype.repositionLibrary = function(nextChild) 
 	{
 	    var c = this.sidebar.container;
+	    
+	    if (nextChild == null)
+	    {
+	    	var elts = this.sidebar.palettes['L.scratchpad'];
+	    	
+	    	if (elts == null)
+	    	{
+	    		elts = this.sidebar.palettes['search'];
+	    	}
+	    	
+	    	if (elts != null)
+	    	{
+	    		nextChild = elts[elts.length - 1].nextSibling;
+	    	}
+	    }
+	    
 		nextChild = (nextChild != null) ? nextChild : c.firstChild.nextSibling.nextSibling;
 		
 		var content = c.lastChild;

+ 2 - 2
war/js/diagramly/OneDriveClient.js

@@ -676,7 +676,7 @@ OneDriveClient.prototype.pickFolder = function(fn)
 /**
  * Checks if the client is authorized and calls the next step.
  */
-OneDriveClient.prototype.pickFile = function(fn)
+OneDriveClient.prototype.pickFile = function(fn, returnObject)
 {
 	fn = (fn != null) ? fn : mxUtils.bind(this, function(id)
 	{
@@ -696,7 +696,7 @@ OneDriveClient.prototype.pickFile = function(fn)
 		{
 			if (files != null && files.value != null && files.value.length > 0)
 			{
-				fn(files.value[0].id);
+				fn((returnObject) ? files : files.value[0].id);
 			}
 		},
 		cancel: function()

File diff suppressed because it is too large
+ 1 - 1
war/js/embed-static.min.js


+ 7 - 3
war/js/mxgraph/Sidebar.js

@@ -1525,7 +1525,7 @@ Sidebar.prototype.addUmlPalette = function(expand)
 			edge.geometry.y = 3;
 			edge.edge = true;
 		
-			return sb.createEdgeTemplateFromCells([edge], 160, 0, 'Aggregation');
+			return sb.createEdgeTemplateFromCells([edge], 160, 0, 'Aggregation 1');
 		}),
 		this.addEntry('uml composition', function()
 		{
@@ -1537,7 +1537,7 @@ Sidebar.prototype.addUmlPalette = function(expand)
 			edge.geometry.y = 3;
 			edge.edge = true;
 			
-			return sb.createEdgeTemplateFromCells([edge], 160, 0, 'Composition');
+			return sb.createEdgeTemplateFromCells([edge], 160, 0, 'Composition 1');
 		}),
 		this.addEntry('uml relation', function()
 		{
@@ -1565,7 +1565,11 @@ Sidebar.prototype.addUmlPalette = function(expand)
 		this.createEdgeTemplateEntry('endArrow=block;endSize=16;endFill=0;html=1;', 160, 0, 'Extends', 'Generalization', null, 'uml generalization extend'),
 	 	this.createEdgeTemplateEntry('endArrow=block;startArrow=block;endFill=1;startFill=1;html=1;', 160, 0, '', 'Association 2', null, 'uml association'),
 	 	this.createEdgeTemplateEntry('endArrow=open;startArrow=circlePlus;endFill=0;startFill=0;endSize=8;html=1;', 160, 0, '', 'Inner Class', null, 'inner class'),
-	 	this.createEdgeTemplateEntry('endArrow=open;startArrow=cross;endFill=0;startFill=0;endSize=8;startSize=10;html=1;', 160, 0, '', 'Terminate', null, 'terminate')
+	 	this.createEdgeTemplateEntry('endArrow=open;startArrow=cross;endFill=0;startFill=0;endSize=8;startSize=10;html=1;', 160, 0, '', 'Terminate', null, 'terminate'),
+	 	this.createEdgeTemplateEntry('endArrow=block;dashed=1;endFill=0;endSize=12;html=1;', 160, 0, '', 'Implementation', null, 'realization implementation'),
+	 	this.createEdgeTemplateEntry('endArrow=diamondThin;endFill=0;endSize=24;html=1;', 160, 0, '', 'Aggregation 2', null, 'aggregation'),
+	 	this.createEdgeTemplateEntry('endArrow=diamondThin;endFill=1;endSize=24;html=1;', 160, 0, '', 'Composition 2', null, 'composition'),
+	 	this.createEdgeTemplateEntry('endArrow=open;endFill=1;endSize=12;html=1;', 160, 0, '', 'Association 3', null, 'association')
 	];
 	
 	this.addPaletteFunctions('uml', mxResources.get('uml'), expand || false, fns);

File diff suppressed because it is too large
+ 1 - 1
war/js/reader.min.js


File diff suppressed because it is too large
+ 44 - 44
war/js/viewer.min.js


+ 1 - 1
war/resources/dia_de.txt

@@ -387,7 +387,7 @@ left=Links
 leftAlign=Links
 leftToRight=Von links nach rechts
 libraryTooltip=Objekte per Drag und Drop oder durck Klicken auf + hier einfügen. Doppelklicken zum Bearbeiten.
-lightbox=Lightbox
+lightbox=Vollbildansicht
 line=Linie
 lineend=Linienende
 lineheight=Zeilenhöhe