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

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