mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
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:
@@ -17,10 +17,13 @@
|
|||||||
<#if user.properties["wca:username"] = person.properties.userName>
|
<#if user.properties["wca:username"] = person.properties.userName>
|
||||||
<#assign projectcount=projectcount+1>
|
<#assign projectcount=projectcount+1>
|
||||||
<#-- construct the sandbox name based on the webproject and current username -->
|
<#-- 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="webProjectRow">
|
||||||
<div class="webProjectTitle">
|
<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>
|
<#if wp.properties.description?exists && wp.properties.description?length!=0>
|
||||||
<br>
|
<br>
|
||||||
<span class="webprojectDesc">${wp.properties.description}</span>
|
<span class="webprojectDesc">${wp.properties.description}</span>
|
||||||
@@ -69,7 +72,7 @@
|
|||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.webProjectLink:link, a.webProjectLink:visited, a.webProjectLink:hover
|
a.webPreviewLink:link, a.webPreviewLink:visited, a.webPreviewLink:hover
|
||||||
{
|
{
|
||||||
color: #5A5741;
|
color: #5A5741;
|
||||||
font-family: Trebuchet MS, Arial, Helvetica, sans-serif;
|
font-family: Trebuchet MS, Arial, Helvetica, sans-serif;
|
||||||
@@ -77,6 +80,15 @@ a.webProjectLink:link, a.webProjectLink:visited, a.webProjectLink:hover
|
|||||||
font-weight: bold;
|
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
|
.webProjectRow
|
||||||
{
|
{
|
||||||
background-color: #EEF7FB;
|
background-color: #EEF7FB;
|
||||||
|
@@ -49,8 +49,6 @@ import org.alfresco.util.VirtServerUtils;
|
|||||||
import org.alfresco.web.app.Application;
|
import org.alfresco.web.app.Application;
|
||||||
import org.alfresco.web.bean.repository.Repository;
|
import org.alfresco.web.bean.repository.Repository;
|
||||||
import org.alfresco.web.config.ClientConfigElement;
|
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(':'));
|
store = store.substring(0, store.indexOf(':'));
|
||||||
}
|
}
|
||||||
ClientConfigElement config = Application.getClientConfig(FacesContext.getCurrentInstance());
|
ClientConfigElement config = Application.getClientConfig(FacesContext.getCurrentInstance());
|
||||||
return MessageFormat.format(PREVIEW_SANDBOX_URL,
|
return MessageFormat.format(JNDIConstants.PREVIEW_SANDBOX_URL,
|
||||||
lookupStoreDNS(store),
|
lookupStoreDNS(store),
|
||||||
config.getWCMDomain(),
|
config.getWCMDomain(),
|
||||||
config.getWCMPort());
|
config.getWCMPort());
|
||||||
@@ -677,7 +675,7 @@ public final class AVMConstants
|
|||||||
assetPath = '/' + assetPath;
|
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)
|
public static String lookupStoreDNS(String store)
|
||||||
@@ -952,9 +950,7 @@ public final class AVMConstants
|
|||||||
|
|
||||||
private static VirtServerRegistry getVirtServerRegistry()
|
private static VirtServerRegistry getVirtServerRegistry()
|
||||||
{
|
{
|
||||||
final FacesContext fc = FacesContext.getCurrentInstance();
|
return Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getVirtServerRegistry();
|
||||||
final WebApplicationContext ac = FacesContextUtils.getRequiredWebApplicationContext(fc);
|
|
||||||
return (VirtServerRegistry)ac.getBean(BEAN_VIRT_SERVER_REGISTRY);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ConfigElement getDeploymentConfig()
|
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_MANAGER = "ContentManager";
|
||||||
public final static String ROLE_CONTENT_PUBLISHER = "ContentPublisher";
|
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
|
// pattern for absolute AVM Path
|
||||||
private final static Pattern STORE_RELATIVE_PATH_PATTERN =
|
private final static Pattern STORE_RELATIVE_PATH_PATTERN =
|
||||||
Pattern.compile("[^:]+:(.+)");
|
Pattern.compile("[^:]+:(.+)");
|
||||||
|
@@ -27,12 +27,13 @@ package org.alfresco.web.config;
|
|||||||
import javax.faces.context.FacesContext;
|
import javax.faces.context.FacesContext;
|
||||||
|
|
||||||
import org.alfresco.config.ConfigElement;
|
import org.alfresco.config.ConfigElement;
|
||||||
|
import org.alfresco.config.JNDIConstants;
|
||||||
import org.alfresco.config.element.ConfigElementAdapter;
|
import org.alfresco.config.element.ConfigElementAdapter;
|
||||||
import org.alfresco.mbeans.VirtServerRegistry;
|
import org.alfresco.mbeans.VirtServerRegistry;
|
||||||
import org.alfresco.repo.cache.ExpiringValueCache;
|
import org.alfresco.repo.cache.ExpiringValueCache;
|
||||||
|
import org.alfresco.web.bean.repository.Repository;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.springframework.web.jsf.FacesContextUtils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom config element that represents config values for the client
|
* 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";
|
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 static final String DEFAULT_FROM_ADDRESS = "alfresco@alfresco.org";
|
||||||
|
|
||||||
private String fromEmailAddress = DEFAULT_FROM_ADDRESS;
|
private String fromEmailAddress = DEFAULT_FROM_ADDRESS;
|
||||||
@@ -505,12 +503,12 @@ public class ClientConfigElement extends ConfigElementAdapter
|
|||||||
String value = this.wcmDomain.get();
|
String value = this.wcmDomain.get();
|
||||||
if (value == null)
|
if (value == null)
|
||||||
{
|
{
|
||||||
VirtServerRegistry vServerRegistry = (VirtServerRegistry)FacesContextUtils.getRequiredWebApplicationContext(
|
VirtServerRegistry vServerRegistry = Repository.getServiceRegistry(
|
||||||
FacesContext.getCurrentInstance()).getBean(BEAN_VIRT_SERVER_REGISTRY);
|
FacesContext.getCurrentInstance()).getVirtServerRegistry();
|
||||||
value = vServerRegistry.getVirtServerFQDN();
|
value = vServerRegistry.getVirtServerFQDN();
|
||||||
if (value == null)
|
if (value == null)
|
||||||
{
|
{
|
||||||
value = DEFAULT_VSERVER_IP;
|
value = JNDIConstants.DEFAULT_VSERVER_IP;
|
||||||
logger.warn("Virtualisation Server not started - reverting to default IP: " + value);
|
logger.warn("Virtualisation Server not started - reverting to default IP: " + value);
|
||||||
}
|
}
|
||||||
this.wcmDomain.put(value);
|
this.wcmDomain.put(value);
|
||||||
@@ -526,12 +524,12 @@ public class ClientConfigElement extends ConfigElementAdapter
|
|||||||
String value = this.wcmPort.get();
|
String value = this.wcmPort.get();
|
||||||
if (value == null)
|
if (value == null)
|
||||||
{
|
{
|
||||||
VirtServerRegistry vServerRegistry = (VirtServerRegistry)FacesContextUtils.getRequiredWebApplicationContext(
|
VirtServerRegistry vServerRegistry = Repository.getServiceRegistry(
|
||||||
FacesContext.getCurrentInstance()).getBean(BEAN_VIRT_SERVER_REGISTRY);
|
FacesContext.getCurrentInstance()).getVirtServerRegistry();
|
||||||
Integer iValue = vServerRegistry.getVirtServerHttpPort();
|
Integer iValue = vServerRegistry.getVirtServerHttpPort();
|
||||||
if (iValue == null)
|
if (iValue == null)
|
||||||
{
|
{
|
||||||
iValue = DEFAULT_VSERVER_PORT;
|
iValue = JNDIConstants.DEFAULT_VSERVER_PORT;
|
||||||
logger.warn("Virtualisation Server not started - reverting to default port: " + iValue);
|
logger.warn("Virtualisation Server not started - reverting to default port: " + iValue);
|
||||||
}
|
}
|
||||||
value = iValue.toString();
|
value = iValue.toString();
|
||||||
|
Reference in New Issue
Block a user