diff --git a/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java b/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java index fd4883d..84a6d10 100644 --- a/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java +++ b/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java @@ -73,7 +73,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen _log.error("Error While trying to save Notification"); } if (channels.contains(NotificationChannelType.EMAIL)) - EmailPlugin.sendNotification(notification2Save); + EmailPlugin.sendNotification(notification2Save, aslSession.getGroupName()); if (channels.isEmpty()) { _log.info("Notification was not needed as the user decided not to be notified"); @@ -103,7 +103,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen sharedFolder.getId(), //the new Date(), "?oid="+sharedFolder.getId(), - "has shared a workspace folder ("+ sharedFolder.getName() +") with you", + "shared the workspace folder "+ sharedFolder.getName() +" with you", false, aslSession.getUsername(), aslSession.getUserFullName(), @@ -127,8 +127,8 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen userIdToNotify, //user no notify sharedFolder.getId(), //the new Date(), - "?oid="+sharedFolder.getId(), - "has added a new user ("+ user.getFullname() +") on your workspace shared folder ("+ sharedFolder.getName() +")", + "?oid="+sharedFolder.getId(), + "added "+ user.getFullname() +" to your workspace shared folder "+ sharedFolder.getName(), false, aslSession.getUsername(), aslSession.getUserFullName(), @@ -150,7 +150,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen sharedFolder.getId(), //the new Date(), "?oid="+sharedFolder.getId(), - "has removed a user ("+ user.getFullname() +") from your workspace shared folder ("+ sharedFolder.getName() +")", + "removed "+ user.getFullname() +" from your workspace shared folder "+ sharedFolder.getName(), false, aslSession.getUsername(), aslSession.getUserFullName(), @@ -171,7 +171,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen item.getId(), //the new Date(), "?oid="+item.getId()+"&parentoid="+item.getParent().getId(), - "has added a new item ("+ item.getName() +") on your workspace shared folder ("+ item.getParent().getName() +")", + "added "+ item.getName() +" to your workspace shared folder "+ item.getParent().getName(), false, aslSession.getUsername(), aslSession.getUserFullName(), @@ -192,7 +192,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen item.getId(), //the new Date(), "?oid="+item.getId()+"&parentoid="+item.getParent().getId(), - "has removed an item ("+ item.getName() +") from your workspace shared folder ("+ item.getParent().getName() +")", + "removed "+ item.getName() +" from your workspace shared folder "+ item.getParent().getName(), false, aslSession.getUsername(), aslSession.getUserFullName(), @@ -213,7 +213,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen "?oid="+item.getId()+"&parentoid="+item.getParent().getId(), new Date(), "?folder="+item.getParent().getId()+"&item="+item.getId(), - "has updated an item ("+ item.getName() +") on your workspace shared folder ("+ item.getParent().getName() +")", + " updated "+ item.getName() +" to your workspace shared folder "+ item.getParent().getName(), false, aslSession.getUsername(), aslSession.getUserFullName(), @@ -233,7 +233,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen "messageid_not_provided", //the new Date(), "", - "has sent you a message with subject: " + escapeHtml(subject), + "sent you a message with subject: " + escapeHtml(subject), false, aslSession.getUsername(), aslSession.getUserFullName(), @@ -307,7 +307,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen documentWorkflowId, //the workflowid new Date(), getApplicationUrl()+"?oid="+documentWorkflowId, - "has viewed a document workflow you created (" + escapeHtml(documentName) + ").", + "viewed document workflow " + escapeHtml(documentName), false, aslSession.getUsername(), aslSession.getUserFullName(), @@ -327,7 +327,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen documentWorkflowId, //the workflowid new Date(), getApplicationUrl()+"?oid="+documentWorkflowId, - "has edited a document workflow you created (" + escapeHtml(documentName) + ").", + "updated document workflow " + escapeHtml(documentName), false, aslSession.getUsername(), aslSession.getUserFullName(), @@ -339,9 +339,10 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen */ @Override public boolean notifyDocumentWorkflowTaskRequest(String userIdToNotify, String documentWorkflowId, String documentName, String assignedRoleName) { + + String notificationText = "in " + aslSession.getGroupName() + " you are requested to perform a new task in the Document Workflow titled: " + + escapeHtml(documentName) + ". Your role is: " + assignedRoleName; - String notificationText = "You are requested to perform a new task in the Document Workflow (" + escapeHtml(documentName) + "). " + - "Your role is: " + assignedRoleName +". On " + aslSession.getGroupName() + " Virtual Research Environment."; Notification not = new Notification( UUID.randomUUID().toString(), NotificationType.DOCUMENT_WORKFLOW_STEP_REQUEST_TASK, @@ -370,8 +371,9 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen documentWorkflowId, //the workflowid new Date(), getApplicationUrl()+"?oid="+documentWorkflowId, - "has forwarded a document workflow you created (" + escapeHtml(documentName) + ") " + - "from step " + fromStepName + " towards step " + toStepName +". On " + aslSession.getGroupName() + " Virtual Research Environment. ", + + "forwarded the Document Workflow titled: " + escapeHtml(documentName) + + " from status \"" + fromStepName + "\" to status \"" + toStepName +"\". In " + aslSession.getGroupName(), false, aslSession.getUsername(), aslSession.getUserFullName(), @@ -391,8 +393,8 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen documentWorkflowId, //the workflowid new Date(), getApplicationUrl()+"?oid="+documentWorkflowId, - "has performed the last needed forward on a document workflow you created (" + escapeHtml(documentName) + "). " + - "Consequently, this Document Workflow moved from step " + fromStepName + " to step " + toStepName +". On " + aslSession.getGroupName() + " Virtual Research Environment. ", + "has performed the last needed forward on a Document Workflow titled: " + escapeHtml(documentName) + " in . " + aslSession.getGroupName() + "." + + "Step \"" + fromStepName + "\" is now complete. The next step is \"" + toStepName +"\". On " + aslSession.getGroupName() + " Virtual Research Environment. ", false, aslSession.getUsername(), aslSession.getUserFullName(), @@ -405,8 +407,8 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen */ @Override public boolean notifyDocumentWorkflowFirstStepRequest(String userIdToNotify, String documentWorkflowId, String documentName, String assignedRole) { - String notificationText = "has involved you in a Document Workflow (" + escapeHtml(documentName) + ") " + - "and has assigned you the role: " + assignedRole +". On " + aslSession.getGroupName() + " Virtual Research Environment."; + String notificationText = "involved you in the Document Workflow titled: " + escapeHtml(documentName) + ". " + + "You are requested to perform a task. Your role is: " + assignedRole+"."; Notification not = new Notification( UUID.randomUUID().toString(), NotificationType.DOCUMENT_WORKFLOW_FIRST_STEP_REQUEST_INVOLVMENT, diff --git a/src/main/java/org/gcube/applicationsupportlayer/social/mailing/EmailPlugin.java b/src/main/java/org/gcube/applicationsupportlayer/social/mailing/EmailPlugin.java index 6540c9d..ffb4249 100644 --- a/src/main/java/org/gcube/applicationsupportlayer/social/mailing/EmailPlugin.java +++ b/src/main/java/org/gcube/applicationsupportlayer/social/mailing/EmailPlugin.java @@ -27,29 +27,46 @@ import com.liferay.portal.util.PortalUtil; public class EmailPlugin { private static GCUBEClientLog _log = new GCUBEClientLog(EmailPlugin.class); - private static String getHTMLEmail(Notification notification2Save, String userFirstName, String portalUrl, String email) { - - String removeMarkup = notification2Save.getDescription().replaceAll("&", "&"); - removeMarkup = removeMarkup.replaceAll(">", ">"); - removeMarkup = removeMarkup.replaceAll("<", "<"); - + private static String getHTMLEmail(Notification notification2Save, String userFirstName, String portalURL, String email) { + + String removedMarkup = notification2Save.getDescription().replaceAll("&", "&"); + removedMarkup = removedMarkup.replaceAll(">", ">"); + removedMarkup = removedMarkup.replaceAll("<", "<"); + String sender = notification2Save.getSenderFullName(); if (notification2Save.getType() == NotificationType.DOCUMENT_WORKFLOW_STEP_REQUEST_TASK) sender = ""; - - return "
" + - "" + sender + " " + removeMarkup + "
" + - "See this at " + portalUrl + "" +
- "
").append(sender).append(" ").append(removedMarkup) // has done something + .append(getActionLink(notification2Save, portalURL)).append("
") //Goto + .append("