From 92849b02eb733697ff9fdf579cebf2ca45dcb8ab Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Sun, 3 Feb 2013 13:47:31 -0300 Subject: [PATCH] Finish moving mindmap loading to rest. --- .../src/main/javascript/LocalStorageManager.js | 7 ++++--- wise-editor/src/main/webapp/js/editor.js | 2 +- wise-webapp/src/main/webapp/jsp/mindmapEditor.jsp | 11 +++++++---- wise-webapp/src/main/webapp/jsp/mindmapEmbed.jsp | 14 +++++++------- wise-webapp/src/main/webapp/jsp/mindmapPrint.jsp | 13 ++++++------- 5 files changed, 25 insertions(+), 22 deletions(-) diff --git a/mindplot/src/main/javascript/LocalStorageManager.js b/mindplot/src/main/javascript/LocalStorageManager.js index c436dc0c..c7cb45f6 100644 --- a/mindplot/src/main/javascript/LocalStorageManager.js +++ b/mindplot/src/main/javascript/LocalStorageManager.js @@ -18,8 +18,9 @@ mindplot.LocalStorageManager = new Class({ Extends:mindplot.PersistenceManager, - initialize:function () { + initialize:function (documentUrl) { this.parent(); + this.documentUrl = documentUrl; }, saveMapXml:function (mapId, mapXml, pref, saveHistory, events) { @@ -33,9 +34,9 @@ mindplot.LocalStorageManager = new Class({ loadMapDom:function (mapId) { var xml = localStorage.getItem(mapId + "-xml"); if (xml == null) { - // Let's try to open one from the local directory ... var xmlRequest = new Request({ - url:'samples/' + mapId + '.xml', + url:this.documentUrl.replace("{id}", mapId), + headers:{"Content-Type":"text/plain","Accept":"application/xml"}, method:'get', async:false, onSuccess:function (responseText) { diff --git a/wise-editor/src/main/webapp/js/editor.js b/wise-editor/src/main/webapp/js/editor.js index 4b767b2b..f1dc50a0 100644 --- a/wise-editor/src/main/webapp/js/editor.js +++ b/wise-editor/src/main/webapp/js/editor.js @@ -87,7 +87,7 @@ function buildDesigner(options) { } } else { - persistence = new mindplot.LocalStorageManager(); + persistence = new mindplot.LocalStorageManager("samples/{id}.xml"); } mindplot.PersistenceManager.init(persistence); diff --git a/wise-webapp/src/main/webapp/jsp/mindmapEditor.jsp b/wise-webapp/src/main/webapp/jsp/mindmapEditor.jsp index a0cf75e5..d2368c26 100644 --- a/wise-webapp/src/main/webapp/jsp/mindmapEditor.jsp +++ b/wise-webapp/src/main/webapp/jsp/mindmapEditor.jsp @@ -33,18 +33,21 @@ // Configure designer options ... var options = loadDesignerOptions(); - + options.persistenceManager = new mindplot.RESTPersistenceManager( { documentUrl:"c/restful/maps/{id}/document", revertUrl:"c/restful/maps/{id}/history/latest", lockUrl:"c/restful/maps/{id}/lock", - timestamp: "${lockTimestamp}?${lockTimestamp}:0", - session: "${lockSession}?${lockSession}:0" + timestamp: "${lockTimestamp}", + session: "${lockSession}" } ); - + + options.persistenceManager = new mindplot.LocalStorageManager("c/restful/maps/{id}/document/xml"); + + var userOptions = ${mindmap.properties}; options.zoom = userOptions.zoom; options.readOnly = ${!!readOnlyMode}; diff --git a/wise-webapp/src/main/webapp/jsp/mindmapEmbed.jsp b/wise-webapp/src/main/webapp/jsp/mindmapEmbed.jsp index 0a5c8811..b30125cf 100644 --- a/wise-webapp/src/main/webapp/jsp/mindmapEmbed.jsp +++ b/wise-webapp/src/main/webapp/jsp/mindmapEmbed.jsp @@ -6,7 +6,6 @@ <%--@elvariable id="mindmap" type="com.wisemapping.model.Mindmap"--%> <%--@elvariable id="editorTryMode" type="java.lang.Boolean"--%> <%--@elvariable id="editorTryMode" type="java.lang.String"--%> -<%--@elvariable id="mapXml" type="com.wisemapping.model.User"--%> @@ -27,7 +26,7 @@