- Add custom message support

This commit is contained in:
Paulo Gustavo Veiga 2012-06-16 11:37:40 -03:00
parent 9836ffdecf
commit 2f52856ea1
9 changed files with 437 additions and 398 deletions

View File

@ -20,6 +20,7 @@
package com.wisemapping.mail; package com.wisemapping.mail;
import org.apache.velocity.app.VelocityEngine; import org.apache.velocity.app.VelocityEngine;
import org.jetbrains.annotations.NotNull;
import org.springframework.mail.javamail.JavaMailSender; import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessageHelper; import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.mail.javamail.MimeMessagePreparator; import org.springframework.mail.javamail.MimeMessagePreparator;
@ -53,7 +54,7 @@ public final class Mailer {
} }
public void sendEmail(final String from, final String to, final String subject, final Map model, public void sendEmail(final String from, final String to, final String subject, final Map model,
final String templateMail) { @NotNull final String templateMail) {
final MimeMessagePreparator preparator = final MimeMessagePreparator preparator =
new MimeMessagePreparator() { new MimeMessagePreparator() {
public void prepare(MimeMessage mimeMessage) public void prepare(MimeMessage mimeMessage)
@ -63,11 +64,7 @@ public final class Mailer {
message.setFrom(from); message.setFrom(from);
message.setSubject(subject); message.setSubject(subject);
final String messageBody = final String messageBody = VelocityEngineUtils.mergeTemplateIntoString(velocityEngine, "/mail/" + templateMail, model);
VelocityEngineUtils.mergeTemplateIntoString(velocityEngine, "/mail/" + templateMail,
model);
System.out.println(message);
message.setText(messageBody, true); message.setText(messageBody, true);
} }
}; };

View File

@ -59,6 +59,7 @@ final public class NotificationService {
model.put("mapEditUrl", baseUrl + "/c/maps/" + mindmap.getId() + "/edit"); model.put("mapEditUrl", baseUrl + "/c/maps/" + mindmap.getId() + "/edit");
model.put("baseUrl", formMail); model.put("baseUrl", formMail);
model.put("senderMail", user.getEmail()); model.put("senderMail", user.getEmail());
model.put("message", message);
mailer.sendEmail(formMail, collabEmail, subject, model, "newCollaboration.vm"); mailer.sendEmail(formMail, collabEmail, subject, model, "newCollaboration.vm");

View File

@ -1,3 +1,4 @@
/* /*
* Copyright [2011] [wisemapping] * Copyright [2011] [wisemapping]
* *

View File

@ -227,9 +227,10 @@ public class MindmapController extends BaseController {
// Is owner ? // Is owner ?
final CollaborationRole role = CollaborationRole.valueOf(roleStr.toUpperCase()); final CollaborationRole role = CollaborationRole.valueOf(roleStr.toUpperCase());
if (role != CollaborationRole.OWNER) { if (role != CollaborationRole.OWNER) {
mindmapService.addCollaboration(mindMap, restCollab.getEmail(), role); mindmapService.addCollaboration(mindMap, restCollab.getEmail(), role, restCollabs.getMessage());
} }
// Remove from the list of pendings to remove ...
if (collaboration != null) { if (collaboration != null) {
collabsToRemove.remove(collaboration); collabsToRemove.remove(collaboration);
} }

View File

@ -21,6 +21,7 @@ import java.util.*;
public class RestCollaborationList { public class RestCollaborationList {
private List<RestCollaboration> collaborations; private List<RestCollaboration> collaborations;
private String message;
public RestCollaborationList() { public RestCollaborationList() {
collaborations = new ArrayList<RestCollaboration>(); collaborations = new ArrayList<RestCollaboration>();
@ -46,4 +47,12 @@ public class RestCollaborationList {
public void setCollaborations(@NotNull List<RestCollaboration> collaborations) { public void setCollaborations(@NotNull List<RestCollaboration> collaborations) {
this.collaborations = collaborations; this.collaborations = collaborations;
} }
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
} }

View File

@ -1,63 +1,63 @@
/* /*
* Copyright [2011] [wisemapping] * Copyright [2011] [wisemapping]
* *
* Licensed under WiseMapping Public License, Version 1.0 (the "License"). * Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the * It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page; * "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the license at * You may obtain a copy of the license at
* *
* http://www.wisemapping.org/license * http://www.wisemapping.org/license
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.wisemapping.service; package com.wisemapping.service;
import com.wisemapping.model.*; import com.wisemapping.model.*;
import com.wisemapping.exceptions.WiseMappingException; import com.wisemapping.exceptions.WiseMappingException;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.util.List; import java.util.List;
import java.io.IOException; import java.io.IOException;
public interface MindmapService { public interface MindmapService {
public static final String TAG_SEPARATOR = " "; public static final String TAG_SEPARATOR = " ";
public MindMap getMindmapById(int mindmapId); public MindMap getMindmapById(int mindmapId);
public MindMap getMindmapByTitle(String title, User user); public MindMap getMindmapByTitle(String title, User user);
public List<Collaboration> getCollaborationsBy(@NotNull User user); public List<Collaboration> getCollaborationsBy(@NotNull User user);
public void updateMindmap(MindMap mindMap, boolean saveHistory) throws WiseMappingException; public void updateMindmap(MindMap mindMap, boolean saveHistory) throws WiseMappingException;
public void addMindmap(MindMap map, User user) throws WiseMappingException; public void addMindmap(MindMap map, User user) throws WiseMappingException;
public void addCollaboration(@NotNull MindMap mindmap, @NotNull String email, @NotNull CollaborationRole role) public void addCollaboration(@NotNull MindMap mindmap, @NotNull String email, @NotNull CollaborationRole role, @Nullable String message)
throws CollaborationException; throws CollaborationException;
public void removeCollaboration(@NotNull MindMap mindmap, @NotNull Collaboration collaboration) throws CollaborationException; public void removeCollaboration(@NotNull MindMap mindmap, @NotNull Collaboration collaboration) throws CollaborationException;
public void addTags(MindMap mindmap, String tags); public void addTags(MindMap mindmap, String tags);
public void removeMindmap(@NotNull final MindMap mindmap, @NotNull final User user) throws WiseMappingException; public void removeMindmap(@NotNull final MindMap mindmap, @NotNull final User user) throws WiseMappingException;
public List<MindMap> search(MindMapCriteria criteria); public List<MindMap> search(MindMapCriteria criteria);
public List<MindMapHistory> getMindMapHistory(int mindmapId); public List<MindMapHistory> getMindMapHistory(int mindmapId);
public boolean hasPermissions(@Nullable User user, MindMap map, CollaborationRole allowedRole); public boolean hasPermissions(@Nullable User user, MindMap map, CollaborationRole allowedRole);
public boolean hasPermissions(@Nullable User user, int mapId, CollaborationRole allowedRole); public boolean hasPermissions(@Nullable User user, int mapId, CollaborationRole allowedRole);
public void addWelcomeMindmap(User user) throws WiseMappingException; public void addWelcomeMindmap(User user) throws WiseMappingException;
public void revertMapToHistory(MindMap map, int historyId) throws IOException, WiseMappingException; public void revertMapToHistory(MindMap map, int historyId) throws IOException, WiseMappingException;
} }

View File

@ -1,273 +1,273 @@
/* /*
* Copyright [2011] [wisemapping] * Copyright [2011] [wisemapping]
* *
* Licensed under WiseMapping Public License, Version 1.0 (the "License"). * Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the * It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page; * "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the license at * You may obtain a copy of the license at
* *
* http://www.wisemapping.org/license * http://www.wisemapping.org/license
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.wisemapping.service; package com.wisemapping.service;
import com.wisemapping.dao.MindmapManager; import com.wisemapping.dao.MindmapManager;
import com.wisemapping.exceptions.WiseMappingException; import com.wisemapping.exceptions.WiseMappingException;
import com.wisemapping.mail.Mailer; import com.wisemapping.mail.NotificationService;
import com.wisemapping.mail.NotificationService; import com.wisemapping.model.*;
import com.wisemapping.model.*; import com.wisemapping.security.Utils;
import com.wisemapping.security.Utils; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.Nullable; 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 java.io.IOException;
import java.io.IOException; import java.util.*;
import java.util.*;
public class MindmapServiceImpl
public class MindmapServiceImpl implements MindmapService {
implements MindmapService {
@Autowired
@Autowired private MindmapManager mindmapManager;
private MindmapManager mindmapManager;
@Autowired
@Autowired @Qualifier("userService")
@Qualifier("userService") private UserService userService;
private UserService userService;
@Autowired
@Autowired private NotificationService notificationService;
private NotificationService notificationService;
@Override
@Override public boolean hasPermissions(@Nullable User user, int mapId, @NotNull CollaborationRole grantedRole) {
public boolean hasPermissions(@NotNull User user, int mapId, @NotNull CollaborationRole grantedRole) { final MindMap map = mindmapManager.getMindmapById(mapId);
final MindMap map = mindmapManager.getMindmapById(mapId); return hasPermissions(user, map, grantedRole);
return hasPermissions(user, map, grantedRole); }
}
@Override
@Override public boolean hasPermissions(@Nullable User user, @Nullable MindMap map, @NotNull CollaborationRole role) {
public boolean hasPermissions(@Nullable User user, @Nullable MindMap map, @NotNull CollaborationRole role) { boolean result = false;
boolean result = false; if (map != null) {
if (map != null) { if (map.isPublic() && role == CollaborationRole.VIEWER) {
if (map.isPublic() && role == CollaborationRole.VIEWER) { result = true;
result = true; } else if (user != null) {
} else if (user != null) { final Collaboration collaboration = map.findCollaboration(user);
final Collaboration collaboration = map.findCollaboration(user); if (collaboration != null) {
if (collaboration != null) { result = collaboration.hasPermissions(role);
result = collaboration.hasPermissions(role); }
}
}
} }
} return result;
return result; }
}
@Override
@Override public MindMap getMindmapByTitle(String title, User user) {
public MindMap getMindmapByTitle(String title, User user) { return mindmapManager.getMindmapByTitle(title, user);
return mindmapManager.getMindmapByTitle(title, user); }
}
@Override
@Override public MindMap getMindmapById(int mindmapId) {
public MindMap getMindmapById(int mindmapId) { return mindmapManager.getMindmapById(mindmapId);
return mindmapManager.getMindmapById(mindmapId); }
}
@Override
@Override public List<Collaboration> getCollaborationsBy(@NotNull User user) {
public List<Collaboration> getCollaborationsBy(@NotNull User user) { return mindmapManager.getMindmapUserByCollaborator(user.getId());
return mindmapManager.getMindmapUserByCollaborator(user.getId()); }
}
@Override
@Override public void updateMindmap(MindMap mindMap, boolean saveHistory) throws WiseMappingException {
public void updateMindmap(MindMap mindMap, boolean saveHistory) throws WiseMappingException { if (mindMap.getTitle() == null || mindMap.getTitle().length() == 0) {
if (mindMap.getTitle() == null || mindMap.getTitle().length() == 0) { throw new WiseMappingException("The tile can not be empty");
throw new WiseMappingException("The tile can not be empty"); }
}
mindmapManager.updateMindmap(mindMap, saveHistory);
mindmapManager.updateMindmap(mindMap, saveHistory); }
}
@Override
@Override public List<MindMap> search(MindMapCriteria criteria) {
public List<MindMap> search(MindMapCriteria criteria) { return mindmapManager.search(criteria);
return mindmapManager.search(criteria); }
}
@Override
@Override public void removeCollaboration(@NotNull MindMap mindmap, @NotNull Collaboration collaboration) throws CollaborationException {
public void removeCollaboration(@NotNull MindMap mindmap, @NotNull Collaboration collaboration) throws CollaborationException { // remove collaborator association
// remove collaborator association final MindMap mindMap = collaboration.getMindMap();
final MindMap mindMap = collaboration.getMindMap(); final Set<Collaboration> collaborations = mindMap.getCollaborations();
final Set<Collaboration> collaborations = mindMap.getCollaborations();
if (mindMap.getCreator().getEmail().equals(collaboration.getCollaborator().getEmail())) {
if (mindMap.getCreator().getEmail().equals(collaboration.getCollaborator().getEmail())) { throw new CollaborationException("User is the creator and must have ownership permissions");
throw new CollaborationException("User is the creator and must have ownership permissions"); }
}
// When you delete an object from hibernate you have to delete it from *all* collections it exists in...
// When you delete an object from hibernate you have to delete it from *all* collections it exists in... mindmapManager.removeCollaboration(collaboration);
mindmapManager.removeCollaboration(collaboration); collaborations.remove(collaboration);
collaborations.remove(collaboration); }
}
@Override
@Override public void removeMindmap(@NotNull MindMap mindmap, @NotNull User user) throws WiseMappingException {
public void removeMindmap(@NotNull MindMap mindmap, @NotNull User user) throws WiseMappingException { if (mindmap.getCreator().equals(user)) {
if (mindmap.getCreator().equals(user)) { mindmapManager.removeMindmap(mindmap);
mindmapManager.removeMindmap(mindmap); } else {
} else { final Collaboration collaboration = mindmap.findCollaboration(user);
final Collaboration collaboration = mindmap.findCollaboration(user); if (collaboration != null) {
if (collaboration != null) { this.removeCollaboration(mindmap, collaboration);
this.removeCollaboration(mindmap, collaboration); }
} }
} }
}
@Override
@Override public void addMindmap(@NotNull MindMap map, @NotNull User user) throws WiseMappingException {
public void addMindmap(@NotNull MindMap map, @NotNull User user) throws WiseMappingException {
final String title = map.getTitle();
final String title = map.getTitle();
if (title == null || title.length() == 0) {
if (title == null || title.length() == 0) { throw new IllegalArgumentException("The tile can not be empty");
throw new IllegalArgumentException("The tile can not be empty"); }
}
//noinspection ConstantConditions
if (user == null) { if (user == null) {
throw new IllegalArgumentException("User can not be null"); throw new IllegalArgumentException("User can not be null");
} }
final Calendar creationTime = Calendar.getInstance(); final Calendar creationTime = Calendar.getInstance();
final String username = user.getUsername(); final String username = user.getUsername();
map.setLastModifierUser(username); map.setLastModifierUser(username);
map.setCreationTime(creationTime); map.setCreationTime(creationTime);
map.setLastModificationTime(creationTime); map.setLastModificationTime(creationTime);
map.setCreator(user); map.setCreator(user);
// Add map creator with owner permissions ... // Add map creator with owner permissions ...
final User dbUser = userService.getUserBy(user.getId()); final User dbUser = userService.getUserBy(user.getId());
final Collaboration collaboration = new Collaboration(CollaborationRole.OWNER, dbUser, map); final Collaboration collaboration = new Collaboration(CollaborationRole.OWNER, dbUser, map);
map.getCollaborations().add(collaboration); map.getCollaborations().add(collaboration);
mindmapManager.addMindmap(dbUser, map); mindmapManager.addMindmap(dbUser, map);
} }
@Override @Override
public void addCollaboration(@NotNull MindMap mindmap, @NotNull String email, @NotNull CollaborationRole role) public void addCollaboration(@NotNull MindMap mindmap, @NotNull String email, @NotNull CollaborationRole role, @Nullable String message)
throws CollaborationException { throws CollaborationException {
// Validate // Validate
final Collaborator owner = mindmap.getCreator(); final Collaborator owner = mindmap.getCreator();
if (owner.getEmail().equals(email)) { if (owner.getEmail().equals(email)) {
throw new CollaborationException("The user " + owner.getEmail() + " is the owner"); throw new CollaborationException("The user " + owner.getEmail() + " is the owner");
} }
if (role == CollaborationRole.OWNER) { if (role == CollaborationRole.OWNER) {
throw new CollaborationException("Ownership can not be modified"); throw new CollaborationException("Ownership can not be modified");
} }
final Set<Collaboration> collaborations = mindmap.getCollaborations(); final Set<Collaboration> collaborations = mindmap.getCollaborations();
Collaboration collaboration = getCollaborationBy(email, collaborations); Collaboration collaboration = getCollaborationBy(email, collaborations);
if (collaboration == null) { if (collaboration == null) {
final Collaborator collaborator = addCollaborator(email); final Collaborator collaborator = addCollaborator(email);
collaboration = new Collaboration(role, collaborator, mindmap); collaboration = new Collaboration(role, collaborator, mindmap);
mindmap.getCollaborations().add(collaboration); mindmap.getCollaborations().add(collaboration);
mindmapManager.saveMindmap(mindmap); mindmapManager.saveMindmap(mindmap);
// Notify by email ... // Notify by email ...
final User user = Utils.getUser(); final User user = Utils.getUser();
notificationService.newCollaboration(collaboration, mindmap, user, null); notificationService.newCollaboration(collaboration, mindmap, user, message);
} else if (collaboration.getRole() != role) { } else if (collaboration.getRole() != role) {
// If the relationship already exists and the role changed then only update the role // If the relationship already exists and the role changed then only update the role
collaboration.setRole(role); collaboration.setRole(role);
mindmapManager.updateMindmap(mindmap, false); mindmapManager.updateMindmap(mindmap, false);
} }
} }
private Collaborator addCollaborator(String email) { private Collaborator addCollaborator(String email) {
// Add a new collaborator ... // Add a new collaborator ...
Collaborator collaborator = mindmapManager.getCollaboratorBy(email); Collaborator collaborator = mindmapManager.getCollaboratorBy(email);
if (collaborator == null) { if (collaborator == null) {
collaborator = new Collaborator(); collaborator = new Collaborator();
collaborator.setEmail(email); collaborator.setEmail(email);
collaborator.setCreationDate(Calendar.getInstance()); collaborator.setCreationDate(Calendar.getInstance());
mindmapManager.addCollaborator(collaborator); mindmapManager.addCollaborator(collaborator);
} }
return collaborator; return collaborator;
} }
@Override @Override
public void addTags(@NotNull MindMap mindmap, String tags) { public void addTags(@NotNull MindMap mindmap, String tags) {
mindmap.setTags(tags); mindmap.setTags(tags);
mindmapManager.updateMindmap(mindmap, false); mindmapManager.updateMindmap(mindmap, false);
if (tags != null && tags.length() > 0) { if (tags != null && tags.length() > 0) {
final String tag[] = tags.split(TAG_SEPARATOR); final String tag[] = tags.split(TAG_SEPARATOR);
final User user = mindmap.getCreator(); final User user = mindmap.getCreator();
// Add new Tags to User // Add new Tags to User
boolean updateUser = false; boolean updateUser = false;
for (String userTag : tag) { for (String userTag : tag) {
if (!user.getTags().contains(userTag)) { if (!user.getTags().contains(userTag)) {
user.getTags().add(userTag); user.getTags().add(userTag);
updateUser = true; updateUser = true;
} }
} }
if (updateUser) { if (updateUser) {
//update user //update user
userService.updateUser(user); userService.updateUser(user);
} }
} }
} }
public void addWelcomeMindmap(User user) throws WiseMappingException { public void addWelcomeMindmap(User user) throws WiseMappingException {
final MindMap savedWelcome = getMindmapById(Constants.WELCOME_MAP_ID); final MindMap savedWelcome = getMindmapById(Constants.WELCOME_MAP_ID);
// Is there a welcomed map configured ? // Is there a welcomed map configured ?
if (savedWelcome != null) { if (savedWelcome != null) {
final MindMap welcomeMap = new MindMap(); final MindMap welcomeMap = new MindMap();
welcomeMap.setTitle(savedWelcome.getTitle() + " " + user.getFirstname()); welcomeMap.setTitle(savedWelcome.getTitle() + " " + user.getFirstname());
welcomeMap.setDescription(savedWelcome.getDescription()); welcomeMap.setDescription(savedWelcome.getDescription());
welcomeMap.setXml(savedWelcome.getXml()); welcomeMap.setXml(savedWelcome.getXml());
addMindmap(welcomeMap, user); addMindmap(welcomeMap, user);
} }
} }
public List<MindMapHistory> getMindMapHistory(int mindmapId) { public List<MindMapHistory> getMindMapHistory(int mindmapId) {
return mindmapManager.getHistoryFrom(mindmapId); return mindmapManager.getHistoryFrom(mindmapId);
} }
public void revertMapToHistory(MindMap map, int historyId) public void revertMapToHistory(MindMap map, int historyId)
throws IOException, WiseMappingException { throws IOException, WiseMappingException {
final MindMapHistory history = mindmapManager.getHistory(historyId); final MindMapHistory history = mindmapManager.getHistory(historyId);
map.setXml(history.getXml()); map.setXml(history.getXml());
updateMindmap(map, false); updateMindmap(map, false);
} }
private Collaboration getCollaborationBy(String email, Set<Collaboration> collaborations) { private Collaboration getCollaborationBy(String email, Set<Collaboration> collaborations) {
Collaboration collaboration = null; Collaboration collaboration = null;
for (Collaboration user : collaborations) { for (Collaboration user : collaborations) {
if (user.getCollaborator().getEmail().equals(email)) { if (user.getCollaborator().getEmail().equals(email)) {
collaboration = user; collaboration = user;
break; break;
} }
} }
return collaboration; return collaboration;
} }
public void setMindmapManager(MindmapManager mindmapManager) { public void setMindmapManager(MindmapManager mindmapManager) {
this.mindmapManager = mindmapManager; this.mindmapManager = mindmapManager;
} }
public void setUserService(UserService userService) { public void setUserService(UserService userService) {
this.userService = userService; this.userService = userService;
} }
public void setNotificationService(NotificationService notificationService) { public void setNotificationService(NotificationService notificationService) {
this.notificationService = notificationService; this.notificationService = notificationService;
} }
} }

View File

@ -1,41 +1,39 @@
<html> <html>
<body> <body>
<div style="background-color: #fbeed5; max-width: 650px; font-family: Arial, sans-serif; color: #000; padding: 5px;"> <div style="background-color: #fbeed5; max-width: 650px; font-family: Arial, sans-serif; color: #000; padding: 5px;">
<div style="height: 60px; font-size: 14px; font-weight: bold; padding-bottom: 4px;"> <div style="height: 60px; font-size: 14px; font-weight: bold; padding-bottom: 4px;">
<table style="display: inline;width: 100%;"> <table style="display: inline;width: 100%;">
<tbody> <tbody>
<tr> <tr>
<td height="50px" width="2px" <td height="50px" width="2px"
style="padding: 0; padding-right: 5px; text-align:center;font-weight: normal;font-family: Arial, sans-serif"> style="padding: 0; padding-right: 5px; text-align:center;font-weight: normal;font-family: Arial, sans-serif">
<a href="${baseUrl}"> <a href="${baseUrl}">
<img style="border: 0;margin-top: 10px;" <img style="border: 0;margin-top: 10px;"
src="${baseUrl}/images/logo-small.png" src="${baseUrl}/images/logo-small.png"
alt="WiseMapping Log"/> alt="WiseMapping Log"/>
</a> </a>
</td> </td>
<td valign="bottom" height="32px" style="padding: 0;font-size: 16px;">I've shared <a <td valign="bottom" height="32px" style="padding: 0;font-size: 16px;">I've shared <a
href='${mapEditUrl}'> href='${mapEditUrl}'>
${mindmap.title}</a> mindmap with you. ${mindmap.title}</a> mindmap with you.
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
<div style="font-size: 13px; background-color: #FFF; padding: 10px 7px 7px 7px; min-height: 100px"> <div style="font-size: 13px; background-color: #FFF; padding: 10px 7px 7px 7px; min-height: 100px">
#if( ! $message ) #if($message )
<p>${message}</p> <pre style="font-family: Arial, sans-serif; color: #000; ">${message}</pre>
#end #end
<p>Click to open: <a href="${mapEditUrl}">${mindmap.title}</a></p> <p>Click to open: <a href="${mapEditUrl}">${mindmap.title}</a></p>
<br/> <p style="color: #898989;">Do you have a WiseMapping account ?. Don't worry, you can create an account for
free. </p>
<p style="color: #898989;">Do you have a WiseMapping account ?. Don't worry, you can create an account for </div>
free. </p> </div>
</div>
</div> <p style="font-size: 13px;font-family: Arial, sans-serif">Important: Do not reply this email. If
you need to contact mindmap sender, you can send an email clicking <a href="mailto:${senderMail}">here</a>.
<p style="font-size: 13px;font-family: Arial, sans-serif">Important: Do not reply this email. If </p>
you need to contact mindmap sender, you can send an email clicking <a href="mailto:${senderMail}">here</a>. </body>
</p>
</body>
</html> </html>

View File

@ -13,13 +13,26 @@
} }
#collabEmails { #collabEmails {
float: left;
width: 300px; width: 300px;
display: inline-block;
vertical-align: middle;
margin-bottom: 0;
} }
#roleBtn { #roleBtn {
float: left; margin: 0 10px;
margin: 0px 10px; display: inline-block;
vertical-align: middle;
}
#addBtn {
display: inline-block;
vertical-align: middle;
}
#collabMessage {
display: block;
width: 100%;
} }
</style> </style>
@ -38,25 +51,43 @@
<div class="well"> <div class="well">
<div id="errorMsg" class="alert alert-error"></div> <div id="errorMsg" class="alert alert-error"></div>
<p>Add People: </p> <div>
<input type="text" id="collabEmails" name="collabEmails"
placeholder="Enter collaborators emails separared by comas."/>
<div class="btn-group" id="roleBtn"> <p><strong>Add People:</strong></p>
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">Can edit
<span class="caret"> </span> <input type="text" id="collabEmails" name="collabEmails"
</a> placeholder="Enter collaborators emails separared by comas."/>
<ul class="dropdown-menu" data-role="editor" id="shareRole">
<li><a href="#" data-role="editor">Can edit</a></li> <div class="btn-group" id="roleBtn">
<li><a href="#" data-role="viewer">Can view</a></li> <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">Can edit
</ul> <span class="caret"> </span>
</a>
<ul class="dropdown-menu" data-role="editor" id="shareRole">
<li><a href="#" data-role="editor">Can edit</a></li>
<li><a href="#" data-role="viewer">Can view</a></li>
</ul>
</div>
<button id="addBtn" class="btn btn-primary">Add</button>
</div>
<div style="margin-top: 10px;">
<p><strong>Notify people via email</strong> - <a href="#" id="addMessageLink">Add message</a></p>
<textarea cols="4" id="collabMessage" placeholder="Optional: Include a personal message">
</textarea>
</div> </div>
<button id="addBtn" class="btn btn-primary">Add</button>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
$("#errorMsg").hide(); $("#errorMsg").hide();
$("#collabMessage").hide();
$("#addMessageLink").click(function(event) {
$("#collabMessage").toggle().val("");
event.preventDefault();
});
var messages = { var messages = {
owner: 'Is owner', owner: 'Is owner',
editor: 'Can edit', editor: 'Can edit',
@ -248,6 +279,7 @@ var submitDialogForm = function() {
collabs.collaborations = jQuery.grep(collabs.collaborations, function() { collabs.collaborations = jQuery.grep(collabs.collaborations, function() {
return this.role != 'owner'; return this.role != 'owner';
}); });
collabs['message'] = $("#collabMessage").val();
jQuery.ajax("service/maps/${mindmap.id}/collabs", { jQuery.ajax("service/maps/${mindmap.id}/collabs", {
async:false, async:false,