diff --git a/ChangeLog b/ChangeLog index c9a91426..e7854de3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +31-MAR-2018: 8.5.2 + +- Add mass gliffy import in Confluence Cloud +- Fixes importing Gliffy sitemap stencils +- Adds workaround for Confluence Cloud saveMacro problem + +28-MAR-2018: 8.5.1 + +- Confluence Cloud integration improvements + 23-MAR-2018: 8.5.0 - Adds shapes in Basic sidebar diff --git a/VERSION b/VERSION index 5eaed3b7..bd0b85a9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.5.0 \ No newline at end of file +8.5.2 \ No newline at end of file diff --git a/src/main/java/com/mxgraph/io/gliffy/model/GliffyObject.java b/src/main/java/com/mxgraph/io/gliffy/model/GliffyObject.java index 31fc60fc..16b1f5b6 100644 --- a/src/main/java/com/mxgraph/io/gliffy/model/GliffyObject.java +++ b/src/main/java/com/mxgraph/io/gliffy/model/GliffyObject.java @@ -121,9 +121,32 @@ public class GliffyObject implements PostDeserializable GRAPHICLESS_SHAPES.add("com.gliffy.shape.sitemap.sitemap_v2.home"); GRAPHICLESS_SHAPES.add("com.gliffy.shape.sitemap.sitemap_v2.gliffy"); GRAPHICLESS_SHAPES.add("com.gliffy.shape.sitemap.sitemap_v2.form"); + GRAPHICLESS_SHAPES.add("com.gliffy.shape.sitemap.sitemap_v2.shopping_cart"); + GRAPHICLESS_SHAPES.add("com.gliffy.shape.sitemap.sitemap_v2.text"); + GRAPHICLESS_SHAPES.add("com.gliffy.shape.sitemap.sitemap_v2.video"); + GRAPHICLESS_SHAPES.add("com.gliffy.shape.sitemap.sitemap_v2.upload"); + GRAPHICLESS_SHAPES.add("com.gliffy.shape.sitemap.sitemap_v2.slideshow"); + GRAPHICLESS_SHAPES.add("com.gliffy.shape.sitemap.sitemap_v2.sitemap"); + GRAPHICLESS_SHAPES.add("com.gliffy.shape.sitemap.sitemap_v2.settings"); + GRAPHICLESS_SHAPES.add("com.gliffy.shape.sitemap.sitemap_v2.search"); + GRAPHICLESS_SHAPES.add("com.gliffy.shape.sitemap.sitemap_v2.script"); + GRAPHICLESS_SHAPES.add("com.gliffy.shape.sitemap.sitemap_v2.print"); + GRAPHICLESS_SHAPES.add("com.gliffy.shape.sitemap.sitemap_v2.pricing"); + GRAPHICLESS_SHAPES.add("com.gliffy.shape.sitemap.sitemap_v2.photo"); + GRAPHICLESS_SHAPES.add("com.gliffy.shape.sitemap.sitemap_v2.map"); + GRAPHICLESS_SHAPES.add("com.gliffy.shape.sitemap.sitemap_v2.login"); + GRAPHICLESS_SHAPES.add("com.gliffy.shape.sitemap.sitemap_v2.game"); + GRAPHICLESS_SHAPES.add("com.gliffy.shape.sitemap.sitemap_v2.gallery"); + GRAPHICLESS_SHAPES.add("com.gliffy.shape.sitemap.sitemap_v2.download"); + GRAPHICLESS_SHAPES.add("com.gliffy.shape.sitemap.sitemap_v2.document"); + GRAPHICLESS_SHAPES.add("com.gliffy.shape.sitemap.sitemap_v2.chat"); + GRAPHICLESS_SHAPES.add("com.gliffy.shape.sitemap.sitemap_v2.calendar"); + GRAPHICLESS_SHAPES.add("com.gliffy.shape.sitemap.sitemap_v2.audio"); + GRAPHICLESS_SHAPES.add("com.gliffy.shape.sitemap.sitemap_v2.profile"); + GRAPHICLESS_SHAPES.add("com.gliffy.shape.sitemap.sitemap_v2.error"); + GRAPHICLESS_SHAPES.add("com.gliffy.shape.sitemap.sitemap_v2.success"); + GRAPHICLESS_SHAPES.add("com.gliffy.shape.sitemap.sitemap_v2.cloud"); - /*GRAPHICLESS_SHAPES.add("com.gliffy.shape.sitemap.sitemap_v2.page"); - */ GROUP_SHAPES.add("com.gliffy.shape.basic.basic_v1.default.group"); GROUP_SHAPES.add("com.gliffy.shape.erd.erd_v1.default.entity_with_attributes"); diff --git a/src/main/webapp/cache.manifest b/src/main/webapp/cache.manifest index 73a03cc8..5460179f 100644 --- a/src/main/webapp/cache.manifest +++ b/src/main/webapp/cache.manifest @@ -1,7 +1,7 @@ CACHE MANIFEST # THIS FILE WAS GENERATED. DO NOT MODIFY! -# 03/23/2018 11:58 AM +# 03/31/2018 02:35 PM app.html index.html?offline=1 diff --git a/src/main/webapp/connect/confluence/connect-dev.json b/src/main/webapp/connect/confluence/connect-dev.json deleted file mode 100644 index c4fa7ff5..00000000 --- a/src/main/webapp/connect/confluence/connect-dev.json +++ /dev/null @@ -1,270 +0,0 @@ -{ - "name": "Draw.io gaudenz", - "description": "Draw.io add-on for Confluence", - "key": "com.mxgraph.confluence.plugins.diagramly", - "baseUrl": "https://bb63834e.ngrok.io", - "vendor": - { - "name": "JGraph Ltd.", - "url": "https://www.jgraph.com" - }, - "links": { - "documentation": "https://support.draw.io/display/DFCC/draw.io+for+Confluence+Cloud" - }, - "version": "1.4.8", - "authentication": - { - "type": "none" - }, - "modules": - { - "generalPages": [ - { - "key": "lightbox", - "url": "/connect/confluence/viewer-1-4-8.html?lightbox=1", - "name": { - "value": "Lightbox" - } - }, - { - "key": "customContentViewer", - "url": "/connect/confluence/viewer-1-4-8.html?custom=1&contentId={content.id}", - "name": { - "value": "Draw.io Viewer" - } - } - ], - "customContent": [{ - "key": "drawio-diagram", - "name": { - "value": "Draw.io Diagrams" - }, - "uiSupport": { - "contentViewComponent": { - "moduleKey": "customContentViewer" - }, - "icons": { - "item": { - "url": "/images/drawlogo48.png" - } - } - }, - "apiSupport": { - "supportedContainerTypes": ["page", "comment", "space", "blogpost"], - "supportedChildTypes": ["attachment"], - "indexing": { - "enabled": true - } - } - } - ], - "dynamicContentMacros": - [ - { - "name": - { - "i18n": "drawioMacro", - "value": "Draw.io Diagram" - }, - "url": "/connect/confluence/viewer-1-4-8.html?ceoId=${page.id}&diagramName=${diagramName}&revision=${revision}&width=${width}&height=${height}&tbstyle=${tbstyle}&lbox=${lbox}&zoom=${zoom}&links=${links}&owningPageId=${pageId}", - "width": "100%", - "description": - { - "i18n": "description", - "value": "Inserts a new Draw.io Diagram" - }, "icon": - { - "width": 128, - "height": 128, - "url": "/images/drawlogo128.png" - }, - "categories": [ - "visuals" - ], - "outputType": "block", - "featured": true, - "key": "drawio", - "parameters": - [ - { - "identifier": "diagramName", - "name": - { - "value": "Diagram name (do not change)" - }, - "type": "string" - }, - { - "identifier": "autoSize", - "name": - { - "value": "automatic size" - }, - "type": "boolean" - }, - { - "identifier": "PageId", - "name": - { - "value": "Parent page ID" - }, - "type": "string" - }, - { - "identifier": "baseUrl", - "name": - { - "value": "Confluence Base URL" - }, - "type": "string" - }, - { - "identifier": "width", - "name": - { - "value": "Diagram width" - }, - "type": "string" - }, - { - "identifier": "height", - "name": - { - "value": "Diagram Height" - }, - "type": "string" - } - ], - "editor": { - "url": "/connect/confluence/macroEditor-1-4-8.html?ceoId=${page.id}&diagramName=${diagramName}", - "width": "100%", - "height": "100%", - "editTitle": - { - "value" : "--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------" - }, - "insertTitle": - { - "value" : "--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------" - } - }, - "imagePlaceholder": { - "width": 500, - "height": 300, - "url": "/connectImage", - "applyChrome": false - }, - "renderModes": { - "default": { - "url": "/connectRender?pageId=${page.id}&diagramName=${diagramName}" - } - } - }, - { - "name": - { - "i18n": "drawioMacro", - "value": "Legacy macro - do not use" - }, - "url": "/connect/confluence/viewer.html?ceoId=${page.id}&diagramName=${diagramName}&revision=${revision}&width=${width}&height=${height}", - "width": "100%", - "description": - { - "i18n": "description", - "value": "Do not use" - }, "icon": - { - "width": 80, - "height": 80, - "url": "/images/stop-flat-icon-80.png" - }, - "categories": [ - "visuals" - ], - "outputType": "block", - "featured": false, - "key": "drawio-macro", - "parameters": - [ - { - "identifier": "diagramName", - "name": - { - "value": "Diagram name (do not change)" - }, - "type": "string" - }, - { - "identifier": "autoSize", - "name": - { - "value": "automatic size" - }, - "type": "boolean" - }, - { - "identifier": "PageId", - "name": - { - "value": "Parent page ID" - }, - "type": "string" - }, - { - "identifier": "baseUrl", - "name": - { - "value": "Confluence Base URL" - }, - "type": "string" - }, - { - "identifier": "width", - "name": - { - "value": "Diagram width" - }, - "type": "string" - }, - { - "identifier": "height", - "name": - { - "value": "Diagram Height" - }, - "type": "string" - } - ], - "editor": { - "url": "/connect/confluence/macroEditor.html?ceoId=${page.id}&diagramName=${diagramName}", - "editTitle": { - "value": "Edit MarkDown", - "i18n": "macro.md.edit" - }, - "insertTitle": { - "value": "Insert New MarkDown", - "i18n": "macro.md.insert" - }, - "width": "100%", - "height": "100%" - }, - "imagePlaceholder": { - "width": 500, - "height": 300, - "url": "/connectImage", - "applyChrome": true - }, - "renderModes": { - "default": { - "url": "/connectRender?pageId=${page.id}&diagramName=${diagramName}&revision=${revision}" - } - } - } - ] - }, - "scopes": [ - "read", - "write", - "delete" - ] -} \ No newline at end of file diff --git a/src/main/webapp/connect/confluence/connect.json b/src/main/webapp/connect/confluence/connect.json index 4c698cec..2751c51d 100644 --- a/src/main/webapp/connect/confluence/connect.json +++ b/src/main/webapp/connect/confluence/connect.json @@ -19,6 +19,15 @@ }, "modules": { + "adminPages": [ + { + "key": "gliffyImport", + "url": "/connect/confluence/admin.html", + "name": { + "value": "Gliffy - draw.io Conversion" + } + } + ], "generalPages": [ { "key": "lightbox", diff --git a/src/main/webapp/connect/confluence/connectUtils-1-4-8.js b/src/main/webapp/connect/confluence/connectUtils-1-4-8.js index eec19263..4543d009 100644 --- a/src/main/webapp/connect/confluence/connectUtils-1-4-8.js +++ b/src/main/webapp/connect/confluence/connectUtils-1-4-8.js @@ -1172,15 +1172,103 @@ AC.init = function(baseUrl, location, pageId, editor, diagramName, initialXml, d }); }; -AC.loadDiagram = function (pageId, diagramName, revision, success, error, owningPageId, tryRev1) { +AC.loadDiagram = function (pageId, diagramName, revision, success, error, owningPageId, tryRev1, dontCheckVer) { // TODO: Get binary - AP.require('request', function(request) { + AP.require(['request', 'confluence'], function(request, confluence) { + //Confirm that the macro is in sync with the diagram + //Sometimes the diagram is saved but the macro is not updated + var attInfo = null; + var pageInfo = null; + + function confirmDiagramInSync() + { + if (attInfo == null || pageInfo == null) + return; + + //TODO is this condition enough or we need to check timestamps also? + if (attInfo.version.number > revision + && (pageInfo.version.message == null || pageInfo.version.message.indexOf("Reverted") < 0)) + { + AC.loadDiagram(pageId, diagramName, attInfo.version.number, success, error, owningPageId, tryRev1, true); + //Update the macro + //Custom Content version will be fixed on next save, this will not affect correctness + confluence.getMacroData(function (macroData) + { + if (macroData != null) + { + confluence.saveMacro( + { + diagramName: macroData.diagramName, + revision: attInfo.version.number, + pageId: macroData.pageId, + contentId: macroData.contentId, + contentVer: macroData.contentVer, + baseUrl: macroData.baseUrl, + width: macroData.width, + height: macroData.height, + tbstyle: macroData.tbstyle, + links: macroData.links, + lbox: macroData.lbox != null ? macroData.lbox : '1', + zoom: macroData.zoom != null ? macroData.zoom : '1' + }); + } + }); + } + } + + //To avoid race we do the version check after loading the diagram in the macro + var localSuccess = function() + { + success.apply(this, arguments); + + if (!dontCheckVer && revision != null) + { + request({ + type: 'GET', + url: '/rest/api/content/' + pageId + '?expand=version', + contentType: 'application/json;charset=UTF-8', + success: function (resp) + { + pageInfo = JSON.parse(resp); + + confirmDiagramInSync(); + }, + error: function (resp) + { + //Ignore + } + }); + + request({ + type: 'GET', + url: '/rest/api/content/' + pageId + '/child/attachment?filename=' + + encodeURIComponent(diagramName) + '&expand=version', + contentType: 'application/json;charset=UTF-8', + success: function (resp) + { + var tmp = JSON.parse(resp); + + if (tmp.results && tmp.results.length == 1) + { + attInfo = tmp.results[0]; + } + + confirmDiagramInSync(); + }, + error: function (resp) + { + //Ignore + } + }); + } + } + request({ //TODO find out the ID of the page that actually holds the attachments because historical revisions do not have attachments url: '/download/attachments/' + pageId + '/' + encodeURIComponent(diagramName) + ((revision != null) ? '?version=' + revision : ''), - success: success, + success: localSuccess, error : function(resp) { //When a page is copied, attachments are reset to version 1 while the revision parameter remains the same @@ -1188,14 +1276,14 @@ AC.loadDiagram = function (pageId, diagramName, revision, success, error, owning { request({ url: '/download/attachments/' + pageId + '/' + encodeURIComponent(diagramName), - success: success, + success: localSuccess, error : function(resp) { //If revesion 1 failed, then try the owningPageId if (owningPageId && resp.status == 404) { request({ url: '/download/attachments/' + owningPageId + '/' + encodeURIComponent(diagramName) +'?version=' + revision, //this version should exists in the original owning page - success: success, + success: localSuccess, error : error }); } @@ -1206,7 +1294,7 @@ AC.loadDiagram = function (pageId, diagramName, revision, success, error, owning { request({ url: '/download/attachments/' + owningPageId + '/' + encodeURIComponent(diagramName), - success: success, + success: localSuccess, error : error }); } @@ -1268,6 +1356,18 @@ AC.saveCustomContent = function(spaceKey, pageId, pageType, diagramName, revisio { AC.saveCustomContent(spaceKey, pageId, pageType, diagramName, revision, null, null, success, error); } + //Sometimes the macro is not updated such that the version is not correct. The same happens when a page version is restored + else if (err.statusCode == 409 && err.message.indexOf("Current version is:") > 0) + { + //We will use the error message to detect the correct version instead of doing another request. + //It should be safe as long as error messages are not translated or changed + var curContentVer = err.message.match(/\d+/); + + if (curContentVer != null) + { + AC.saveCustomContent(spaceKey, pageId, pageType, diagramName, revision, contentId, curContentVer[0], success, error); + } + } else { error(resp); diff --git a/src/main/webapp/connect/confluence/macroEditor-1-4-8.html b/src/main/webapp/connect/confluence/macroEditor-1-4-8.html index b40b8b31..8bf6ae5e 100644 --- a/src/main/webapp/connect/confluence/macroEditor-1-4-8.html +++ b/src/main/webapp/connect/confluence/macroEditor-1-4-8.html @@ -38,7 +38,7 @@ if (license != null && license == 'none') { - if (xdm_e != null && (xdm_e == "https://drawio.atlassian.net" || xdm_e.indexOf('ngrok') > -1)) + if (xdm_e != null && (xdm_e == "https://drawio.atlassian.net" || xdm_e.indexOf('ngrok') > -1 || xdm_e.indexOf('incura') > -1)) { console.log("License status = ", license); } diff --git a/src/main/webapp/connect/confluence/macroEditor.html b/src/main/webapp/connect/confluence/macroEditor.html index 4df63394..7c34c335 100644 --- a/src/main/webapp/connect/confluence/macroEditor.html +++ b/src/main/webapp/connect/confluence/macroEditor.html @@ -34,6 +34,8 @@ var script = document.createElement('script'); script.setAttribute('data-options', 'resize:false;margin:false'); + alert("Unsupported draw.io version, please upgrade."); + // Main script.onload = function() { diff --git a/src/main/webapp/connect/confluence/viewer-1-4-8.html b/src/main/webapp/connect/confluence/viewer-1-4-8.html index 7237be4f..d01eeafd 100644 --- a/src/main/webapp/connect/confluence/viewer-1-4-8.html +++ b/src/main/webapp/connect/confluence/viewer-1-4-8.html @@ -233,11 +233,19 @@ if (lang != null) } else { + //In case we want to load another diagram + var oldContainer = document.getElementById("drawIODiagram"); + + if (oldContainer != null) + { + oldContainer.parentNode.removeChild(oldContainer); + } // LATER: Fix horizontal alignment ignored with 100% width of iframe // LATER: Fix page scrolling on touch device if trigger event on diagram // LATER: Hide toolbar after second container click for iOS // LATER: Disable responsive resize while lightbox shows var container = document.createElement('div'); + container.id = "drawIODiagram"; container.style.cssText = 'position:absolute;box-sizing:border-box;' + 'max-width:100%;border:1px solid transparent;'; document.body.appendChild(container); @@ -322,6 +330,68 @@ if (lang != null) }; } + //Confirm that the macro is in sync with the diagram + //Sometimes the diagram is saved but the macro is not updated + var attInfo = null; + var pageInfo = null; + + function confirmDiagramInSync() + { + if (attInfo == null || pageInfo == null) + return; + + var loadedVer = parseInt(revision); + + //TODO is this condition enough or we need to check timestamps also? + if (attInfo.version.number > loadedVer + && (pageInfo.version.message == null || pageInfo.version.message.indexOf("Reverted") < 0)) + { + showDiagram(id, backupId, name, attInfo.version.number + '', page, links, {dontCheckVer: true}); + //I think updating macro here is too risky since calling confluence.getMacroData returns null + } + } + + if (!retryParams.dontCheckVer && revision != null && revision.length > 0) + { + request({ + type: 'GET', + url: '/rest/api/content/' + id + '?expand=version', + contentType: 'application/json;charset=UTF-8', + success: function (resp) + { + pageInfo = JSON.parse(resp); + + confirmDiagramInSync(); + }, + error: function (resp) + { + //Ignore + } + }); + + request({ + type: 'GET', + url: '/rest/api/content/' + id + '/child/attachment?filename=' + + encodeURIComponent(name) + '&expand=version', + contentType: 'application/json;charset=UTF-8', + success: function (resp) + { + var tmp = JSON.parse(resp); + + if (tmp.results && tmp.results.length == 1) + { + attInfo = tmp.results[0]; + } + + confirmDiagramInSync(); + }, + error: function (resp) + { + //Ignore + } + }); + } + //Saving the diagram to this page negates page linking feature! //May be we should ask the user first or saving is not needed all together /*if (retryParams.saveIt) @@ -401,7 +471,7 @@ if (lang != null) var info = JSON.parse(decodeURIComponent(resp.body.storage.value)); - showDiagram(info.pageId, info.pageId, info.diagramName, info.version, null, links); + showDiagram(info.pageId, info.pageId, info.diagramName, info.version, null, links, {dontCheckVer: true}); //custom content can load old versions which will be overridden by version check }, error: function (resp) { diff --git a/src/main/webapp/connect/jira/connect-dev.json b/src/main/webapp/connect/jira/connect-dev.json deleted file mode 100644 index 16c3f277..00000000 --- a/src/main/webapp/connect/jira/connect-dev.json +++ /dev/null @@ -1,93 +0,0 @@ -{ - "name": "Draw.io gaudenz", - "description": "Draw.io add-on for JIRA", - "key": "com.mxgraph.jira.plugins.drawio.gaudenz", - "baseUrl": "https://0d961297.ngrok.io/", - "vendor": { - "name": "JGraph Ltd.", - "url": "https://www.jgraph.com" - }, - "authentication": - { - "type": "none" - }, - "version": "1.0.4", - "scopes": - [ - "READ", - "WRITE", - "DELETE" - ], - "modules": - { - "generalPages": - [ - { - "url":"/connect/jira/editor2.html?issueId=${issue.id}", - "key":"drawioEditor", - "name": - { - "value":"Draw.io Editor" - }, - "location":"hidden" - }, - { - "url":"/connect/jira/fullScreenViewer2.html?issueId=${issue.id}", - "key":"drawioFullScreenViewer", - "name": - { - "value":"Draw.io Full Screen Viewer" - }, - "location":"hidden" - } - ], - "webItems": [ - { - "location": "operations-attachments", - "weight": 50, - "key": "drawioEditorBlank", - "url": "/connect/jira/editor2.html?issueId=${issue.id}", - "name": { - "value": "Add Draw.io Diagram" - }, - "target": - { - "type":"dialog", - "options": - { - "width":"100%", - "height":"100%", - "chrome":false - } - } - }, - { - "key": "drawioEditorDialog", - "name": - { - "value": "Draw.io Editor" - }, - "url": "/connect/jira/editor2.html?issueId=${issue.id}", - "location": "none", - "context": "addon" - } - ], - "webPanels": - [ - { - "url": "/connect/jira/viewerPanel2.html?issueId=${issue.id}", - "location": "atl.jira.view.issue.right.context", - "layout": - { - "width": "300px" - }, - "weight": 50, - "key": "drawioViewerPanel", - "name": - { - "value": "Draw.io Diagrams" - } - } - ] - } - } \ No newline at end of file diff --git a/src/main/webapp/images/logo-quip.png b/src/main/webapp/images/logo-quip.png new file mode 100644 index 00000000..6d8986ae Binary files /dev/null and b/src/main/webapp/images/logo-quip.png differ diff --git a/src/main/webapp/images/sidebar-basic.png b/src/main/webapp/images/sidebar-basic.png index a7054dd7..3b2b363a 100644 Binary files a/src/main/webapp/images/sidebar-basic.png and b/src/main/webapp/images/sidebar-basic.png differ diff --git a/src/main/webapp/images/sidebar-flowchart.png b/src/main/webapp/images/sidebar-flowchart.png index 2ca3d991..46ecf664 100644 Binary files a/src/main/webapp/images/sidebar-flowchart.png and b/src/main/webapp/images/sidebar-flowchart.png differ diff --git a/src/main/webapp/index.html b/src/main/webapp/index.html index bfff74b7..950766ef 100644 --- a/src/main/webapp/index.html +++ b/src/main/webapp/index.html @@ -397,10 +397,10 @@ width="26" height="20" src="images/youtube.png"/>Quick Start Video