From 65de7403d76b8896a3cc855a0073c897963265f4 Mon Sep 17 00:00:00 2001
From: Paulo Gustavo Veiga
Date: Fri, 17 Feb 2012 21:00:41 -0300
Subject: [PATCH 01/45] Fix Firefox issue that causes that the map is not
centered.
---
Compiling-and-running.md | 8 +--
web2d/src/main/javascript/Workspace.js | 2 +-
wise-editor/src/main/webapp/css/editor.less | 80 ++-------------------
wise-editor/src/main/webapp/js/editor.js | 54 +++++++-------
4 files changed, 40 insertions(+), 104 deletions(-)
diff --git a/Compiling-and-running.md b/Compiling-and-running.md
index fda2addb..74a25a5c 100644
--- a/Compiling-and-running.md
+++ b/Compiling-and-running.md
@@ -5,7 +5,7 @@
The following products must be installed:
* Java Development Kit 6 or higher (http://java.sun.com/javase/downloads/index.jsp)
- * Maven 2.2.1 or higher (http://maven.apache.org/)
+ * Maven 3.x or higher (http://maven.apache.org/)
## Compiling
@@ -14,13 +14,14 @@ WiseMapping uses Maven as packaging and project management. The project is compo
* core-js: Utilities JavaScript libraries
* web2d: JavaScript 2D VML/SVG abstraction library used by the mind map editor
* mindplot: JavaScript mind map designer core
+ * wise-editor: Mindmap Editor standalone distribution
* wise-webapp: J2EE web application
Full compilation of the project can be done executing within :
-`mvn install`
+`mvn package`
-Once this command is execute, the file /wise-webapp/target/wisemapping.war will be generated.
+Once this command is execute, the file /wise-webapp/target/wisemapping*.war will be generated.
## Testing
The previously generated war can be deployed locally executing within the directory /wise-webapp the following command:
@@ -30,5 +31,4 @@ The previously generated war can be deployed locally executing within the direct
This will start the application on the URL: http://localhost:8080/wise-webapp/. Additionally, a file based database is automatically populated with a test user.
User: test@wisemapping.org
-
Password: test
\ No newline at end of file
diff --git a/web2d/src/main/javascript/Workspace.js b/web2d/src/main/javascript/Workspace.js
index 8fe78d5c..158e1f5e 100644
--- a/web2d/src/main/javascript/Workspace.js
+++ b/web2d/src/main/javascript/Workspace.js
@@ -66,7 +66,7 @@ web2d.Workspace = new Class({
_createDivContainer : function(domElement) {
var container = window.document.createElement("div");
container.id = "workspaceContainer";
- container.style.overflow = "hidden";
+// container.style.overflow = "hidden";
container.style.position = "relative";
container.style.top = "0px";
container.style.left = "0px";
diff --git a/wise-editor/src/main/webapp/css/editor.less b/wise-editor/src/main/webapp/css/editor.less
index 17ce1982..5cff02f5 100644
--- a/wise-editor/src/main/webapp/css/editor.less
+++ b/wise-editor/src/main/webapp/css/editor.less
@@ -1,91 +1,21 @@
@import "compatibility.less";
@import "../css/libraries/moodialog/css/MooDialog.css";
-
-/**********************************************************/
-/* Error Dialog ... */
-/**********************************************************/
-
-#waitDialog {
- position: absolute;
- top: 10px;
- left: 10px;
- height: 200px;
-}
-
-#waitingContainer, #errorContainer {
- position: relative;
- top: 80px;
- height: 120px; /*background: whitesmoke;*/
- background: #FEFEFE;
- opacity: .99;
- padding: 15px;
- width: 100%;
- border: 1px solid;
- border-color: #a9a9a9;
-
-}
-
-#errorContainer {
- width: 400px;
- border: 1px solid red;
-}
-
-#waitingContainer .loadingText {
- position: relative;
- top: 50%;
- margin-top: -35px;
- font-size: 30px;
- font-weight: bold;
- vertical-align: text-bottom;
- height: 30px;
- float: left;
-}
-
-#errorContainer .loadingText {
- position: relative;
- top: 50%;
- margin-top: -80px;
- font-size: 15px;
- font-weight: bold;
- vertical-align: text-bottom;
- height: 30px;
- float: right;
- padding-left: 120px;
-}
-
-#waitingContainer .loadingIcon {
- position: relative;
- background: url(../images/rebota.gif) no-repeat;
- top: 50%;
- margin-top: -65px;
- height: 100px;
- width: 121px;
- float: left;
- clear: both;
-}
-
-#errorContainer .loadingIcon {
- position: relative;
- background: url(../images/errorIcon.png) no-repeat;
- top: 50%;
- margin-top: -65px;
- height: 100px;
- width: 121px;
- float: left;
- clear: both;
-}
-
/********************************************************************************/
/* Header & Toolbar Styles */
/********************************************************************************/
@import "header.less";
+body {
+ overflow:hidden;
+}
+
div#mindplot {
position: relative;
top: 0;
left: 0;
width: 100%;
+ height:100%;
border: 0;
}
diff --git a/wise-editor/src/main/webapp/js/editor.js b/wise-editor/src/main/webapp/js/editor.js
index 5b17f47d..94f361f3 100644
--- a/wise-editor/src/main/webapp/js/editor.js
+++ b/wise-editor/src/main/webapp/js/editor.js
@@ -90,6 +90,7 @@ function loadDesignerOptions(jsonConf) {
};
result = {readOnly:false,zoom:0.85,saveOnLoad:true,size:containerSize,viewPort:viewPort,container:'mindplot'};
}
+ console.log("result:" + JSON.encode(result));
return result;
}
@@ -161,32 +162,37 @@ editor.WaitDialog = new Class({
});
editor.Help = {
- buildHelp:function(panel){
+ buildHelp:function(panel) {
var container = new Element('div');
container.setStyles({width:'100%', textAlign:'center'});
- var content1 = Help.buildContentIcon('../images/black-keyboard.png', 'Keyboard Shortcuts', function(){MOOdalBox.open('keyboard.htm','KeyBoard Shortcuts', '500px 400px', false);panel.hidePanel();});
- var content2 = Help.buildContentIcon('../images/firstSteps.png', 'Editor First Steps', function(){
- var wOpen;
- var sOptions;
+ var content1 = Help.buildContentIcon('../images/black-keyboard.png', 'Keyboard Shortcuts', function() {
+ MOOdalBox.open('keyboard.htm', 'KeyBoard Shortcuts', '500px 400px', false);
+ panel.hidePanel();
+ });
+ var content2 = Help.buildContentIcon('../images/firstSteps.png', 'Editor First Steps', function() {
+ var wOpen;
+ var sOptions;
- sOptions = 'status=yes,menubar=yes,scrollbars=yes,resizable=yes,toolbar=yes';
- sOptions = sOptions + ',width=' + (screen.availWidth - 10).toString();
- sOptions = sOptions + ',height=' + (screen.availHeight - 122).toString();
- sOptions = sOptions + ',screenX=0,screenY=0,left=0,top=0';
+ sOptions = 'status=yes,menubar=yes,scrollbars=yes,resizable=yes,toolbar=yes';
+ sOptions = sOptions + ',width=' + (screen.availWidth - 10).toString();
+ sOptions = sOptions + ',height=' + (screen.availHeight - 122).toString();
+ sOptions = sOptions + ',screenX=0,screenY=0,left=0,top=0';
- wOpen = window.open("firststeps.htm", "WiseMapping", "width=100px, height=100px");
- wOpen.focus();
- wOpen.moveTo( 0, 0 );
- wOpen.resizeTo( screen.availWidth, screen.availHeight );
- panel.hidePanel();
+ wOpen = window.open("firststeps.htm", "WiseMapping", "width=100px, height=100px");
+ wOpen.focus();
+ wOpen.moveTo(0, 0);
+ wOpen.resizeTo(screen.availWidth, screen.availHeight);
+ panel.hidePanel();
});
- container.addEvent('show', function(){
- content1.effect('opacity',{duration:800}).start(0,100);
- var eff = function(){content2.effect('opacity',{duration:800}).start(0,100);};
+ container.addEvent('show', function() {
+ content1.effect('opacity', {duration:800}).start(0, 100);
+ var eff = function() {
+ content2.effect('opacity', {duration:800}).start(0, 100);
+ };
eff.delay(150);
});
- container.addEvent('hide', function(){
+ container.addEvent('hide', function() {
content1.effect('opacity').set(0);
content2.effect('opacity').set(0)
});
@@ -194,25 +200,25 @@ editor.Help = {
content2.inject(container);
return container;
},
- buildContentIcon:function(image, text, onClickFn){
+ buildContentIcon:function(image, text, onClickFn) {
var container = new Element('div').setStyles({margin:'15px 0px 0px 0px', opacity:0, padding:'5px 0px', border: '1px solid transparent', cursor:'pointer'});
var icon = new Element('div');
- icon.addEvent('click',onClickFn);
+ icon.addEvent('click', onClickFn);
var img = new Element('img');
- img.setProperty('src',image);
+ img.setProperty('src', image);
img.inject(icon);
icon.inject(container);
var textContainer = new Element('div').setStyles({width:'100%', color:'white'});
- textContainer.innerHTML=text;
+ textContainer.innerHTML = text;
textContainer.inject(container);
- container.addEvent('mouseover', function(event){
+ container.addEvent('mouseover', function() {
$(this).setStyle('border-top', '1px solid #BBB4D6');
$(this).setStyle('border-bottom', '1px solid #BBB4D6');
}.bindWithEvent(container));
- container.addEvent('mouseout', function(event){
+ container.addEvent('mouseout', function() {
$(this).setStyle('border-top', '1px solid transparent');
$(this).setStyle('border-bottom', '1px solid transparent');
From 8fda11b34c8e56c09a5844c5af39d6f4c2bab151 Mon Sep 17 00:00:00 2001
From: Paulo Gustavo Veiga
Date: Sun, 19 Feb 2012 13:51:19 -0300
Subject: [PATCH 02/45] REmove out of date faq.
---
Faq.textile | 11 -----------
1 file changed, 11 deletions(-)
delete mode 100644 Faq.textile
diff --git a/Faq.textile b/Faq.textile
deleted file mode 100644
index ed01ff1e..00000000
--- a/Faq.textile
+++ /dev/null
@@ -1,11 +0,0 @@
-h1. FAQ
-
-h2. Which technology is being used to render the mind maps?
-
-We use SVG for Firefox and Safari, and VML for IE and Opera.
-
-SVG (Scalable Vectorial Graphics) allows straightforward and efficient vector graphics animation and VML (Vector Markup Language) supports the markup of vector graphic information in the same way that HTML supports the markup of textual information.
-
-h2. What's the source code License?
-
-http://www.wisemapping.org/license
\ No newline at end of file
From 5216f954107e8e769f8513eaaf53bf2972149e2e Mon Sep 17 00:00:00 2001
From: Paulo Gustavo Veiga
Date: Sun, 19 Feb 2012 13:56:49 -0300
Subject: [PATCH 03/45] Minor doc fix.
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 1b9d08a2..f93ca778 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@ The following products must be installed:
WiseMapping uses Maven as packaging and project management. The project is composed of 4 maven sub-modules:
* core-js: Utilities JavaScript libraries
- * web2d: JavaScript 2D VML/SVG abstraction library used by the mind map editor
+ * web2d: JavaScript 2D SVG abstraction library used by the mind map editor
* mindplot: JavaScript mind map designer core
* wise-webapp: J2EE web application
From e033e8552cff93154f4372e91c859dd9837c9dff Mon Sep 17 00:00:00 2001
From: Paulo Gustavo Veiga
Date: Sun, 19 Feb 2012 18:05:33 -0300
Subject: [PATCH 04/45] Add support for menu base dir configuration.
---
mindplot/src/main/javascript/widget/Menu.js | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/mindplot/src/main/javascript/widget/Menu.js b/mindplot/src/main/javascript/widget/Menu.js
index d7e56316..74ba58de 100644
--- a/mindplot/src/main/javascript/widget/Menu.js
+++ b/mindplot/src/main/javascript/widget/Menu.js
@@ -19,10 +19,11 @@
mindplot.widget.Menu = new Class({
Extends: mindplot.widget.IMenu,
- initialize : function(designer, containerId, mapId, readOnly) {
+ initialize : function(designer, containerId, mapId, readOnly, baseUrl) {
this.parent(designer, containerId, mapId);
- var baseUrl = "../css/widget";
+ baseUrl = !$defined(baseUrl) ? "../" : baseUrl;
+ var widgetsBaseUrl = baseUrl + "css/widget";
// Stop event propagation ...
$(this._containerId).addEvent('click', function(event) {
@@ -130,7 +131,7 @@ mindplot.widget.Menu = new Class({
designer.changeBackgroundColor(hex);
}
};
- this._toolbarElems.push(new mindplot.widget.ColorPalettePanel('topicColor', topicColorModel, baseUrl));
+ this._toolbarElems.push(new mindplot.widget.ColorPalettePanel('topicColor', topicColorModel, widgetsBaseUrl));
// Border color item ...
var borderColorModel =
@@ -152,7 +153,7 @@ mindplot.widget.Menu = new Class({
designer.changeBorderColor(hex);
}
};
- this._toolbarElems.push(new mindplot.widget.ColorPalettePanel('topicBorder', borderColorModel, baseUrl));
+ this._toolbarElems.push(new mindplot.widget.ColorPalettePanel('topicBorder', borderColorModel, widgetsBaseUrl));
// Font color item ...
var fontColorModel =
From 81538f049b9ffb334ba70258da3a16b3543b0203 Mon Sep 17 00:00:00 2001
From: Paulo Gustavo Veiga
Date: Sun, 19 Feb 2012 21:07:24 -0300
Subject: [PATCH 05/45] - Remove old ExportController - Add support for simple
REST transformation
---
.../src/main/webapp/icons/legacy/links.png | Bin 0 -> 957 bytes
.../controller/ExportController.java | 214 ------------------
.../wisemapping/rest/MindmapController.java | 12 +-
.../rest/TransformerController.java | 60 ++++-
.../wisemapping/rest/model/RestMindmap.java | 6 +-
.../wisemapping/rest/view/TransformView.java | 3 +-
.../WEB-INF/wisemapping-acegi-security.xml | 167 --------------
.../main/webapp/WEB-INF/wisemapping-rest.xml | 18 +-
.../webapp/WEB-INF/wisemapping-security.xml | 2 +
.../webapp/WEB-INF/wisemapping-servlet.xml | 7 +-
.../src/main/webapp/jsp/mindmapExport.jsp | 48 ++--
11 files changed, 115 insertions(+), 422 deletions(-)
create mode 100644 wise-editor/src/main/webapp/icons/legacy/links.png
delete mode 100644 wise-webapp/src/main/java/com/wisemapping/controller/ExportController.java
delete mode 100644 wise-webapp/src/main/webapp/WEB-INF/wisemapping-acegi-security.xml
diff --git a/wise-editor/src/main/webapp/icons/legacy/links.png b/wise-editor/src/main/webapp/icons/legacy/links.png
new file mode 100644
index 0000000000000000000000000000000000000000..b8edc1265db4bf69814875d1c10b8761f7009e23
GIT binary patch
literal 957
zcmV;u148_XP)(^b;|pVbz=yzjpaJj$
zhrpuriKefui_0DvN;1Ymq&%nwWg*IrK!Xz^eJWuq3u2H~0ra?EC@ge%+`A>6mV
z9{TYo{=G6
zt@5m|4G+Q2zKv;Ch@O;`PfWArmB5n3gvMsxV&Iu>97{a!2kL74wd@!f_AP^O%_&ND
zm}1c*+F;TcH^{p$P_|akvD5o7vmT>HCkP;z;;&+8tDBI;koi9eX`W!oH4`pYaHlFZwV;$>vvfQTw
zM-`m&R_SPIBa^FUasC0GCCh%{h`$~db`z&-lFX#%(f>H6JD6Z(sIW`RKE+xOL+?+uQ%q
z){?+F%=6pqEH{6=NzusC-*<`PZYiLCGyKD}Z8^V8ul-K=AV@SE1t4~D2*b1(9UUc=
zN-;Dv#Ngl{rd7e$ZUPXC##BFmV>$26ZQi?6Po#@{4gllsPbku3Vq${Y+FAf~T}OJb
zGWEz9{(zcvI&CUaN&p7GcqMG4&7ULx##68M4k(F4l7Q+Xm&>uSv4N&(w6?a=)YOC{
zoYLN-J?7@-9xGBx007$C+kK7w_2Z$(k&l}jo2#`dO;J#Ipsbc$pS#^Dy3Q&nSeE5x
fGMT)t>sS8=`naU3reLNz00000NkvXXu0mjf)bGN+
literal 0
HcmV?d00001
diff --git a/wise-webapp/src/main/java/com/wisemapping/controller/ExportController.java b/wise-webapp/src/main/java/com/wisemapping/controller/ExportController.java
deleted file mode 100644
index c83346af..00000000
--- a/wise-webapp/src/main/java/com/wisemapping/controller/ExportController.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
-* Copyright [2011] [wisemapping]
-*
-* Licensed under WiseMapping Public License, Version 1.0 (the "License").
-* It is basically the Apache License, Version 2.0 (the "License") plus the
-* "powered by wisemapping" text requirement on every single page;
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the license at
-*
-* http://www.wisemapping.org/license
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-package com.wisemapping.controller;
-
-import com.wisemapping.exporter.ExportException;
-import com.wisemapping.exporter.ExportFormat;
-import com.wisemapping.exporter.ExporterFactory;
-import com.wisemapping.model.MindMap;
-import com.wisemapping.service.MindmapService;
-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;
-import org.xml.sax.SAXException;
-import sun.misc.BASE64Encoder;
-
-import javax.servlet.ServletOutputStream;
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.bind.JAXBException;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.transform.TransformerException;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-
-public class ExportController extends BaseMultiActionController {
- private static final String IMG_EXPORT_FORMAT = "IMG_EXPORT_FORMAT";
- private static final String MAP_ID_PARAMETER = "mapId";
- private static final String MAP_SVG_PARAMETER = "mapSvg";
- private static final String EXPORT_FORMAT_PARAMETER = "exportFormat";
- private static final String IMG_SIZE_PARAMETER = "imgSize";
- private static final String MAP_XML_PARAM = "mapXml";
-
-
- public ModelAndView handleNoSuchRequestHandlingMethod(NoSuchRequestHandlingMethodException noSuchRequestHandlingMethodException, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
- logger.info("Mindmap Controller: EXPORT action");
- final MindMap mindmap = getMindmapFromRequest(httpServletRequest);
- return new ModelAndView("mindmapExport", "mindmap", new MindMapBean(mindmap));
- }
-
- public ModelAndView export(HttpServletRequest request, HttpServletResponse response) throws TranscoderException, IOException, JAXBException {
- logger.info("Export Controller: exporting WiseMap action");
-
- final String mapIdStr = request.getParameter(MAP_ID_PARAMETER);
- if (mapIdStr != null) {
- final String mapSvg = request.getParameter(MAP_SVG_PARAMETER);
- try {
-
- int mindmapId = Integer.parseInt(mapIdStr);
-
- logger.debug("SVG Map to export:" + mapSvg);
- if (mapSvg == null || mapSvg.isEmpty()) {
- throw new IllegalArgumentException("SVG map could not be null");
- }
-
- String formatStr = request.getParameter(EXPORT_FORMAT_PARAMETER);
- if (IMG_EXPORT_FORMAT.endsWith(formatStr)) {
- formatStr = request.getParameter("imgFormat");
- }
-
- final MindmapService service = getMindmapService();
- final MindMap mindMap = service.getMindmapById(mindmapId);
-
- // Build format properties ...
- final ExportFormat format = ExportFormat.valueOf(formatStr);
- final ExportProperties properties = ExportProperties.create(format);
- if (properties instanceof ExportProperties.ImageProperties) {
- final String sizeStr = request.getParameter(IMG_SIZE_PARAMETER);
- final ExportProperties.ImageProperties imageProperties = (ExportProperties.ImageProperties) properties;
- if (sizeStr != null) {
- final ExportProperties.ImageProperties.Size size = ExportProperties.ImageProperties.Size.valueOf(sizeStr);
- imageProperties.setSize(size);
- } else {
- imageProperties.setSize(ExportProperties.ImageProperties.Size.LARGE);
- }
- }
-
- final ByteArrayOutputStream bos = new ByteArrayOutputStream();
-
- // Change image link URL.
- setBaseBaseImgUrl(format, properties);
- ExporterFactory.export(properties, mindMap.getUnzippedXml(), bos, mapSvg);
-
- // If the export goes ok, write the map to the stream ...
-
- // Set format content type...
- final String contentType = format.getContentType();
- response.setContentType(contentType);
-
- // Set file name...
- final String fileName = mindMap.getTitle() + "." + format.getFileExtension();
- response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
-
- // Write content ...
- final ServletOutputStream outputStream = response.getOutputStream();
- outputStream.write(bos.toByteArray());
-
-
- } catch (Throwable e) {
- logger.error("Unexpexted error during export process", e);
- response.setStatus(HttpServletResponse.SC_NOT_FOUND);
- logger.error("map: " + mapSvg);
- }
- } else {
- logger.warn("mapIdStr is null.Image could not be imported. UserAgent:" + request.getHeaders(UserAgent.USER_AGENT_HEADER));
- response.setStatus(HttpServletResponse.SC_NOT_FOUND);
- }
- return null;
- }
-
- private void setBaseBaseImgUrl(@NotNull 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("/icons/") + "/";
- }
- properties.setBaseImagePath(baseUrl);
- }
-
- public ModelAndView print(HttpServletRequest request, HttpServletResponse response) throws TranscoderException, IOException, JAXBException {
- logger.info("Export Controller: printing WiseMap action");
-
- final String mapIdStr = request.getParameter(MAP_ID_PARAMETER);
- int mindmapId = Integer.parseInt(mapIdStr);
- final MindmapService service = getMindmapService();
- final MindMap mindmap = service.getMindmapById(mindmapId);
- final String mapSvg = request.getParameter(MAP_SVG_PARAMETER);
-
- final ByteArrayOutputStream bos = new ByteArrayOutputStream();
- try {
- exportImage(response, mapSvg, bos, false);
- } catch (Throwable e) {
- logger.error("Unexpexted error generating the image", e);
- logger.error("map: " + mapSvg);
- }
-
- BASE64Encoder encoder = new BASE64Encoder();
- String content = encoder.encode(bos.toByteArray());
- final String exportContent = "data:image/png;base64," + content;
- bos.close();
-
- ModelAndView view = new ModelAndView("mindmapPrint", "mindmap", new MindMapBean(mindmap));
- final String xmlMap = mindmap.getNativeXmlAsJsLiteral();
- view.addObject(MAP_XML_PARAM, xmlMap);
- view.addObject(MAP_SVG_PARAMETER, exportContent);
-
- return view;
-
- }
-
- public ModelAndView image(HttpServletRequest request, HttpServletResponse response) throws TranscoderException, IOException, JAXBException {
- logger.info("Export Controller: generating image WiseMap action");
-
- final String mapIdStr = request.getParameter(MAP_ID_PARAMETER);
- final String mapSvg = request.getParameter(MAP_SVG_PARAMETER);
- try {
- final ServletOutputStream outputStream = response.getOutputStream();
-
- exportImage(response, mapSvg, outputStream, true);
-
-
- } catch (Throwable e) {
- logger.error("Unexpexted error generating the image", e);
- logger.error("map: " + mapSvg);
- }
- return null;
- }
-
- private void exportImage(HttpServletResponse response, String mapSvg, OutputStream outputStream, boolean setOutput) throws TranscoderException, IOException, ParserConfigurationException, SAXException, XMLStreamException, TransformerException, JAXBException, ExportException {
-
- //Image Format
- ExportFormat imageFormat = ExportFormat.PNG;
-
- // Build format properties ...
- final ExportProperties.ImageProperties imageProperties = new ExportProperties.ImageProperties(imageFormat);
- imageProperties.setSize(ExportProperties.ImageProperties.Size.XMEDIUM);
-
- // Change image link URL.
- setBaseBaseImgUrl(imageFormat, imageProperties);
-
- // Set format content type...
- if (setOutput)
- response.setContentType(imageFormat.getContentType());
-
- // Write content ...
- ExporterFactory.export(imageProperties, null, outputStream, mapSvg);
- }
-}
\ No newline at end of file
diff --git a/wise-webapp/src/main/java/com/wisemapping/rest/MindmapController.java b/wise-webapp/src/main/java/com/wisemapping/rest/MindmapController.java
index e3b0186a..ea78ae2a 100644
--- a/wise-webapp/src/main/java/com/wisemapping/rest/MindmapController.java
+++ b/wise-webapp/src/main/java/com/wisemapping/rest/MindmapController.java
@@ -4,9 +4,8 @@ package com.wisemapping.rest;
import com.wisemapping.model.MindMap;
import com.wisemapping.model.MindmapUser;
import com.wisemapping.model.User;
-import com.wisemapping.rest.model.RestMindMap;
+import com.wisemapping.rest.model.RestMindmap;
import com.wisemapping.service.MindmapService;
-import com.wisemapping.validator.Utils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
@@ -16,21 +15,18 @@ import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import java.io.IOException;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
@Controller
public class MindmapController {
@Autowired
private MindmapService mindmapService;
-
- @RequestMapping(method = RequestMethod.GET, value = "/map/{id}")
+ @RequestMapping(method = RequestMethod.GET, value = "/map/{id}", produces = {"text/xml", "application/json", "text/html"})
@ResponseBody
public ModelAndView getMindmap(@PathVariable int id) throws IOException {
final MindMap mindMap = mindmapService.getMindmapById(id);
- final RestMindMap map = new RestMindMap(mindMap);
+ final RestMindmap map = new RestMindmap(mindMap);
return new ModelAndView("mapView", "map", map);
}
@@ -39,7 +35,7 @@ public class MindmapController {
final User user = com.wisemapping.security.Utils.getUser();
final List list = mindmapService.getMindmapUserByUser(user);
-// final RestMindMap map = new RestMindMap(mindMap);
+// final RestMindMap map = new RestMindmap(mindMap);
// return new ModelAndView("mapView", "map", map);
return null;
}
diff --git a/wise-webapp/src/main/java/com/wisemapping/rest/TransformerController.java b/wise-webapp/src/main/java/com/wisemapping/rest/TransformerController.java
index 65238e89..445704d8 100644
--- a/wise-webapp/src/main/java/com/wisemapping/rest/TransformerController.java
+++ b/wise-webapp/src/main/java/com/wisemapping/rest/TransformerController.java
@@ -1,12 +1,16 @@
package com.wisemapping.rest;
+import com.wisemapping.exporter.ExportFormat;
import com.wisemapping.exporter.ExportProperties;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
@@ -14,6 +18,10 @@ import java.util.Map;
@Controller
public class TransformerController {
+ private static final String PARAM_SVG_XML = "svgXml";
+ private static final String PARAM_WISE_MAP_XML = "mapXml";
+ private static final String PARAM_FILENAME = "filename";
+
@RequestMapping(method = RequestMethod.POST, value = "/transform", produces = {"application/pdf"}, consumes = {"image/svg+xml"})
@ResponseBody
public ModelAndView transformPdf(@RequestBody @Nullable final String content) throws IOException {
@@ -26,6 +34,18 @@ public class TransformerController {
return new ModelAndView("transformViewPdf", values);
}
+ @RequestMapping(method = RequestMethod.POST, value = "/transform", produces = {"image/svg+xml"}, consumes = {"image/svg+xml"})
+ @ResponseBody
+ public ModelAndView transformSvg(@RequestBody @Nullable final String content) throws IOException {
+ final Map values = new HashMap();
+ if (content == null || content.length() == 0) {
+ throw new IllegalArgumentException("Body can not be null.");
+ }
+
+ values.put("content", content);
+ return new ModelAndView("transformViewSvg", values);
+ }
+
@RequestMapping(method = RequestMethod.POST, value = "/transform", produces = {"image/png"}, consumes = {"image/svg+xml"})
@ResponseBody
public ModelAndView transformPng(@RequestBody @Nullable final String content) throws IOException {
@@ -47,7 +67,7 @@ public class TransformerController {
}
values.put("content", content);
values.put("imageSize", ExportProperties.ImageProperties.Size.LARGE);
- return new ModelAndView("transformViewJpg", values);
+ return new ModelAndView("transformViewJpeg", values);
}
@RequestMapping(method = RequestMethod.POST, value = "/transform", produces = {"application/freemind"}, consumes = {"text/xml"})
@@ -60,4 +80,42 @@ public class TransformerController {
values.put("content", content);
return new ModelAndView("transformViewFreemind", values);
}
+
+ @RequestMapping(method = RequestMethod.POST, value = "/transform", consumes = {"application/x-www-form-urlencoded"})
+ public ModelAndView transform(@NotNull HttpServletRequest request,
+ @NotNull HttpServletResponse response) throws IOException {
+ final String svg = request.getParameter(PARAM_SVG_XML);
+ final String mapXml = request.getParameter(PARAM_WISE_MAP_XML);
+ final String filename = request.getParameter(PARAM_FILENAME);
+
+
+ // Obtains transformation type based on the last part of the URL ...
+ final String requestURI = request.getRequestURI();
+ final String format = requestURI.substring(requestURI.lastIndexOf(".") + 1, requestURI.length());
+ final ExportFormat exportFormat = ExportFormat.valueOf(format.toUpperCase());
+
+ ModelAndView result;
+ switch (exportFormat) {
+ case PNG:
+ result = this.transformPng(svg);
+ break;
+ case JPEG:
+ result = this.transformJpeg(svg);
+ break;
+ case PDF:
+ result = this.transformPdf(svg);
+ break;
+ case SVG:
+ result = this.transformSvg(svg);
+ break;
+ case FREEMIND:
+ result = this.transformFreemind(mapXml);
+ break;
+ default:
+ throw new IllegalArgumentException("Unsupported export format");
+
+ }
+ result.getModelMap().put("filename", filename);
+ return result;
+ }
}
diff --git a/wise-webapp/src/main/java/com/wisemapping/rest/model/RestMindmap.java b/wise-webapp/src/main/java/com/wisemapping/rest/model/RestMindmap.java
index 5291045c..8c4cf46e 100644
--- a/wise-webapp/src/main/java/com/wisemapping/rest/model/RestMindmap.java
+++ b/wise-webapp/src/main/java/com/wisemapping/rest/model/RestMindmap.java
@@ -17,17 +17,17 @@ import java.util.Date;
@XmlRootElement(name = "map")
@XmlAccessorType(XmlAccessType.PROPERTY)
-public class RestMindMap {
+public class RestMindmap {
@JsonIgnore
private MindMap mindmap;
- public RestMindMap() {
+ public RestMindmap() {
this(null);
}
- public RestMindMap(@NotNull MindMap mindmap) {
+ public RestMindmap(@NotNull MindMap mindmap) {
this.mindmap = mindmap;
}
diff --git a/wise-webapp/src/main/java/com/wisemapping/rest/view/TransformView.java b/wise-webapp/src/main/java/com/wisemapping/rest/view/TransformView.java
index 6d31a78d..144db7e2 100644
--- a/wise-webapp/src/main/java/com/wisemapping/rest/view/TransformView.java
+++ b/wise-webapp/src/main/java/com/wisemapping/rest/view/TransformView.java
@@ -28,6 +28,7 @@ public class TransformView extends AbstractView {
protected void renderMergedOutputModel(@NotNull Map viewMap, @NotNull HttpServletRequest request, @NotNull final HttpServletResponse response) throws Exception {
final String content = (String) viewMap.get("content");
+ final String filename = (String) viewMap.get("filename");
// Build format properties ...
final ExportProperties properties = ExportProperties.create(exportFormat);
@@ -57,7 +58,7 @@ public class TransformView extends AbstractView {
response.setContentType(contentType);
// Set file name...
- final String fileName = "map" + "." + exportFormat.getFileExtension();
+ final String fileName = (filename != null ? filename : "map" + ".") + exportFormat.getFileExtension();
response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
// Write content ...
diff --git a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-acegi-security.xml b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-acegi-security.xml
deleted file mode 100644
index 0359e3ea..00000000
--- a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-acegi-security.xml
+++ /dev/null
@@ -1,167 +0,0 @@
-
-
-
-
-
-
-
-
- CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
- PATTERN_TYPE_APACHE_ANT
- /**=httpSessionContextIntegrationFilter,logoutFilter,authenticationProcessingFilter,securityContextHolderAwareRequestFilter,rememberMeProcessingFilter,anonymousProcessingFilter,exceptionTranslationFilter,filterInvocationInterceptor
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- /c/login.htm?login_error=2
- /c/login.htm?login_error=3
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
- PATTERN_TYPE_APACHE_ANT
- /index.jsp=IS_AUTHENTICATED_ANONYMOUSLY
- /c/login*=IS_AUTHENTICATED_ANONYMOUSLY
- /c/userregistration*=IS_AUTHENTICATED_ANONYMOUSLY
- /c/activation.htm=IS_AUTHENTICATED_ANONYMOUSLY
- /c/forgotpassword*=IS_AUTHENTICATED_ANONYMOUSLY
- /c/captcha*=IS_AUTHENTICATED_ANONYMOUSLY
- /c/home.htm=IS_AUTHENTICATED_ANONYMOUSLY
- /c/try.htm=IS_AUTHENTICATED_ANONYMOUSLY
- /c/search.htm=IS_AUTHENTICATED_ANONYMOUSLY
- /c/keyboard.htm=IS_AUTHENTICATED_ANONYMOUSLY
- /css/*=IS_AUTHENTICATED_ANONYMOUSLY
- /js/**=IS_AUTHENTICATED_ANONYMOUSLY
- /ws/**=IS_AUTHENTICATED_ANONYMOUSLY
- /images/*=IS_AUTHENTICATED_ANONYMOUSLY
- /c/embeddedview.htm=IS_AUTHENTICATED_ANONYMOUSLY
- /c/export.htm=IS_AUTHENTICATED_ANONYMOUSLY
- /c/publicview.htm=IS_AUTHENTICATED_ANONYMOUSLY
- /dwr/engine.js=IS_AUTHENTICATED_ANONYMOUSLY
- /dwr/interface/loggerservice.js=IS_AUTHENTICATED_ANONYMOUSLY
- /dwr/call/plaincall/loggerservice.logerror.dwr=IS_AUTHENTICATED_ANONYMOUSLY
- /**=IS_AUTHENTICATED_REMEMBERED
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-rest.xml b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-rest.xml
index 0c2baf05..1e0b28b4 100644
--- a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-rest.xml
+++ b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-rest.xml
@@ -15,15 +15,10 @@
-
-
-
-
-
- com.wisemapping.rest.model.RestMindMap
+ com.wisemapping.rest.model.RestMindmap
@@ -33,11 +28,14 @@
@@ -76,5 +74,7 @@
-
+
+
+
\ No newline at end of file
diff --git a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-security.xml b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-security.xml
index 6ed011bf..0c3bde00 100644
--- a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-security.xml
+++ b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-security.xml
@@ -30,9 +30,11 @@
+
+
diff --git a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-servlet.xml b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-servlet.xml
index b19db494..8fd5e210 100644
--- a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-servlet.xml
+++ b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-servlet.xml
@@ -107,11 +107,7 @@
-
-
-
-
-
+
@@ -303,7 +299,6 @@
editorController
cookerController
settingsController
- exportController
publishController
editProfileController
tagsController
diff --git a/wise-webapp/src/main/webapp/jsp/mindmapExport.jsp b/wise-webapp/src/main/webapp/jsp/mindmapExport.jsp
index b5ab7be3..c580e92d 100644
--- a/wise-webapp/src/main/webapp/jsp/mindmapExport.jsp
+++ b/wise-webapp/src/main/webapp/jsp/mindmapExport.jsp
@@ -1,13 +1,13 @@
<%@ include file="/jsp/init.jsp" %>
-
- '${mindmap.title}'
+ '${mindmap.title}'
-
" style="height:100%;">
-
-
-
+
"
+ style="height:100%;" enctype="application/x-www-form-urlencoded">
+
+
+
@@ -85,14 +85,36 @@
});
$('ok').addEvent('click', function(event) {
- $('exportForm').submit();
+
+ var form = $('exportForm');
+
+ // Look for the selected format and append export suffix...
+ var value = $$('input[name=exportFormat]:checked')[0].get('value');
+ var suffix;
+ if (value == 'IMG_EXPORT_FORMAT') {
+ var selected = $('imgFormat');
+ suffix = selected.options[selected.selectedIndex].value;
+ } else {
+ suffix = value;
+ }
+ suffix = suffix.toLowerCase();
+ form.action = form.action + "." + suffix;
+
+ // Store SVG o native map...
+ if (suffix == "freemind") {
+ var mindmap = designer.getMindmap();
+ var serializer = mindplot.XMLMindmapSerializerFactory.getSerializerFromMindmap(mindmap);
+ var domMap = serializer.toXML(mindmap);
+ form.mapXml.value = core.Utils.innerXML(domMap);
+ } else {
+ form.svgXml.value = $("workspaceContainer").innerHTML;
+ }
+
+ // Finally, submit map ...
+ form.submit();
+
+
MooDialog.Request.active.close();
});
- $('cancel').addEvent('click', function(event) {
- MooDialog.Request.active.close();
- });
-
- document.exportForm.mapSvg.value = $("workspaceContainer").innerHTML;
-
\ No newline at end of file
From 95aa9f18eb7358cd47bdbebf6376f77a130567b6 Mon Sep 17 00:00:00 2001
From: Paulo Gustavo Veiga
Date: Mon, 20 Feb 2012 10:01:53 -0300
Subject: [PATCH 06/45] Add missing images to wise-webapps.
---
wise-editor/src/main/webapp/c/export.bin | Bin 658 -> 0 bytes
wise-editor/src/main/webapp/c/export.htm | 75 +++++++++++-------
wise-editor/src/main/webapp/html/editor.html | 3 +
.../main/webapp/icons/legacy/printNews.png | Bin 6739 -> 0 bytes
.../src/main/webapp/images/icon_list.png | Bin 0 -> 4556 bytes
wise-webapp/src/main/webapp/images/key.png | Bin 0 -> 612 bytes
6 files changed, 49 insertions(+), 29 deletions(-)
delete mode 100644 wise-editor/src/main/webapp/c/export.bin
delete mode 100644 wise-editor/src/main/webapp/icons/legacy/printNews.png
create mode 100644 wise-webapp/src/main/webapp/images/icon_list.png
create mode 100644 wise-webapp/src/main/webapp/images/key.png
diff --git a/wise-editor/src/main/webapp/c/export.bin b/wise-editor/src/main/webapp/c/export.bin
deleted file mode 100644
index efa4f251a4939168342b9f844070b7ad90bad249..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 658
zcmZ?wbhEHbEMkyiIKsg2UqImhhY$ZRT=@Us!G8mT{|O2I6%_t2Snxj};QxdP|2J&-
zUr_MBq2a%S!~X*Z{sYzj2NEOz#h)x-)jA*&WG4gbe+8Akl+1Ym7kTJ
zZ^g|-nIw3SRCg&3x0_a2x(OCZSGfauB+)-DZx{~FZJKfA(eHywV+od|$!UF1cFWXiU4WOXyC`dbenc$K0oMi<
zfhoORlO}v~cy~!ZNMmv2H`O->4rwGYSuB{wy2&fyoTpmht@j;HuV#GBy;2p(xU74H
zqUjU~{qB`W?7p1;{N&l`++HjP2)iWi&(~kMh>+V5BQsS%w9Zb
Q7I4#e*doFu!Ngz<0O^(iFaQ7m
diff --git a/wise-editor/src/main/webapp/c/export.htm b/wise-editor/src/main/webapp/c/export.htm
index 4e761788..c1f5f070 100644
--- a/wise-editor/src/main/webapp/c/export.htm
+++ b/wise-editor/src/main/webapp/c/export.htm
@@ -1,24 +1,18 @@
-
-
-
-
- Export
- 'sss'
+
Export
diff --git a/wise-editor/src/main/webapp/html/editor.html b/wise-editor/src/main/webapp/html/editor.html
index 3c749a42..8982283a 100644
--- a/wise-editor/src/main/webapp/html/editor.html
+++ b/wise-editor/src/main/webapp/html/editor.html
@@ -2,20 +2,22 @@