various minor bug fixes to create/edit form, parseXMLDocuments

- WCM-351 fixes to select workflow screen on IE (weird onchange behavior)
- WCM-468 fixes to remove rendering engine
- doing the jsp 2.0 thing
- WCM-427 fix to encoding issue with parseXMLDocuements
- fix for remove rendering engine templates in create form (wasn't clearing the list in init)


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5630 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Ariel Backenroth
2007-05-04 21:02:05 +00:00
parent 3c1db37e0c
commit 6e0afbf34c
9 changed files with 357 additions and 318 deletions

View File

@@ -583,11 +583,13 @@ public class CreateFormWizard
*/
public String removeUploadedSchemaFile()
{
LOGGER.debug("removing uploaded rendering engine template file " +
this.getRenderingEngineTemplateFileName());
this.clearUpload(FILE_SCHEMA);
this.schemaRootElementNameChoices = null;
this.schema = null;
this.schemaFileName = null;
assert this.getSchemaFileName() == null;
// refresh the current page
return null;
}
@@ -597,8 +599,11 @@ public class CreateFormWizard
*/
public String removeUploadedRenderingEngineTemplateFile()
{
clearUpload(FILE_RENDERING_ENGINE_TEMPLATE);
LOGGER.debug("removing uploaded rendering engine template file " +
this.getRenderingEngineTemplateFileName());
this.clearUpload(FILE_RENDERING_ENGINE_TEMPLATE);
this.renderingEngineTemplateFileName = null;
assert this.getRenderingEngineTemplateFileName() == null;
// refresh the current page
return null;
}

View File

@@ -137,6 +137,7 @@ public class EditFormWizard
this.new RenderingEngineTemplateData(ret);
this.renderingEngineTemplates.add(data);
}
this.removedRenderingEngineTemplates = null;
}
/**
@@ -192,7 +193,7 @@ public class EditFormWizard
if (this.getSchemaFile() != null)
{
FileInfo fileInfo =
final FileInfo fileInfo =
this.fileFolderService.create(formNodeRef,
this.getSchemaFileName(),
ContentModel.TYPE_CONTENT);
@@ -211,13 +212,16 @@ public class EditFormWizard
if (this.removedRenderingEngineTemplates != null)
{
for (RenderingEngineTemplateData retd : this.removedRenderingEngineTemplates)
for (final RenderingEngineTemplateData retd : this.removedRenderingEngineTemplates)
{
LOGGER.debug("removing rendering engine template " + retd);
assert retd != null;
assert retd.getNodeRef() != null;
this.nodeService.removeChild(formNodeRef, retd.getNodeRef());
}
}
for (RenderingEngineTemplateData retd : this.renderingEngineTemplates)
for (final RenderingEngineTemplateData retd : this.renderingEngineTemplates)
{
if (retd.getFile() != null)
{

View File

@@ -32,6 +32,7 @@ import freemarker.template.TemplateModelException;
import java.io.*;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URLEncoder;
import java.text.MessageFormat;
import java.util.*;
import javax.faces.context.FacesContext;
@@ -57,6 +58,7 @@ import org.alfresco.service.cmr.remote.AVMRemote;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.wcm.AVMConstants;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.context.WebApplicationContext;
@@ -378,10 +380,15 @@ public class RenderingEngineTemplateImpl
}
}
URI uri = null;
try
{
uri = new URI(webappUrl + (name.charAt(0) == '/' ? name : '/' + name));
final String[] path = (name.startsWith("/") ? name.substring(1) : name).split("/");
for (int i = 0; i < path.length; i++)
{
path[i] = URLEncoder.encode(path[i], "utf-8").replace("+", "%20");
}
final URI uri = new URI(webappUrl + '/' + StringUtils.join(path, '/'));
if (LOGGER.isDebugEnabled())
LOGGER.debug("loading " + uri);
return uri.toURL().openStream();

View File

@@ -148,11 +148,16 @@ public class XMLUtil
public static Document parse(final InputStream source)
throws SAXException,
IOException
{
try
{
final DocumentBuilder db = XMLUtil.getDocumentBuilder();
final Document result = db.parse(source);
return db.parse(source);
}
finally
{
source.close();
return result;
}
}
/** provides a document builder that is namespace aware but not validating by default */

View File

@@ -54,7 +54,7 @@
<div class="name">Values from xml files generated by in ${alf.parent_path}:</div>
<ul>
<#list alf.parseXMLDocuments('output-method-callout') as d>
<#list alf.parseXMLDocuments('form-data-functions-test') as d>
<li>
<div class="name">
<#noparse>${d["@alf:file_name"]} = ${d.string}</#noparse>

View File

@@ -85,7 +85,7 @@ body
<div class="name">Values from xml files generated by in <xsl:value-of select="$alf:parent_path"/>:</div>
<ul>
<xsl:for-each select="alf:parseXMLDocuments('output-method-callout')">
<xsl:for-each select="alf:parseXMLDocuments('form-data-functions-test')">
<li>
<div class="name">
&lt;xsl:value-of select="@alf:file_name"/&gt; = &lt;xsl:value-of select="string"/&gt;

View File

@@ -1,4 +1,4 @@
<%--
<!--
* Copyright (C) 2005-2007 Alfresco Software Limited.
* This program is free software; you can redistribute it and/or
@@ -18,30 +18,36 @@
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing"
--%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %>
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
* http://www.alfresco.com/legal/licensing
-->
<jsp:root version="1.2"
xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
xmlns:a="urn:jsptld:/WEB-INF/alfresco.tld"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html">
<jsp:output doctype-root-element="html"
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
doctype-system="http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
<jsp:directive.page language="java" buffer="32kb" contentType="text/html; charset=UTF-8"/>
<jsp:directive.page isELIgnored="false"/>
<jsp:directive.page import="java.io.*"/>
<jsp:directive.page import="org.alfresco.web.bean.FileUploadBean"/>
<jsp:directive.page import="org.alfresco.web.bean.wcm.CreateFormWizard"/>
<jsp:directive.page buffer="32kb" contentType="text/html;charset=UTF-8"/>
<jsp:directive.page isELIgnored="false"/>
<f:verbatim>
<script type="text/javascript"
src="<%=request.getContextPath()%>/scripts/upload_helper.js">
</script>
<script type="text/javascript" src="${pageContext.request.contextPath}/scripts/upload_helper.js">&#160;</script>
<script type="text/javascript">
function handle_upload(target)
{
handle_upload_helper(target,
"<%= CreateFormWizard.FILE_RENDERING_ENGINE_TEMPLATE %>",
"<jsp:expression>CreateFormWizard.FILE_RENDERING_ENGINE_TEMPLATE</jsp:expression>",
upload_complete,
"<%= request.getContextPath() %>")
"${pageContext.request.contextPath}")
}
function upload_complete(id, path, filename)
@@ -67,9 +73,9 @@
value="1. #{msg.create_form_configure_rendering_engine_templates_step1_desc}"
escape="false" />
<h:panelGrid id="panel_grid_3"
columns="4" cellpadding="3" cellspacing="3" border="0"
columns="4" cellpadding="3" cellspacing="3" border="0" width="100%"
columnClasses="panelGridRequiredImageColumn,panelGridLabelColumn,panelGridValueColumn">
width="100%">
<h:outputText id="required_image_rendering_engine_template_file"
value="" />
<h:outputText id="output_text_rendering_engine_template_file"
@@ -88,7 +94,7 @@
<h:outputText id="rendering-engine-template-file-name"
value="#{WizardManager.bean.renderingEngineTemplateFileName}"/>
<h:outputText id="output_text_rendering_engine_template_space"
value="&nbsp;"
value="&#160;"
escape="false"/>
<a:actionLink id="action_link_remove_rendering_engine_template"
image="/images/icons/delete.gif"
@@ -97,7 +103,7 @@
showLink="false"
target="top"/>
</h:column>
<%-- we need to include this invisible image in order to get the column to size correctly --%>
<!-- we need to include this invisible image in order to get the column to size correctly -->
<h:graphicImage id="invisible_img_rendering_engine_template_file_help"
value="/images/icons/Help_icon.gif" style="cursor:help; visibility: hidden;"/>
</h:panelGrid>
@@ -106,9 +112,9 @@
value="2. #{msg.create_form_configure_rendering_engine_templates_step2_desc}"
escape="false" />
<h:panelGrid id="panel_grid_specify_details"
columns="4" cellpadding="3" cellspacing="3" border="0"
columns="4" cellpadding="3" cellspacing="3" border="0" width="100%"
columnClasses="panelGridRequiredImageColumn,panelGridLabelColumn,panelGridValueColumn,panelGridRequiredImageColumn">
width="100%">
<h:graphicImage id="required-image-rendering-engine"
value="/images/icons/required_field.gif"
@@ -226,7 +232,7 @@
<h:outputText id="data-table-name-0" value="#{msg.selected_rendering_engine_templates}" />
</f:facet>
<f:verbatim>
<img style="float: left" src="<%= request.getContextPath() %>/images/icons/template_large.gif"/>
<img style="float: left" src="${pageContext.request.contextPath}/images/icons/template_large.gif"/>
</f:verbatim>
<h:panelGrid id="panel_grid_row"
columns="2" cellspacing="1" border="0">
@@ -272,3 +278,4 @@
</a:panel>
</h:panelGroup>
</h:panelGrid>
</jsp:root>

View File

@@ -1,4 +1,4 @@
<%--
<!--
* Copyright (C) 2005-2007 Alfresco Software Limited.
* This program is free software; you can redistribute it and/or
@@ -19,11 +19,21 @@
* FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing
--%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %>
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
-->
<jsp:root version="1.2"
xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:a="urn:jsptld:/WEB-INF/alfresco.tld"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html">
<jsp:output doctype-root-element="html"
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
doctype-system="http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
<jsp:directive.page language="java" buffer="32kb" contentType="text/html; charset=UTF-8"/>
<jsp:directive.page isELIgnored="false"/>
<script type="text/javascript">
function apply_default_workflow_changed(value)
{
@@ -38,19 +48,20 @@ function apply_default_workflow_changed(value)
<h:selectOneRadio id="sdw-apply-default-workflow-select-one"
required="false"
onchange="apply_default_workflow_changed(this.value)"
onclick="apply_default_workflow_changed(this.value)"
value="#{WizardManager.bean.applyDefaultWorkflow}">
<f:selectItem itemLabel="#{msg.yes}" itemValue="#{true}"/>
<f:selectItem itemLabel="#{msg.no_not_now}" itemValue="#{false}"/>
</h:selectOneRadio>
<f:verbatim><div style="margin-top:10px">&nbsp;</div></f:verbatim>
<f:verbatim><div style="margin-top:10px">&#160;</div></f:verbatim>
<h:panelGroup id="sdw-pg-2" style="#{WizardManager.bean.applyDefaultWorkflow?'display:block':'display:none'}">
<h:outputText id="sdw-select-workflow"
value="#{msg.create_form_select_default_workflow_select_workflow}:"
escape="false" />
<f:verbatim><div id="workflow-list-div"
style="margin:5px 0px;height:144px;*height:148px;width:100%;overflow:auto" class="selectListTable"></f:verbatim>
<h:panelGroup id="workflow-list-div"
style="margin:5px 0px;height:144px;*height:148px;width:100%;overflow:auto;display:block;"
styleClass="selectListTable">
<a:selectList id="workflow-list"
multiSelect="false"
style="width:100%"
@@ -58,6 +69,7 @@ function apply_default_workflow_changed(value)
value="#{WizardManager.bean.defaultWorkflowName}">
<a:listItems value="#{WizardManager.bean.defaultWorkflowChoices}" />
</a:selectList>
<f:verbatim></div></f:verbatim>
</h:panelGroup>
</h:panelGroup>
</h:panelGroup>
</jsp:root>

View File

@@ -25,7 +25,6 @@
<jsp:root version="1.2"
xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:pr="http://www.alfresco.org/alfresco/pr"
xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html">