From 7752ac0dc1c86651e9c0167aa459bf8ef94e9467 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Sun, 1 Jul 2012 17:54:46 -0300 Subject: [PATCH] Integrate Designer location with the editor ... --- mindplot/src/main/javascript/Designer.js | 2 +- mindplot/src/main/javascript/Messages.js | 4 ++-- mindplot/src/main/javascript/widget/Menu.js | 2 +- wise-editor/src/main/webapp/js/editor.js | 2 +- .../java/com/wisemapping/ncontroller/MindmapController.java | 6 ++++++ wise-webapp/src/main/webapp/jsp/mindmapEditor.jsp | 3 ++- 6 files changed, 13 insertions(+), 6 deletions(-) diff --git a/mindplot/src/main/javascript/Designer.js b/mindplot/src/main/javascript/Designer.js index 618ef107..129c96ce 100644 --- a/mindplot/src/main/javascript/Designer.js +++ b/mindplot/src/main/javascript/Designer.js @@ -24,7 +24,7 @@ mindplot.Designer = new Class({ $assert(divElement, "divElement must be defined"); // Set up i18n location ... - mindplot.Messages.init(options.location); + mindplot.Messages.init(options.locale); this._options = options; diff --git a/mindplot/src/main/javascript/Messages.js b/mindplot/src/main/javascript/Messages.js index 0152ed3b..26989e05 100644 --- a/mindplot/src/main/javascript/Messages.js +++ b/mindplot/src/main/javascript/Messages.js @@ -18,8 +18,8 @@ mindplot.Messages = new Class({ Static:{ - init:function (location) { - var locale = $defined(location) ? location : 'en'; + init:function (locale) { + locale = $defined(locale) ? locale : 'en'; mindplot.Messages.__bundle = mindplot.Messages.BUNDLES[locale]; console.log(mindplot.Messages.__bundle); } diff --git a/mindplot/src/main/javascript/widget/Menu.js b/mindplot/src/main/javascript/widget/Menu.js index 0f902e2a..6c8e5c6b 100644 --- a/mindplot/src/main/javascript/widget/Menu.js +++ b/mindplot/src/main/javascript/widget/Menu.js @@ -248,7 +248,7 @@ mindplot.widget.Menu = new Class({ this._addButton('redoEdition', false, false, function () { designer.redo(); }); - this._registerTooltip('redoEdition', $msg('REDO'), "meta+Y"); + this._registerTooltip('redoEdition', $msg('REDO'), "meta+shift+Z"); this._addButton('addTopic', true, false, function () { diff --git a/wise-editor/src/main/webapp/js/editor.js b/wise-editor/src/main/webapp/js/editor.js index 1d4b9fd5..e3aff480 100644 --- a/wise-editor/src/main/webapp/js/editor.js +++ b/wise-editor/src/main/webapp/js/editor.js @@ -108,7 +108,7 @@ function loadDesignerOptions(jsonConf) { height:parseInt(window.innerHeight - 70), // Footer and Header width:parseInt(window.innerWidth) }; - result = {readOnly:false, zoom:0.85, saveOnLoad:true, size:containerSize, viewPort:viewPort, container:'mindplot', location:'en'}; + result = {readOnly:false, zoom:0.85, saveOnLoad:true, size:containerSize, viewPort:viewPort, container:'mindplot', locale:'en'}; } 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 a1e89a3f..b79e8e22 100644 --- a/wise-webapp/src/main/java/com/wisemapping/ncontroller/MindmapController.java +++ b/wise-webapp/src/main/java/com/wisemapping/ncontroller/MindmapController.java @@ -30,12 +30,14 @@ import org.jetbrains.annotations.NotNull; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; import java.io.IOException; +import java.util.Locale; @Controller public class MindmapController { @@ -134,6 +136,10 @@ public class MindmapController { String result; if (mindmap.hasPermissions(Utils.getUser(), CollaborationRole.EDITOR)) { model.addAttribute("mindmap", mindmapBean); + + // Configure default locale for the editor ... + final Locale locale = LocaleContextHolder.getLocale(); + model.addAttribute("locale", locale.getLanguage()); result = "mindmapEditor"; } else { result = "redirect:view"; diff --git a/wise-webapp/src/main/webapp/jsp/mindmapEditor.jsp b/wise-webapp/src/main/webapp/jsp/mindmapEditor.jsp index d5bb9d5c..efe55d09 100644 --- a/wise-webapp/src/main/webapp/jsp/mindmapEditor.jsp +++ b/wise-webapp/src/main/webapp/jsp/mindmapEditor.jsp @@ -10,7 +10,7 @@ <%--@elvariable id="editorTryMode" type="java.lang.String"--%> <%--@elvariable id="mapXml" type="com.wisemapping.model.User"--%> <% - User user = Utils.getUser(true); + User user = Utils.getUser(); if (user != null) { request.setAttribute("principal", user); } @@ -44,6 +44,7 @@ var userOptions = ${mindmap.properties}; options.zoom = userOptions.zoom; options.readOnly = ${!!readOnlyMode}; + options.locale = '${locale}'; // Set map id ... options.mapId = mapId;