diff --git a/config/alfresco/messages/webclient.properties b/config/alfresco/messages/webclient.properties index 9fa486beef..8db5cad327 100644 --- a/config/alfresco/messages/webclient.properties +++ b/config/alfresco/messages/webclient.properties @@ -1073,6 +1073,7 @@ website_details=Web Project Details create_website_step1_title=Step One - Web Project Details create_website_step1_desc=Enter the information about the web project. website_dnsname=DNS name +website_preview_provider=Preview Provider validation_invalid_dns_name=Invalid website DNS name: only alpha-numeric and non-initial/final hyphen characters are allowed (max length < 64). website_webapp=Default Webapp website_createfrom=Create From Existing Web Project diff --git a/config/alfresco/web-client-config-properties.xml b/config/alfresco/web-client-config-properties.xml index 75d35ef907..7f27bf66c9 100644 --- a/config/alfresco/web-client-config-properties.xml +++ b/config/alfresco/web-client-config-properties.xml @@ -649,6 +649,8 @@ + + diff --git a/source/java/org/alfresco/web/bean/wcm/AVMUtil.java b/source/java/org/alfresco/web/bean/wcm/AVMUtil.java index 570f77f19f..a9a89c4f5c 100644 --- a/source/java/org/alfresco/web/bean/wcm/AVMUtil.java +++ b/source/java/org/alfresco/web/bean/wcm/AVMUtil.java @@ -35,15 +35,14 @@ import org.alfresco.config.ConfigService; import org.alfresco.config.JNDIConstants; import org.alfresco.mbeans.VirtServerRegistry; import org.alfresco.repo.avm.AVMNodeConverter; -import org.alfresco.service.ServiceRegistry; import org.alfresco.service.cmr.avm.AVMNotFoundException; import org.alfresco.service.cmr.avm.AVMService; import org.alfresco.wcm.util.WCMUtil; import org.alfresco.web.app.Application; import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.bean.wcm.preview.PreviewURIService; -import org.alfresco.web.bean.wcm.preview.VirtualisationServerPreviewURIService; -import org.alfresco.web.config.ClientConfigElement; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.springframework.web.context.WebApplicationContext; import org.springframework.web.jsf.FacesContextUtils; @@ -57,6 +56,8 @@ import org.springframework.web.jsf.FacesContextUtils; */ public final class AVMUtil extends WCMUtil { + private static Log logger = LogFactory.getLog(AVMUtil.class); + ///////////////////////////////////////////////////////////////////////////// public static enum PathRelation @@ -270,14 +271,6 @@ public final class AVMUtil extends WCMUtil return WCMUtil.buildStoreWebappPath(storeName, webapp); } - public static String buildStoreUrl(String store) - { - ServiceRegistry serviceRegistry = Repository.getServiceRegistry(FacesContext.getCurrentInstance()); - AVMService avmService = serviceRegistry.getAVMService(); - ClientConfigElement config = Application.getClientConfig(FacesContext.getCurrentInstance()); - return WCMUtil.buildStoreUrl(avmService, store, config.getWCMDomain(), config.getWCMPort()); - } - public static String buildWebappUrl(final String avmPath) { if (avmPath == null || avmPath.length() == 0) @@ -285,7 +278,7 @@ public final class AVMUtil extends WCMUtil throw new IllegalArgumentException("AVM path is mandatory."); } return AVMUtil.buildWebappUrl(AVMUtil.getStoreName(avmPath), - AVMUtil.getWebapp(avmPath)); + AVMUtil.getWebapp(avmPath)); } public static String buildWebappUrl(final String store, final String webapp) @@ -295,30 +288,8 @@ public final class AVMUtil extends WCMUtil throw new IllegalArgumentException("Webapp name is mandatory."); } return (webapp.equals(DIR_ROOT) - ? buildStoreUrl(store) - : buildStoreUrl(store) + '/' + webapp); - } - - /** - * NOTE: do not call directly from client - use getPreviewURI instead - */ - public static String buildAssetUrl(String store, String assetPath) - { - if (store == null || store.length() == 0) - { - throw new IllegalArgumentException("Store name is mandatory."); - } - if (assetPath == null || assetPath.length() == 0) - { - throw new IllegalArgumentException("Asset path is mandatory."); - } - ClientConfigElement config = Application.getClientConfig(FacesContext.getCurrentInstance()); - return buildAssetUrl(assetPath, config.getWCMDomain(), config.getWCMPort(), lookupStoreDNS(store)); - } - - public static String buildAssetUrl(String assetPath, String domain, String port, String dns) - { - return WCMUtil.buildAssetUrl(assetPath, domain, port, dns); + ? getPreviewURI(store) + : getPreviewURI(store) + '/' + webapp); } public static String getPreviewURI(String storeNameOrAvmPath) @@ -327,50 +298,49 @@ public final class AVMUtil extends WCMUtil { throw new IllegalArgumentException("AVM store name or absolute path is mandatory."); } - final String[] s = storeNameOrAvmPath.split(AVM_STORE_SEPARATOR); + final String[] s = storeNameOrAvmPath.split(WCMUtil.AVM_STORE_SEPARATOR); if (s.length == 1) { - return AVMUtil.getPreviewURI(s[0], null); + return getPreviewURI(s[0], null); } if (s.length != 2) { throw new IllegalArgumentException("expected exactly one ':' in " + storeNameOrAvmPath); } - return AVMUtil.getPreviewURI(s[0], s[1]); + return getPreviewURI(s[0], s[1]); } - public static String getPreviewURI(final String storeId, final String assetPath) + public static String getPreviewURI(String storeId, String assetPath) { - if (previewURIGenerator == null) + if (! deprecatedPreviewURIGeneratorChecked) { - WebApplicationContext wac = FacesContextUtils.getRequiredWebApplicationContext( - FacesContext.getCurrentInstance()); - - if (wac.containsBean(SPRING_BEAN_NAME_PREVIEW_URI_SERVICE)) + if (deprecatedPreviewURIGenerator == null) { - // if the bean is present retrieve it - previewURIGenerator = (PreviewURIService)wac.getBean(SPRING_BEAN_NAME_PREVIEW_URI_SERVICE, - PreviewURIService.class); - } - else - { - // Backwards compatibility - if the new Spring bean doesn't exist, default to the - // existing behaviour (create a URL to the virtualisation server). - previewURIGenerator = new VirtualisationServerPreviewURIService(); + // backwards compatibility - will hide new implementation, until custom providers/context are migrated + WebApplicationContext wac = FacesContextUtils.getRequiredWebApplicationContext( + FacesContext.getCurrentInstance()); + + if (wac.containsBean(SPRING_BEAN_NAME_PREVIEW_URI_SERVICE)) + { + // if the bean is present retrieve it + deprecatedPreviewURIGenerator = (PreviewURIService)wac.getBean(SPRING_BEAN_NAME_PREVIEW_URI_SERVICE, + PreviewURIService.class); + + logger.warn("Found deprecated '"+SPRING_BEAN_NAME_PREVIEW_URI_SERVICE+"' config - which will be used instead of new 'WCMPreviewURIService' until migrated (changing web project preview provider will have no effect)"); + } } + + deprecatedPreviewURIGeneratorChecked = true; } - - return previewURIGenerator.getPreviewURI(storeId, assetPath); + + if (deprecatedPreviewURIGenerator != null) + { + return deprecatedPreviewURIGenerator.getPreviewURI(storeId, assetPath); + } + + return getPreviewURIService().getPreviewURI(storeId, assetPath); } - public static String lookupStoreDNS(String store) - { - final ServiceRegistry serviceRegistry = - Repository.getServiceRegistry(FacesContext.getCurrentInstance()); - final AVMService avmService = serviceRegistry.getAVMService(); - return WCMUtil.lookupStoreDNS(avmService, store); - } - /** * Converts the provided path to an absolute path within the avm. * @@ -443,9 +413,7 @@ public final class AVMUtil extends WCMUtil */ public static void makeAllDirectories(final String avmDirectoryPath) { - final ServiceRegistry serviceRegistry = - Repository.getServiceRegistry(FacesContext.getCurrentInstance()); - final AVMService avmService = serviceRegistry.getAVMService(); + final AVMService avmService = getAVMService(); // LOGGER.debug("mkdir -p " + avmDirectoryPath); String s = avmDirectoryPath; final Stack dirNames = new Stack(); @@ -467,7 +435,7 @@ public final class AVMUtil extends WCMUtil // LOGGER.debug("pushing " + sb[1]); dirNames.push(sb); } - + while (!dirNames.isEmpty()) { final String[] sb = dirNames.pop(); @@ -496,6 +464,16 @@ public final class AVMUtil extends WCMUtil return Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getVirtServerRegistry(); } + private static AVMService getAVMService() + { + return Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMService(); + } + + private static org.alfresco.wcm.preview.PreviewURIService getPreviewURIService() + { + return Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPreviewURIService(); + } + private static ConfigElement getDeploymentConfig() { if ((deploymentConfig == null) || (Application.isDynamicConfig(FacesContext.getCurrentInstance()))) @@ -541,6 +519,8 @@ public final class AVMUtil extends WCMUtil private static ConfigElement deploymentConfig = null; private static ConfigElement linksManagementConfig = null; - private final static String SPRING_BEAN_NAME_PREVIEW_URI_SERVICE = "PreviewURIService"; - private static PreviewURIService previewURIGenerator = null; + // deprecated + private final static String SPRING_BEAN_NAME_PREVIEW_URI_SERVICE = "PreviewURIService"; + private static PreviewURIService deprecatedPreviewURIGenerator = null; + private static boolean deprecatedPreviewURIGeneratorChecked = false; } diff --git a/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java b/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java index 23bc8aa099..0b5839a8a0 100644 --- a/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java +++ b/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005-2008 Alfresco Software Limited. + * Copyright (C) 2005-2009 Alfresco Software Limited. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -31,6 +31,7 @@ import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.Set; import javax.faces.context.FacesContext; import javax.faces.event.ActionEvent; @@ -50,8 +51,10 @@ import org.alfresco.service.cmr.workflow.WorkflowService; import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.RegexQNamePattern; import org.alfresco.util.ExpiringValueCache; +import org.alfresco.wcm.preview.PreviewURIService; import org.alfresco.wcm.util.WCMUtil; import org.alfresco.wcm.webproject.WebProjectInfo; +import org.alfresco.wcm.webproject.WebProjectInfoImpl; import org.alfresco.wcm.webproject.WebProjectService; import org.alfresco.web.app.AlfrescoNavigationHandler; import org.alfresco.web.app.Application; @@ -112,19 +115,21 @@ public class CreateWebsiteWizard extends BaseWizardBean protected String webapp = WEBAPP_DEFAULT; protected String createFrom = null; protected boolean isSource; + protected String previewProvider; protected NodeRef wpNodeRef; protected String[] sourceWebProject = null; protected ExpiringValueCache> webProjectsList; protected List webappsList; + protected List previewProvidersList; protected boolean showAllSourceProjects; protected String websiteDescriptionAttribute; transient private WorkflowService workflowService; transient private PersonService personService; transient private FormsService formsService; - transient private WebProjectService wpService; + transient private PreviewURIService previewURIService; /** set true when an option in the Create From screen is changed - this is used as an indicator to reload the wizard data model from the selected source web project */ @@ -183,6 +188,7 @@ public class CreateWebsiteWizard extends BaseWizardBean this.sourceWebProject = null; this.createFromValueChanged = false; this.showAllSourceProjects = false; + this.websiteDescriptionAttribute = null; } private void clearFormsWorkflowsDeploymentAndUsers() @@ -222,7 +228,7 @@ public class CreateWebsiteWizard extends BaseWizardBean sourceNodeRef = new NodeRef(this.sourceWebProject[0]); } - WebProjectInfo wpInfo = getWebProjectService().createWebProject(this.dnsName, this.name, this.title, this.description, this.webapp, this.isSource, sourceNodeRef); + WebProjectInfo wpInfo = getWebProjectService().createWebProject(new WebProjectInfoImpl(this.dnsName, this.name, this.title, this.description, this.webapp, this.isSource, sourceNodeRef, this.previewProvider)); String avmStore = wpInfo.getStoreId(); NodeRef wpNodeRef = wpInfo.getNodeRef(); @@ -406,6 +412,7 @@ public class CreateWebsiteWizard extends BaseWizardBean this.webapp = wpInfo.getDefaultWebApp(); this.isSource = wpInfo.isTemplate(); this.wpNodeRef = wpInfo.getNodeRef(); + this.previewProvider = wpInfo.getPreviewProviderName(); } if (loadUsers) @@ -593,11 +600,28 @@ public class CreateWebsiteWizard extends BaseWizardBean { if (wpService == null) { - wpService = (WebProjectService) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "WebProjectService"); + wpService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getWebProjectService(); } return wpService; } + /** + * @param previewURIService The PreviewURIService to set. + */ + public void setPreviewURIService(final PreviewURIService previewURIService) + { + this.previewURIService = previewURIService; + } + + protected PreviewURIService getPreviewURIService() + { + if (previewURIService == null) + { + previewURIService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPreviewURIService(); + } + return previewURIService; + } + // ------------------------------------------------------------------------------ // Bean getters and setters @@ -705,6 +729,16 @@ public class CreateWebsiteWizard extends BaseWizardBean this.webapp = webapp; } + public String getPreviewProvider() + { + return this.previewProvider; + } + + public void setPreviewProvider(String previewProvider) + { + this.previewProvider = previewProvider; + } + /** * @return the create from selection value */ @@ -852,6 +886,31 @@ public class CreateWebsiteWizard extends BaseWizardBean return this.webappsList; } + public List getPreviewProvidersList() + { + if (this.previewProvidersList == null) + { + // create list of preview providers + + String defaultPreviewProvider = getPreviewURIService().getDefaultProviderName(); + Set previewProviders = getPreviewURIService().getProviderNames(); + + this.previewProvidersList = new ArrayList(previewProviders.size()); + + this.previewProvidersList.add(new SelectItem(defaultPreviewProvider, defaultPreviewProvider)); + + for (String previewProvider : previewProviders) + { + if (! previewProvider.equals(defaultPreviewProvider)) + { + this.previewProvidersList.add(new SelectItem(previewProvider, previewProvider)); + } + } + } + + return this.previewProvidersList; + } + /** * @see org.alfresco.web.bean.wizard.BaseWizardBean#next() */ @@ -1387,6 +1446,7 @@ public class CreateWebsiteWizard extends BaseWizardBean attribute.append(DescriptionAttributeHelper.getTableLine(fc, "title", getTitle())); attribute.append(DescriptionAttributeHelper.getTableLine(fc, "description", DescriptionAttributeHelper.getDescriptionNotEmpty(fc, getDescription()), false)); + attribute.append(DescriptionAttributeHelper.getTableLine(fc, "website_preview_provider", getPreviewProvider())); attribute.append(DescriptionAttributeHelper.getTableEnd()); return attribute.toString(); } diff --git a/source/java/org/alfresco/web/bean/wcm/EditWebsiteWizard.java b/source/java/org/alfresco/web/bean/wcm/EditWebsiteWizard.java index 1d50100916..b5c6c5dea6 100644 --- a/source/java/org/alfresco/web/bean/wcm/EditWebsiteWizard.java +++ b/source/java/org/alfresco/web/bean/wcm/EditWebsiteWizard.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005-2008 Alfresco Software Limited. + * Copyright (C) 2005-2009 Alfresco Software Limited. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -31,7 +31,6 @@ import java.util.Map; import javax.faces.context.FacesContext; import javax.faces.model.SelectItem; -import org.alfresco.model.ContentModel; import org.alfresco.model.WCMAppModel; import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.NodeRef; @@ -117,6 +116,7 @@ public class EditWebsiteWizard extends CreateWebsiteWizard wpInfo.setTitle(this.title); wpInfo.setDescription(this.description); wpInfo.setIsTemplate(this.isSource); + wpInfo.setPreviewProviderName(this.previewProvider); getWebProjectService().updateWebProject(wpInfo); diff --git a/source/java/org/alfresco/web/bean/wcm/preview/NullPreviewURIService.java b/source/java/org/alfresco/web/bean/wcm/preview/NullPreviewURIService.java index ce536d3cc8..29f1147e27 100644 --- a/source/java/org/alfresco/web/bean/wcm/preview/NullPreviewURIService.java +++ b/source/java/org/alfresco/web/bean/wcm/preview/NullPreviewURIService.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005-2008 Alfresco Software Limited. + * Copyright (C) 2005-2009 Alfresco Software Limited. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -25,22 +25,19 @@ package org.alfresco.web.bean.wcm.preview; - /** * A PreviewURIService that always returns null (no preview URI). * * @author Peter Monks (peter.monks@alfresco.com) - * @version $Id$ + * + * @since 2.2.1 + * + * @deprecated see org.alfresco.web.bean.wcm.preview.NullPreviewURIService */ -public class NullPreviewURIService - implements PreviewURIService +public class NullPreviewURIService extends org.alfresco.wcm.preview.NullPreviewURIService implements PreviewURIService { - /** - * @see org.alfresco.web.bean.wcm.preview.PreviewURIService#getPreviewURI(java.lang.String, java.lang.String) - */ public String getPreviewURI(final String storeId, final String webapp) { - return(null); + return super.getPreviewURI(storeId, webapp, null); } - } \ No newline at end of file diff --git a/source/java/org/alfresco/web/bean/wcm/preview/PreviewURIService.java b/source/java/org/alfresco/web/bean/wcm/preview/PreviewURIService.java index 8d7ec04103..b45ef8241e 100644 --- a/source/java/org/alfresco/web/bean/wcm/preview/PreviewURIService.java +++ b/source/java/org/alfresco/web/bean/wcm/preview/PreviewURIService.java @@ -30,7 +30,10 @@ package org.alfresco.web.bean.wcm.preview; * Abstraction for generating preview URLs. * * @author Peter Monks (peter.monks@alfresco.com) - * @version $Id$ + * + * @since 2.2.1 + * + * @deprecated see org.alfresco.wcm.preview.PreviewURIServiceProvider */ public interface PreviewURIService { diff --git a/source/java/org/alfresco/web/bean/wcm/preview/StoreSpecificPreviewURIService.java b/source/java/org/alfresco/web/bean/wcm/preview/StoreSpecificPreviewURIService.java index 1f9c22e686..1b2705b647 100644 --- a/source/java/org/alfresco/web/bean/wcm/preview/StoreSpecificPreviewURIService.java +++ b/source/java/org/alfresco/web/bean/wcm/preview/StoreSpecificPreviewURIService.java @@ -40,10 +40,12 @@ import org.alfresco.util.Pair; * is being generated for. * * @author Peter Monks (peter.monks@alfresco.com) - * @version $Id$ + * + * @since 2.2.1 + * + * @deprecated see org.alfresco.wcm.preview.* */ -public class StoreSpecificPreviewURIService - implements PreviewURIService +public class StoreSpecificPreviewURIService implements PreviewURIService { private final List> storeURIGenerators; private final PreviewURIService fallback; diff --git a/source/java/org/alfresco/web/bean/wcm/preview/URITemplatePreviewURIService.java b/source/java/org/alfresco/web/bean/wcm/preview/URITemplatePreviewURIService.java index 5663a9862f..7d5ae2672c 100644 --- a/source/java/org/alfresco/web/bean/wcm/preview/URITemplatePreviewURIService.java +++ b/source/java/org/alfresco/web/bean/wcm/preview/URITemplatePreviewURIService.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005-2008 Alfresco Software Limited. + * Copyright (C) 2005-2009 Alfresco Software Limited. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -34,18 +34,13 @@ package org.alfresco.web.bean.wcm.preview; * * * @author Peter Monks (peter.monks@alfresco.com) - * @version $Id$ + * + * @since 2.2.1 + * + * @deprecated see org.alfresco.wcm.preview.URITemplatePreviewURIService */ -public class URITemplatePreviewURIService - implements PreviewURIService +public class URITemplatePreviewURIService extends org.alfresco.wcm.preview.URITemplatePreviewURIService implements PreviewURIService { - private final static String URI_TEMPLATE_PARAMETER_STORE_ID = "{storeId}"; - private final static String URI_TEMPLATE_PARAMETER_PATH_TO_ASSET = "{pathToAsset}"; - - - private final String uriTemplate; - - public URITemplatePreviewURIService(final String uriTemplate) { // PRECONDITIONS @@ -55,40 +50,8 @@ public class URITemplatePreviewURIService this.uriTemplate = uriTemplate; } - - /** - * @see org.alfresco.web.bean.wcm.preview.PreviewURIService#getPreviewURI(java.lang.String, java.lang.String) - */ - public String getPreviewURI(final String storeId, final String pathToAsset) + public String getPreviewURI(final String storeId, final String webapp) { - String result = uriTemplate; - - if (uriTemplate.contains(URI_TEMPLATE_PARAMETER_STORE_ID)) - { - if (storeId != null && storeId.trim().length() > 0) - { - result = result.replace(URI_TEMPLATE_PARAMETER_STORE_ID, storeId); - } - else - { - // Shouldn't ever happen (store ids are always provided), but better to be safe than sorry - result = result.replace(URI_TEMPLATE_PARAMETER_STORE_ID, ""); - } - } - - if (uriTemplate.contains(URI_TEMPLATE_PARAMETER_PATH_TO_ASSET)) - { - if (pathToAsset != null && pathToAsset.trim().length() > 0) - { - result = result.replace(URI_TEMPLATE_PARAMETER_PATH_TO_ASSET, pathToAsset); - } - else - { - result = result.replace(URI_TEMPLATE_PARAMETER_PATH_TO_ASSET, ""); - } - } - - return(result); + return super.getPreviewURI(storeId, webapp, null); } - } diff --git a/source/java/org/alfresco/web/bean/wcm/preview/VirtualisationServerPreviewURIService.java b/source/java/org/alfresco/web/bean/wcm/preview/VirtualisationServerPreviewURIService.java index 24a6d7c261..e3f5bf1b66 100644 --- a/source/java/org/alfresco/web/bean/wcm/preview/VirtualisationServerPreviewURIService.java +++ b/source/java/org/alfresco/web/bean/wcm/preview/VirtualisationServerPreviewURIService.java @@ -25,37 +25,34 @@ package org.alfresco.web.bean.wcm.preview; -import org.alfresco.config.JNDIConstants; -import org.alfresco.web.bean.wcm.AVMUtil; +import javax.faces.context.FacesContext; + +import org.alfresco.service.ServiceRegistry; +import org.alfresco.web.bean.repository.Repository; /** * A PreviewURIService that constructs a virtualisation server URI. * * @author Peter Monks (peter.monks@alfresco.com) - * @version $Id$ + * + * @since 2.2.1 + * + * @deprecated see org.alfresco.wcm.preview.VirtualisationServerPreviewURIService */ -public class VirtualisationServerPreviewURIService - implements PreviewURIService +public class VirtualisationServerPreviewURIService extends org.alfresco.wcm.preview.VirtualisationServerPreviewURIService implements PreviewURIService { /** * @see org.alfresco.web.bean.wcm.preview.PreviewURIService#getPreviewURI(java.lang.String, java.lang.String) */ - public String getPreviewURI(final String storeId, final String pathToAsset) + public String getPreviewURI(final String sbStoreId, final String pathToAsset) { - if ((pathToAsset == null) || (pathToAsset.length() == 0)) - { - return AVMUtil.buildStoreUrl(storeId); - } + ServiceRegistry serviceRegistry = Repository.getServiceRegistry(FacesContext.getCurrentInstance()); - // Sanity checking - if (!pathToAsset.startsWith('/' + JNDIConstants.DIR_DEFAULT_WWW + '/' + JNDIConstants.DIR_DEFAULT_APPBASE)) - { - throw new IllegalStateException("Invalid asset path in AVM node ref: " + storeId + ":" + pathToAsset); - } - - return AVMUtil.buildAssetUrl(storeId, pathToAsset); + this.setAvmService(serviceRegistry.getAVMService()); + this.setVirtServerRegistry(serviceRegistry.getVirtServerRegistry()); + + return super.getPreviewURI(sbStoreId, pathToAsset, null); } -} - +} \ No newline at end of file diff --git a/source/java/org/alfresco/web/bean/wcm/preview/WebStudioPreviewURIService.java b/source/java/org/alfresco/web/bean/wcm/preview/WebStudioPreviewURIService.java index fbb132a90b..91876d7983 100644 --- a/source/java/org/alfresco/web/bean/wcm/preview/WebStudioPreviewURIService.java +++ b/source/java/org/alfresco/web/bean/wcm/preview/WebStudioPreviewURIService.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005-2008 Alfresco Software Limited. + * Copyright (C) 2005-2009 Alfresco Software Limited. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License diff --git a/source/java/org/alfresco/web/forms/RenderingEngineTemplateImpl.java b/source/java/org/alfresco/web/forms/RenderingEngineTemplateImpl.java index 98afa16e22..a722d1f50f 100644 --- a/source/java/org/alfresco/web/forms/RenderingEngineTemplateImpl.java +++ b/source/java/org/alfresco/web/forms/RenderingEngineTemplateImpl.java @@ -377,7 +377,7 @@ public class RenderingEngineTemplateImpl final String formInstanceDataAvmPath = formInstanceData.getPath(); final String renditionAvmPath = rendition.getPath(); final String parentPath = AVMNodeConverter.SplitBase(formInstanceDataAvmPath)[0]; - final String sandboxUrl = AVMUtil.buildStoreUrl(AVMUtil.getStoreName(formInstanceDataAvmPath)); + final String sandboxUrl = AVMUtil.getPreviewURI(AVMUtil.getStoreName(formInstanceDataAvmPath)); final String webappUrl = AVMUtil.buildWebappUrl(formInstanceDataAvmPath); final HashMap model = new HashMap(); // add simple scalar parameters diff --git a/source/web/jsp/wcm/create-website-wizard/details.jsp b/source/web/jsp/wcm/create-website-wizard/details.jsp index 30daf8b981..883307f37a 100644 --- a/source/web/jsp/wcm/create-website-wizard/details.jsp +++ b/source/web/jsp/wcm/create-website-wizard/details.jsp @@ -185,5 +185,20 @@ + + + + + + + + + + + + + + +