From 5d939a1e78f5f81c4e98ff169d4328c440044092 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Mon, 28 Mar 2011 02:55:54 -0300 Subject: [PATCH 1/7] Change export controller path and keep compatibility with old SVG images. --- .../controller/ExportController.java | 5 +++-- .../com/wisemapping/exporter/SvgExporter.java | 19 ++++++++++++------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/wise-webapp/src/main/java/com/wisemapping/controller/ExportController.java b/wise-webapp/src/main/java/com/wisemapping/controller/ExportController.java index 7c72743d..bdc2031a 100644 --- a/wise-webapp/src/main/java/com/wisemapping/controller/ExportController.java +++ b/wise-webapp/src/main/java/com/wisemapping/controller/ExportController.java @@ -25,6 +25,7 @@ import com.wisemapping.view.MindMapBean; import com.wisemapping.exporter.ExportProperties; import com.wisemapping.filter.UserAgent; import org.apache.batik.transcoder.TranscoderException; +import org.jetbrains.annotations.NotNull; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException; @@ -106,14 +107,14 @@ public class ExportController extends BaseMultiActionController { return null; } - private void setBaseBaseImgUrl(ExportFormat format, ExportProperties properties) { + private void setBaseBaseImgUrl(ExportFormat format, @NotNull ExportProperties properties) { final String baseUrl; if (format == ExportFormat.SVG) { baseUrl = "http://www.wisemapping.com/images"; } else { final ServletContext servletContext = this.getServletContext(); - baseUrl = "file://" + servletContext.getRealPath("/images/"); + baseUrl = "file://" + servletContext.getRealPath("/icons/"); } properties.setBaseImagePath(baseUrl); } diff --git a/wise-webapp/src/main/java/com/wisemapping/exporter/SvgExporter.java b/wise-webapp/src/main/java/com/wisemapping/exporter/SvgExporter.java index db8e9602..320fb18d 100644 --- a/wise-webapp/src/main/java/com/wisemapping/exporter/SvgExporter.java +++ b/wise-webapp/src/main/java/com/wisemapping/exporter/SvgExporter.java @@ -187,13 +187,18 @@ public class SvgExporter { Element elem = (Element) node; // Cook image href ... - String imgName = elem.getAttribute("href"); - int index = imgName.lastIndexOf("/"); + final String imgUrl = elem.getAttribute("href"); + int index = imgUrl.lastIndexOf("/"); elem.removeAttribute("href"); - if (index != -1) - { - imgName = imgName.substring(index); - final String imgPath = imgBaseUrl + imgName; + if (index != -1) { + final String iconName = imgUrl.substring(index); + // Hack for backward compatibility . This can be removed in 2012. :) + String imgPath; + if (imgUrl.contains("images")) { + imgPath = imgBaseUrl + "../images/" + imgUrl; + } else { + imgPath = imgBaseUrl + imgUrl; + } elem.setAttribute("xlink:href", imgPath); } } @@ -231,7 +236,7 @@ public class SvgExporter { final NodeList groupChildren = node.getChildNodes(); for (int idx = 0; idx < groupChildren.getLength(); idx++) { final Node rectNode = groupChildren.item(idx); - float curentHeight = 0 ; + float curentHeight = 0; float curentWidth = 0; // If has a rect use the rect to calcular the real width of the topic From 6c9e057503af0edfd6f4c8b6f1fb8bae3c5bd74e Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Mon, 28 Mar 2011 20:01:32 -0300 Subject: [PATCH 2/7] Fix path. --- .../src/test/java/com/wisemapping/test/export/ExportTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wise-webapp/src/test/java/com/wisemapping/test/export/ExportTest.java b/wise-webapp/src/test/java/com/wisemapping/test/export/ExportTest.java index 4870b41f..7d0de138 100644 --- a/wise-webapp/src/test/java/com/wisemapping/test/export/ExportTest.java +++ b/wise-webapp/src/test/java/com/wisemapping/test/export/ExportTest.java @@ -42,7 +42,7 @@ public class ExportTest { final ExportProperties properties = ExportProperties.create(format); final ExportProperties.ImageProperties imageProperties = (ExportProperties.ImageProperties) properties; imageProperties.setSize(ExportProperties.ImageProperties.Size.LARGE); - String baseUrl = "file://"+svgFile.getParentFile().getAbsolutePath()+"/../../../main/webapp/images"; + String baseUrl = "file://"+svgFile.getParentFile().getAbsolutePath()+"/../../../main/webapp/icons/"; properties.setBaseImagePath(baseUrl); // Write content ... From 08daec009257adb74ab5c7b182b7bd610bdb1c9f Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Mon, 28 Mar 2011 20:53:18 -0300 Subject: [PATCH 3/7] Editor HTML 5.0 compliant. --- wise-webapp/src/main/webapp/js/editor.js | 7 ++++--- wise-webapp/src/main/webapp/jsp/mindmapEditor.jsp | 2 +- wise-webapp/src/test/data/svg/map4.png | 0 3 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 wise-webapp/src/test/data/svg/map4.png diff --git a/wise-webapp/src/main/webapp/js/editor.js b/wise-webapp/src/main/webapp/js/editor.js index 41f1061d..9d3b3226 100644 --- a/wise-webapp/src/main/webapp/js/editor.js +++ b/wise-webapp/src/main/webapp/js/editor.js @@ -589,15 +589,16 @@ function fontFamilyPanel() function shapeTypePanel() { - var shapeTypePanel = ['rectagle','rounded rectagle','line','elipse']; + var shapeTypePanel = ['rectagle','rounded_rectagle','line','elipse']; var updateFunction = function(value) { - designer.setShape2SelectedNode(value); + designer.setShape2SelectedNode(value.replace('_',' ')); }; var onFocusValue = function(selectedNode) { - return selectedNode.getShapeType(); + + return selectedNode.getShapeType().replace(' ','_'); }; buildPanel('topicShape', 'topicShapePanel', shapeTypePanel, updateFunction, onFocusValue); diff --git a/wise-webapp/src/main/webapp/jsp/mindmapEditor.jsp b/wise-webapp/src/main/webapp/jsp/mindmapEditor.jsp index 0a4b41d9..a05f6de7 100644 --- a/wise-webapp/src/main/webapp/jsp/mindmapEditor.jsp +++ b/wise-webapp/src/main/webapp/jsp/mindmapEditor.jsp @@ -103,7 +103,7 @@
- +
diff --git a/wise-webapp/src/test/data/svg/map4.png b/wise-webapp/src/test/data/svg/map4.png new file mode 100644 index 00000000..e69de29b From 18e9651ba17a18c2601c34b9fd5ce2a99bd983d4 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Mon, 28 Mar 2011 21:40:38 -0300 Subject: [PATCH 4/7] HTML 5.0 compliant. --- wise-webapp/src/main/webapp/jsp/mindmapDetail.jsp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/wise-webapp/src/main/webapp/jsp/mindmapDetail.jsp b/wise-webapp/src/main/webapp/jsp/mindmapDetail.jsp index 63dbecaf..9605db3e 100644 --- a/wise-webapp/src/main/webapp/jsp/mindmapDetail.jsp +++ b/wise-webapp/src/main/webapp/jsp/mindmapDetail.jsp @@ -22,11 +22,11 @@ - "/> + <spring:message code=" title=""/> () - "/> + <spring:message code=" title=""/> () @@ -64,7 +64,7 @@ - &mapId=${wisemapDetail.id}" rel="moodalbox 780px 530px wizard" + &mapId=${wisemapDetail.id}" rel="moodalbox 780px 530px wizard" title=""> @@ -137,7 +137,7 @@ : - \ No newline at end of file diff --git a/wise-webapp/src/main/webapp/jsp/mindmapList.jsp b/wise-webapp/src/main/webapp/jsp/mindmapList.jsp index 9a16e96b..e969b30e 100644 --- a/wise-webapp/src/main/webapp/jsp/mindmapList.jsp +++ b/wise-webapp/src/main/webapp/jsp/mindmapList.jsp @@ -1,4 +1,4 @@ - + <%@ page import="com.wisemapping.view.MindMapBean" %> <%@ page import="java.util.List" %> @@ -103,7 +103,7 @@ }, 'onConfirm':function(){ $(document.toolbarForm.mindmapIds).value=$('selectedMapIds').value; - $(document.toolbarForm).action='${deleteSelectedMapUrl}'; + $(document.toolbarForm).action=''; $(document.toolbarForm).submit(); } });"> @@ -131,19 +131,19 @@
- - - - - - - - + + + + + + + + - @@ -282,24 +266,20 @@
- + @@ -172,29 +172,21 @@
-
+
- - + - "> + "> - "> + &mapId=${mindmap.id}" rel="moodalbox 780px 530px wizard" title=""> - "> + "> @@ -260,16 +246,14 @@ alt=""/> - : " - alt="title=" + : " alt="World"
${mindmap.creationUser} ${mindmap.lastEditDate} by ${mindmap.lastEditor} + &mapId=${mindmap.id}">