Merged V3.2 to HEAD

15292: Solution for MOB-536 (Remove form-include virtualization server dependencies from Web Forms)
   15299: Fix for ETHREEOH-896 and partial fix for ETHREEOH-1923: XForms layout issues
   15501: MOB-947: Remove virtualisation server dependency from the TinyMCE control used in web forms. Preview URL has been replaced with a call to the 'avm' webscript.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@16904 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gavin Cornwell
2009-10-14 10:26:07 +00:00
parent e2fa0967aa
commit e13b3f6414
6 changed files with 155 additions and 46 deletions

View File

@@ -38,7 +38,9 @@ import java.util.List;
import java.util.Map;
import java.util.ResourceBundle;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletRequest;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel;
@@ -56,9 +58,11 @@ import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.TemplateException;
import org.alfresco.service.cmr.repository.TemplateService;
import org.alfresco.service.cmr.security.AuthenticationService;
import org.alfresco.service.namespace.DynamicNamespacePrefixResolver;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.alfresco.util.URLDecoder;
import org.alfresco.util.URLEncoder;
import org.alfresco.web.app.Application;
import org.alfresco.web.app.servlet.FacesHelper;
@@ -100,6 +104,7 @@ public class RenderingEngineTemplateImpl
static final QName PROP_RESOURCE_RESOLVER = QName.createQName(NamespaceService.ALFRESCO_PREFIX,
"resource_resolver",
namespacePrefixResolver);
private static final String WEBSCRIPT_PREFIX = "webscript://";
private final NodeRef nodeRef;
private final NodeRef renditionPropertiesNodeRef;
@@ -437,6 +442,64 @@ public class RenderingEngineTemplateImpl
}
}
if (name.startsWith(WEBSCRIPT_PREFIX))
{
try
{
final FacesContext facesContext = FacesContext.getCurrentInstance();
final ExternalContext externalContext = facesContext.getExternalContext();
final HttpServletRequest request = (HttpServletRequest)externalContext.getRequest();
String decodedName = URLDecoder.decode(name.substring(WEBSCRIPT_PREFIX.length()));
String rewrittenName = decodedName;
if (decodedName.contains("${storeid}"))
{
rewrittenName = rewrittenName.replace("${storeid}", AVMUtil.getStoreName(formInstanceDataAvmPath));
}
else
{
if (decodedName.contains("{storeid}"))
{
rewrittenName = rewrittenName.replace("{storeid}", AVMUtil.getStoreName(formInstanceDataAvmPath));
}
}
if (decodedName.contains("${ticket}"))
{
AuthenticationService authenticationService = Repository.getServiceRegistry(facesContext).getAuthenticationService();
final String ticket = authenticationService.getCurrentTicket();
rewrittenName = rewrittenName.replace("${ticket}", ticket);
}
else
{
if (decodedName.contains("{ticket}"))
{
AuthenticationService authenticationService = Repository.getServiceRegistry(facesContext).getAuthenticationService();
final String ticket = authenticationService.getCurrentTicket();
rewrittenName = rewrittenName.replace("{ticket}", ticket);
}
}
final String webscriptURI = (request.getScheme() + "://" +
request.getServerName() + ':' +
request.getServerPort() +
request.getContextPath() + "/wcservice/" +
rewrittenName);
if (LOGGER.isDebugEnabled())
LOGGER.debug("loading webscript: " + webscriptURI);
final URI uri = new URI(webscriptURI);
return uri.toURL().openStream();
}
catch (Exception e)
{
if (LOGGER.isDebugEnabled())
LOGGER.debug(e);
}
}
try
{
final String[] path = (name.startsWith("/") ? name.substring(1) : name).split("/");

View File

@@ -215,7 +215,8 @@ public class XFormsProcessor implements FormProcessor
String storeName = avmBrowseBean.getSandbox();
if (storeName != null)
{
js.append(JavaScriptUtils.javaScriptEscape(AVMUtil.buildWebappUrl(AVMUtil.getCorrespondingPreviewStoreName(storeName), avmBrowseBean.getWebapp())));
js.append(JavaScriptUtils.javaScriptEscape(fc.getExternalContext().getRequestContextPath() + "/wcs/api/path/content/avm/" +
AVMUtil.buildStoreWebappPath(storeName, avmWebApp).replace(":","")));
}
}

View File

@@ -8,6 +8,9 @@
upload include-test-data-dictionary.* into the data dictionary folder created for the form (e.g. Data Dictionary/Web Forms/include-test
upload include-test-webapp.* into the root of your webapp directory within the web project.
An example of including the output of a webscript can also be shown by creating a separate form using this schema
and the include-webscript-test.xsl and include-webscript-test.ftl files as the rendering engine templates.
When the rendering template gets executed, it should be able to include all auxilliary xsls and ftls.
</xs:documentation>
</xs:annotation>

View File

@@ -0,0 +1,10 @@
<html>
<head>
<title>Include Test</title>
</head>
<body>
<div>Generated by include-webscript-test.ftl</div>
<div>Value from template is <b>${.vars["include-test"]["in-template"]}</b></div>
<#include "webscript://api/path/content/avm/{storeid}/www/avm_webapps/ROOT/include-test-webapp.ftl?ticket={ticket}">
</body>
</html>

View File

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
exclude-result-prefixes="xhtml">
<xsl:output method="html" version="4.01" encoding="UTF-8" indent="yes"
doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
doctype-system="http://www.w3.org/TR/html4/loose.dtd"/>
<xsl:preserve-space elements="*"/>
<xsl:include href="webscript://api/path/content/avm/%7Bstoreid%7D/www/avm_webapps/ROOT/include-test-webapp.xsl?ticket=%7Bticket%7D"/>
<xsl:template match="in-template">
<div>Value from template is <b><xsl:value-of select="."/></b></div>
</xsl:template>
<xsl:template match="include-test">
<html>
<head>
<title>Include Test</title>
</head>
<body>
<div>Generated by include-webscript-test.xsl</div>
<xsl:apply-templates select="in-template"/>
<xsl:apply-templates select="in-webapp"/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

View File

@@ -30,16 +30,16 @@
.xformsItemDOMContainer
{
position: relative;
top: 0px;
top: 1px;
left: 0px;
padding: 0px;
margin: 0px;
margin: 5px 0px;
}
.xformsGroup
{
position: relative;
top: 0px;
top: 5px;
left: 0px;
width: 100%;
border: 1px solid #d2d2d9;
@@ -49,7 +49,7 @@
.xformsGroupItem
{
position: relative;
margin: 5px 0px;
margin: 0px 0px;
max-width: 100%;
clear: both;
}
@@ -183,7 +183,7 @@
.xformsFilePicker
{
width: 100%;
max-width: 400px;
max-width: 100%;
}
.xformsFilePickerStatus
@@ -204,6 +204,7 @@
padding-left: 2px;
background-color: #e3effa;
border: 1px solid #67a4e6;
margin-right: 1px;
}
.xformsFilePickerHeaderMenuTrigger
@@ -221,6 +222,7 @@
line-height: 30px;
background-color: #e3effa;
border: 1px solid #67a4e6;
margin-right: 1px;
}
.xformsFilePickerFileList
@@ -230,6 +232,7 @@
background-color: white;
border-left: 1px solid #67a4e6;
border-right: 1px solid #67a4e6;
margin-right: 1px;
}
.xformsFilePickerRow