From 88b0efa859f6675d5487585d34306c4f8e230026 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Sun, 3 Jun 2012 20:23:31 -0300 Subject: [PATCH] Add zoom support for embedded maps. Add new url to embedded maps --- wise-editor/src/main/webapp/css/embedded.less | 3 +- .../controller/EmbeddedViewController.java | 78 ------------- .../com/wisemapping/filter/UserAgent.java | 7 +- .../ncontroller/MindmapController.java | 18 +++ .../wisemapping/rest/MindmapController.java | 4 - .../src/main/webapp/WEB-INF/app.properties | 3 + .../WEB-INF/classes/messages.properties | 3 +- .../WEB-INF/classes/messages_es.properties | 4 +- .../WEB-INF/classes/messages_fr.properties | 1 + .../main/webapp/WEB-INF/defs/definitions.xml | 4 +- .../webapp/WEB-INF/wisemapping-security.xml | 8 +- .../webapp/WEB-INF/wisemapping-servlet.xml | 6 - .../src/main/webapp/jsp/embeddedView.jsp | 106 ------------------ .../src/main/webapp/jsp/embeddedViewError.jsp | 35 ------ .../webapp/jsp/embeddedViewNotSupported.jsp | 18 --- .../src/main/webapp/jsp/mindmapDetail.jsp | 2 +- .../src/main/webapp/jsp/mindmapEditor.jsp | 10 -- .../src/main/webapp/jsp/mindmapEmbed.jsp | 93 +++++++++++++++ .../src/main/webapp/jsp/mindmapPrint.jsp | 4 +- .../src/main/webapp/jsp/mindmapPublish.jsp | 4 +- 20 files changed, 134 insertions(+), 277 deletions(-) delete mode 100644 wise-webapp/src/main/java/com/wisemapping/controller/EmbeddedViewController.java delete mode 100644 wise-webapp/src/main/webapp/jsp/embeddedView.jsp delete mode 100644 wise-webapp/src/main/webapp/jsp/embeddedViewError.jsp delete mode 100644 wise-webapp/src/main/webapp/jsp/embeddedViewNotSupported.jsp create mode 100644 wise-webapp/src/main/webapp/jsp/mindmapEmbed.jsp diff --git a/wise-editor/src/main/webapp/css/embedded.less b/wise-editor/src/main/webapp/css/embedded.less index 98c761c4..aaf6abbf 100644 --- a/wise-editor/src/main/webapp/css/embedded.less +++ b/wise-editor/src/main/webapp/css/embedded.less @@ -40,12 +40,11 @@ div#zoomIn { } #zoomOut { - background: url(../images/zoom-out.png) no-repeat left top;; + background: url(../images/zoom-out.png) no-repeat left top; margin-top: 10px; margin-left: 5px; } - .button { width: 20px; height: 20px; diff --git a/wise-webapp/src/main/java/com/wisemapping/controller/EmbeddedViewController.java b/wise-webapp/src/main/java/com/wisemapping/controller/EmbeddedViewController.java deleted file mode 100644 index eed88c36..00000000 --- a/wise-webapp/src/main/java/com/wisemapping/controller/EmbeddedViewController.java +++ /dev/null @@ -1,78 +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 org.springframework.web.servlet.ModelAndView; -import org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.wisemapping.model.MindMap; -import com.wisemapping.filter.UserAgent; - -import java.lang.reflect.UndeclaredThrowableException; - -public class EmbeddedViewController extends BaseMultiActionController { - - protected ModelAndView handleNoSuchRequestHandlingMethod(NoSuchRequestHandlingMethodException noSuchRequestHandlingMethodException, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { - - ModelAndView view; - try { - final MindMap mindmap = this.getMindmapFromRequest(httpServletRequest); - if (mindmap == null) { - throw new IllegalStateException("Map could not be found"); - } - - final String fullViewStr = httpServletRequest.getParameter("fullView"); - final boolean fullView = Boolean.parseBoolean(fullViewStr); - - final UserAgent userAgent = UserAgent.create(httpServletRequest); - - if (userAgent.isBrowserSupported()) { - view = new ModelAndView("embeddedView"); - view.addObject("mindmap", mindmap); - final String xmlMap = mindmap.getXmlAsJsLiteral(); - view.addObject("mapXml", xmlMap); - - final String zoomStr = httpServletRequest.getParameter("zoom"); - float zoom = 1; - if(zoomStr!=null) - { - try { - zoom = Float.parseFloat(zoomStr); - } catch (NumberFormatException e) { - } - } - view.addObject("zoom",zoom); - - } else { - - view = new ModelAndView("embeddedViewNotSupported"); - } - view.addObject("fullView", fullView); - - } catch (UndeclaredThrowableException e) { - // Security exception .... - view = new ModelAndView("embeddedViewError"); - } - - return view; - } -} diff --git a/wise-webapp/src/main/java/com/wisemapping/filter/UserAgent.java b/wise-webapp/src/main/java/com/wisemapping/filter/UserAgent.java index 669d6539..ccd487f4 100644 --- a/wise-webapp/src/main/java/com/wisemapping/filter/UserAgent.java +++ b/wise-webapp/src/main/java/com/wisemapping/filter/UserAgent.java @@ -55,7 +55,6 @@ public class UserAgent implements Serializable { firefox = UserAgent.create("Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.12) Gecko/20080129 Iceweasel/2.0.0.12 (Debian-2.0.0.12-0etch1)"); assert firefox.isBrowserSupported(); - } @@ -323,10 +322,10 @@ public class UserAgent implements Serializable { public boolean isBrowserSupported() { // Is it a supported browser ?. final UserAgent.Product product = this.getProduct(); - boolean result = product == UserAgent.Product.FIREFOX && this.isVersionGreatedOrEqualThan(3, 0); + boolean result = product == UserAgent.Product.FIREFOX && this.isVersionGreatedOrEqualThan(10, 0); result = result || product == UserAgent.Product.EXPLORER && this.isVersionGreatedOrEqualThan(7, 0) && this.getOs() == UserAgent.OS.WINDOWS; - result = result || product == UserAgent.Product.OPERA && this.isVersionGreatedOrEqualThan(9, 0); - result = result || product == UserAgent.Product.CHROME && this.isVersionGreatedOrEqualThan(8, 0); + result = result || product == UserAgent.Product.OPERA && this.isVersionGreatedOrEqualThan(11, 0); + result = result || product == UserAgent.Product.CHROME && this.isVersionGreatedOrEqualThan(19, 0); result = result || product == UserAgent.Product.SAFARI && this.isVersionGreatedOrEqualThan(5, 0); return result; } diff --git a/wise-webapp/src/main/java/com/wisemapping/ncontroller/MindmapController.java b/wise-webapp/src/main/java/com/wisemapping/ncontroller/MindmapController.java index 84c552be..2234c95c 100644 --- a/wise-webapp/src/main/java/com/wisemapping/ncontroller/MindmapController.java +++ b/wise-webapp/src/main/java/com/wisemapping/ncontroller/MindmapController.java @@ -23,6 +23,13 @@ import java.util.List; @Controller public class MindmapController { + + private String baseUrl; + + MindmapController() { + + } + @Autowired private MindmapService mindmapService; @@ -100,6 +107,17 @@ public class MindmapController { return view; } + @RequestMapping(value = "maps/{id}/embed") + public ModelAndView embeddedView(@PathVariable int id, @RequestParam(required = false) Float zoom, @NotNull HttpServletRequest request) { + ModelAndView view; + final UserAgent userAgent = UserAgent.create(request); + final MindMap mindmap = mindmapService.getMindmapById(id); + view = new ModelAndView("mindmapEmbedded", "mindmap", mindmap); + view.addObject("user", Utils.getUser()); + view.addObject("zoom", zoom == null ? 1 : zoom); + return view; + } + @RequestMapping(value = "collaborator") public ModelAndView showCollaborator(@RequestParam(required = true) long mapId) { final MindMapBean modelObject = findMindmapBean(mapId); 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 cfe068c9..9027dcd7 100644 --- a/wise-webapp/src/main/java/com/wisemapping/rest/MindmapController.java +++ b/wise-webapp/src/main/java/com/wisemapping/rest/MindmapController.java @@ -20,7 +20,6 @@ package com.wisemapping.rest; import com.wisemapping.exceptions.WiseMappingException; -import com.wisemapping.exporter.ExportFormat; import com.wisemapping.importer.ImportFormat; import com.wisemapping.importer.Importer; import com.wisemapping.importer.ImporterException; @@ -33,10 +32,8 @@ import com.wisemapping.rest.model.RestMindmapInfo; import com.wisemapping.rest.model.RestMindmapList; import com.wisemapping.security.Utils; import com.wisemapping.service.MindmapService; -import com.wisemapping.service.UserService; import com.wisemapping.validator.MapInfoValidator; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Controller; @@ -45,7 +42,6 @@ import org.springframework.validation.BindingResult; 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.ByteArrayInputStream; import java.io.IOException; diff --git a/wise-webapp/src/main/webapp/WEB-INF/app.properties b/wise-webapp/src/main/webapp/WEB-INF/app.properties index c5e02bf9..1022c535 100755 --- a/wise-webapp/src/main/webapp/WEB-INF/app.properties +++ b/wise-webapp/src/main/webapp/WEB-INF/app.properties @@ -80,3 +80,6 @@ registration.recaptcha.publicKey = # Site administration user. This user will have special permissions for operations such as removing users, set password # etc. admin.user = admin@wisemapping.org + +# Site URL. This url will be used during sharing emails and public views. +site.baseurl = http://localhost:8080 diff --git a/wise-webapp/src/main/webapp/WEB-INF/classes/messages.properties b/wise-webapp/src/main/webapp/WEB-INF/classes/messages.properties index a59d70d4..8c895f3b 100644 --- a/wise-webapp/src/main/webapp/WEB-INF/classes/messages.properties +++ b/wise-webapp/src/main/webapp/WEB-INF/classes/messages.properties @@ -309,4 +309,5 @@ NO_PRODUCTION_DATABASE_CONFIGURED=Note: Although HSQLDB is bundled with WiseMapp IMPORT=Import EMBEDDED_MAP_SIZE=* Note: You can change embedded map size modifying 'height' and 'width' style properties. You can also adjust the zoom factor modifying 'zoom' parameter from the URL. -EXPORT_FORMAT_RESTRICTIONS=Important: Exporting to Image, PDF or SVG is available only in the editor toolbar only.\ +EXPORT_FORMAT_RESTRICTIONS=Important: Exporting to Image, PDF or SVG is available only in the editor toolbar only. +STARRED=Starred \ No newline at end of file diff --git a/wise-webapp/src/main/webapp/WEB-INF/classes/messages_es.properties b/wise-webapp/src/main/webapp/WEB-INF/classes/messages_es.properties index 52209f65..8fb4bad3 100644 --- a/wise-webapp/src/main/webapp/WEB-INF/classes/messages_es.properties +++ b/wise-webapp/src/main/webapp/WEB-INF/classes/messages_es.properties @@ -239,7 +239,6 @@ NEWS_DESC_FREEMIND=Ahora, puede importar y exportar sus mapas con formato de Fre NEWS_TITLE_KEYBOARD_NAVIGATION=La creacion de mapas mentales es mas facil que nunca! NEWS_DESC_KEYBOARD_NAVIGATION=WiseMapping lo deja crear sus mapas mentales utilzando solo el teclado. -MOST_POPULAR_MAPS=Los mapas mas populares JOIN_WISEMAPPING=Utilice WiseMapping IT_IS_FREE=Es gratis! CREATE_EDIT_ACCESS_FROM_ANYWHERE=Crear, editar y acceder a sus mapas mentales desde cualquier lugar de Internet @@ -258,4 +257,5 @@ SEARCH_PUBLIC=Buscar mapas públicos UNDO_EDITION=Undo Edition REDO_EDITION=Redo Edition REVERT=revert -EXPORT_FORMAT_RESTRICTIONS=Important: Exporting to Image, PDF or SVG is available only in the editor toolbar only.\ \ No newline at end of file +EXPORT_FORMAT_RESTRICTIONS=Important: Exporting to Image, PDF or SVG is available only in the editor toolbar. +STARRED=Starred \ No newline at end of file diff --git a/wise-webapp/src/main/webapp/WEB-INF/classes/messages_fr.properties b/wise-webapp/src/main/webapp/WEB-INF/classes/messages_fr.properties index ddc45c7b..64052082 100755 --- a/wise-webapp/src/main/webapp/WEB-INF/classes/messages_fr.properties +++ b/wise-webapp/src/main/webapp/WEB-INF/classes/messages_fr.properties @@ -248,3 +248,4 @@ EMBEDDED_MAP_SIZE=* Note EDITOR_LINKS=Mind Map feature NEWS_ADD_ICON=Mind Map feature EXPORT_FORMAT_RESTRICTIONS=Important: Exporting to Image, PDF or SVG is available only in the editor toolbar only.\ +STARRED=Starred \ No newline at end of file diff --git a/wise-webapp/src/main/webapp/WEB-INF/defs/definitions.xml b/wise-webapp/src/main/webapp/WEB-INF/defs/definitions.xml index 6222387b..142f203f 100644 --- a/wise-webapp/src/main/webapp/WEB-INF/defs/definitions.xml +++ b/wise-webapp/src/main/webapp/WEB-INF/defs/definitions.xml @@ -8,11 +8,9 @@ - - + - 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 e2399bfb..cdb4515b 100644 --- a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-security.xml +++ b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-security.xml @@ -24,15 +24,15 @@ - + + + - - - + 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 a6ad861b..db4290e0 100644 --- a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-servlet.xml +++ b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-servlet.xml @@ -136,11 +136,6 @@ - - - - - @@ -152,7 +147,6 @@ publicView - embeddedView userController diff --git a/wise-webapp/src/main/webapp/jsp/embeddedView.jsp b/wise-webapp/src/main/webapp/jsp/embeddedView.jsp deleted file mode 100644 index 4c7b661c..00000000 --- a/wise-webapp/src/main/webapp/jsp/embeddedView.jsp +++ /dev/null @@ -1,106 +0,0 @@ - - -<%@ include file="/jsp/init.jsp" %> - - - - - <spring:message code="SITE.TITLE"/> - ${mindmap.title} - - - - - - - - - - - - - - - - - - - - -
-
-
- - - - -
-
-
- <%--:${mindmap.creator}--%> - :${mindmap.title} -
-
-
- - - diff --git a/wise-webapp/src/main/webapp/jsp/embeddedViewError.jsp b/wise-webapp/src/main/webapp/jsp/embeddedViewError.jsp deleted file mode 100644 index d6dcfcd6..00000000 --- a/wise-webapp/src/main/webapp/jsp/embeddedViewError.jsp +++ /dev/null @@ -1,35 +0,0 @@ - -<%@ include file="/jsp/init.jsp" %> - - - - <spring:message code="NO_ENOUGH_PERMISSIONS"/> - - - - - - - - - -
-

- -

-

- -

-
-
- - - -
- - - - - diff --git a/wise-webapp/src/main/webapp/jsp/embeddedViewNotSupported.jsp b/wise-webapp/src/main/webapp/jsp/embeddedViewNotSupported.jsp deleted file mode 100644 index 211bf5a3..00000000 --- a/wise-webapp/src/main/webapp/jsp/embeddedViewNotSupported.jsp +++ /dev/null @@ -1,18 +0,0 @@ - - -<%@ include file="/jsp/init.jsp" %> - - - - - - - - - - - - diff --git a/wise-webapp/src/main/webapp/jsp/mindmapDetail.jsp b/wise-webapp/src/main/webapp/jsp/mindmapDetail.jsp index 62cf2fd3..08d9fde7 100644 --- a/wise-webapp/src/main/webapp/jsp/mindmapDetail.jsp +++ b/wise-webapp/src/main/webapp/jsp/mindmapDetail.jsp @@ -17,7 +17,7 @@
  • : ${wisemapDetail.creationTime}
  • : ${wisemapDetail.lastEditTime}
  • : ${wisemapDetail.lastEditor}
  • -
  • : ${wisemapDetail.tags}
  • +
  • : ${wisemapDetail.starred}
  • diff --git a/wise-webapp/src/main/webapp/jsp/mindmapEditor.jsp b/wise-webapp/src/main/webapp/jsp/mindmapEditor.jsp index 8e7a116b..82bf0494 100644 --- a/wise-webapp/src/main/webapp/jsp/mindmapEditor.jsp +++ b/wise-webapp/src/main/webapp/jsp/mindmapEditor.jsp @@ -6,10 +6,6 @@ <%--@elvariable id="mapXml" type="com.wisemapping.model.User"--%> <%@ include file="/jsp/init.jsp" %> - - - - @@ -60,12 +56,6 @@
    -
    - - - - -