mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-15 15:02:20 +00:00
Merged SHA-SIMP-1 (5.1.0) to HEAD (5.1)
106196: SHA-993: Create Site Link in Email - Modified InviteSender to add siteDashboardLink as a property being sent to the email generation - Updated email template with siteDashboardLink - Updated InviteSenderTest git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@110794 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -54,6 +54,8 @@
|
||||
<p>${inviterPerson.properties["cm:firstName"]!""} ${inviterPerson.properties["cm:lastName"]!""}
|
||||
has added you to the <b>${args["siteName"]}</b> site with the role of ${args["inviteeSiteRole"]}.</p>
|
||||
|
||||
<p><a href="${args["siteDashboardLink"]}">Go to ${args["siteName"]}</a>
|
||||
|
||||
<p>Sincerely,<br />
|
||||
Alfresco ${productName!""}</p>
|
||||
</div>
|
||||
|
@@ -30,6 +30,7 @@ import static org.alfresco.repo.invitation.WorkflowModelNominatedInvitation.wfVa
|
||||
import static org.alfresco.repo.invitation.WorkflowModelNominatedInvitation.wfVarServerPath;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
@@ -70,6 +71,7 @@ public class InviteSender
|
||||
{
|
||||
public static final String WF_INSTANCE_ID = "wf_instanceId";
|
||||
public static final String WF_PACKAGE = "wf_package";
|
||||
private static final String SITE_DASHBOARD_ENDPOINT_PATTERN = "/page/site/{0}/dashboard";
|
||||
|
||||
private static final List<String> expectedProperties = Arrays.asList(wfVarInviteeUserName,//
|
||||
wfVarResourceName,//
|
||||
@@ -186,6 +188,10 @@ public class InviteSender
|
||||
String acceptLink = makeLink(properties.get(wfVarServerPath), properties.get(wfVarAcceptUrl), params);
|
||||
String rejectLink = makeLink(properties.get(wfVarServerPath), properties.get(wfVarRejectUrl), params);
|
||||
|
||||
String siteDashboardEndpoint = getSiteDashboardEndpoint(properties);
|
||||
String siteDashboardLink = makeLink(properties.get(wfVarServerPath),
|
||||
siteDashboardEndpoint, null);
|
||||
|
||||
Map<String, String> args = new HashMap<String, String>();
|
||||
args.put("inviteePersonRef", invitee.toString());
|
||||
args.put("inviterPersonRef", inviter.toString());
|
||||
@@ -195,6 +201,7 @@ public class InviteSender
|
||||
args.put("inviteeGenPassword", properties.get(wfVarInviteeGenPassword));
|
||||
args.put("acceptLink", acceptLink);
|
||||
args.put("rejectLink", rejectLink);
|
||||
args.put("siteDashboardLink", siteDashboardLink);
|
||||
return args;
|
||||
}
|
||||
|
||||
@@ -202,7 +209,14 @@ public class InviteSender
|
||||
{
|
||||
location = location.endsWith("/") ? location : location + "/";
|
||||
endpoint = endpoint.startsWith("/") ? endpoint.substring(1) : endpoint;
|
||||
if (queryParams != null)
|
||||
{
|
||||
queryParams = queryParams.startsWith("?") ? queryParams : "?" + queryParams;
|
||||
}
|
||||
else
|
||||
{
|
||||
queryParams = "";
|
||||
}
|
||||
return location + endpoint + queryParams;
|
||||
}
|
||||
|
||||
@@ -275,4 +289,10 @@ public class InviteSender
|
||||
}
|
||||
return siteName;
|
||||
}
|
||||
|
||||
private String getSiteDashboardEndpoint(Map<String, String> properties)
|
||||
{
|
||||
String siteName = properties.get(wfVarResourceName);
|
||||
return MessageFormat.format(SITE_DASHBOARD_ENDPOINT_PATTERN, siteName);
|
||||
}
|
||||
}
|
||||
|
@@ -96,6 +96,7 @@ public class InviteSenderTest extends TestCase
|
||||
|
||||
private static final String acceptUrl = "/accpet";
|
||||
private static final String rejectUrl = "/reject";
|
||||
private static final String dashboardUrl = "/dashboard";
|
||||
private static final String role = "Role";
|
||||
private static final String password = "password";
|
||||
private static final String ticket = "Ticket";
|
||||
@@ -170,6 +171,12 @@ public class InviteSenderTest extends TestCase
|
||||
"test://test/path/reject?inviteId=InstanceId&inviteeUserName=invitee&siteShortName=Full Site Name&inviteTicket=Ticket",
|
||||
argsMap.get("rejectLink"));
|
||||
}
|
||||
else
|
||||
{
|
||||
assertEquals(
|
||||
"test://test/path/page/site/Full Site Name" + dashboardUrl,
|
||||
argsMap.get("siteDashboardLink"));
|
||||
}
|
||||
|
||||
|
||||
// When no role message is found then the role name is used.
|
||||
|
Reference in New Issue
Block a user