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.Map;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext; import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletRequest;
import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel; 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.NodeService;
import org.alfresco.service.cmr.repository.TemplateException; import org.alfresco.service.cmr.repository.TemplateException;
import org.alfresco.service.cmr.repository.TemplateService; 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.DynamicNamespacePrefixResolver;
import org.alfresco.service.namespace.NamespaceService; import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
import org.alfresco.util.URLDecoder;
import org.alfresco.util.URLEncoder; import org.alfresco.util.URLEncoder;
import org.alfresco.web.app.Application; import org.alfresco.web.app.Application;
import org.alfresco.web.app.servlet.FacesHelper; 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, static final QName PROP_RESOURCE_RESOLVER = QName.createQName(NamespaceService.ALFRESCO_PREFIX,
"resource_resolver", "resource_resolver",
namespacePrefixResolver); namespacePrefixResolver);
private static final String WEBSCRIPT_PREFIX = "webscript://";
private final NodeRef nodeRef; private final NodeRef nodeRef;
private final NodeRef renditionPropertiesNodeRef; private final NodeRef renditionPropertiesNodeRef;
@@ -436,6 +441,64 @@ public class RenderingEngineTemplateImpl
LOGGER.debug(e); LOGGER.debug(e);
} }
} }
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 try
{ {

View File

@@ -215,7 +215,8 @@ public class XFormsProcessor implements FormProcessor
String storeName = avmBrowseBean.getSandbox(); String storeName = avmBrowseBean.getSandbox();
if (storeName != null) 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

@@ -7,6 +7,9 @@
configure include-test.xsl and include-test.ftl as the rendering engine templates for the form. configure include-test.xsl and include-test.ftl as the rendering engine templates for the form.
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-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. 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. When the rendering template gets executed, it should be able to include all auxilliary xsls and ftls.
</xs:documentation> </xs:documentation>

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