diff --git a/config/alfresco/action-services-context.xml b/config/alfresco/action-services-context.xml index 304ee124cf..b03d46e8d3 100644 --- a/config/alfresco/action-services-context.xml +++ b/config/alfresco/action-services-context.xml @@ -381,6 +381,9 @@ ${mail.from.default} + + ${repo.remote.url} + diff --git a/config/alfresco/activities/activities-feed-context.xml b/config/alfresco/activities/activities-feed-context.xml index f637a52e3b..59084cc311 100644 --- a/config/alfresco/activities/activities-feed-context.xml +++ b/config/alfresco/activities/activities-feed-context.xml @@ -54,7 +54,7 @@ - + diff --git a/config/alfresco/repository.properties b/config/alfresco/repository.properties index ae3e2c2a00..ffafeab5b7 100644 --- a/config/alfresco/repository.properties +++ b/config/alfresco/repository.properties @@ -312,7 +312,8 @@ linkvalidation.disableOnFail=false system.usages.enabled=true # Repository endpoint - used by Activity Service -repo.remote.endpoint.url=http://localhost:8080/alfresco/service +repo.remote.url=http://localhost:8080/alfresco +repo.remote.endpoint=/service # Create home folders as people are created (true) or create them lazily (false) home.folder.creation.eager=true diff --git a/source/java/org/alfresco/repo/action/executer/MailActionExecuter.java b/source/java/org/alfresco/repo/action/executer/MailActionExecuter.java index 9625ef0102..ad77d0b13b 100644 --- a/source/java/org/alfresco/repo/action/executer/MailActionExecuter.java +++ b/source/java/org/alfresco/repo/action/executer/MailActionExecuter.java @@ -86,6 +86,8 @@ public class MailActionExecuter extends ActionExecuterAbstractBase */ private static final String FROM_ADDRESS = "alfresco@alfresco.org"; + private static final String REPO_REMOTE_URL = "http://localhost:8080/alfresco"; + /** * The java mail sender */ @@ -131,6 +133,11 @@ public class MailActionExecuter extends ActionExecuterAbstractBase */ private String fromAddress = null; + /** + * Default alfresco installation url + */ + private String repoRemoteUrl = null; + /** * @param javaMailSender the java mail sender */ @@ -203,6 +210,15 @@ public class MailActionExecuter extends ActionExecuterAbstractBase this.fromAddress = fromAddress; } + /** + * + * @param repoRemoteUrl The default alfresco installation url + */ + public void setRepoRemoteUrl(String repoRemoteUrl) + { + this.repoRemoteUrl = repoRemoteUrl; + } + /** * Initialise bean */ @@ -212,6 +228,11 @@ public class MailActionExecuter extends ActionExecuterAbstractBase { fromAddress = FROM_ADDRESS; } + + if (repoRemoteUrl == null || repoRemoteUrl.length() == 0) + { + repoRemoteUrl = REPO_REMOTE_URL; + } } /** @@ -421,6 +442,7 @@ public class MailActionExecuter extends ActionExecuterAbstractBase model.put("hasAspect", new HasAspectMethod()); model.put("message", new I18NMessageMethod()); model.put("dateCompare", new DateCompareMethod()); + model.put("url", new URLHelper(repoRemoteUrl)); return model; } @@ -439,4 +461,26 @@ public class MailActionExecuter extends ActionExecuterAbstractBase paramList.add(new ParameterDefinitionImpl(PARAM_TEMPLATE, DataTypeDefinition.NODE_REF, false, getParamDisplayLabel(PARAM_TEMPLATE))); } + public static class URLHelper + { + String contextPath; + String serverPath; + + public URLHelper(String repoRemoteUrl) + { + String[] parts = repoRemoteUrl.split("/"); + this.contextPath = "/" + parts[parts.length - 1]; + this.serverPath = parts[0] + "//" + parts[2]; + } + + public String getContext() + { + return this.contextPath; + } + + public String getServerPath() + { + return this.serverPath; + } + } }