From 5cb2289cbc1c0bd5836bafc798d37491e00d1c36 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Sun, 4 Nov 2012 15:56:26 -0300 Subject: [PATCH 1/9] Disable images support. --- mindplot/src/main/javascript/Designer.js | 65 ++++++++++++------------ 1 file changed, 33 insertions(+), 32 deletions(-) diff --git a/mindplot/src/main/javascript/Designer.js b/mindplot/src/main/javascript/Designer.js index 8a5ae4b5..c839d5d6 100644 --- a/mindplot/src/main/javascript/Designer.js +++ b/mindplot/src/main/javascript/Designer.js @@ -167,39 +167,40 @@ mindplot.Designer = new Class({ } // Enable drag events ... - Element.NativeEvents.dragenter = 2; - Element.NativeEvents.dragexit = 2; - Element.NativeEvents.dragover = 2; - Element.NativeEvents.drop = 2; - - screenManager.addEvent('dragenter', noopHandler); - screenManager.addEvent('dragexit', noopHandler); - screenManager.addEvent('dragover', noopHandler); - screenManager.addEvent('drop', function (evt) { - evt.stopPropagation(); - evt.preventDefault(); + // @Todo: Images support on progress ... +// Element.NativeEvents.dragenter = 2; +// Element.NativeEvents.dragexit = 2; +// Element.NativeEvents.dragover = 2; +// Element.NativeEvents.drop = 2; // - var files = evt.event.dataTransfer.files; - console.log(event); - - var count = files.length; - - // Only call the handler if 1 or more files was dropped. - if (count > 0) { - - var model = this.getMindmap().createNode(); - model.setImageSize(80, 43); - model.setMetadata("{'media':'video,'url':'http://www.youtube.com/watch?v=P3FrXftyuzw&feature=g-vrec&context=G2b4ab69RVAAAAAAAAAA'}"); - model.setImageUrl("images/logo-small.png"); - model.setShapeType(mindplot.model.TopicShape.IMAGE); - - var position = screenManager.getWorkspaceMousePosition(evt); - model.setPosition(position.x, position.y); - model.setPosition(100, 100); - - this._actionDispatcher.addTopics([model]); - } - }.bind(this)); +// screenManager.addEvent('dragenter', noopHandler); +// screenManager.addEvent('dragexit', noopHandler); +// screenManager.addEvent('dragover', noopHandler); +// screenManager.addEvent('drop', function (evt) { +// evt.stopPropagation(); +// evt.preventDefault(); +//// +// var files = evt.event.dataTransfer.files; +// console.log(event); +// +// var count = files.length; +// +// // Only call the handler if 1 or more files was dropped. +// if (count > 0) { +// +// var model = this.getMindmap().createNode(); +// model.setImageSize(80, 43); +// model.setMetadata("{'media':'video,'url':'http://www.youtube.com/watch?v=P3FrXftyuzw&feature=g-vrec&context=G2b4ab69RVAAAAAAAAAA'}"); +// model.setImageUrl("images/logo-small.png"); +// model.setShapeType(mindplot.model.TopicShape.IMAGE); +// +// var position = screenManager.getWorkspaceMousePosition(evt); +// model.setPosition(position.x, position.y); +// model.setPosition(100, 100); +// +// this._actionDispatcher.addTopics([model]); +// } +// }.bind(this)); }, From 37b4298579bb693b34b82af07536d729af9d3dee Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Sun, 4 Nov 2012 18:17:32 -0300 Subject: [PATCH 2/9] Fix Apache Proxy configuration property. --- .../filter/RequestPropertiesInterceptor.java | 46 ++++++++++++++----- .../wisemapping/mail/NotificationService.java | 30 ++++++++---- .../src/main/webapp/WEB-INF/app.properties | 6 ++- .../main/webapp/WEB-INF/wisemapping-dao.xml | 3 -- .../webapp/WEB-INF/wisemapping-security.xml | 7 --- .../webapp/WEB-INF/wisemapping-service.xml | 5 +- .../webapp/WEB-INF/wisemapping-servlet.xml | 24 ++-------- .../main/webapp/jsp/dialogFullTemplate.jsp | 2 +- wise-webapp/src/main/webapp/jsp/init.jsp | 3 -- .../src/main/webapp/jsp/mindmapEditor.jsp | 2 +- .../src/main/webapp/jsp/mindmapEmbed.jsp | 2 +- .../src/main/webapp/jsp/mindmapList.jsp | 2 +- .../src/main/webapp/jsp/mindmapPrint.jsp | 2 +- wise-webapp/src/main/webapp/jsp/template.jsp | 2 +- 14 files changed, 71 insertions(+), 65 deletions(-) diff --git a/wise-webapp/src/main/java/com/wisemapping/filter/RequestPropertiesInterceptor.java b/wise-webapp/src/main/java/com/wisemapping/filter/RequestPropertiesInterceptor.java index a187e920..36362821 100644 --- a/wise-webapp/src/main/java/com/wisemapping/filter/RequestPropertiesInterceptor.java +++ b/wise-webapp/src/main/java/com/wisemapping/filter/RequestPropertiesInterceptor.java @@ -18,29 +18,51 @@ package com.wisemapping.filter; -import com.wisemapping.exceptions.GoogleChromeFrameRequiredException; -import com.wisemapping.exceptions.UnsupportedBrowserException; import org.jetbrains.annotations.NotNull; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.core.env.ConfigurableEnvironment; +import org.springframework.core.env.Environment; +import org.springframework.core.env.MutablePropertySources; +import org.springframework.core.env.PropertySource; import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; -import java.util.HashMap; import java.util.Map; -import java.util.Set; +import java.util.regex.Pattern; + public class RequestPropertiesInterceptor extends HandlerInterceptorAdapter { - private Map attributes; + @Value("${google.analytics.enabled}") + private Boolean analyticsEnabled; + + @Value("${google.analytics.account}") + private String analyticsAccount; + + @Value("${google.ads.enabled}") + private Boolean adsEnabled; + + @Value("${site.homepage}") + private String siteHomepage; + + @Autowired + Environment env; public boolean preHandle(@NotNull HttpServletRequest request, @NotNull HttpServletResponse response, Object object) throws Exception { - for (String key : attributes.keySet()) { - request.setAttribute(key, attributes.get(key)); + + request.setAttribute("google.analytics.enabled", analyticsEnabled); + request.setAttribute("google.analytics.account", analyticsAccount); + request.setAttribute("google.ads.enabled", adsEnabled); + request.setAttribute("site.homepage", siteHomepage); + + final String baseUrl; + if (env.containsProperty("site.baseurl")) { + baseUrl = env.getProperty("site.baseurl"); + } else { + baseUrl = request.getRequestURL().toString().replace(request.getRequestURI(), request.getContextPath()); } + request.setAttribute("site.baseurl", baseUrl); return true; } - - public void setAttributes(Map attributes) { - this.attributes = attributes; - } } diff --git a/wise-webapp/src/main/java/com/wisemapping/mail/NotificationService.java b/wise-webapp/src/main/java/com/wisemapping/mail/NotificationService.java index c047d657..8c97954c 100644 --- a/wise-webapp/src/main/java/com/wisemapping/mail/NotificationService.java +++ b/wise-webapp/src/main/java/com/wisemapping/mail/NotificationService.java @@ -27,6 +27,7 @@ import org.apache.commons.lang.StringEscapeUtils; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; import javax.servlet.http.HttpServletRequest; import java.io.PrintWriter; @@ -37,12 +38,14 @@ import java.util.Map; final public class NotificationService { - + public static final String DEFAULT_WISE_URL = "http://localhost:8080/wisemapping"; @Autowired private Mailer mailer; - private String baseUrl; + private NotifierFilter notificationFilter; + private String baseUrl; + public NotificationService() { this.notificationFilter = new NotifierFilter(); } @@ -64,8 +67,8 @@ final public class NotificationService { model.put("mindmap", mindmap); model.put("message", "message"); model.put("ownerName", user.getFirstname()); - model.put("mapEditUrl", baseUrl + "/c/maps/" + mindmap.getId() + "/edit"); - model.put("baseUrl", baseUrl); + model.put("mapEditUrl", getBaseUrl() + "/c/maps/" + mindmap.getId() + "/edit"); + model.put("baseUrl", getBaseUrl()); model.put("senderMail", user.getEmail()); model.put("message", message); model.put("supportEmail", mailer.getSupportEmail()); @@ -83,7 +86,7 @@ final public class NotificationService { final String messageBody = "

Someone, most likely you, requested a new password for your WiseMapping account.

\n" + "

Here is your new password: " + temporalPassword + "

\n" + - "

You can login clicking here. We strongly encourage you to change the password as soon as possible.

"; + "

You can login clicking here. We strongly encourage you to change the password as soon as possible.

"; sendTemplateMail(user, mailSubject, messageTitle, messageBody); } @@ -112,7 +115,7 @@ final public class NotificationService { model.put("firstName", user.getFirstname()); model.put("messageTitle", messageTitle); model.put("messageBody", messageBody); - model.put("baseUrl", this.baseUrl); + model.put("baseUrl", getBaseUrl()); model.put("supportEmail", mailer.getSupportEmail()); mailer.sendEmail(mailer.getServerSenderEmail(), user.getEmail(), mailSubject, model, "baseLayout.vm"); @@ -127,10 +130,6 @@ final public class NotificationService { } - public void setBaseUrl(String baseUrl) { - this.baseUrl = baseUrl; - } - public void setMailer(Mailer mailer) { this.mailer = mailer; } @@ -227,6 +226,17 @@ final public class NotificationService { return retValue; } + public String getBaseUrl() { + if ("${site.baseurl}".equals(baseUrl)) { + baseUrl = DEFAULT_WISE_URL; + System.err.println("Warning: site.baseurl has not being configured. Mail site references could be not properly sent. Using :" + baseUrl); + } + return baseUrl; + } + + public void setBaseUrl(String baseUrl) { + this.baseUrl = baseUrl; + } } diff --git a/wise-webapp/src/main/webapp/WEB-INF/app.properties b/wise-webapp/src/main/webapp/WEB-INF/app.properties index 9d9189e3..f0aa2f30 100755 --- a/wise-webapp/src/main/webapp/WEB-INF/app.properties +++ b/wise-webapp/src/main/webapp/WEB-INF/app.properties @@ -80,8 +80,10 @@ google.recaptcha.publicKey = 6LeQ4tISAAAAALzCGKNgRv8UqsDx7Cb0vq4wbJBr # etc. admin.user = admin@wisemapping.org -# Site URL. This url will be used during sharing emails and public views. -site.baseurl = http://localhost:8080/wisemapping +# Base URL where WiseMapping is deployed. By default, It will be automatically inferred. +# If you are planning to put wisemapping behind an Apache using an Apache Proxy setup, you must enable this property. +# site.baseurl = http:///example.com:8080/wisemapping + # Site Homepage URL. This will be used as URL for homepage location. site.homepage = c/home diff --git a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-dao.xml b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-dao.xml index 1f690e87..c8017226 100644 --- a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-dao.xml +++ b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-dao.xml @@ -7,9 +7,6 @@ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd"> - - - 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 92352c2d..a84c5a99 100644 --- a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-security.xml +++ b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-security.xml @@ -11,8 +11,6 @@ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> - - @@ -72,9 +70,4 @@ - - - - - \ No newline at end of file diff --git a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-service.xml b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-service.xml index bbd9fcf5..8ebbd33f 100755 --- a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-service.xml +++ b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-service.xml @@ -1,8 +1,11 @@ + http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd"> + + 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 215414ce..76584ef5 100644 --- a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-servlet.xml +++ b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-servlet.xml @@ -14,9 +14,7 @@ - + @@ -38,18 +36,8 @@ - - - - - - - - - - - - + + @@ -110,10 +98,4 @@ - - - - diff --git a/wise-webapp/src/main/webapp/jsp/dialogFullTemplate.jsp b/wise-webapp/src/main/webapp/jsp/dialogFullTemplate.jsp index 5abb179d..b7cc410d 100644 --- a/wise-webapp/src/main/webapp/jsp/dialogFullTemplate.jsp +++ b/wise-webapp/src/main/webapp/jsp/dialogFullTemplate.jsp @@ -16,7 +16,7 @@ - + diff --git a/wise-webapp/src/main/webapp/jsp/init.jsp b/wise-webapp/src/main/webapp/jsp/init.jsp index 040b1cf2..91b72cbb 100644 --- a/wise-webapp/src/main/webapp/jsp/init.jsp +++ b/wise-webapp/src/main/webapp/jsp/init.jsp @@ -2,6 +2,3 @@ <%@taglib prefix="spring" uri="http://www.springframework.org/tags" %> <%@taglib prefix="form" uri="http://www.springframework.org/tags/form" %> <%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> - - - diff --git a/wise-webapp/src/main/webapp/jsp/mindmapEditor.jsp b/wise-webapp/src/main/webapp/jsp/mindmapEditor.jsp index 5c857efa..ae22ee1b 100644 --- a/wise-webapp/src/main/webapp/jsp/mindmapEditor.jsp +++ b/wise-webapp/src/main/webapp/jsp/mindmapEditor.jsp @@ -11,7 +11,7 @@ <%--@elvariable id="mapXml" type="com.wisemapping.model.User"--%> - + <spring:message code="SITE.TITLE"/> - <c:out value="${mindmap.title}"/> @@ -280,7 +286,7 @@ org.slf4j slf4j-api - 1.6.4 + 1.7.2 runtime diff --git a/wise-webapp/src/main/resources/com/wisemapping/model/AccessAuditory.hbm.xml b/wise-webapp/src/main/resources/com/wisemapping/model/AccessAuditory.hbm.xml index c9eb20da..8586119d 100755 --- a/wise-webapp/src/main/resources/com/wisemapping/model/AccessAuditory.hbm.xml +++ b/wise-webapp/src/main/resources/com/wisemapping/model/AccessAuditory.hbm.xml @@ -1,7 +1,7 @@ + "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> diff --git a/wise-webapp/src/main/resources/com/wisemapping/model/Collaboration.hbm.xml b/wise-webapp/src/main/resources/com/wisemapping/model/Collaboration.hbm.xml index a07f023f..51808281 100644 --- a/wise-webapp/src/main/resources/com/wisemapping/model/Collaboration.hbm.xml +++ b/wise-webapp/src/main/resources/com/wisemapping/model/Collaboration.hbm.xml @@ -1,7 +1,7 @@ + "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> diff --git a/wise-webapp/src/main/resources/com/wisemapping/model/CollaborationProperties.hbm.xml b/wise-webapp/src/main/resources/com/wisemapping/model/CollaborationProperties.hbm.xml index 905f9bf0..6e9908d6 100644 --- a/wise-webapp/src/main/resources/com/wisemapping/model/CollaborationProperties.hbm.xml +++ b/wise-webapp/src/main/resources/com/wisemapping/model/CollaborationProperties.hbm.xml @@ -1,7 +1,7 @@ + "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> diff --git a/wise-webapp/src/main/resources/com/wisemapping/model/Collaborator.hbm.xml b/wise-webapp/src/main/resources/com/wisemapping/model/Collaborator.hbm.xml index 4bc92e65..ef094032 100755 --- a/wise-webapp/src/main/resources/com/wisemapping/model/Collaborator.hbm.xml +++ b/wise-webapp/src/main/resources/com/wisemapping/model/Collaborator.hbm.xml @@ -1,7 +1,7 @@ + "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> diff --git a/wise-webapp/src/main/resources/com/wisemapping/model/MindMapHistory.hbm.xml b/wise-webapp/src/main/resources/com/wisemapping/model/MindMapHistory.hbm.xml index b265e130..e1320af4 100755 --- a/wise-webapp/src/main/resources/com/wisemapping/model/MindMapHistory.hbm.xml +++ b/wise-webapp/src/main/resources/com/wisemapping/model/MindMapHistory.hbm.xml @@ -1,7 +1,7 @@ + "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> diff --git a/wise-webapp/src/main/resources/com/wisemapping/model/Mindmap.hbm.xml b/wise-webapp/src/main/resources/com/wisemapping/model/Mindmap.hbm.xml index 45c43afa..823a0725 100644 --- a/wise-webapp/src/main/resources/com/wisemapping/model/Mindmap.hbm.xml +++ b/wise-webapp/src/main/resources/com/wisemapping/model/Mindmap.hbm.xml @@ -1,7 +1,7 @@ + "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> diff --git a/wise-webapp/src/main/webapp/WEB-INF/classes/log4j.properties b/wise-webapp/src/main/webapp/WEB-INF/classes/log4j.properties index fc70ce71..8621a470 100644 --- a/wise-webapp/src/main/webapp/WEB-INF/classes/log4j.properties +++ b/wise-webapp/src/main/webapp/WEB-INF/classes/log4j.properties @@ -2,8 +2,8 @@ log4j.rootLogger=WARN, stdout, R log4j.logger.com.wisemapping=WARN,stdout,R log4j.logger.org.springframework=WARN,stdout,R log4j.logger.org.codehaus.jackson=WARN,stdout,R -log4j.logger.org.hibernate=DEBUG,stdout,R -log4j.logger.org.hibernate.SQL=true +log4j.logger.org.hibernate=WARN,stdout,R +#log4j.logger.org.hibernate.SQL=WARN,stdout,R # Stdout logger � From c1d041e3f891bdc7c7d679eeac1573ae18b34165 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Mon, 5 Nov 2012 00:55:51 -0300 Subject: [PATCH 8/9] Remove logger info. --- wise-webapp/src/main/webapp/WEB-INF/classes/log4j.properties | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wise-webapp/src/main/webapp/WEB-INF/classes/log4j.properties b/wise-webapp/src/main/webapp/WEB-INF/classes/log4j.properties index 8621a470..f1555fcd 100644 --- a/wise-webapp/src/main/webapp/WEB-INF/classes/log4j.properties +++ b/wise-webapp/src/main/webapp/WEB-INF/classes/log4j.properties @@ -3,6 +3,8 @@ log4j.logger.com.wisemapping=WARN,stdout,R log4j.logger.org.springframework=WARN,stdout,R log4j.logger.org.codehaus.jackson=WARN,stdout,R log4j.logger.org.hibernate=WARN,stdout,R +log4j.logger.org.hibernate.engine.StatefulPersistenceContext=ERROR,stdout,R + #log4j.logger.org.hibernate.SQL=WARN,stdout,R From 29e397ab3f528102948503900f8db0c0c32c4355 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Mon, 5 Nov 2012 00:58:00 -0300 Subject: [PATCH 9/9] Fix call to undefined value --- mindplot/src/main/javascript/StandaloneActionDispatcher.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mindplot/src/main/javascript/StandaloneActionDispatcher.js b/mindplot/src/main/javascript/StandaloneActionDispatcher.js index 7b5df982..b25fbb62 100644 --- a/mindplot/src/main/javascript/StandaloneActionDispatcher.js +++ b/mindplot/src/main/javascript/StandaloneActionDispatcher.js @@ -83,7 +83,7 @@ mindplot.StandaloneActionDispatcher = new Class({ topic.setText(value); return result; }; - command.commandType = "changeTextToTopic"; + commandFunc.commandType = "changeTextToTopic"; var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicsIds, text); this.execute(command);