From dcd15d8fa434d85daad4332dcb58f63aa0940bd5 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Thu, 23 Aug 2012 22:07:37 -0300 Subject: [PATCH] Fix resources generation bug Add support for try. --- mindplot/pom.xml | 3 +- pom.xml | 10 +++++ wise-webapp/pom.xml | 1 - .../ncontroller/ExtensionsController.java | 17 ------- .../ncontroller/MindmapController.java | 44 ++++++++++--------- .../main/resources/messages_zh_CN.properties | 6 +-- .../main/resources/messages_zh_TW.properties | 6 +-- .../src/main/webapp/jsp/mindmapEditor.jsp | 4 +- 8 files changed, 44 insertions(+), 47 deletions(-) diff --git a/mindplot/pom.xml b/mindplot/pom.xml index 2c8d22b0..53144cd4 100644 --- a/mindplot/pom.xml +++ b/mindplot/pom.xml @@ -61,7 +61,7 @@ println "Converting ${file.name} to ${outfile.name}"; outfile.withWriter('UTF-8') { out -> - out.writeLine "mindplot.Messages.BUNDLES['${lang}'] = { "; + out.writeLine "mindplot.Messages.BUNDLES['${lang.toLowerCase()}'] = { "; file.eachLine('UTF-8') { line -> if( line.trim()!="" && line[0]!='#' ) { matcher = line =~ /(.+)=(.+)/; @@ -245,7 +245,6 @@ org.apache.maven.plugins maven-surefire-plugin - 2.4.2 true diff --git a/pom.xml b/pom.xml index d07e5279..d469c4f8 100644 --- a/pom.xml +++ b/pom.xml @@ -79,6 +79,16 @@ yuicompressor-maven-plugin 1.1 + + org.apache.maven.plugins + maven-antrun-plugin + 1.7 + + + net.alchim31.maven + yuicompressor-maven-plugin + 1.1 + diff --git a/wise-webapp/pom.xml b/wise-webapp/pom.xml index b85b0ddd..e461bfa8 100644 --- a/wise-webapp/pom.xml +++ b/wise-webapp/pom.xml @@ -384,7 +384,6 @@ org.apache.maven.plugins maven-antrun-plugin - 1.7 compile diff --git a/wise-webapp/src/main/java/com/wisemapping/ncontroller/ExtensionsController.java b/wise-webapp/src/main/java/com/wisemapping/ncontroller/ExtensionsController.java index 96b6e67b..da57582e 100644 --- a/wise-webapp/src/main/java/com/wisemapping/ncontroller/ExtensionsController.java +++ b/wise-webapp/src/main/java/com/wisemapping/ncontroller/ExtensionsController.java @@ -34,19 +34,6 @@ public class ExtensionsController { @Autowired private MindmapService mindmapService; - @RequestMapping(value = "try") - public ModelAndView tryEditor() throws IOException { - - final Mindmap mindmap = mindmapService.findMindmapById(TRY_EXAMPLE_MINDMAP_ID); - - ModelAndView view = new ModelAndView("mindmapEditor", "mindmap", mindmap); - final String xmlMap = mindmap.getXmlAsJsLiteral(); - view.addObject(MAP_XML_PARAM, xmlMap); - view.addObject("editorTryMode", true); - view.addObject("showHelp", true); - return view; - } - @RequestMapping(value = "privacyPolicy") public ModelAndView privacyPolicy() { return new ModelAndView("privacyPolicy"); @@ -56,8 +43,4 @@ public class ExtensionsController { public ModelAndView faq() { return new ModelAndView("faq"); } - - public static final int TRY_EXAMPLE_MINDMAP_ID = 3; - public static final String MAP_XML_PARAM = "mapXml"; - } 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 7124b986..5362fd46 100644 --- a/wise-webapp/src/main/java/com/wisemapping/ncontroller/MindmapController.java +++ b/wise-webapp/src/main/java/com/wisemapping/ncontroller/MindmapController.java @@ -138,39 +138,43 @@ public class MindmapController { final MindMapBean mindmapBean = findMindmapBean(id); final Mindmap mindmap = mindmapBean.getDelegated(); - String result; - 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.toString().toLowerCase()); - model.addAttribute("principal", Utils.getUser()); - result = "mindmapEditor"; - } else { - result = "redirect:view"; - } - return result; + // Configure default locale for the editor ... + final Locale locale = LocaleContextHolder.getLocale(); + model.addAttribute("locale", locale.toString().toLowerCase()); + model.addAttribute("principal", Utils.getUser()); + model.addAttribute("readOnlyMode", !mindmap.hasPermissions(Utils.getUser(), CollaborationRole.EDITOR)); + + return "mindmapEditor"; } @RequestMapping(value = "maps/{id}/view", method = RequestMethod.GET) public String showMindmapViewerPage(@PathVariable int id, @NotNull Model model) { - final MindMapBean mindmapBean = findMindmapBean(id); - model.addAttribute("mindmap", mindmapBean); + final String result = showMindmapEditorPage(id, model); model.addAttribute("readOnlyMode", true); - return "mindmapEditor"; + return result; + } + + @RequestMapping(value = "maps/{id}/try", method = RequestMethod.GET) + public String showMindmapTryPage(@PathVariable int id, @NotNull Model model) { + final String result = showMindmapEditorPage(id, model); + model.addAttribute("memoryPersistence", true); + return result; } @RequestMapping(value = "maps/{id}/{hid}/view", method = RequestMethod.GET) public String showMindmapViewerRevPage(@PathVariable int id, @PathVariable int hid, @NotNull Model model) throws WiseMappingException { - final MindMapBean mindmapBean = findMindmapBean(id); - final MindMapHistory mindmapHistory = mindmapService.findMindmapHistory(id, hid); - mindmapBean.getDelegated().setXml(mindmapHistory.getXml()); - model.addAttribute("mindmap", mindmapBean); + final String result = showMindmapEditorPage(id, model); model.addAttribute("readOnlyMode", true); - return "mindmapEditor"; + // Change map XML .... + final MindMapBean mindmapBean = (MindMapBean) model.asMap().get("mindmap"); + final MindMapHistory mindmapHistory = mindmapService.findMindmapHistory(id, hid); + mindmapBean.getDelegated().setXml(mindmapHistory.getXml()); + + return result; } @RequestMapping(value = "maps/{id}/embed") diff --git a/wise-webapp/src/main/resources/messages_zh_CN.properties b/wise-webapp/src/main/resources/messages_zh_CN.properties index bc9ec335..bdcf6fb6 100644 --- a/wise-webapp/src/main/resources/messages_zh_CN.properties +++ b/wise-webapp/src/main/resources/messages_zh_CN.properties @@ -209,7 +209,7 @@ KEYBOARD_SHORTCUTS_MSG=快捷键可以帮助你节约时间,使你的手不必 COPY_AND_PASTE_TOPICS=拷贝和粘贴节点 MULTIPLE_LINES=添加多行长文本 TERM_OF_USE=条款和条件 -CONTACT_US=ËÅîÁ≥ªÊà뉪¨ -FEEDBACK=Âèçȶà -SUPPORT=Â∏ÆÂä© +CONTACT_US=联系我们 +FEEDBACK=反馈 +SUPPORT=支援 diff --git a/wise-webapp/src/main/resources/messages_zh_TW.properties b/wise-webapp/src/main/resources/messages_zh_TW.properties index 65a4f72b..5651f173 100644 --- a/wise-webapp/src/main/resources/messages_zh_TW.properties +++ b/wise-webapp/src/main/resources/messages_zh_TW.properties @@ -209,7 +209,7 @@ KEYBOARD_SHORTCUTS_MSG=快捷鍵可以幫助你節約時間,使你的手不必 COPY_AND_PASTE_TOPICS=拷貝和粘貼節點 MULTIPLE_LINES=添加多行長文本 TERM_OF_USE=條款和條件 -CONTACT_US=ËÅØÁπ´ÊàëÂÄë -FEEDBACK=ÂèçÈ•ã -SUPPORT=Âπ´Âä© +CONTACT_US=聯繫我們 +FEEDBACK=反饋 +SUPPORT=幫助 diff --git a/wise-webapp/src/main/webapp/jsp/mindmapEditor.jsp b/wise-webapp/src/main/webapp/jsp/mindmapEditor.jsp index 72fcc971..510f067c 100644 --- a/wise-webapp/src/main/webapp/jsp/mindmapEditor.jsp +++ b/wise-webapp/src/main/webapp/jsp/mindmapEditor.jsp @@ -33,7 +33,9 @@ // Configure designer options ... var options = loadDesignerOptions(); - options.persistenceManager = new mindplot.RESTPersistenceManager("service/maps/{id}/document","service/maps/{id}/history/latest"); + + options.persistenceManager = new mindplot.RESTPersistenceManager("service/maps/{id}/document", "service/maps/{id}/history/latest"); + var userOptions = ${mindmap.properties}; options.zoom = userOptions.zoom; options.readOnly = ${!!readOnlyMode};