mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V3.1 to HEAD
14077: Merged V2.2 to V3.1 14074: Fix ETWOTWO-929 and ETWOTWO-1175 (WCM preview) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@14568 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -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
|
||||
@@ -299,20 +299,9 @@ public final class AVMUtil extends WCMUtil
|
||||
: buildStoreUrl(store) + '/' + webapp);
|
||||
}
|
||||
|
||||
public static String buildAssetUrl(final String avmPath)
|
||||
{
|
||||
if (avmPath == null || avmPath.length() == 0)
|
||||
{
|
||||
throw new IllegalArgumentException("AVM path is mandatory.");
|
||||
}
|
||||
final String[] s = avmPath.split(":");
|
||||
if (s.length != 2)
|
||||
{
|
||||
throw new IllegalArgumentException("expected exactly one ':' in " + avmPath);
|
||||
}
|
||||
return AVMUtil.buildAssetUrl(s[0], s[1]);
|
||||
}
|
||||
|
||||
/**
|
||||
* NOTE: do not call directly from client - use getPreviewURI instead
|
||||
*/
|
||||
public static String buildAssetUrl(String store, String assetPath)
|
||||
{
|
||||
if (store == null || store.length() == 0)
|
||||
@@ -332,6 +321,24 @@ public final class AVMUtil extends WCMUtil
|
||||
return WCMUtil.buildAssetUrl(assetPath, domain, port, dns);
|
||||
}
|
||||
|
||||
public static String getPreviewURI(String storeNameOrAvmPath)
|
||||
{
|
||||
if (storeNameOrAvmPath == null || storeNameOrAvmPath.length() == 0)
|
||||
{
|
||||
throw new IllegalArgumentException("AVM store name or absolute path is mandatory.");
|
||||
}
|
||||
final String[] s = storeNameOrAvmPath.split(AVM_STORE_SEPARATOR);
|
||||
if (s.length == 1)
|
||||
{
|
||||
return AVMUtil.getPreviewURI(s[0], null);
|
||||
}
|
||||
if (s.length != 2)
|
||||
{
|
||||
throw new IllegalArgumentException("expected exactly one ':' in " + storeNameOrAvmPath);
|
||||
}
|
||||
return AVMUtil.getPreviewURI(s[0], s[1]);
|
||||
}
|
||||
|
||||
public static String getPreviewURI(final String storeId, final String assetPath)
|
||||
{
|
||||
if (previewURIGenerator == null)
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2007 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
|
||||
@@ -143,7 +143,7 @@ public class FileDetailsBean extends AVMDetailsBean
|
||||
*/
|
||||
public String getPreviewUrl()
|
||||
{
|
||||
return AVMUtil.buildAssetUrl(getAvmNode().getPath());
|
||||
return AVMUtil.getPreviewURI(getAvmNode().getPath());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2007 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
|
||||
@@ -66,7 +66,7 @@ public class FolderDetailsBean extends AVMDetailsBean
|
||||
*/
|
||||
public String getPreviewUrl()
|
||||
{
|
||||
return AVMUtil.buildAssetUrl(getAvmNode().getPath());
|
||||
return AVMUtil.getPreviewURI(getAvmNode().getPath());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -65,7 +65,6 @@ import org.alfresco.web.app.servlet.FacesHelper;
|
||||
import org.alfresco.web.bean.BrowseBean;
|
||||
import org.alfresco.web.bean.dialog.BaseDialogBean;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
import org.alfresco.web.config.ClientConfigElement;
|
||||
import org.alfresco.web.forms.FormInstanceData;
|
||||
import org.alfresco.web.forms.FormsService;
|
||||
import org.alfresco.web.forms.Rendition;
|
||||
@@ -1045,12 +1044,7 @@ public class SubmitDialog extends BaseDialogBean
|
||||
|
||||
public String getPreviewUrl()
|
||||
{
|
||||
ClientConfigElement config = Application.getClientConfig(FacesContext.getCurrentInstance());
|
||||
String dns = AVMUtil.lookupStoreDNS(AVMUtil.getStoreName(descriptor.getPath()));
|
||||
return AVMUtil.buildAssetUrl(AVMUtil.getSandboxRelativePath(descriptor.getPath()),
|
||||
config.getWCMDomain(),
|
||||
config.getWCMPort(),
|
||||
dns);
|
||||
return AVMUtil.getPreviewURI(descriptor.getPath());
|
||||
}
|
||||
|
||||
public AVMNodeDescriptor getDescriptor()
|
||||
|
@@ -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
|
||||
@@ -36,7 +36,7 @@ public interface PreviewURIService
|
||||
{
|
||||
/**
|
||||
* @param storeId The id of the store to generate the preview URI for.
|
||||
* @param pathToAsset The path to the asset to generate the preview URI for.
|
||||
* @param pathToAsset The path to the asset to generate the preview URI for (can be null or empty, to return preview URL to store)
|
||||
* @return The Preview URI for the given store id and/or asset (<i>may be null</i>).
|
||||
*/
|
||||
String getPreviewURI(String storeId, String pathToAsset);
|
||||
|
@@ -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
|
||||
@@ -43,13 +43,18 @@ public class VirtualisationServerPreviewURIService
|
||||
*/
|
||||
public String getPreviewURI(final String storeId, final String pathToAsset)
|
||||
{
|
||||
if ((pathToAsset == null) || (pathToAsset.length() == 0))
|
||||
{
|
||||
return AVMUtil.buildStoreUrl(storeId);
|
||||
}
|
||||
|
||||
// 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));
|
||||
return AVMUtil.buildAssetUrl(storeId, pathToAsset);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2007 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
|
||||
@@ -39,14 +39,12 @@ import org.alfresco.model.WCMAppModel;
|
||||
import org.alfresco.repo.avm.AVMNodeConverter;
|
||||
import org.alfresco.repo.domain.PropertyValue;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.avm.AVMNotFoundException;
|
||||
import org.alfresco.service.cmr.avm.AVMService;
|
||||
import org.alfresco.service.cmr.avm.locking.AVMLock;
|
||||
import org.alfresco.service.cmr.avm.locking.AVMLockingService;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.web.app.servlet.FacesHelper;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
import org.alfresco.web.bean.wcm.AVMUtil;
|
||||
@@ -171,7 +169,7 @@ import org.xml.sax.SAXException;
|
||||
|
||||
public String getUrl()
|
||||
{
|
||||
return AVMUtil.buildAssetUrl(this.getPath());
|
||||
return AVMUtil.getPreviewURI(this.getPath());
|
||||
}
|
||||
|
||||
public List<FormInstanceData.RegenerateResult> regenerateRenditions()
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2007 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
|
||||
@@ -211,7 +211,7 @@ import org.xml.sax.SAXException;
|
||||
|
||||
public String getUrl()
|
||||
{
|
||||
return AVMUtil.buildAssetUrl(this.getPath());
|
||||
return AVMUtil.getPreviewURI(this.getPath());
|
||||
}
|
||||
|
||||
public String getFileTypeImage()
|
||||
|
@@ -619,8 +619,8 @@ public class XFormsBean implements Serializable
|
||||
{
|
||||
// It's a web project asset include / import
|
||||
final String baseURI = (uri.charAt(0) == '/'
|
||||
? AVMUtil.buildStoreUrl(AVMUtil.getStoreName(cwdAvmPath))
|
||||
: AVMUtil.buildAssetUrl(cwdAvmPath));
|
||||
? AVMUtil.getPreviewURI(AVMUtil.getStoreName(cwdAvmPath))
|
||||
: AVMUtil.getPreviewURI(cwdAvmPath));
|
||||
|
||||
finalURI = baseURI + uri;
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2007 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
|
||||
@@ -45,7 +45,6 @@ import org.alfresco.web.bean.repository.Repository;
|
||||
import org.alfresco.web.bean.wcm.AVMNode;
|
||||
import org.alfresco.web.bean.wcm.AVMUtil;
|
||||
import org.alfresco.web.bean.wcm.LinkValidationState;
|
||||
import org.alfresco.web.config.ClientConfigElement;
|
||||
import org.alfresco.web.ui.common.ComponentConstants;
|
||||
import org.alfresco.web.ui.common.Utils;
|
||||
import org.alfresco.web.ui.common.component.UIActionLink;
|
||||
@@ -80,7 +79,6 @@ public class UILinkValidationReport extends AbstractLinkValidationReportComponen
|
||||
// ------------------------------------------------------------------------------
|
||||
// Component implementation
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void restoreState(FacesContext context, Object state)
|
||||
{
|
||||
@@ -102,7 +100,6 @@ public class UILinkValidationReport extends AbstractLinkValidationReportComponen
|
||||
return values;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void encodeBegin(FacesContext context) throws IOException
|
||||
{
|
||||
@@ -231,16 +228,11 @@ public class UILinkValidationReport extends AbstractLinkValidationReportComponen
|
||||
UIActions actions = aquireFileActions("broken_file_actions", getValue().getStore());
|
||||
AVMService avmService = Repository.getServiceRegistry(context).getAVMService();
|
||||
int rootPathIndex = AVMUtil.buildSandboxRootPath(linkState.getStore()).length();
|
||||
String dns = AVMUtil.lookupStoreDNS(linkState.getStore());
|
||||
ClientConfigElement config = Application.getClientConfig(context);
|
||||
String wcmDomain = config.getWCMDomain();
|
||||
String wcmPort = config.getWCMPort();
|
||||
|
||||
// render each broken file
|
||||
for (String file : brokenFiles)
|
||||
{
|
||||
renderBrokenFile(context, out, file, linkState, actions, avmService,
|
||||
rootPathIndex, wcmDomain, wcmPort, dns, sectionsExpanded);
|
||||
rootPathIndex, linkState.getStore(), sectionsExpanded);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -395,8 +387,7 @@ public class UILinkValidationReport extends AbstractLinkValidationReportComponen
|
||||
|
||||
protected void renderBrokenFile(FacesContext context, ResponseWriter out,
|
||||
String file, LinkValidationState linkState, UIActions actions,
|
||||
AVMService avmService, int rootPathIndex, String wcmDomain,
|
||||
String wcmPort, String dns, boolean brokenLinksExpanded)
|
||||
AVMService avmService, int rootPathIndex, String storeId, boolean brokenLinksExpanded)
|
||||
throws IOException
|
||||
{
|
||||
// gather the data to show for the file
|
||||
@@ -430,7 +421,7 @@ public class UILinkValidationReport extends AbstractLinkValidationReportComponen
|
||||
AVMNode node = new AVMNode(desc);
|
||||
|
||||
String assetPath = file.substring(rootPathIndex);
|
||||
String previewUrl = AVMUtil.buildAssetUrl(assetPath, wcmDomain, wcmPort, dns);
|
||||
String previewUrl = AVMUtil.getPreviewURI(storeId, assetPath);
|
||||
node.getProperties().put("previewUrl", previewUrl);
|
||||
actions.setContext(node);
|
||||
|
||||
|
@@ -168,7 +168,7 @@ public class UIPendingSubmissions extends SelfRenderingComponent
|
||||
}
|
||||
|
||||
// get the preview url for the sandbox
|
||||
String sandboxPreviewUrl = AVMUtil.buildStoreUrl(sandbox);
|
||||
String sandboxPreviewUrl = AVMUtil.getPreviewURI(sandbox);
|
||||
|
||||
// get the noderef representing the web project
|
||||
PropertyValue val = Repository.getServiceRegistry(context).getAVMService().
|
||||
@@ -290,7 +290,7 @@ public class UIPendingSubmissions extends SelfRenderingComponent
|
||||
NodeRef pkg = task.path.instance.workflowPackage;
|
||||
Pair<Integer, String> pkgPath = AVMNodeConverter.ToAVMVersionPath(pkg);
|
||||
String workflowStore = AVMUtil.getStoreName(pkgPath.getSecond());
|
||||
String workflowPreviewUrl = AVMUtil.buildStoreUrl(workflowStore);
|
||||
String workflowPreviewUrl = AVMUtil.getPreviewURI(workflowStore);
|
||||
|
||||
UIActionLink preview = findAction(ACT_PREVIEW, sandbox);
|
||||
if (preview == null)
|
||||
|
Reference in New Issue
Block a user