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

@@ -2,56 +2,56 @@
{
/* border: 1px dashed blue; */
/* margin-right: 2px; */
clear: both;
clear: both;
}
.xformsItemRequiredImage
{
vertical-align: middle;
margin: 0px 5px;
width: 9px;
height: 9px;
vertical-align: middle;
margin: 0px 5px;
width: 9px;
height: 9px;
}
.xformsItemLabelContainer
{
height: 100%;
line-height: 100%;
white-space: nowrap;
overflow: hidden;
vertical-align: middle;
height: 100%;
line-height: 100%;
white-space: nowrap;
overflow: hidden;
vertical-align: middle;
}
.xformsItemLabelSubmitError
{
color: red;
color: red;
}
.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;
clear: both;
clear: both;
}
.xformsGroupItem
{
position: relative;
margin: 5px 0px;
margin: 0px 0px;
max-width: 100%;
clear: both;
clear: both;
}
.xformsGroupHeader
@@ -69,14 +69,14 @@
.xformsGroupDivider
{
border-bottom: 1px dotted #d9d9de;
margin: 5px 3px;
border-bottom: 1px dotted #d9d9de;
margin: 5px 3px;
}
.xformsViewRoot
{
padding-bottom: 5px;
border-bottom: 1px dotted #d9d9de;
padding-bottom: 5px;
border-bottom: 1px dotted #d9d9de;
}
.xformsViewRootHeader
@@ -89,11 +89,11 @@
width: 100%;
font-weight: bold;
font-size: 12px;
font-weight: bold;
text-align: center;
padding-bottom: 5px;
border-bottom: 1px dotted #d9d9de;
margin-bottom: 5px;
font-weight: bold;
text-align: center;
padding-bottom: 5px;
border-bottom: 1px dotted #d9d9de;
margin-bottom: 5px;
}
.xformsTextArea
@@ -103,19 +103,19 @@
.xformsRichTextEditorHoverLayer
{
position: absolute;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
background-color: #d9d9de;
border: 2px inset black;
color: black;
z-index: 100;
font-weight: bolder;
font-size: 16px;
text-align: center;
overflow: hidden;
position: absolute;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
background-color: #d9d9de;
border: 2px inset black;
color: black;
z-index: 100;
font-weight: bolder;
font-size: 16px;
text-align: center;
overflow: hidden;
}
.xformsRepeat
@@ -124,7 +124,7 @@
.xformsRepeatFocusedHeader
{
background-color: #d4e4f4;
background-color: #d4e4f4;
}
.xformsRepeatItem
@@ -137,7 +137,7 @@
.xformsRepeatItemSelected
{
background-color: #ecf4fc;
background-color: #ecf4fc;
}
.xformsRepeatControls
@@ -147,7 +147,7 @@
border: 1px solid #67a4e6;
height: 20px;
line-height: 20px;
margin: 0px auto;
margin: 0px auto;
}
.xformsRowEven
@@ -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,15 +222,17 @@
line-height: 30px;
background-color: #e3effa;
border: 1px solid #67a4e6;
margin-right: 1px;
}
.xformsFilePickerFileList
{
position: relative;
position: relative;
overflow-y: auto;
background-color: white;
border-left: 1px solid #67a4e6;
border-right: 1px solid #67a4e6;
margin-right: 1px;
}
.xformsFilePickerRow
@@ -259,6 +262,6 @@
.xformsGhostText
{
color: grey;
color: grey;
}