mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Added new API methods to template Site helper - to retrieve Share URL stem and Share URL for a given site.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@37952 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -18,16 +18,18 @@
|
||||
*/
|
||||
package org.alfresco.repo.template;
|
||||
|
||||
import org.alfresco.repo.admin.SysAdminParamsImpl;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.site.SiteInfo;
|
||||
import org.alfresco.service.cmr.site.SiteService;
|
||||
import org.alfresco.util.UrlUtil;
|
||||
import org.springframework.extensions.surf.util.ParameterCheck;
|
||||
|
||||
/**
|
||||
* Site support in FreeMarker templates.
|
||||
*
|
||||
* @author Mike Hatfield
|
||||
* @author Kevin Roast
|
||||
*/
|
||||
public class Site extends BaseTemplateProcessorExtension
|
||||
{
|
||||
@@ -67,4 +69,35 @@ public class Site extends BaseTemplateProcessorExtension
|
||||
ParameterCheck.mandatoryString("shortName", shortName);
|
||||
return siteService.getSite(shortName);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns a URL stem which resolves to the configured Alfresco Share URL.
|
||||
* <p>
|
||||
* @see SysAdminParamsImpl#setAlfrescoHost(String)
|
||||
* @see SysAdminParamsImpl#setShareHost(String)
|
||||
*/
|
||||
public String getShareUrl()
|
||||
{
|
||||
return UrlUtil.getShareUrl(services.getSysAdminParams());
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns a URL which resolves to the configured Alfresco Share site URL.
|
||||
* <p>
|
||||
* @see SysAdminParamsImpl#setAlfrescoHost(String)
|
||||
* @see SysAdminParamsImpl#setShareHost(String)
|
||||
* @param siteShortName the shortName of the Site to build URL for
|
||||
* @return the Site or null if no such site exists
|
||||
*/
|
||||
public String getShareSiteUrl(String siteShortName)
|
||||
{
|
||||
StringBuilder result = new StringBuilder(UrlUtil.getShareUrl(services.getSysAdminParams()));
|
||||
result.append("/page");
|
||||
if (siteShortName != null)
|
||||
{
|
||||
result.append("/site/").append(siteShortName);
|
||||
}
|
||||
|
||||
return result.toString();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user