mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-09-12 07:10:07 +02:00
- Start working on a I18n tutorial mindmap.
This commit is contained in:
parent
98846768fe
commit
f2cdc96a96
@ -21,6 +21,7 @@ package com.wisemapping.mail;
|
||||
import com.wisemapping.model.Collaboration;
|
||||
import com.wisemapping.model.MindMap;
|
||||
import com.wisemapping.model.User;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -137,16 +138,17 @@ final public class NotificationService {
|
||||
}
|
||||
|
||||
public void sendRegistrationEmail(@NotNull User user) {
|
||||
try {
|
||||
final Map<String, Object> model = new HashMap<String, Object>();
|
||||
model.put("user", user);
|
||||
final String activationUrl = "http://wisemapping.com/c/activation?code=" + user.getActivationCode();
|
||||
model.put("emailcheck", activationUrl);
|
||||
mailer.sendEmail(mailer.getServerSenderEmail(), user.getEmail(), "Welcome to Wisemapping!", model,
|
||||
"confirmationMail.vm");
|
||||
} catch (Exception e) {
|
||||
handleException(e);
|
||||
}
|
||||
throw new UnsupportedOperationException("Not implemented yet");
|
||||
// try {
|
||||
// final Map<String, Object> model = new HashMap<String, Object>();
|
||||
// model.put("user", user);
|
||||
// final String activationUrl = "http://wisemapping.com/c/activation?code=" + user.getActivationCode();
|
||||
// model.put("emailcheck", activationUrl);
|
||||
// mailer.sendEmail(mailer.getServerSenderEmail(), user.getEmail(), "Welcome to Wisemapping!", model,
|
||||
// "confirmationMail.vm");
|
||||
// } catch (Exception e) {
|
||||
// handleException(e);
|
||||
// }
|
||||
}
|
||||
|
||||
public void reportMindmapEditorError(@NotNull MindMap mindmap, @NotNull User user, @NotNull String userAgent, @Nullable String jsErrorMsg) {
|
||||
@ -198,11 +200,8 @@ final public class NotificationService {
|
||||
e.printStackTrace(pw);
|
||||
retValue = sw.toString();
|
||||
} finally {
|
||||
try {
|
||||
if (pw != null) pw.close();
|
||||
if (sw != null) sw.close();
|
||||
} catch (IOException ignore) {
|
||||
}
|
||||
IOUtils.closeQuietly(pw);
|
||||
IOUtils.closeQuietly(sw);
|
||||
}
|
||||
return retValue;
|
||||
}
|
||||
|
@ -26,15 +26,16 @@ import com.wisemapping.model.Collaborator;
|
||||
import com.wisemapping.model.MindMap;
|
||||
import com.wisemapping.model.User;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.velocity.app.VelocityEngine;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.ui.velocity.VelocityEngineUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Calendar;
|
||||
import java.util.Locale;
|
||||
import java.util.UUID;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.*;
|
||||
|
||||
public class UserServiceImpl
|
||||
implements UserService {
|
||||
@ -42,6 +43,7 @@ public class UserServiceImpl
|
||||
private MindmapService mindmapService;
|
||||
private NotificationService notificationService;
|
||||
private MessageSource messageSource;
|
||||
private VelocityEngine velocityEngine;
|
||||
|
||||
|
||||
@Override
|
||||
@ -131,6 +133,7 @@ public class UserServiceImpl
|
||||
final MindMap mindMap = buildWelcomeMindmap(user.getFirstname());
|
||||
mindmapService.addMindmap(mindMap, user);
|
||||
|
||||
|
||||
// Send registration email.
|
||||
if (emailConfirmEnabled) {
|
||||
notificationService.sendRegistrationEmail(user);
|
||||
@ -142,24 +145,27 @@ public class UserServiceImpl
|
||||
return user;
|
||||
}
|
||||
|
||||
private MindMap buildWelcomeMindmap(@NotNull String firstName) throws WiseMappingException {
|
||||
public MindMap buildWelcomeMindmap(@NotNull String firstName) {
|
||||
//To change body of created methods use File | Settings | File Templates.
|
||||
final Locale locale = LocaleContextHolder.getLocale();
|
||||
MindMap result = new MindMap();
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
|
||||
// @TODO: Remove this once is translated
|
||||
locale = Locale.ENGLISH;
|
||||
MindMap result = new MindMap();
|
||||
final Map<String, Object> model = new HashMap<String, Object>();
|
||||
model.put("messages", messageSource);
|
||||
model.put("noArgs", new Object[]{});
|
||||
model.put("locale", locale);
|
||||
|
||||
final String mapXml = VelocityEngineUtils.mergeTemplateIntoString(velocityEngine, "/samples/tutorial.vm", model);
|
||||
|
||||
final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
|
||||
InputStream resourceAsStream = contextClassLoader.getResourceAsStream("samples/welcome_" + locale.toString() + ".xml");
|
||||
if (resourceAsStream == null) {
|
||||
resourceAsStream = contextClassLoader.getResourceAsStream("samples/welcome_en.xml");
|
||||
}
|
||||
try {
|
||||
final byte[] bytes = IOUtils.toByteArray(resourceAsStream);
|
||||
result.setXml(bytes);
|
||||
result.setXmlStr(mapXml);
|
||||
result.setTitle(messageSource.getMessage("WELCOME", null, locale) + " " + firstName);
|
||||
result.setDescription("");
|
||||
|
||||
} catch (IOException e) {
|
||||
throw new WiseMappingException("Could not be loaded", e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -201,4 +207,8 @@ public class UserServiceImpl
|
||||
public void setMessageSource(@NotNull MessageSource messageSource) {
|
||||
this.messageSource = messageSource;
|
||||
}
|
||||
|
||||
public void setVelocityEngine(VelocityEngine velocityEngine) {
|
||||
this.velocityEngine = velocityEngine;
|
||||
}
|
||||
}
|
||||
|
62
wise-webapp/src/main/resources/samples/tutorial.vm
Normal file
62
wise-webapp/src/main/resources/samples/tutorial.vm
Normal file
@ -0,0 +1,62 @@
|
||||
<map name="usage" version="tango">
|
||||
<topic central="true" text="How to Start ?" id="1" fontStyle=";;#eeeeee;;;" bgColor="#0a0a08">
|
||||
<icon id="sign_help"/>
|
||||
<topic position="171,-40" order="0" text="Topics Properties" id="11" fontStyle=";;#444444;;;" bgColor="#250be3"
|
||||
brColor="#080559">
|
||||
<icon id="sign_cancel"/>
|
||||
<topic position="295,-92" order="1" text="${messages.getMessage("TUTORIAL.ADD_NOTES",$noArgs,$locale)}" id="31">
|
||||
<note><![CDATA[This is a simple note !.]]></note>
|
||||
</topic>
|
||||
<topic position="321,-118" order="0" text="Add Links to Web Pages" id="7" fontStyle=";;#444444;;;">
|
||||
<link url="http://www.google.com" type="url"/>
|
||||
</topic>
|
||||
<topic position="310,-14" order="3" text="${messages.getMessage("TUTORIAL.MULTIPLE_TEXT_STYLES",$noArgs,$locale)}"
|
||||
id="32">
|
||||
<topic position="402,-40" order="0" text="Color" id="33" fontStyle=";;#ff0000;;;"/>
|
||||
<topic position="402,-13" order="1" text="Style" id="35" fontStyle=";;;bold;italic;"/>
|
||||
<topic position="400,12" order="2" text="Type" id="36" fontStyle="Times;6;;;;"/>
|
||||
</topic>
|
||||
<topic position="302,38" order="4" text="${messages.getMessage("TUTORIAL.DIFFERENT_SHAPES",$noArgs,$locale)}" shape="rectagle" id="8"
|
||||
fontStyle=";;#444444;;;"/>
|
||||
<topic position="298,-66" order="2" text="${messages.getMessage("TUTORIAL.FANCY_ICONS",$noArgs,$locale)}" id="43">
|
||||
<icon id="face_wink"/>
|
||||
</topic>
|
||||
</topic>
|
||||
<topic position="-188,-66" order="1" text="Edition Using Keyboard" id="22" fontStyle=";;#444444;;;"
|
||||
bgColor="#add1f7">
|
||||
<icon id="hard_keyboard"/>
|
||||
<topic position="-348,-119" order="0" id="26" fontStyle=";;#444444;;;">
|
||||
<text><![CDATA[${messages.getMessage("TUTORIAL.MOVE_WITH_ARROWS",$noArgs,$locale)}]]></text>
|
||||
</topic>
|
||||
<topic position="-351,-88" order="1"
|
||||
text="${messages.getMessage("TUTORIAL.START_TYPING_TO_EDIT_TEXT",$noArgs,$locale)}" id="24"
|
||||
fontStyle=";;#444444;;;"/>
|
||||
<topic position="-357,-35" order="3" text="${messages.getMessage("TUTORIAL.ENTER_TO_ADD_SIBLING",$noArgs,$locale)}"
|
||||
id="25" fontStyle=";;#444444;;;"/>
|
||||
<topic position="-370,-62" order="2" text="${messages.getMessage("TUTORIAL.CTRL_TO_ADD_CHILD",$noArgs,$locale)}"
|
||||
id="23"
|
||||
fontStyle=";;#444444;;;"/>
|
||||
<topic position="-355,-8" order="4" text="${messages.getMessage("TUTORIAL.MORE_KEY_TIPS",$noArgs,$locale)}" id="50"/>
|
||||
</topic>
|
||||
<topic position="134,92" order="2" text="Sharing" id="6" fontStyle=";;#444444;;;" bgColor="#edabff">
|
||||
<topic position="253,65" order="0" text="Invite Friends to Collaborate" id="9" fontStyle=";;#444444;;;"/>
|
||||
<topic position="226,92" order="1" text="Embed in Blogs" id="10" fontStyle=";;#444444;;;"/>
|
||||
<topic position="257,119" order="2" text="Public your mindmap as public" id="15" fontStyle=";;#444444;;;"/>
|
||||
</topic>
|
||||
<topic position="-178,71" order="3" text="Edition Using Mouse" id="2" fontStyle=";;#444444;;;"
|
||||
bgColor="#d9b518">
|
||||
<icon id="hard_mouse"/>
|
||||
<topic position="-327,22" order="0" id="4" fontStyle=";;#444444;;;">
|
||||
<text><![CDATA[${messages.getMessage("TUTORIAL.DOUBLE_CLICK_TO_EDIT_TEXT",$noArgs,$locale)}]]></text>
|
||||
</topic>
|
||||
<topic position="-341,57" order="1" id="3" fontStyle=";;#444444;;;">
|
||||
<text><![CDATA[${messages.getMessage("TUTORIAL.DOUBLE_CLICK_TO_ADD",$noArgs,$locale)}]]></text>
|
||||
</topic>
|
||||
<topic position="-327,92" order="2" id="5" fontStyle=";;#444444;;;">
|
||||
<text><![CDATA[${messages.getMessage("TUTORIAL.DRAG_AND_DROP_TO_POSITION",$noArgs,$locale)}]]></text>
|
||||
</topic>
|
||||
<topic position="-336,123" order="3" text="Use the Toolbar Functions " id="27"/>
|
||||
</topic>
|
||||
</topic>
|
||||
<relationship srcTopicId="22" destTopicId="2" lineType="3" endArrow="true" startArrow="false"/>
|
||||
</map>
|
@ -1,53 +0,0 @@
|
||||
<map name="welcome" version="tango">
|
||||
<topic central="true" text="Welcome To WiseMapping" id="1" fontStyle=";;#eeeeee;;;" bgColor="#0a0a08">
|
||||
<topic position="179,-130" order="0" id="11" fontStyle=";;#444444;;;" bgColor="#250be3" brColor="#080559">
|
||||
<text><![CDATA[Easy to use Try it Now!]]></text>
|
||||
<topic position="294,-156" order="0" id="12" fontStyle=";;#444444;;italic;">
|
||||
<text><![CDATA[Double Click To Create new Topics!]]></text>
|
||||
</topic>
|
||||
<topic position="305,-126" order="1" text="Start typing to edit the text" id="13"
|
||||
fontStyle=";;#444444;;italic;"/>
|
||||
<topic position="287,-100" order="2" text="Drag map to move" id="14" fontStyle=";;#444444;;italic;"/>
|
||||
</topic>
|
||||
<topic position="-172,-39" order="1" text="Web Tool" id="22" fontStyle=";;#444444;;;" bgColor="#add1f7">
|
||||
<topic position="-256,-78" order="0" text="Shortcuts" id="26" fontStyle=";;#444444;;;"/>
|
||||
<topic position="-280,-52" order="1" text="No plugin required" id="24" fontStyle=";;#444444;;;">
|
||||
<icon id="conn_disconnect"/>
|
||||
</topic>
|
||||
<topic position="-265,-26" order="2" text="Collaborate" id="23" fontStyle=";;#444444;;;">
|
||||
<icon id="people_group"/>
|
||||
</topic>
|
||||
<topic position="-249,0" order="3" text="Share" id="25" fontStyle=";;#444444;;;"/>
|
||||
</topic>
|
||||
<topic position="185,-35" order="2" text="Mind Mapping" id="6" fontStyle=";;#444444;;;" bgColor="#edabff">
|
||||
<topic position="303,-74" order="0" text="Share with Colleagues" id="7" fontStyle=";;#444444;;;"/>
|
||||
<topic position="275,-48" order="1" text="Online" id="8" fontStyle=";;#444444;;;"/>
|
||||
<topic position="299,-22" order="2" text="Anyplace, Anytime" id="9" fontStyle=";;#444444;;;"/>
|
||||
<topic position="277,4" order="3" text="Free!!!" id="10" fontStyle=";;#444444;;;"/>
|
||||
</topic>
|
||||
<topic position="-189,52" order="3" text="Productivity" id="2" fontStyle=";;#444444;;;" bgColor="#d9b518">
|
||||
<icon id="chart_bar"/>
|
||||
<topic position="-310,26" order="0" text="Share your ideas" id="3" fontStyle=";;#444444;;;">
|
||||
<icon id="bulb_light_on"/>
|
||||
</topic>
|
||||
<topic position="-299,52" order="1" text="Brainstorming" id="4" fontStyle=";;#444444;;;"/>
|
||||
<topic position="-283,78" order="2" text="Visual " id="5" fontStyle=";;#444444;;;"/>
|
||||
</topic>
|
||||
<topic position="171,96" order="4" text="Features" id="15" fontStyle=";;#444444;;;">
|
||||
<topic position="267,31" order="0" text="Links to Sites" id="16" fontStyle=";6;#444444;;;">
|
||||
<link url="http://www.digg.com" type="url"/>
|
||||
</topic>
|
||||
<topic position="246,57" order="1" text="Fonts" id="17" fontStyle=";;#444444;;;"/>
|
||||
<topic position="256,83" order="2" text="Topic Color" id="18" fontStyle=";;#444444;;;"/>
|
||||
<topic position="252,135" order="4" text="Icons" id="20" fontStyle=";;#444444;;;">
|
||||
<icon id="object_rainbow"/>
|
||||
</topic>
|
||||
<topic position="273,161" order="5" text="History Changes" id="21" fontStyle=";;#444444;;;">
|
||||
<icon id="arrowc_turn_left"/>
|
||||
</topic>
|
||||
<topic position="260,109" order="3" text="Topic Shapes" shape="line" id="19" fontStyle=";;#444444;;;"/>
|
||||
</topic>
|
||||
</topic>
|
||||
<relationship srcTopicId="26" destTopicId="11" lineType="3" srcCtrlPoint="96,-81" destCtrlPoint="-167,-40"
|
||||
endArrow="true" startArrow="false"/>
|
||||
</map>
|
@ -210,5 +210,17 @@ COPY_AND_PASTE_TOPICS=Copy and Page Topics
|
||||
MULTIPLE_LINES=Add multiple text lines
|
||||
TERM_OF_USE=Terms and Conditions
|
||||
|
||||
|
||||
# Properties used on the tutorial mindmap ....
|
||||
TUTORIAL.MULTIPLE_TEXT_STYLES=Multitple Text Styles
|
||||
TUTORIAL.DIFFERENT_SHAPES=Different Shapes
|
||||
TUTORIAL.FANCY_ICONS=Fancy Icons
|
||||
TUTORIAL.MOVE_WITH_ARROWS=Move Between Topics\nWith The Arrows
|
||||
TUTORIAL.START_TYPING_TO_EDIT_TEXT=Start Typing to Edit Text
|
||||
TUTORIAL.CTRL_TO_ADD_CHILD=Press Ctrl/Meta+Enter to Add Child Topic
|
||||
TUTORIAL.ENTER_TO_ADD_SIBLING=Press Enter to Add a Sibling Topic
|
||||
TUTORIAL.MORE_KEY_TIPS=More ... ?. Click on shortcuts above
|
||||
TUTORIAL.DOUBLE_CLICK_TO_ADD=Double Click on the Canvas to Create Topics
|
||||
TUTORIAL.DRAG_AND_DROP_TO_POSITION=Drag and Drop Topics Position
|
||||
TUTORIAL.DOUBLE_CLICK_TO_EDIT_TEXT=Double Click on a Topic to Edit the Text
|
||||
TUTORIAL.ADD_NOTES=Add Notes
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
<property name="mindmapService" ref="mindMapServiceTarget"/>
|
||||
<property name="notificationService" ref="notificationService"/>
|
||||
<property name="messageSource" ref="messageSource"/>
|
||||
|
||||
<property name="velocityEngine" ref="velocityEngine"/>
|
||||
</bean>
|
||||
|
||||
<bean id="userService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
|
||||
|
Loading…
Reference in New Issue
Block a user