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

View File

@@ -137,6 +137,7 @@ public class EditFormWizard
this.new RenderingEngineTemplateData(ret); this.new RenderingEngineTemplateData(ret);
this.renderingEngineTemplates.add(data); this.renderingEngineTemplates.add(data);
} }
this.removedRenderingEngineTemplates = null;
} }
/** /**
@@ -192,7 +193,7 @@ public class EditFormWizard
if (this.getSchemaFile() != null) if (this.getSchemaFile() != null)
{ {
FileInfo fileInfo = final FileInfo fileInfo =
this.fileFolderService.create(formNodeRef, this.fileFolderService.create(formNodeRef,
this.getSchemaFileName(), this.getSchemaFileName(),
ContentModel.TYPE_CONTENT); ContentModel.TYPE_CONTENT);
@@ -211,13 +212,16 @@ public class EditFormWizard
if (this.removedRenderingEngineTemplates != null) 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()); this.nodeService.removeChild(formNodeRef, retd.getNodeRef());
} }
} }
for (RenderingEngineTemplateData retd : this.renderingEngineTemplates) for (final RenderingEngineTemplateData retd : this.renderingEngineTemplates)
{ {
if (retd.getFile() != null) if (retd.getFile() != null)
{ {

View File

@@ -32,6 +32,7 @@ import freemarker.template.TemplateModelException;
import java.io.*; import java.io.*;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.net.URLEncoder;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.*; import java.util.*;
import javax.faces.context.FacesContext; 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.app.Application;
import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.wcm.AVMConstants; import org.alfresco.web.bean.wcm.AVMConstants;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.WebApplicationContext;
@@ -378,10 +380,15 @@ public class RenderingEngineTemplateImpl
} }
} }
URI uri = null;
try 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()) if (LOGGER.isDebugEnabled())
LOGGER.debug("loading " + uri); LOGGER.debug("loading " + uri);
return uri.toURL().openStream(); return uri.toURL().openStream();

View File

@@ -148,11 +148,16 @@ public class XMLUtil
public static Document parse(final InputStream source) public static Document parse(final InputStream source)
throws SAXException, throws SAXException,
IOException IOException
{
try
{ {
final DocumentBuilder db = XMLUtil.getDocumentBuilder(); final DocumentBuilder db = XMLUtil.getDocumentBuilder();
final Document result = db.parse(source); return db.parse(source);
}
finally
{
source.close(); source.close();
return result; }
} }
/** provides a document builder that is namespace aware but not validating by default */ /** 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> <div class="name">Values from xml files generated by in ${alf.parent_path}:</div>
<ul> <ul>
<#list alf.parseXMLDocuments('output-method-callout') as d> <#list alf.parseXMLDocuments('form-data-functions-test') as d>
<li> <li>
<div class="name"> <div class="name">
<#noparse>${d["@alf:file_name"]} = ${d.string}</#noparse> <#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> <div class="name">Values from xml files generated by in <xsl:value-of select="$alf:parent_path"/>:</div>
<ul> <ul>
<xsl:for-each select="alf:parseXMLDocuments('output-method-callout')"> <xsl:for-each select="alf:parseXMLDocuments('form-data-functions-test')">
<li> <li>
<div class="name"> <div class="name">
&lt;xsl:value-of select="@alf:file_name"/&gt; = &lt;xsl:value-of select="string"/&gt; &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. * Copyright (C) 2005-2007 Alfresco Software Limited.
* This program is free software; you can redistribute it and/or * 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 * and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing * FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here: * the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing" * http://www.alfresco.com/legal/licensing
--%> -->
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> <jsp:root version="1.2"
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> xmlns:jsp="http://java.sun.com/JSP/Page"
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> xmlns:c="http://java.sun.com/jsp/jstl/core"
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> 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:directive.page import="java.io.*"/> <jsp:output doctype-root-element="html"
<jsp:directive.page import="org.alfresco.web.bean.FileUploadBean"/> doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
<jsp:directive.page import="org.alfresco.web.bean.wcm.CreateFormWizard"/> doctype-system="http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
<jsp:directive.page buffer="32kb" contentType="text/html;charset=UTF-8"/>
<jsp:directive.page isELIgnored="false"/>
<f:verbatim> <jsp:directive.page language="java" buffer="32kb" contentType="text/html; charset=UTF-8"/>
<script type="text/javascript" <jsp:directive.page isELIgnored="false"/>
src="<%=request.getContextPath()%>/scripts/upload_helper.js">
</script> <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"/>
<f:verbatim>
<script type="text/javascript" src="${pageContext.request.contextPath}/scripts/upload_helper.js">&#160;</script>
<script type="text/javascript"> <script type="text/javascript">
function handle_upload(target) function handle_upload(target)
{ {
handle_upload_helper(target, handle_upload_helper(target,
"<%= CreateFormWizard.FILE_RENDERING_ENGINE_TEMPLATE %>", "<jsp:expression>CreateFormWizard.FILE_RENDERING_ENGINE_TEMPLATE</jsp:expression>",
upload_complete, upload_complete,
"<%= request.getContextPath() %>") "${pageContext.request.contextPath}")
} }
function upload_complete(id, path, filename) function upload_complete(id, path, filename)
@@ -52,24 +58,24 @@
rendering_engine_template_file_input.form.submit(); rendering_engine_template_file_input.form.submit();
} }
</script> </script>
</f:verbatim> </f:verbatim>
<h:inputText id="rendering-engine-template-file" <h:inputText id="rendering-engine-template-file"
value="#{WizardManager.bean.renderingEngineTemplateFileName}" value="#{WizardManager.bean.renderingEngineTemplateFileName}"
immediate="true" immediate="true"
style="display:none;" style="display:none;"
valueChangeListener="#{WizardManager.bean.renderingEngineTemplateFileValueChanged}"/> valueChangeListener="#{WizardManager.bean.renderingEngineTemplateFileValueChanged}"/>
<h:panelGrid id="general-properties-panel-grid" <h:panelGrid id="general-properties-panel-grid"
columns="1" cellpadding="2" style="padding-top: 4px; padding-bottom: 4px;" columns="1" cellpadding="2" style="padding-top: 4px; padding-bottom: 4px;"
width="100%"> width="100%">
<h:outputText id="step-1-text" <h:outputText id="step-1-text"
value="1. #{msg.create_form_configure_rendering_engine_templates_step1_desc}" value="1. #{msg.create_form_configure_rendering_engine_templates_step1_desc}"
escape="false" /> escape="false" />
<h:panelGrid id="panel_grid_3" <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"> columnClasses="panelGridRequiredImageColumn,panelGridLabelColumn,panelGridValueColumn">
width="100%">
<h:outputText id="required_image_rendering_engine_template_file" <h:outputText id="required_image_rendering_engine_template_file"
value="" /> value="" />
<h:outputText id="output_text_rendering_engine_template_file" <h:outputText id="output_text_rendering_engine_template_file"
@@ -88,7 +94,7 @@
<h:outputText id="rendering-engine-template-file-name" <h:outputText id="rendering-engine-template-file-name"
value="#{WizardManager.bean.renderingEngineTemplateFileName}"/> value="#{WizardManager.bean.renderingEngineTemplateFileName}"/>
<h:outputText id="output_text_rendering_engine_template_space" <h:outputText id="output_text_rendering_engine_template_space"
value="&nbsp;" value="&#160;"
escape="false"/> escape="false"/>
<a:actionLink id="action_link_remove_rendering_engine_template" <a:actionLink id="action_link_remove_rendering_engine_template"
image="/images/icons/delete.gif" image="/images/icons/delete.gif"
@@ -97,7 +103,7 @@
showLink="false" showLink="false"
target="top"/> target="top"/>
</h:column> </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" <h:graphicImage id="invisible_img_rendering_engine_template_file_help"
value="/images/icons/Help_icon.gif" style="cursor:help; visibility: hidden;"/> value="/images/icons/Help_icon.gif" style="cursor:help; visibility: hidden;"/>
</h:panelGrid> </h:panelGrid>
@@ -106,9 +112,9 @@
value="2. #{msg.create_form_configure_rendering_engine_templates_step2_desc}" value="2. #{msg.create_form_configure_rendering_engine_templates_step2_desc}"
escape="false" /> escape="false" />
<h:panelGrid id="panel_grid_specify_details" <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"> columnClasses="panelGridRequiredImageColumn,panelGridLabelColumn,panelGridValueColumn,panelGridRequiredImageColumn">
width="100%">
<h:graphicImage id="required-image-rendering-engine" <h:graphicImage id="required-image-rendering-engine"
value="/images/icons/required_field.gif" value="/images/icons/required_field.gif"
@@ -226,7 +232,7 @@
<h:outputText id="data-table-name-0" value="#{msg.selected_rendering_engine_templates}" /> <h:outputText id="data-table-name-0" value="#{msg.selected_rendering_engine_templates}" />
</f:facet> </f:facet>
<f:verbatim> <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> </f:verbatim>
<h:panelGrid id="panel_grid_row" <h:panelGrid id="panel_grid_row"
columns="2" cellspacing="1" border="0"> columns="2" cellspacing="1" border="0">
@@ -271,4 +277,5 @@
</h:panelGrid> </h:panelGrid>
</a:panel> </a:panel>
</h:panelGroup> </h:panelGroup>
</h:panelGrid> </h:panelGrid>
</jsp:root>

View File

@@ -1,4 +1,4 @@
<%-- <!--
* Copyright (C) 2005-2007 Alfresco Software Limited. * Copyright (C) 2005-2007 Alfresco Software Limited.
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@@ -19,38 +19,49 @@
* FLOSS exception. You should have recieved a copy of the text describing * FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here: * the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing * http://www.alfresco.com/legal/licensing
--%> -->
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> <jsp:root version="1.2"
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> xmlns:jsp="http://java.sun.com/JSP/Page"
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> xmlns:c="http://java.sun.com/jsp/jstl/core"
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> xmlns:a="urn:jsptld:/WEB-INF/alfresco.tld"
<script type="text/javascript"> xmlns:f="http://java.sun.com/jsf/core"
function apply_default_workflow_changed(value) 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)
{
value = String(value) == 'true'; value = String(value) == 'true';
document.getElementById("wizard:wizard-body:sdw-pg-2").style.display = value ? "block" : "none"; document.getElementById("wizard:wizard-body:sdw-pg-2").style.display = value ? "block" : "none";
} }
</script> </script>
<h:panelGroup id="sdw-pg-1"> <h:panelGroup id="sdw-pg-1">
<h:outputText id="sdw-question" <h:outputText id="sdw-question"
value="#{msg.create_form_select_default_workflow_apply_default_workflow}" value="#{msg.create_form_select_default_workflow_apply_default_workflow}"
escape="false" /> escape="false" />
<h:selectOneRadio id="sdw-apply-default-workflow-select-one" <h:selectOneRadio id="sdw-apply-default-workflow-select-one"
required="false" required="false"
onchange="apply_default_workflow_changed(this.value)" onclick="apply_default_workflow_changed(this.value)"
value="#{WizardManager.bean.applyDefaultWorkflow}"> value="#{WizardManager.bean.applyDefaultWorkflow}">
<f:selectItem itemLabel="#{msg.yes}" itemValue="#{true}"/> <f:selectItem itemLabel="#{msg.yes}" itemValue="#{true}"/>
<f:selectItem itemLabel="#{msg.no_not_now}" itemValue="#{false}"/> <f:selectItem itemLabel="#{msg.no_not_now}" itemValue="#{false}"/>
</h:selectOneRadio> </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:panelGroup id="sdw-pg-2" style="#{WizardManager.bean.applyDefaultWorkflow?'display:block':'display:none'}">
<h:outputText id="sdw-select-workflow" <h:outputText id="sdw-select-workflow"
value="#{msg.create_form_select_default_workflow_select_workflow}:" value="#{msg.create_form_select_default_workflow_select_workflow}:"
escape="false" /> escape="false" />
<f:verbatim><div id="workflow-list-div" <h:panelGroup id="workflow-list-div"
style="margin:5px 0px;height:144px;*height:148px;width:100%;overflow:auto" class="selectListTable"></f:verbatim> style="margin:5px 0px;height:144px;*height:148px;width:100%;overflow:auto;display:block;"
styleClass="selectListTable">
<a:selectList id="workflow-list" <a:selectList id="workflow-list"
multiSelect="false" multiSelect="false"
style="width:100%" style="width:100%"
@@ -58,6 +69,7 @@ function apply_default_workflow_changed(value)
value="#{WizardManager.bean.defaultWorkflowName}"> value="#{WizardManager.bean.defaultWorkflowName}">
<a:listItems value="#{WizardManager.bean.defaultWorkflowChoices}" /> <a:listItems value="#{WizardManager.bean.defaultWorkflowChoices}" />
</a:selectList> </a:selectList>
<f:verbatim></div></f:verbatim>
</h:panelGroup> </h:panelGroup>
</h:panelGroup> </h:panelGroup>
</h:panelGroup>
</jsp:root>

View File

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