My Forms template now opens website virtualisation URL when icon clicked.

New Template AVM API methods added to generate staging, user sandbox and path asset URLs for virtualisation server.
Some refactoring of constants used in AVMConstants into JNDIConstants to allow repository classes to also use them.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5624 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2007-05-04 11:27:46 +00:00
parent dd5a638c20
commit 741fb75305
3 changed files with 26 additions and 27 deletions

View File

@@ -17,10 +17,13 @@
<#if user.properties["wca:username"] = person.properties.userName>
<#assign projectcount=projectcount+1>
<#-- construct the sandbox name based on the webproject and current username -->
<#assign sandbox=wp.properties["wca:avmstore"] + "--" + person.properties.userName>
<#assign storeId=wp.properties["wca:avmstore"]>
<#assign username=person.properties.userName>
<#assign sandbox=avm.userSandboxStore(storeId, username)>
<div class="webProjectRow">
<div class="webProjectTitle">
<a class="webProjectLink" href="${url.context}${wp.url}" target="new"><img src="${url.context}/images/icons/website_large.gif" width=32 height=32 border=0><span class="websiteLink">${wp.name}</span></a>
<a class="webPreviewLink" href="${avm.websiteUserSandboxUrl(storeId, username)}" target="new"><img src="${url.context}/images/icons/website_large.gif" width=32 height=32 border=0><span class="websiteLink">${wp.name}</span></a>
<a class="webProjectLink" href="${url.context}${wp.url}" target="new">View Web Project</span></a>
<#if wp.properties.description?exists && wp.properties.description?length!=0>
<br>
<span class="webprojectDesc">${wp.properties.description}</span>
@@ -69,7 +72,7 @@
overflow: auto;
}
a.webProjectLink:link, a.webProjectLink:visited, a.webProjectLink:hover
a.webPreviewLink:link, a.webPreviewLink:visited, a.webPreviewLink:hover
{
color: #5A5741;
font-family: Trebuchet MS, Arial, Helvetica, sans-serif;
@@ -77,6 +80,15 @@ a.webProjectLink:link, a.webProjectLink:visited, a.webProjectLink:hover
font-weight: bold;
}
a.webProjectLink:link, a.webProjectLink:visited, a.webProjectLink:hover
{
color: #5A5741;
font-family: Trebuchet MS, Arial, Helvetica, sans-serif;
font-size: 11px;
padding-left: 16px;
vertical-align: 60%;
}
.webProjectRow
{
background-color: #EEF7FB;

View File

@@ -49,8 +49,6 @@ import org.alfresco.util.VirtServerUtils;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.config.ClientConfigElement;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.jsf.FacesContextUtils;
/**
@@ -597,7 +595,7 @@ public final class AVMConstants
store = store.substring(0, store.indexOf(':'));
}
ClientConfigElement config = Application.getClientConfig(FacesContext.getCurrentInstance());
return MessageFormat.format(PREVIEW_SANDBOX_URL,
return MessageFormat.format(JNDIConstants.PREVIEW_SANDBOX_URL,
lookupStoreDNS(store),
config.getWCMDomain(),
config.getWCMPort());
@@ -677,7 +675,7 @@ public final class AVMConstants
assetPath = '/' + assetPath;
}
return MessageFormat.format(PREVIEW_ASSET_URL, dns, domain, port, assetPath);
return MessageFormat.format(JNDIConstants.PREVIEW_ASSET_URL, dns, domain, port, assetPath);
}
public static String lookupStoreDNS(String store)
@@ -952,9 +950,7 @@ public final class AVMConstants
private static VirtServerRegistry getVirtServerRegistry()
{
final FacesContext fc = FacesContext.getCurrentInstance();
final WebApplicationContext ac = FacesContextUtils.getRequiredWebApplicationContext(fc);
return (VirtServerRegistry)ac.getBean(BEAN_VIRT_SERVER_REGISTRY);
return Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getVirtServerRegistry();
}
private static ConfigElement getDeploymentConfig()
@@ -1004,13 +1000,6 @@ public final class AVMConstants
public final static String ROLE_CONTENT_MANAGER = "ContentManager";
public final static String ROLE_CONTENT_PUBLISHER = "ContentPublisher";
// virtualisation server MBean registry
private static final String BEAN_VIRT_SERVER_REGISTRY = "VirtServerRegistry";
// URLs for preview of sandboxes and assets
private final static String PREVIEW_SANDBOX_URL = "http://{0}.www--sandbox.{1}:{2}";
private final static String PREVIEW_ASSET_URL = "http://{0}.www--sandbox.{1}:{2}{3}";
// pattern for absolute AVM Path
private final static Pattern STORE_RELATIVE_PATH_PATTERN =
Pattern.compile("[^:]+:(.+)");

View File

@@ -27,12 +27,13 @@ package org.alfresco.web.config;
import javax.faces.context.FacesContext;
import org.alfresco.config.ConfigElement;
import org.alfresco.config.JNDIConstants;
import org.alfresco.config.element.ConfigElementAdapter;
import org.alfresco.mbeans.VirtServerRegistry;
import org.alfresco.repo.cache.ExpiringValueCache;
import org.alfresco.web.bean.repository.Repository;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.jsf.FacesContextUtils;
/**
* Custom config element that represents config values for the client
@@ -45,9 +46,6 @@ public class ClientConfigElement extends ConfigElementAdapter
public static final String CONFIG_ELEMENT_ID = "client";
private static final String BEAN_VIRT_SERVER_REGISTRY = "VirtServerRegistry";
private static final String DEFAULT_VSERVER_IP = "127-0-0-1.ip.alfrescodemo.net";
private static final int DEFAULT_VSERVER_PORT = 8180;
private static final String DEFAULT_FROM_ADDRESS = "alfresco@alfresco.org";
private String fromEmailAddress = DEFAULT_FROM_ADDRESS;
@@ -505,12 +503,12 @@ public class ClientConfigElement extends ConfigElementAdapter
String value = this.wcmDomain.get();
if (value == null)
{
VirtServerRegistry vServerRegistry = (VirtServerRegistry)FacesContextUtils.getRequiredWebApplicationContext(
FacesContext.getCurrentInstance()).getBean(BEAN_VIRT_SERVER_REGISTRY);
VirtServerRegistry vServerRegistry = Repository.getServiceRegistry(
FacesContext.getCurrentInstance()).getVirtServerRegistry();
value = vServerRegistry.getVirtServerFQDN();
if (value == null)
{
value = DEFAULT_VSERVER_IP;
value = JNDIConstants.DEFAULT_VSERVER_IP;
logger.warn("Virtualisation Server not started - reverting to default IP: " + value);
}
this.wcmDomain.put(value);
@@ -526,12 +524,12 @@ public class ClientConfigElement extends ConfigElementAdapter
String value = this.wcmPort.get();
if (value == null)
{
VirtServerRegistry vServerRegistry = (VirtServerRegistry)FacesContextUtils.getRequiredWebApplicationContext(
FacesContext.getCurrentInstance()).getBean(BEAN_VIRT_SERVER_REGISTRY);
VirtServerRegistry vServerRegistry = Repository.getServiceRegistry(
FacesContext.getCurrentInstance()).getVirtServerRegistry();
Integer iValue = vServerRegistry.getVirtServerHttpPort();
if (iValue == null)
{
iValue = DEFAULT_VSERVER_PORT;
iValue = JNDIConstants.DEFAULT_VSERVER_PORT;
logger.warn("Virtualisation Server not started - reverting to default port: " + iValue);
}
value = iValue.toString();