Integrate Designer location with the editor ...

This commit is contained in:
Paulo Gustavo Veiga 2012-07-01 17:54:46 -03:00
parent 2757a5ddb4
commit 7752ac0dc1
6 changed files with 13 additions and 6 deletions

View File

@ -24,7 +24,7 @@ mindplot.Designer = new Class({
$assert(divElement, "divElement must be defined"); $assert(divElement, "divElement must be defined");
// Set up i18n location ... // Set up i18n location ...
mindplot.Messages.init(options.location); mindplot.Messages.init(options.locale);
this._options = options; this._options = options;

View File

@ -18,8 +18,8 @@
mindplot.Messages = new Class({ mindplot.Messages = new Class({
Static:{ Static:{
init:function (location) { init:function (locale) {
var locale = $defined(location) ? location : 'en'; locale = $defined(locale) ? locale : 'en';
mindplot.Messages.__bundle = mindplot.Messages.BUNDLES[locale]; mindplot.Messages.__bundle = mindplot.Messages.BUNDLES[locale];
console.log(mindplot.Messages.__bundle); console.log(mindplot.Messages.__bundle);
} }

View File

@ -248,7 +248,7 @@ mindplot.widget.Menu = new Class({
this._addButton('redoEdition', false, false, function () { this._addButton('redoEdition', false, false, function () {
designer.redo(); designer.redo();
}); });
this._registerTooltip('redoEdition', $msg('REDO'), "meta+Y"); this._registerTooltip('redoEdition', $msg('REDO'), "meta+shift+Z");
this._addButton('addTopic', true, false, function () { this._addButton('addTopic', true, false, function () {

View File

@ -108,7 +108,7 @@ function loadDesignerOptions(jsonConf) {
height:parseInt(window.innerHeight - 70), // Footer and Header height:parseInt(window.innerHeight - 70), // Footer and Header
width:parseInt(window.innerWidth) 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; return result;
} }

View File

@ -30,12 +30,14 @@ import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import java.io.IOException; import java.io.IOException;
import java.util.Locale;
@Controller @Controller
public class MindmapController { public class MindmapController {
@ -134,6 +136,10 @@ public class MindmapController {
String result; String result;
if (mindmap.hasPermissions(Utils.getUser(), CollaborationRole.EDITOR)) { if (mindmap.hasPermissions(Utils.getUser(), CollaborationRole.EDITOR)) {
model.addAttribute("mindmap", mindmapBean); model.addAttribute("mindmap", mindmapBean);
// Configure default locale for the editor ...
final Locale locale = LocaleContextHolder.getLocale();
model.addAttribute("locale", locale.getLanguage());
result = "mindmapEditor"; result = "mindmapEditor";
} else { } else {
result = "redirect:view"; result = "redirect:view";

View File

@ -10,7 +10,7 @@
<%--@elvariable id="editorTryMode" type="java.lang.String"--%> <%--@elvariable id="editorTryMode" type="java.lang.String"--%>
<%--@elvariable id="mapXml" type="com.wisemapping.model.User"--%> <%--@elvariable id="mapXml" type="com.wisemapping.model.User"--%>
<% <%
User user = Utils.getUser(true); User user = Utils.getUser();
if (user != null) { if (user != null) {
request.setAttribute("principal", user); request.setAttribute("principal", user);
} }
@ -44,6 +44,7 @@
var userOptions = ${mindmap.properties}; var userOptions = ${mindmap.properties};
options.zoom = userOptions.zoom; options.zoom = userOptions.zoom;
options.readOnly = ${!!readOnlyMode}; options.readOnly = ${!!readOnlyMode};
options.locale = '${locale}';
// Set map id ... // Set map id ...
options.mapId = mapId; options.mapId = mapId;