- renaming everything in order to get consistent good terminology for forms.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@4182 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Ariel Backenroth
2006-10-20 19:52:49 +00:00
parent e808801107
commit fb7ab59141
27 changed files with 538 additions and 551 deletions

View File

@@ -34,7 +34,7 @@
</bean> </bean>
<!-- NOTE: This references a bean in the repository Spring configuration --> <!-- NOTE: This references a bean in the repository Spring configuration -->
<bean id="templatingSerivce" class="org.alfresco.web.templating.TemplatingService"> <bean id="formsSerivce" class="org.alfresco.web.forms.FormsService">
<constructor-arg> <constructor-arg>
<ref bean="ContentService" /> <ref bean="ContentService" />
</constructor-arg> </constructor-arg>
@@ -53,6 +53,9 @@
<constructor-arg> <constructor-arg>
<ref bean="SearchService" /> <ref bean="SearchService" />
</constructor-arg> </constructor-arg>
<constructor-arg>
<ref bean="AVMService" />
</constructor-arg>
</bean> </bean>
</beans> </beans>

View File

@@ -40,10 +40,9 @@ import org.alfresco.web.bean.CheckinCheckoutBean;
import org.alfresco.web.bean.FileUploadBean; import org.alfresco.web.bean.FileUploadBean;
import org.alfresco.web.bean.repository.Node; import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.templating.OutputUtil; import org.alfresco.web.forms.Form;
import org.alfresco.web.templating.TemplateType; import org.alfresco.web.forms.FormProcessor;
import org.alfresco.web.templating.TemplateInputMethod; import org.alfresco.web.forms.FormsService;
import org.alfresco.web.templating.TemplatingService;
import org.alfresco.web.ui.common.Utils; import org.alfresco.web.ui.common.Utils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
@@ -208,28 +207,28 @@ public class AVMEditBean
} }
/** /**
* @return Returns the template type when in the context of editing an xml asset. * @return Returns the form when in the context of editing an xml asset.
*/ */
public TemplateType getTemplateType() public Form getForm()
{ {
final NodeRef ttNodeRef = (NodeRef) final NodeRef ttNodeRef = (NodeRef)
this.nodeService.getProperty(this.getAvmNode().getNodeRef(), this.nodeService.getProperty(this.getAvmNode().getNodeRef(),
WCMModel.PROP_FORM_DERIVED_FROM); WCMModel.PROP_PARENT_FORM);
final TemplatingService ts = TemplatingService.getInstance(); final FormsService ts = FormsService.getInstance();
return ts.getTemplateType(ttNodeRef); return ts.getForm(ttNodeRef);
} }
/** /**
* @return Returns the wrapper instance data for feeding the xml * @return Returns the wrapper instance data for feeding the xml
* content to the form processor. * content to the form processor.
*/ */
public TemplateInputMethod.InstanceData getInstanceData() public FormProcessor.InstanceData getInstanceData()
{ {
final TemplateType tt = this.getTemplateType(); final Form tt = this.getForm();
final TemplateInputMethod tim = tt.getInputMethods().get(0); final FormProcessor tim = tt.getFormProcessors().get(0);
return new TemplateInputMethod.InstanceData() return new FormProcessor.InstanceData()
{ {
private final TemplatingService ts = TemplatingService.getInstance(); private final FormsService ts = FormsService.getInstance();
public Document getContent() public Document getContent()
{ {
@@ -356,13 +355,11 @@ public class AVMEditBean
// commit the transaction // commit the transaction
tx.commit(); tx.commit();
// TODO: regenerate template content // TODO: regenerate form content
if (nodeService.getProperty(avmRef, WCMModel.PROP_FORM_DERIVED_FROM) != null) if (nodeService.getProperty(avmRef, WCMModel.PROP_PARENT_FORM) != null)
{ {
OutputUtil.regenerate(avmRef, final FormsService fs = FormsService.getInstance();
this.contentService, fs.regenerate(avmRef);
this.nodeService,
this.avmService);
} }
resetState(); resetState();

View File

@@ -25,13 +25,11 @@ import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import javax.faces.context.FacesContext; import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent; import javax.faces.event.ActionEvent;
import javax.faces.model.DataModel; import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel; import javax.faces.model.ListDataModel;
import javax.faces.model.SelectItem; import javax.faces.model.SelectItem;
import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.model.WCMModel; import org.alfresco.model.WCMModel;
@@ -43,8 +41,8 @@ import org.alfresco.service.namespace.QName;
import org.alfresco.web.app.Application; import org.alfresco.web.app.Application;
import org.alfresco.web.bean.FileUploadBean; import org.alfresco.web.bean.FileUploadBean;
import org.alfresco.web.bean.wizard.BaseWizardBean; import org.alfresco.web.bean.wizard.BaseWizardBean;
import org.alfresco.web.templating.xforms.*; import org.alfresco.web.forms.*;
import org.alfresco.web.templating.TemplatingService; import org.alfresco.web.forms.xforms.SchemaFormBuilder;
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.apache.xerces.xs.*; import org.apache.xerces.xs.*;
@@ -61,24 +59,24 @@ public class CreateFormWizard extends BaseWizardBean
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
/** /**
* Simple wrapper class to represent a template output method * Simple wrapper class to represent a form data renderer
*/ */
public class TemplateOutputMethodData public class RenderingEngineData
{ {
private final String fileName; private final String fileName;
private final File file; private final File file;
private final String fileExtension; private final String fileExtension;
private final Class templateOutputMethodType; private final Class renderingEngineType;
public TemplateOutputMethodData(final String fileName, public RenderingEngineData(final String fileName,
final File file, final File file,
final String fileExtension, final String fileExtension,
final Class templateOutputMethodType) final Class renderingEngineType)
{ {
this.fileName = fileName; this.fileName = fileName;
this.file = file; this.file = file;
this.fileExtension = fileExtension; this.fileExtension = fileExtension;
this.templateOutputMethodType = templateOutputMethodType; this.renderingEngineType = renderingEngineType;
} }
public String getFileExtension() public String getFileExtension()
@@ -96,20 +94,20 @@ public class CreateFormWizard extends BaseWizardBean
return this.file; return this.file;
} }
public Class getTemplateOutputMethodType() public Class getRenderingEngineType()
{ {
return this.templateOutputMethodType; return this.renderingEngineType;
} }
public String getTemplateOutputMethodTypeName() public String getRenderingEngineTypeName()
{ {
return CreateFormWizard.this.getTemplateOutputMethodTypeName(this.getTemplateOutputMethodType()); return CreateFormWizard.this.getRenderingEngineTypeName(this.getRenderingEngineType());
} }
} }
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
private static final String FILE_TEMPLATEOUTPUT = "template-output-method"; private static final String FILE_RENDERING_ENGINE = "template-output-method";
private static final String FILE_SCHEMA = "schema"; private static final String FILE_SCHEMA = "schema";
@@ -118,10 +116,10 @@ public class CreateFormWizard extends BaseWizardBean
private String schemaRootTagName; private String schemaRootTagName;
private String templateName; private String templateName;
private Class templateOutputMethodType = null; private Class renderingEngineType = null;
protected ContentService contentService; protected ContentService contentService;
private DataModel templateOutputMethodsDataModel; private DataModel renderingEnginesDataModel;
private List<TemplateOutputMethodData> templateOutputMethods = null; private List<RenderingEngineData> renderingEngines = null;
private String fileExtension = null; private String fileExtension = null;
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
@@ -131,7 +129,7 @@ public class CreateFormWizard extends BaseWizardBean
protected String finishImpl(FacesContext context, String outcome) protected String finishImpl(FacesContext context, String outcome)
throws Exception throws Exception
{ {
final TemplatingService ts = TemplatingService.getInstance(); final FormsService ts = FormsService.getInstance();
// get the node ref of the node that will contain the content // get the node ref of the node that will contain the content
final NodeRef contentFormsNodeRef = ts.getContentFormsNodeRef(); final NodeRef contentFormsNodeRef = ts.getContentFormsNodeRef();
@@ -168,18 +166,18 @@ public class CreateFormWizard extends BaseWizardBean
props.put(WCMModel.PROP_SCHEMA_ROOT_TAG_NAME, this.getSchemaRootTagName()); props.put(WCMModel.PROP_SCHEMA_ROOT_TAG_NAME, this.getSchemaRootTagName());
this.nodeService.addAspect(schemaNodeRef, WCMModel.ASPECT_FORM, props); this.nodeService.addAspect(schemaNodeRef, WCMModel.ASPECT_FORM, props);
for (TemplateOutputMethodData tomd : this.templateOutputMethods) for (RenderingEngineData tomd : this.renderingEngines)
{ {
fileInfo = this.fileFolderService.create(folderInfo.getNodeRef(), fileInfo = this.fileFolderService.create(folderInfo.getNodeRef(),
tomd.getFileName(), tomd.getFileName(),
ContentModel.TYPE_CONTENT); ContentModel.TYPE_CONTENT);
final NodeRef templateOutputMethodNodeRef = fileInfo.getNodeRef(); final NodeRef renderingEngineNodeRef = fileInfo.getNodeRef();
if (LOGGER.isDebugEnabled()) if (LOGGER.isDebugEnabled())
LOGGER.debug("Created file node for file: " + tomd.getFileName()); LOGGER.debug("Created file node for file: " + tomd.getFileName());
// get a writer for the content and put the file // get a writer for the content and put the file
writer = this.contentService.getWriter(templateOutputMethodNodeRef, writer = this.contentService.getWriter(renderingEngineNodeRef,
ContentModel.PROP_CONTENT, ContentModel.PROP_CONTENT,
true); true);
// set the mimetype and encoding // set the mimetype and encoding
@@ -188,17 +186,17 @@ public class CreateFormWizard extends BaseWizardBean
writer.putContent(tomd.getFile()); writer.putContent(tomd.getFile());
this.nodeService.createAssociation(schemaNodeRef, this.nodeService.createAssociation(schemaNodeRef,
templateOutputMethodNodeRef, renderingEngineNodeRef,
WCMModel.ASSOC_FORM_TRANSFORMERS); WCMModel.ASSOC_RENDERING_ENGINES);
props = new HashMap<QName, Serializable>(3, 1.0f); props = new HashMap<QName, Serializable>(3, 1.0f);
props.put(WCMModel.PROP_FORM_TRANSFORMER_TYPE, props.put(WCMModel.PROP_RENDERING_ENGINE_TYPE,
tomd.getTemplateOutputMethodType().getName()); tomd.getRenderingEngineType().getName());
props.put(WCMModel.PROP_FORM_SOURCE, schemaNodeRef); props.put(WCMModel.PROP_FORM_SOURCE, schemaNodeRef);
props.put(WCMModel.PROP_FORM_TRANSFORMER_DERIVED_FILE_EXTENSION, props.put(WCMModel.PROP_FILE_EXTENSION_FOR_RENDITION,
tomd.getFileExtension()); tomd.getFileExtension());
this.nodeService.addAspect(templateOutputMethodNodeRef, this.nodeService.addAspect(renderingEngineNodeRef,
WCMModel.ASPECT_FORM_TRANSFORMER, WCMModel.ASPECT_RENDERING_ENGINE,
props); props);
} }
// return the default outcome // return the default outcome
@@ -211,11 +209,11 @@ public class CreateFormWizard extends BaseWizardBean
super.init(parameters); super.init(parameters);
this.removeUploadedSchemaFile(); this.removeUploadedSchemaFile();
this.removeUploadedTemplateOutputMethodFile(); this.removeUploadedRenderingEngineFile();
this.schemaRootTagName = null; this.schemaRootTagName = null;
this.templateName = null; this.templateName = null;
this.templateOutputMethodType = null; this.renderingEngineType = null;
this.templateOutputMethods = new ArrayList<TemplateOutputMethodData>(); this.renderingEngines = new ArrayList<RenderingEngineData>();
this.fileExtension = null; this.fileExtension = null;
} }
@@ -223,7 +221,7 @@ public class CreateFormWizard extends BaseWizardBean
public String cancel() public String cancel()
{ {
this.removeUploadedSchemaFile(); this.removeUploadedSchemaFile();
this.removeUploadedTemplateOutputMethodFile(); this.removeUploadedRenderingEngineFile();
return super.cancel(); return super.cancel();
} }
@@ -254,7 +252,7 @@ public class CreateFormWizard extends BaseWizardBean
*/ */
public boolean getAddToListDisabled() public boolean getAddToListDisabled()
{ {
return getTemplateOutputMethodFileName() == null; return getRenderingEngineFileName() == null;
} }
/** /**
@@ -276,9 +274,9 @@ public class CreateFormWizard extends BaseWizardBean
/** /**
* Add the selected template output method to the list * Add the selected template output method to the list
*/ */
public void addSelectedTemplateOutputMethod(ActionEvent event) public void addSelectedRenderingEngine(ActionEvent event)
{ {
for (TemplateOutputMethodData tomd : this.templateOutputMethods) for (RenderingEngineData tomd : this.renderingEngines)
{ {
if (tomd.getFileExtension().equals(this.fileExtension)) if (tomd.getFileExtension().equals(this.fileExtension))
{ {
@@ -287,14 +285,14 @@ public class CreateFormWizard extends BaseWizardBean
} }
} }
final TemplateOutputMethodData data = final RenderingEngineData data =
this.new TemplateOutputMethodData(this.getTemplateOutputMethodFileName(), this.new RenderingEngineData(this.getRenderingEngineFileName(),
this.getTemplateOutputMethodFile(), this.getRenderingEngineFile(),
this.fileExtension, this.fileExtension,
this.templateOutputMethodType); this.renderingEngineType);
this.templateOutputMethods.add(data); this.renderingEngines.add(data);
this.removeUploadedTemplateOutputMethodFile(); this.removeUploadedRenderingEngineFile();
this.templateOutputMethodType = null; this.renderingEngineType = null;
this.fileExtension = null; this.fileExtension = null;
} }
@@ -302,13 +300,13 @@ public class CreateFormWizard extends BaseWizardBean
* Action handler called when the Remove button is pressed to remove a * Action handler called when the Remove button is pressed to remove a
* template output method * template output method
*/ */
public void removeSelectedTemplateOutputMethod(ActionEvent event) public void removeSelectedRenderingEngine(ActionEvent event)
{ {
final TemplateOutputMethodData wrapper = (TemplateOutputMethodData) final RenderingEngineData wrapper = (RenderingEngineData)
this.templateOutputMethodsDataModel.getRowData(); this.renderingEnginesDataModel.getRowData();
if (wrapper != null) if (wrapper != null)
{ {
this.templateOutputMethods.remove(wrapper); this.renderingEngines.remove(wrapper);
} }
} }
@@ -326,9 +324,9 @@ public class CreateFormWizard extends BaseWizardBean
/** /**
* Action handler called when the user wishes to remove an uploaded file * Action handler called when the user wishes to remove an uploaded file
*/ */
public String removeUploadedTemplateOutputMethodFile() public String removeUploadedRenderingEngineFile()
{ {
clearUpload(FILE_TEMPLATEOUTPUT); clearUpload(FILE_RENDERING_ENGINE);
// refresh the current page // refresh the current page
return null; return null;
@@ -343,68 +341,68 @@ public class CreateFormWizard extends BaseWizardBean
* *
* @return JSF DataModel representing the current configured output methods * @return JSF DataModel representing the current configured output methods
*/ */
public DataModel getTemplateOutputMethodsDataModel() public DataModel getRenderingEnginesDataModel()
{ {
if (this.templateOutputMethodsDataModel == null) if (this.renderingEnginesDataModel == null)
{ {
this.templateOutputMethodsDataModel = new ListDataModel(); this.renderingEnginesDataModel = new ListDataModel();
} }
this.templateOutputMethodsDataModel.setWrappedData(this.templateOutputMethods); this.renderingEnginesDataModel.setWrappedData(this.renderingEngines);
return this.templateOutputMethodsDataModel; return this.renderingEnginesDataModel;
} }
/** /**
* @return Returns the mime type currenty selected * @return Returns the mime type currenty selected
*/ */
public String getTemplateOutputMethodType() public String getRenderingEngineType()
{ {
if (this.templateOutputMethodType == null && if (this.renderingEngineType == null &&
this.getTemplateOutputMethodFileName() != null) this.getRenderingEngineFileName() != null)
{ {
this.templateOutputMethodType = this.renderingEngineType =
(this.getTemplateOutputMethodFileName().endsWith(".xsl") (this.getRenderingEngineFileName().endsWith(".xsl")
? XSLTOutputMethod.class ? XSLTRenderingEngine.class
: (this.getTemplateOutputMethodFileName().endsWith(".ftl") : (this.getRenderingEngineFileName().endsWith(".ftl")
? FreeMarkerOutputMethod.class ? FreeMarkerRenderingEngine.class
: null)); : null));
} }
return (this.templateOutputMethodType == null return (this.renderingEngineType == null
? null ? null
: this.templateOutputMethodType.getName()); : this.renderingEngineType.getName());
} }
/** /**
* @param templateOutputMethodType Sets the currently selected mime type * @param renderingEngineType Sets the currently selected mime type
*/ */
public void setTemplateOutputMethodType(final String templateOutputMethodType) public void setRenderingEngineType(final String renderingEngineType)
throws ClassNotFoundException throws ClassNotFoundException
{ {
this.templateOutputMethodType = (templateOutputMethodType == null this.renderingEngineType = (renderingEngineType == null
? null ? null
: Class.forName(templateOutputMethodType)); : Class.forName(renderingEngineType));
} }
/** /**
* @return Returns a list of mime types to allow the user to select from * @return Returns a list of mime types to allow the user to select from
*/ */
public List<SelectItem> getTemplateOutputMethodTypeChoices() public List<SelectItem> getRenderingEngineTypeChoices()
{ {
return (List<SelectItem>)Arrays.asList(new SelectItem[] return (List<SelectItem>)Arrays.asList(new SelectItem[]
{ {
new SelectItem(FreeMarkerOutputMethod.class.getName(), new SelectItem(FreeMarkerRenderingEngine.class.getName(),
getTemplateOutputMethodTypeName(FreeMarkerOutputMethod.class)), getRenderingEngineTypeName(FreeMarkerRenderingEngine.class)),
new SelectItem(XSLTOutputMethod.class.getName(), new SelectItem(XSLTRenderingEngine.class.getName(),
getTemplateOutputMethodTypeName(XSLTOutputMethod.class)) getRenderingEngineTypeName(XSLTRenderingEngine.class))
}); });
} }
private String getTemplateOutputMethodTypeName(Class type) private String getRenderingEngineTypeName(Class type)
{ {
return (FreeMarkerOutputMethod.class.equals(type) return (FreeMarkerRenderingEngine.class.equals(type)
? "FreeMarker" ? "FreeMarker"
: (XSLTOutputMethod.class.equals(type) : (XSLTRenderingEngine.class.equals(type)
? "XSLT" ? "XSLT"
: null)); : null));
} }
@@ -459,17 +457,17 @@ public class CreateFormWizard extends BaseWizardBean
/** /**
* @return Returns the schema file or <tt>null</tt> * @return Returns the schema file or <tt>null</tt>
*/ */
public String getTemplateOutputMethodFileName() public String getRenderingEngineFileName()
{ {
return this.getFileName(FILE_TEMPLATEOUTPUT); return this.getFileName(FILE_RENDERING_ENGINE);
} }
/** /**
* @return Returns the presentationTemplate file or <tt>null</tt> * @return Returns the presentationTemplate file or <tt>null</tt>
*/ */
public File getTemplateOutputMethodFile() public File getRenderingEngineFile()
{ {
return this.getFile(FILE_TEMPLATEOUTPUT); return this.getFile(FILE_RENDERING_ENGINE);
} }
/** /**
@@ -499,7 +497,7 @@ public class CreateFormWizard extends BaseWizardBean
{ {
try try
{ {
final TemplatingService ts = TemplatingService.getInstance(); final FormsService ts = FormsService.getInstance();
final Document d = ts.parseXML(this.getSchemaFile()); final Document d = ts.parseXML(this.getSchemaFile());
final XSModel xsm = SchemaFormBuilder.loadSchema(d); final XSModel xsm = SchemaFormBuilder.loadSchema(d);
final XSNamedMap elementsMap = xsm.getComponents(XSConstants.ELEMENT_DECLARATION); final XSNamedMap elementsMap = xsm.getComponents(XSConstants.ELEMENT_DECLARATION);
@@ -543,14 +541,14 @@ public class CreateFormWizard extends BaseWizardBean
public String getSummary() public String getSummary()
{ {
final ResourceBundle bundle = Application.getBundle(FacesContext.getCurrentInstance()); final ResourceBundle bundle = Application.getBundle(FacesContext.getCurrentInstance());
final String[] labels = new String[1 + this.templateOutputMethods.size()]; final String[] labels = new String[1 + this.renderingEngines.size()];
final String[] values = new String[1 + this.templateOutputMethods.size()]; final String[] values = new String[1 + this.renderingEngines.size()];
labels[0] = "Schema File"; labels[0] = "Schema File";
values[0] = this.getSchemaFileName(); values[0] = this.getSchemaFileName();
for (int i = 0; i < this.templateOutputMethods.size(); i++) for (int i = 0; i < this.renderingEngines.size(); i++)
{ {
final TemplateOutputMethodData tomd = this.templateOutputMethods.get(i); final RenderingEngineData tomd = this.renderingEngines.get(i);
labels[1 + i] = "Template output method for " + tomd.getFileExtension(); labels[1 + i] = "Form Data Renderer for " + tomd.getFileExtension();
values[1 + i] = tomd.getFileName(); values[1 + i] = tomd.getFileName();
} }

View File

@@ -46,10 +46,9 @@ import org.alfresco.web.app.Application;
import org.alfresco.web.bean.content.BaseContentWizard; import org.alfresco.web.bean.content.BaseContentWizard;
import org.alfresco.web.data.IDataContainer; import org.alfresco.web.data.IDataContainer;
import org.alfresco.web.data.QuickSort; import org.alfresco.web.data.QuickSort;
import org.alfresco.web.templating.OutputUtil; import org.alfresco.web.forms.Form;
import org.alfresco.web.templating.TemplateInputMethod; import org.alfresco.web.forms.FormProcessor;
import org.alfresco.web.templating.TemplateType; import org.alfresco.web.forms.FormsService;
import org.alfresco.web.templating.TemplatingService;
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.w3c.dom.Document; import org.w3c.dom.Document;
@@ -62,7 +61,7 @@ public class CreateWebContentWizard extends BaseContentWizard
private static final Log logger = LogFactory.getLog(CreateWebContentWizard.class); private static final Log logger = LogFactory.getLog(CreateWebContentWizard.class);
protected String content = null; protected String content = null;
protected String templateTypeName; protected String formName;
protected List<SelectItem> createMimeTypes; protected List<SelectItem> createMimeTypes;
protected String createdPath = null; protected String createdPath = null;
@@ -101,27 +100,24 @@ public class CreateWebContentWizard extends BaseContentWizard
logger.debug("saving file content to " + this.fileName); logger.debug("saving file content to " + this.fileName);
saveContent(null, this.content); saveContent(null, this.content);
if (MimetypeMap.MIMETYPE_XML.equals(this.mimeType) && this.templateTypeName != null) if (MimetypeMap.MIMETYPE_XML.equals(this.mimeType) && this.formName != null)
{ {
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
logger.debug("generating template output for " + this.templateTypeName); logger.debug("generating form data renderer output for " + this.formName);
final TemplateType tt = this.getTemplateType(); final Form tt = this.getForm();
final TemplatingService ts = TemplatingService.getInstance(); final FormsService ts = FormsService.getInstance();
final Map<QName, Serializable> props = new HashMap<QName, Serializable>(1, 1.0f); final Map<QName, Serializable> props = new HashMap<QName, Serializable>(1, 1.0f);
props.put(WCMModel.PROP_FORM_DERIVED_FROM, tt.getNodeRef()); props.put(WCMModel.PROP_PARENT_FORM, tt.getNodeRef());
props.put(WCMModel.PROP_FORM_DERIVED_FROM_NAME, tt.getName()); props.put(WCMModel.PROP_PARENT_FORM_NAME, tt.getName());
this.nodeService.addAspect(AVMNodeConverter.ToNodeRef(-1, this.createdPath), this.nodeService.addAspect(AVMNodeConverter.ToNodeRef(-1, this.createdPath),
WCMModel.ASPECT_FORM_DERIVED, WCMModel.ASPECT_FORM_INSTANCE_DATA,
props); props);
OutputUtil.generate(this.createdPath.substring(0, this.createdPath.lastIndexOf('/')), ts.generate(this.createdPath.substring(0, this.createdPath.lastIndexOf('/')),
ts.parseXML(this.content), ts.parseXML(this.content),
tt, tt,
this.fileName, this.fileName);
this.contentService,
this.nodeService,
this.avmService);
} }
// return the default outcome // return the default outcome
@@ -169,7 +165,7 @@ public class CreateWebContentWizard extends BaseContentWizard
this.content = null; this.content = null;
this.inlineEdit = true; this.inlineEdit = true;
this.templateTypeName = null; this.formName = null;
this.mimeType = MimetypeMap.MIMETYPE_XML; this.mimeType = MimetypeMap.MIMETYPE_XML;
} }
@@ -224,11 +220,11 @@ public class CreateWebContentWizard extends BaseContentWizard
this.content = content; this.content = content;
} }
public List<SelectItem> getCreateTemplateTypes() public List<SelectItem> getCreateForms()
{ {
Collection<TemplateType> ttl = TemplatingService.getInstance().getTemplateTypes(); Collection<Form> ttl = FormsService.getInstance().getForms();
List<SelectItem> sil = new ArrayList<SelectItem>(ttl.size()); List<SelectItem> sil = new ArrayList<SelectItem>(ttl.size());
for (TemplateType tt : ttl) for (Form tt : ttl)
{ {
sil.add(new SelectItem(tt.getName(), tt.getName())); sil.add(new SelectItem(tt.getName(), tt.getName()));
} }
@@ -287,34 +283,34 @@ public class CreateWebContentWizard extends BaseContentWizard
return this.createMimeTypes; return this.createMimeTypes;
} }
public String getTemplateTypeName() public String getFormName()
{ {
return this.templateTypeName; return this.formName;
} }
public TemplateType getTemplateType() public Form getForm()
{ {
final TemplatingService ts = TemplatingService.getInstance(); final FormsService ts = FormsService.getInstance();
return ts.getTemplateType(this.getTemplateTypeName()); return ts.getForm(this.getFormName());
} }
/** /**
* @param templateType Sets the currently selected template type * @param form Sets the currently selected form
*/ */
public void setTemplateTypeName(final String templateTypeName) public void setFormName(final String formName)
{ {
this.templateTypeName = templateTypeName; this.formName = formName;
} }
/** /**
* @return Returns the wrapper instance data for feeding the xml * @return Returns the wrapper instance data for feeding the xml
* content to the form processor. * content to the form processor.
*/ */
public TemplateInputMethod.InstanceData getInstanceData() public FormProcessor.InstanceData getInstanceData()
{ {
return new TemplateInputMethod.InstanceData() return new FormProcessor.InstanceData()
{ {
private final TemplatingService ts = TemplatingService.getInstance(); private final FormsService ts = FormsService.getInstance();
public Document getContent() public Document getContent()
{ {

View File

@@ -14,7 +14,7 @@
* language governing permissions and limitations under the * language governing permissions and limitations under the
* License. * License.
*/ */
package org.alfresco.web.templating; package org.alfresco.web.forms;
import javax.faces.context.FacesContext; import javax.faces.context.FacesContext;
import org.alfresco.model.WCMModel; import org.alfresco.model.WCMModel;
@@ -23,7 +23,6 @@ import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.web.bean.wcm.AVMConstants; import org.alfresco.web.bean.wcm.AVMConstants;
import org.alfresco.web.templating.extension.ExtensionFunctions;
import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.jsf.FacesContextUtils; import org.springframework.web.jsf.FacesContextUtils;
@@ -32,8 +31,8 @@ import org.springframework.web.jsf.FacesContextUtils;
*/ */
// XXXarielb this class is probably temporary - but useful to // XXXarielb this class is probably temporary - but useful to
// reduce redundant code until i find a better place to put this stuff // reduce redundant code until i find a better place to put this stuff
public abstract class AbstractFormDataRenderer public abstract class AbstractRenderingEngine
implements FormDataRenderer implements RenderingEngine
{ {
protected static final String ALFRESCO_NS = "http://www.alfresco.org/alfresco"; protected static final String ALFRESCO_NS = "http://www.alfresco.org/alfresco";
protected static final String ALFRESCO_NS_PREFIX = "alfresco"; protected static final String ALFRESCO_NS_PREFIX = "alfresco";
@@ -42,9 +41,9 @@ public abstract class AbstractFormDataRenderer
protected final NodeService nodeService; protected final NodeService nodeService;
protected final ContentService contentService; protected final ContentService contentService;
protected AbstractFormDataRenderer(final NodeRef nodeRef, protected AbstractRenderingEngine(final NodeRef nodeRef,
final NodeService nodeService, final NodeService nodeService,
final ContentService contentService) final ContentService contentService)
{ {
this.nodeRef = nodeRef; this.nodeRef = nodeRef;
this.nodeService = nodeService; this.nodeService = nodeService;
@@ -60,7 +59,7 @@ public abstract class AbstractFormDataRenderer
{ {
return (String) return (String)
this.nodeService.getProperty(this.nodeRef, this.nodeService.getProperty(this.nodeRef,
WCMModel.PROP_FORM_TRANSFORMER_DERIVED_FILE_EXTENSION); WCMModel.PROP_FILE_EXTENSION_FOR_RENDITION);
} }
protected static AVMRemote getAVMRemote() protected static AVMRemote getAVMRemote()
@@ -72,9 +71,9 @@ public abstract class AbstractFormDataRenderer
return (AVMRemote)wac.getBean("avmRemote"); return (AVMRemote)wac.getBean("avmRemote");
} }
protected static ExtensionFunctions getExtensionFunctions() protected static FormDataFunctions getFormDataFunctions()
{ {
return new ExtensionFunctions(AbstractFormDataRenderer.getAVMRemote()); return new FormDataFunctions(AbstractRenderingEngine.getAVMRemote());
} }
protected static String toAVMPath(String parentAVMPath, String path) protected static String toAVMPath(String parentAVMPath, String path)

View File

@@ -14,7 +14,7 @@
* language governing permissions and limitations under the * language governing permissions and limitations under the
* License. * License.
*/ */
package org.alfresco.web.templating; package org.alfresco.web.forms;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.w3c.dom.Document; import org.w3c.dom.Document;
@@ -23,15 +23,15 @@ import java.net.URI;
import java.util.List; import java.util.List;
/** /**
* Encapsulation of a template type. * Encapsulation of a form.
* *
* @author Ariel Backenroth * @author Ariel Backenroth
*/ */
public interface TemplateType public interface Form
extends Serializable extends Serializable
{ {
/** the name of the template, which must be unique within the TemplatingService */ /** the name of the template, which must be unique within the FormsService */
public String getName(); public String getName();
/** the root tag to use within the schema */ /** the root tag to use within the schema */
@@ -48,15 +48,15 @@ public interface TemplateType
/** /**
* Provides a set of input methods for this template. * Provides a set of input methods for this template.
*/ */
public List<TemplateInputMethod> getInputMethods(); public List<FormProcessor> getFormProcessors();
/** /**
* adds an output method to this template type. * adds an output method to this template type.
*/ */
public void addFormDataRenderer(FormDataRenderer output); public void addRenderingEngine(RenderingEngine output);
/** /**
* Provides the set of output methods for this template. * Provides the set of output methods for this template.
*/ */
public List<FormDataRenderer> getFormDataRenderers(); public List<RenderingEngine> getRenderingEngines();
} }

View File

@@ -14,7 +14,7 @@
* language governing permissions and limitations under the * language governing permissions and limitations under the
* License. * License.
*/ */
package org.alfresco.web.templating.extension; package org.alfresco.web.forms;
import org.alfresco.model.WCMModel; import org.alfresco.model.WCMModel;
import org.alfresco.repo.avm.AVMRemote; import org.alfresco.repo.avm.AVMRemote;
@@ -38,15 +38,15 @@ import java.util.HashMap;
* *
* @author Ariel Backenroth * @author Ariel Backenroth
*/ */
public class ExtensionFunctions public class FormDataFunctions
{ {
private static final Log LOGGER = LogFactory.getLog(ExtensionFunctions.class); private static final Log LOGGER = LogFactory.getLog(FormDataFunctions.class);
private static DocumentBuilder documentBuilder; private static DocumentBuilder documentBuilder;
private final AVMRemote avmRemote; private final AVMRemote avmRemote;
public ExtensionFunctions(final AVMRemote avmRemote) public FormDataFunctions(final AVMRemote avmRemote)
{ {
this.avmRemote = avmRemote; this.avmRemote = avmRemote;
} }
@@ -102,7 +102,7 @@ public class ExtensionFunctions
PropertyValue pv = PropertyValue pv =
this.avmRemote.getNodeProperty(-1, this.avmRemote.getNodeProperty(-1,
avmPath + '/' + entryName, avmPath + '/' + entryName,
WCMModel.PROP_FORM_DERIVED_FROM_NAME); WCMModel.PROP_PARENT_FORM_NAME);
if (pv == null || if (pv == null ||
pv.getStringValue() == null || pv.getStringValue() == null ||
!((String)pv.getStringValue()).equals(formName)) !((String)pv.getStringValue()).equals(formName))
@@ -113,7 +113,7 @@ public class ExtensionFunctions
pv = this.avmRemote.getNodeProperty(-1, pv = this.avmRemote.getNodeProperty(-1,
avmPath + '/' + entryName, avmPath + '/' + entryName,
WCMModel.PROP_FORM_TRANSFORMER_DERIVED_FROM); WCMModel.PROP_PARENT_RENDERING_ENGINE);
if (pv != null) if (pv != null)
{ {
@@ -139,20 +139,20 @@ public class ExtensionFunctions
private static DocumentBuilder getDocumentBuilder() private static DocumentBuilder getDocumentBuilder()
{ {
if (ExtensionFunctions.documentBuilder == null) if (FormDataFunctions.documentBuilder == null)
{ {
try try
{ {
final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true); dbf.setNamespaceAware(true);
dbf.setValidating(false); dbf.setValidating(false);
ExtensionFunctions.documentBuilder = dbf.newDocumentBuilder(); FormDataFunctions.documentBuilder = dbf.newDocumentBuilder();
} }
catch (ParserConfigurationException pce) catch (ParserConfigurationException pce)
{ {
LOGGER.error(pce); LOGGER.error(pce);
} }
} }
return ExtensionFunctions.documentBuilder; return FormDataFunctions.documentBuilder;
} }
} }

View File

@@ -14,42 +14,42 @@
* language governing permissions and limitations under the * language governing permissions and limitations under the
* License. * License.
*/ */
package org.alfresco.web.templating.xforms; package org.alfresco.web.forms;
import java.io.*; import java.io.*;
import java.net.URI; import java.net.URI;
import java.util.*; import java.util.*;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.web.forms.xforms.XFormsProcessor;
import org.alfresco.web.app.servlet.DownloadContentServlet; import org.alfresco.web.app.servlet.DownloadContentServlet;
import org.alfresco.web.templating.*;
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.w3c.dom.*; import org.w3c.dom.*;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
public class TemplateTypeImpl public class FormImpl
implements TemplateType implements Form
{ {
private static final Log LOGGER = LogFactory.getLog(TemplateTypeImpl.class); private static final Log LOGGER = LogFactory.getLog(FormImpl.class);
private transient Document schema; private transient Document schema;
private final NodeRef schemaNodeRef; private final NodeRef schemaNodeRef;
private final String name; private final String name;
private final String rootTagName; private final String rootTagName;
private final LinkedList<FormDataRenderer> formDataRenderers = private final LinkedList<RenderingEngine> renderingEngines =
new LinkedList<FormDataRenderer>(); new LinkedList<RenderingEngine>();
private final static LinkedList<TemplateInputMethod> INPUT_METHODS = private final static LinkedList<FormProcessor> PROCESSORS =
new LinkedList<TemplateInputMethod>(); new LinkedList<FormProcessor>();
static static
{ {
INPUT_METHODS.add(new XFormsInputMethod()); PROCESSORS.add(new XFormsProcessor());
} }
public TemplateTypeImpl(final String name, public FormImpl(final String name,
final NodeRef schemaNodeRef, final NodeRef schemaNodeRef,
final String rootTagName) final String rootTagName)
{ {
this.name = name; this.name = name;
this.schemaNodeRef = schemaNodeRef; this.schemaNodeRef = schemaNodeRef;
@@ -70,7 +70,7 @@ public class TemplateTypeImpl
{ {
if (this.schema == null) if (this.schema == null)
{ {
final TemplatingService ts = TemplatingService.getInstance(); final FormsService ts = FormsService.getInstance();
try try
{ {
//XXXarielb maybe cloneNode instead? //XXXarielb maybe cloneNode instead?
@@ -89,19 +89,19 @@ public class TemplateTypeImpl
return this.schemaNodeRef; return this.schemaNodeRef;
} }
public List<TemplateInputMethod> getInputMethods() public List<FormProcessor> getFormProcessors()
{ {
return INPUT_METHODS; return PROCESSORS;
} }
public void addFormDataRenderer(final FormDataRenderer output) public void addRenderingEngine(final RenderingEngine output)
{ {
this.formDataRenderers.add(output); this.renderingEngines.add(output);
} }
public List<FormDataRenderer> getFormDataRenderers() public List<RenderingEngine> getRenderingEngines()
{ {
return this.formDataRenderers; return this.renderingEngines;
} }
public int hashCode() public int hashCode()

View File

@@ -14,7 +14,7 @@
* language governing permissions and limitations under the * language governing permissions and limitations under the
* License. * License.
*/ */
package org.alfresco.web.templating; package org.alfresco.web.forms;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import java.io.Serializable; import java.io.Serializable;
@@ -23,7 +23,7 @@ import java.io.Writer;
/** /**
* Generates a user interface for inputing data into a template. * Generates a user interface for inputing data into a template.
*/ */
public interface TemplateInputMethod public interface FormProcessor
extends Serializable extends Serializable
{ {
@@ -43,13 +43,13 @@ public interface TemplateInputMethod
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
/** /**
* Generates a user interface for inputing data into this template. * Generates a user interface for inputing data into a form.
* *
* @param instanceData provides the xml instance data if available. * @param instanceData provides the xml instance data if available.
* @param tt the template type to generate for * @param form the form to generate for
* @param out the writer to write the output to. * @param out the writer to write the output to.
*/ */
public void generate(final TemplateInputMethod.InstanceData instanceData, public void generate(final FormProcessor.InstanceData instanceData,
final TemplateType tt, final Form form,
final Writer out); final Writer out);
} }

View File

@@ -14,57 +14,59 @@
* language governing permissions and limitations under the * language governing permissions and limitations under the
* License. * License.
*/ */
package org.alfresco.web.templating; package org.alfresco.web.forms;
import java.io.*; import java.io.*;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.util.*; import java.util.*;
import javax.faces.context.FacesContext;
import javax.xml.parsers.*; import javax.xml.parsers.*;
import javax.xml.transform.*; import javax.xml.transform.*;
import javax.xml.transform.dom.DOMSource; import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamResult;
import org.alfresco.web.templating.xforms.*; import org.alfresco.model.ContentModel;
import org.alfresco.model.WCMModel;
import org.w3c.dom.Document; import org.alfresco.repo.avm.*;
import org.w3c.dom.Node; import org.alfresco.service.ServiceRegistry;
import org.xml.sax.SAXException; import org.alfresco.service.cmr.avm.AVMNotFoundException;
import org.apache.commons.logging.Log; import org.alfresco.service.cmr.avm.AVMService;
import org.apache.commons.logging.LogFactory; import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.model.*;
import org.alfresco.service.cmr.repository.AssociationRef;
import org.alfresco.service.cmr.repository.ContentReader; import org.alfresco.service.cmr.repository.ContentReader;
import org.alfresco.service.cmr.repository.ContentService; import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.model.ContentModel;
import org.alfresco.model.WCMModel;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.repository.AssociationRef;
import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.search.*; import org.alfresco.service.cmr.search.*;
import org.alfresco.service.cmr.model.*;
import org.alfresco.service.namespace.NamespaceService; import org.alfresco.service.namespace.NamespaceService;
import javax.faces.context.FacesContext; import org.alfresco.service.namespace.QName;
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.forms.xforms.*;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.xml.sax.SAXException;
/** /**
* Provides management of template types. * Provides management of forms.
* *
* @author Ariel Backenroth * @author Ariel Backenroth
*/ */
public final class TemplatingService implements Serializable public final class FormsService
implements Serializable
{ {
private static final Log LOGGER = LogFactory.getLog(TemplatingService.class); private static final Log LOGGER = LogFactory.getLog(FormsService.class);
/** the single instance initialized using spring */ /** the single instance initialized using spring */
private static TemplatingService INSTANCE; private static FormsService INSTANCE;
private static DocumentBuilder documentBuilder;
/** internal storage of template types, keyed by the template name */ /** internal storage of forms, keyed by the form name */
private HashMap<String, TemplateType> templateTypes = private HashMap<String, Form> forms = new HashMap<String, Form>();
new HashMap<String, TemplateType>();
private final ContentService contentService; private final ContentService contentService;
private final NodeService nodeService; private final NodeService nodeService;
@@ -72,16 +74,18 @@ public final class TemplatingService implements Serializable
private final DictionaryService dictionaryService; private final DictionaryService dictionaryService;
private final NamespaceService namespaceService; private final NamespaceService namespaceService;
private final SearchService searchService; private final SearchService searchService;
private final AVMService avmService;
private NodeRef contentFormsNodeRef; private NodeRef contentFormsNodeRef;
/** instantiated using spring */ /** instantiated using spring */
public TemplatingService(final ContentService contentService, public FormsService(final ContentService contentService,
final NodeService nodeService, final NodeService nodeService,
final FileFolderService fileFolderService, final FileFolderService fileFolderService,
final DictionaryService dictionaryService, final DictionaryService dictionaryService,
final NamespaceService namespaceService, final NamespaceService namespaceService,
final SearchService searchService) final SearchService searchService,
final AVMService avmService)
{ {
this.contentService = contentService; this.contentService = contentService;
this.nodeService = nodeService; this.nodeService = nodeService;
@@ -89,14 +93,15 @@ public final class TemplatingService implements Serializable
this.dictionaryService = dictionaryService; this.dictionaryService = dictionaryService;
this.namespaceService = namespaceService; this.namespaceService = namespaceService;
this.searchService = searchService; this.searchService = searchService;
this.avmService = avmService;
if (INSTANCE == null) if (INSTANCE == null)
INSTANCE = this; INSTANCE = this;
} }
/** Provides the templating service instance, loads config if necessary */ /** Provides the forms service instance, loads config if necessary */
public static TemplatingService getInstance() public static FormsService getInstance()
{ {
return TemplatingService.INSTANCE; return FormsService.INSTANCE;
} }
/** /**
@@ -122,8 +127,12 @@ public final class TemplatingService implements Serializable
return this.contentFormsNodeRef; return this.contentFormsNodeRef;
} }
/** returns all registered template types */ /**
public Collection<TemplateType> getTemplateTypes() * returns all registered forms
*
* @return all registered forms.
*/
public Collection<Form> getForms()
{ {
try try
{ {
@@ -134,11 +143,11 @@ public final class TemplatingService implements Serializable
LOGGER.debug("running query [" + sp.getQuery() + "]"); LOGGER.debug("running query [" + sp.getQuery() + "]");
final ResultSet rs = this.searchService.query(sp); final ResultSet rs = this.searchService.query(sp);
LOGGER.debug("received " + rs.length() + " results"); LOGGER.debug("received " + rs.length() + " results");
final Collection<TemplateType> result = new LinkedList<TemplateType>(); final Collection<Form> result = new LinkedList<Form>();
for (ResultSetRow row : rs) for (ResultSetRow row : rs)
{ {
final NodeRef nodeRef = row.getNodeRef(); final NodeRef nodeRef = row.getNodeRef();
result.add(this.newTemplateType(nodeRef)); result.add(this.newForm(nodeRef));
} }
return result; return result;
} }
@@ -149,8 +158,12 @@ public final class TemplatingService implements Serializable
} }
} }
/** return the template type by name or <tt>null</tt> if not found */ /**
public TemplateType getTemplateType(final String name) * return the form by name or <tt>null</tt> if not found
*
* @return the form by name or <tt>null</tt> if not found
*/
public Form getForm(final String name)
{ {
try try
{ {
@@ -174,7 +187,7 @@ public final class TemplatingService implements Serializable
} }
if (result == null && LOGGER.isDebugEnabled()) if (result == null && LOGGER.isDebugEnabled())
LOGGER.debug("unable to find tempalte type " + name); LOGGER.debug("unable to find tempalte type " + name);
return result != null ? this.newTemplateType(result) : null; return result != null ? this.newForm(result) : null;
} }
catch (RuntimeException re) catch (RuntimeException re)
{ {
@@ -183,43 +196,43 @@ public final class TemplatingService implements Serializable
} }
} }
public TemplateType getTemplateType(final NodeRef nodeRef) public Form getForm(final NodeRef nodeRef)
{ {
return this.newTemplateType(nodeRef); return this.newForm(nodeRef);
} }
/** /**
* instantiate a template type. for now this will always generate the * instantiate a form. for now this will always generate the
* xforms implementation, but will at some point be configurable such that * xforms implementation, but will at some point be configurable such that
* the template type implementation can be configured for the system, * the form processor type implementation can be configured for the system,
* or specified in the gui. * or specified in the gui.
*/ */
private TemplateType newTemplateType(final NodeRef schemaNodeRef) private Form newForm(final NodeRef schemaNodeRef)
{ {
LOGGER.debug("creating template type for " + schemaNodeRef); LOGGER.debug("creating form for " + schemaNodeRef);
final String title = (String) final String title = (String)
this.nodeService.getProperty(schemaNodeRef, ContentModel.PROP_TITLE); this.nodeService.getProperty(schemaNodeRef, ContentModel.PROP_TITLE);
LOGGER.debug("title is " + title); LOGGER.debug("title is " + title);
final String schemaRootTagName = (String) final String schemaRootTagName = (String)
this.nodeService.getProperty(schemaNodeRef, WCMModel.PROP_SCHEMA_ROOT_TAG_NAME); this.nodeService.getProperty(schemaNodeRef, WCMModel.PROP_SCHEMA_ROOT_TAG_NAME);
LOGGER.debug("root tag name is " + schemaRootTagName); LOGGER.debug("root tag name is " + schemaRootTagName);
final TemplateType tt = new TemplateTypeImpl(title, schemaNodeRef, schemaRootTagName); final Form tt = new FormImpl(title, schemaNodeRef, schemaRootTagName);
for (AssociationRef assoc : this.nodeService.getTargetAssocs(schemaNodeRef, for (AssociationRef assoc : this.nodeService.getTargetAssocs(schemaNodeRef,
WCMModel.ASSOC_FORM_TRANSFORMERS)) WCMModel.ASSOC_RENDERING_ENGINES))
{ {
final NodeRef tomNodeRef = assoc.getTargetRef(); final NodeRef tomNodeRef = assoc.getTargetRef();
try try
{ {
final Class templateOutputMethodType = final Class formDataRendererType =
Class.forName((String)this.nodeService.getProperty(tomNodeRef, Class.forName((String)this.nodeService.getProperty(tomNodeRef,
WCMModel.PROP_FORM_TRANSFORMER_TYPE)); WCMModel.PROP_RENDERING_ENGINE_TYPE));
final Constructor c = templateOutputMethodType.getConstructor(NodeRef.class, NodeService.class, ContentService.class); final Constructor c = formDataRendererType.getConstructor(NodeRef.class, NodeService.class, ContentService.class);
final FormDataRenderer tom = (FormDataRenderer) final RenderingEngine tom = (RenderingEngine)
c.newInstance(tomNodeRef, this.nodeService, this.contentService); c.newInstance(tomNodeRef, this.nodeService, this.contentService);
LOGGER.debug("loaded template output method type " + tom.getClass().getName() + LOGGER.debug("loaded form data renderer type " + tom.getClass().getName() +
" for extension " + tom.getFileExtension() + ", " + tomNodeRef); " for extension " + tom.getFileExtension() + ", " + tomNodeRef);
tt.addFormDataRenderer(tom); tt.addRenderingEngine(tom);
} }
catch (Exception e) catch (Exception e)
{ {
@@ -229,6 +242,112 @@ public final class TemplatingService implements Serializable
return tt; return tt;
} }
public void generate(final String parentPath,
final Document xml,
final Form tt,
final String fileName)
throws IOException,
RenderingEngine.RenderingException
{
for (RenderingEngine tom : tt.getRenderingEngines())
{
// get the node ref of the node that will contain the content
final String generatedFileName = stripExtension(fileName) + "." + tom.getFileExtension();
final OutputStream fileOut = this.avmService.createFile(parentPath, generatedFileName);
final String fullAvmPath = parentPath + '/' + generatedFileName;
final String avmStore = parentPath.substring(0, parentPath.indexOf(":/"));
final String sandBoxUrl = AVMConstants.buildAVMStoreUrl(avmStore);
if (LOGGER.isDebugEnabled())
LOGGER.debug("Created file node for file: " +
fullAvmPath);
final OutputStreamWriter out = new OutputStreamWriter(fileOut);
final HashMap<String, String> parameters =
getOutputMethodParameters(sandBoxUrl, fileName, generatedFileName, parentPath);
tom.generate(xml, parameters, out);
out.close();
NodeRef outputNodeRef = AVMNodeConverter.ToNodeRef(-1, fullAvmPath);
Map<QName, Serializable> props = new HashMap<QName, Serializable>(2, 1.0f);
props.put(WCMModel.PROP_PARENT_FORM, tt.getNodeRef());
props.put(WCMModel.PROP_PARENT_FORM_NAME, tt.getName());
nodeService.addAspect(outputNodeRef, WCMModel.ASPECT_FORM_INSTANCE_DATA, props);
props = new HashMap<QName, Serializable>(2, 1.0f);
props.put(WCMModel.PROP_PARENT_RENDERING_ENGINE, tom.getNodeRef());
props.put(WCMModel.PROP_PRIMARY_FORM_INSTANCE_DATA,
AVMNodeConverter.ToNodeRef(-1, parentPath + fileName));
nodeService.addAspect(outputNodeRef, WCMModel.ASPECT_RENDITION, props);
props = new HashMap<QName, Serializable>(1, 1.0f);
props.put(ContentModel.PROP_TITLE, fileName);
nodeService.addAspect(outputNodeRef, ContentModel.ASPECT_TITLED, props);
LOGGER.debug("generated " + generatedFileName + " using " + tom);
}
}
public void regenerate(final NodeRef nodeRef)
throws IOException,
SAXException,
RenderingEngine.RenderingException
{
final NodeRef formNodeRef = (NodeRef)
nodeService.getProperty(nodeRef, WCMModel.PROP_PARENT_FORM);
final Form tt = this.getForm(formNodeRef);
final ContentReader reader = contentService.getReader(nodeRef, ContentModel.PROP_CONTENT);
final Document xml = this.parseXML(reader.getContentInputStream());
final String fileName = (String)
nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
final String avmPath = AVMNodeConverter.ToAVMVersionPath(nodeRef).getSecond();
final String avmStore = avmPath.substring(0, avmPath.indexOf(":/"));
final String sandBoxUrl = AVMConstants.buildAVMStoreUrl(avmStore);
final String parentPath = AVMNodeConverter.SplitBase(avmPath)[0];
for (RenderingEngine tom : tt.getRenderingEngines())
{
final String generatedFileName = stripExtension(fileName) + "." + tom.getFileExtension();
if (LOGGER.isDebugEnabled())
LOGGER.debug("regenerating file node for : " + fileName + " (" +
nodeRef.toString() + ") to " + parentPath + "/" + generatedFileName);
// get a writer for the content and put the file
OutputStream out = null;
try
{
out = this.avmService.getFileOutputStream(parentPath + "/" + generatedFileName);
}
catch (AVMNotFoundException e)
{
out = this.avmService.createFile(parentPath, generatedFileName);
}
final OutputStreamWriter writer = new OutputStreamWriter(out);
final HashMap<String, String> parameters =
getOutputMethodParameters(sandBoxUrl, fileName, generatedFileName, parentPath);
tom.generate(xml, parameters, writer);
writer.close();
LOGGER.debug("generated " + fileName + " using " + tom);
}
}
private static HashMap<String, String> getOutputMethodParameters(final String sandBoxUrl,
final String fileName,
final String generatedFileName,
final String parentPath)
{
final HashMap<String, String> parameters = new HashMap<String, String>();
parameters.put("avm_store_url", sandBoxUrl);
parameters.put("derived_from_file_name", fileName);
parameters.put("generated_file_name", generatedFileName);
parameters.put("parent_path", parentPath);
return parameters;
}
/** utility function for creating a document */ /** utility function for creating a document */
public Document newDocument() public Document newDocument()
{ {
@@ -304,17 +423,15 @@ public final class TemplatingService implements Serializable
/** utility function for parsing xml */ /** utility function for parsing xml */
public Document parseXML(final String source) public Document parseXML(final String source)
throws ParserConfigurationException, throws SAXException,
SAXException, IOException
IOException
{ {
return this.parseXML(new ByteArrayInputStream(source.getBytes())); return this.parseXML(new ByteArrayInputStream(source.getBytes()));
} }
/** utility function for parsing xml */ /** utility function for parsing xml */
public Document parseXML(final NodeRef nodeRef) public Document parseXML(final NodeRef nodeRef)
throws ParserConfigurationException, throws SAXException,
SAXException,
IOException IOException
{ {
final ContentReader contentReader = final ContentReader contentReader =
@@ -325,8 +442,7 @@ public final class TemplatingService implements Serializable
/** utility function for parsing xml */ /** utility function for parsing xml */
public Document parseXML(final File source) public Document parseXML(final File source)
throws ParserConfigurationException, throws SAXException,
SAXException,
IOException IOException
{ {
return this.parseXML(new FileInputStream(source)); return this.parseXML(new FileInputStream(source));
@@ -334,16 +450,37 @@ public final class TemplatingService implements Serializable
/** utility function for parsing xml */ /** utility function for parsing xml */
public Document parseXML(final InputStream source) public Document parseXML(final InputStream source)
throws ParserConfigurationException, throws SAXException,
SAXException,
IOException IOException
{ {
final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); final DocumentBuilder db = this.getDocumentBuilder();
dbf.setNamespaceAware(true);
dbf.setValidating(false);
final DocumentBuilder db = dbf.newDocumentBuilder();
final Document result = db.parse(source); final Document result = db.parse(source);
source.close(); source.close();
return result; return result;
} }
private static String stripExtension(final String s)
{
return s.replaceAll("(.+)\\..*", "$1");
}
public DocumentBuilder getDocumentBuilder()
{
if (FormsService.documentBuilder == null)
{
try
{
final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
dbf.setValidating(false);
FormsService.documentBuilder = dbf.newDocumentBuilder();
}
catch (ParserConfigurationException pce)
{
LOGGER.error(pce);
}
}
return FormsService.documentBuilder;
}
} }

View File

@@ -14,7 +14,7 @@
* language governing permissions and limitations under the * language governing permissions and limitations under the
* License. * License.
*/ */
package org.alfresco.web.templating.xforms; package org.alfresco.web.forms;
import freemarker.ext.dom.NodeModel; import freemarker.ext.dom.NodeModel;
import freemarker.template.*; import freemarker.template.*;
@@ -28,8 +28,6 @@ import org.alfresco.service.cmr.repository.ContentReader;
import org.alfresco.service.cmr.repository.ContentService; import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.web.templating.*;
import org.alfresco.web.templating.extension.ExtensionFunctions;
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.chiba.xml.util.DOMUtil; import org.chiba.xml.util.DOMUtil;
@@ -43,13 +41,13 @@ import org.w3c.dom.Node;
* *
* @author Ariel Backenroth * @author Ariel Backenroth
*/ */
public class FreeMarkerOutputMethod public class FreeMarkerRenderingEngine
extends AbstractFormDataRenderer extends AbstractRenderingEngine
{ {
private static final Log LOGGER = LogFactory.getLog(FreeMarkerOutputMethod.class); private static final Log LOGGER = LogFactory.getLog(FreeMarkerRenderingEngine.class);
public FreeMarkerOutputMethod(final NodeRef nodeRef, public FreeMarkerRenderingEngine(final NodeRef nodeRef,
final NodeService nodeService, final NodeService nodeService,
final ContentService contentService) final ContentService contentService)
{ {
@@ -63,11 +61,10 @@ public class FreeMarkerOutputMethod
* all parameters and all extension functions. * all parameters and all extension functions.
*/ */
public void generate(final Document xmlContent, public void generate(final Document xmlContent,
final TemplateType tt,
final Map<String, String> parameters, final Map<String, String> parameters,
final Writer out) final Writer out)
throws IOException, throws IOException,
TemplateException RenderingEngine.RenderingException
{ {
final ContentReader contentReader = final ContentReader contentReader =
this.contentService.getReader(this.getNodeRef(), ContentModel.TYPE_CONTENT); this.contentService.getReader(this.getNodeRef(), ContentModel.TYPE_CONTENT);
@@ -88,8 +85,8 @@ public class FreeMarkerOutputMethod
{ {
try try
{ {
final ExtensionFunctions ef = FreeMarkerOutputMethod.getExtensionFunctions(); final FormDataFunctions ef = FreeMarkerRenderingEngine.getFormDataFunctions();
final String path = FreeMarkerOutputMethod.toAVMPath(parameters.get("parent_path"), final String path = FreeMarkerRenderingEngine.toAVMPath(parameters.get("parent_path"),
(String)args.get(0)); (String)args.get(0));
return ef.getXMLDocument(path); return ef.getXMLDocument(path);
} }
@@ -106,8 +103,8 @@ public class FreeMarkerOutputMethod
{ {
try try
{ {
final ExtensionFunctions ef = FreeMarkerOutputMethod.getExtensionFunctions(); final FormDataFunctions ef = FreeMarkerRenderingEngine.getFormDataFunctions();
final String path = FreeMarkerOutputMethod.toAVMPath(parameters.get("parent_path"), final String path = FreeMarkerRenderingEngine.toAVMPath(parameters.get("parent_path"),
args.size() == 1 ? "" : (String)args.get(1)); args.size() == 1 ? "" : (String)args.get(1));
final Map<String, Document> resultMap = ef.getXMLDocuments((String)args.get(0), path); final Map<String, Document> resultMap = ef.getXMLDocuments((String)args.get(0), path);
LOGGER.debug("received " + resultMap.size() + " documents in " + path); LOGGER.debug("received " + resultMap.size() + " documents in " + path);
@@ -168,7 +165,18 @@ public class FreeMarkerOutputMethod
}; };
// process the form // process the form
t.process(rootModel, out); try
out.flush(); {
t.process(rootModel, out);
}
catch (final TemplateException te)
{
LOGGER.debug(te);
throw new RenderingEngine.RenderingException(te);
}
finally
{
out.flush();
}
} }
} }

View File

@@ -14,9 +14,10 @@
* language governing permissions and limitations under the * language governing permissions and limitations under the
* License. * License.
*/ */
package org.alfresco.web.templating; package org.alfresco.web.forms;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import java.io.IOException;
import java.io.Serializable; import java.io.Serializable;
import java.io.Writer; import java.io.Writer;
import java.util.Map; import java.util.Map;
@@ -27,9 +28,28 @@ import org.w3c.dom.Document;
* *
* @author Ariel Backenroth * @author Ariel Backenroth
*/ */
public interface FormDataRenderer public interface RenderingEngine
extends Serializable extends Serializable
{ {
/////////////////////////////////////////////////////////////////////////////
public static class RenderingException
extends Exception
{
public RenderingException(final Exception cause)
{
super(cause);
}
public RenderingException(final String msg, final Exception cause)
{
super(msg, cause);
}
}
/////////////////////////////////////////////////////////////////////////////
/** the noderef associated with this output method */ /** the noderef associated with this output method */
public NodeRef getNodeRef(); public NodeRef getNodeRef();
@@ -37,15 +57,14 @@ public interface FormDataRenderer
* Serializes the xml data in to a presentation format. * Serializes the xml data in to a presentation format.
* *
* @param xmlContent the xml content to serialize * @param xmlContent the xml content to serialize
* @param tt the template type that collected the xml content. * @param form the form that collected the xml content.
* @param sandBoxUrl the url of the current sandbox * @param sandBoxUrl the url of the current sandbox
* @param out the writer to serialize to. * @param out the writer to serialize to.
*/ */
public void generate(final Document xmlContent, public void generate(final Document xmlContent,
final TemplateType tt,
final Map<String, String> parameters, final Map<String, String> parameters,
final Writer out) final Writer out)
throws Exception; throws IOException, RenderingException;
/** /**
* Returns the file extension to use when generating content for this * Returns the file extension to use when generating content for this

View File

@@ -14,7 +14,7 @@
* language governing permissions and limitations under the * language governing permissions and limitations under the
* License. * License.
*/ */
package org.alfresco.web.templating.extension; package org.alfresco.web.forms;
import org.alfresco.jndi.AVMFileDirContext; import org.alfresco.jndi.AVMFileDirContext;
import org.w3c.dom.Document; import org.w3c.dom.Document;
@@ -23,13 +23,13 @@ import javax.servlet.ServletContext;
import java.io.IOException; import java.io.IOException;
import java.util.Map; import java.util.Map;
public class ServletContextExtensionFunctionsAdapter public class ServletContextFormDataFunctionsAdapter
extends ExtensionFunctions extends FormDataFunctions
{ {
private final ServletContext servletContext; private final ServletContext servletContext;
public ServletContextExtensionFunctionsAdapter(final ServletContext servletContext) public ServletContextFormDataFunctionsAdapter(final ServletContext servletContext)
{ {
super(AVMFileDirContext.getAVMRemote()); super(AVMFileDirContext.getAVMRemote());
this.servletContext = servletContext; this.servletContext = servletContext;
@@ -55,11 +55,11 @@ public class ServletContextExtensionFunctionsAdapter
return super.getXMLDocument(this.toAVMPath(path)); return super.getXMLDocument(this.toAVMPath(path));
} }
public Map<String, Document> getXMLDocuments(final String templateTypeName, public Map<String, Document> getXMLDocuments(final String formName,
final String path) final String path)
throws IOException, throws IOException,
SAXException SAXException
{ {
return super.getXMLDocuments(templateTypeName, this.toAVMPath(path)); return super.getXMLDocuments(formName, this.toAVMPath(path));
} }
} }

View File

@@ -14,7 +14,7 @@
* language governing permissions and limitations under the * language governing permissions and limitations under the
* License. * License.
*/ */
package org.alfresco.web.templating.xforms; package org.alfresco.web.forms;
import java.io.*; import java.io.*;
import java.net.URI; import java.net.URI;
@@ -37,8 +37,6 @@ import org.alfresco.model.WCMModel;
import org.alfresco.service.cmr.repository.ContentService; import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.web.templating.*;
import org.alfresco.web.templating.extension.ExtensionFunctions;
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.apache.xalan.extensions.ExpressionContext; import org.apache.xalan.extensions.ExpressionContext;
@@ -49,13 +47,13 @@ import org.w3c.dom.traversal.NodeFilter;
import org.w3c.dom.traversal.NodeIterator; import org.w3c.dom.traversal.NodeIterator;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
public class XSLTOutputMethod public class XSLTRenderingEngine
extends AbstractFormDataRenderer extends AbstractRenderingEngine
{ {
private static final Log LOGGER = LogFactory.getLog(XSLTOutputMethod.class); private static final Log LOGGER = LogFactory.getLog(XSLTRenderingEngine.class);
public XSLTOutputMethod(final NodeRef nodeRef, public XSLTRenderingEngine(final NodeRef nodeRef,
final NodeService nodeService, final NodeService nodeService,
final ContentService contentService) final ContentService contentService)
{ {
@@ -66,7 +64,7 @@ public class XSLTOutputMethod
throws TransformerException throws TransformerException
{ {
final XObject o = ec.getVariableOrParam(new QName(ALFRESCO_NS, ALFRESCO_NS_PREFIX, "parent_path")); final XObject o = ec.getVariableOrParam(new QName(ALFRESCO_NS, ALFRESCO_NS_PREFIX, "parent_path"));
return o == null ? null : XSLTOutputMethod.toAVMPath(o.toString(), path); return o == null ? null : XSLTRenderingEngine.toAVMPath(o.toString(), path);
} }
public static Document getXMLDocument(final ExpressionContext ec, final String path) public static Document getXMLDocument(final ExpressionContext ec, final String path)
@@ -74,29 +72,29 @@ public class XSLTOutputMethod
IOException, IOException,
SAXException SAXException
{ {
final ExtensionFunctions ef = XSLTOutputMethod.getExtensionFunctions(); final FormDataFunctions ef = XSLTRenderingEngine.getFormDataFunctions();
return ef.getXMLDocument(XSLTOutputMethod.toAVMPath(ec, path)); return ef.getXMLDocument(XSLTRenderingEngine.toAVMPath(ec, path));
} }
public static NodeIterator getXMLDocuments(final ExpressionContext ec, public static NodeIterator getXMLDocuments(final ExpressionContext ec,
final String templateTypeName) final String formName)
throws TransformerException, throws TransformerException,
IOException, IOException,
SAXException SAXException
{ {
return XSLTOutputMethod.getXMLDocuments(ec, templateTypeName, ""); return XSLTRenderingEngine.getXMLDocuments(ec, formName, "");
} }
public static NodeIterator getXMLDocuments(final ExpressionContext ec, public static NodeIterator getXMLDocuments(final ExpressionContext ec,
final String templateTypeName, final String formName,
String path) String path)
throws TransformerException, throws TransformerException,
IOException, IOException,
SAXException SAXException
{ {
final ExtensionFunctions ef = XSLTOutputMethod.getExtensionFunctions(); final FormDataFunctions ef = XSLTRenderingEngine.getFormDataFunctions();
path = XSLTOutputMethod.toAVMPath(ec, path); path = XSLTRenderingEngine.toAVMPath(ec, path);
final Map<String, Document> resultMap = ef.getXMLDocuments(templateTypeName, path); final Map<String, Document> resultMap = ef.getXMLDocuments(formName, path);
LOGGER.debug("received " + resultMap.size() + " documents in " + path); LOGGER.debug("received " + resultMap.size() + " documents in " + path);
final List<Map.Entry<String, Document>> documents = final List<Map.Entry<String, Document>> documents =
new ArrayList<Map.Entry<String, Document>>(resultMap.entrySet()); new ArrayList<Map.Entry<String, Document>>(resultMap.entrySet());
@@ -211,26 +209,40 @@ public class XSLTOutputMethod
} }
public void generate(final Document xmlContent, public void generate(final Document xmlContent,
final TemplateType tt,
final Map<String, String> parameters, final Map<String, String> parameters,
final Writer out) final Writer out)
throws ParserConfigurationException, throws IOException,
TransformerConfigurationException, RenderingEngine.RenderingException
TransformerException,
SAXException,
IOException
{ {
// XXXarielb - dirty - fix this // XXXarielb - dirty - fix this
final String sandBoxUrl = (String)parameters.get("avm_store_url"); final String sandBoxUrl = (String)parameters.get("avm_store_url");
final TransformerFactory tf = TransformerFactory.newInstance(); final TransformerFactory tf = TransformerFactory.newInstance();
final TemplatingService ts = TemplatingService.getInstance(); final FormsService ts = FormsService.getInstance();
final Document xslDocument = ts.parseXML(this.getNodeRef()); Document xslDocument = null;
try
{
xslDocument = ts.parseXML(this.getNodeRef());
}
catch (final SAXException sax)
{
throw new RenderingEngine.RenderingException(sax);
}
this.addScript(xslDocument); this.addScript(xslDocument);
this.addParameters(parameters, xslDocument); this.addParameters(parameters, xslDocument);
final DOMSource source = new DOMSource(xslDocument); final DOMSource source = new DOMSource(xslDocument);
final Templates templates = tf.newTemplates(source);
final Transformer t = templates.newTransformer(); Transformer t = null;
try
{
final Templates templates = tf.newTemplates(source);
t = templates.newTransformer();
}
catch (TransformerConfigurationException tce)
{
LOGGER.error(tce);
throw new RenderingEngine.RenderingException(tce);
}
t.setURIResolver(new URIResolver() t.setURIResolver(new URIResolver()
{ {
public Source resolve(final String href, final String base) public Source resolve(final String href, final String base)
@@ -268,7 +280,7 @@ public class XSLTOutputMethod
catch (TransformerException e) catch (TransformerException e)
{ {
LOGGER.error(e.getMessageAndLocation()); LOGGER.error(e.getMessageAndLocation());
throw e; throw new RenderingEngine.RenderingException(e);
} }
} }
} }

View File

@@ -14,7 +14,7 @@
* language governing permissions and limitations under the * language governing permissions and limitations under the
* License. * License.
*/ */
package org.alfresco.web.templating.xforms; package org.alfresco.web.forms.xforms;
/** /**

View File

@@ -14,7 +14,7 @@
* language governing permissions and limitations under the * language governing permissions and limitations under the
* License. * License.
*/ */
package org.alfresco.web.templating.xforms; package org.alfresco.web.forms.xforms;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@@ -24,7 +24,7 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.*; import javax.xml.transform.*;
import org.alfresco.web.templating.*; import org.alfresco.web.forms.FormsService;
import org.apache.commons.jxpath.JXPathContext; import org.apache.commons.jxpath.JXPathContext;
import org.apache.commons.jxpath.Pointer; import org.apache.commons.jxpath.Pointer;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
@@ -2763,7 +2763,7 @@ public class SchemaFormBuilder
private Document createFormTemplate(final String formId) private Document createFormTemplate(final String formId)
{ {
final TemplatingService ts = TemplatingService.getInstance(); final FormsService ts = FormsService.getInstance();
final Document xForm = ts.newDocument(); final Document xForm = ts.newDocument();
final Element envelopeElement = this.wrapper.createEnvelope(xForm); final Element envelopeElement = this.wrapper.createEnvelope(xForm);
@@ -3479,7 +3479,7 @@ public class SchemaFormBuilder
final DOMImplementationLS lsImpl = (DOMImplementationLS) final DOMImplementationLS lsImpl = (DOMImplementationLS)
registry.getDOMImplementation("XML 1.0 LS 3.0"); registry.getDOMImplementation("XML 1.0 LS 3.0");
final TemplatingService ts = TemplatingService.getInstance(); final FormsService ts = FormsService.getInstance();
final LSInput in = lsImpl.createLSInput(); final LSInput in = lsImpl.createLSInput();
in.setStringData(ts.writeXMLToString(schemaDocument)); in.setStringData(ts.writeXMLToString(schemaDocument));

View File

@@ -14,7 +14,7 @@
* language governing permissions and limitations under the * language governing permissions and limitations under the
* License. * License.
*/ */
package org.alfresco.web.templating.xforms; package org.alfresco.web.forms.xforms;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
@@ -27,7 +27,9 @@ import org.w3c.dom.Element;
* *
* @author Sophie Ramel * @author Sophie Ramel
*/ */
public interface WrapperElementsBuilder { public interface WrapperElementsBuilder
{
/** /**
* create the wrapper element of the form (exemple_ "body" for HTML) * create the wrapper element of the form (exemple_ "body" for HTML)
* *

View File

@@ -14,7 +14,7 @@
* language governing permissions and limitations under the * language governing permissions and limitations under the
* License. * License.
*/ */
package org.alfresco.web.templating.xforms; package org.alfresco.web.forms.xforms;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;
@@ -32,8 +32,7 @@ import javax.servlet.http.HttpSession;
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.alfresco.web.bean.wcm.AVMConstants; import org.alfresco.web.bean.wcm.AVMConstants;
import org.alfresco.web.templating.*; import org.alfresco.web.forms.*;
import org.alfresco.web.templating.xforms.*;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import org.alfresco.web.bean.wcm.AVMBrowseBean; import org.alfresco.web.bean.wcm.AVMBrowseBean;
@@ -59,25 +58,25 @@ public class XFormsBean
{ {
private static final Log LOGGER = LogFactory.getLog(XFormsBean.class); private static final Log LOGGER = LogFactory.getLog(XFormsBean.class);
private TemplateType tt; private Form tt;
private TemplateInputMethod.InstanceData instanceData = null; private FormProcessor.InstanceData instanceData = null;
private ChibaBean chibaBean; private ChibaBean chibaBean;
private final LinkedList<XFormsEvent> eventLog = new LinkedList<XFormsEvent>(); private final LinkedList<XFormsEvent> eventLog = new LinkedList<XFormsEvent>();
/** @return the template type */ /** @return the form */
public TemplateType getTemplateType() public Form getForm()
{ {
return this.tt; return this.tt;
} }
/** @param tt the template type */ /** @param tt the template type */
public void setTemplateType(final TemplateType tt) public void setForm(final Form tt)
{ {
this.tt = tt; this.tt = tt;
} }
/** @param instanceData the instance data being modified. */ /** @param instanceData the instance data being modified. */
public void setInstanceData(final TemplateInputMethod.InstanceData instanceData) public void setInstanceData(final FormProcessor.InstanceData instanceData)
{ {
this.instanceData = instanceData; this.instanceData = instanceData;
} }
@@ -164,7 +163,7 @@ public class XFormsBean
final Map requestParameters = context.getExternalContext().getRequestParameterMap(); final Map requestParameters = context.getExternalContext().getRequestParameterMap();
LOGGER.debug("building xform for " + this.tt.getName()); LOGGER.debug("building xform for " + this.tt.getName());
final Node form = this.chibaBean.getXMLContainer(); final Node form = this.chibaBean.getXMLContainer();
final TemplatingService ts = TemplatingService.getInstance(); final FormsService ts = FormsService.getInstance();
ts.writeXML(form, out); ts.writeXML(form, out);
} }
@@ -186,7 +185,7 @@ public class XFormsBean
LOGGER.debug(this + " setXFormsValue(" + id + ", " + value + ")"); LOGGER.debug(this + " setXFormsValue(" + id + ", " + value + ")");
this.chibaBean.updateControlValue(id, value); this.chibaBean.updateControlValue(id, value);
final TemplatingService ts = TemplatingService.getInstance(); final FormsService ts = FormsService.getInstance();
final ResponseWriter out = context.getResponseWriter(); final ResponseWriter out = context.getResponseWriter();
ts.writeXML(this.getEventLog(), out); ts.writeXML(this.getEventLog(), out);
out.close(); out.close();
@@ -210,7 +209,7 @@ public class XFormsBean
LOGGER.debug(this + " setRepeatIndex(" + id + ", " + index + ")"); LOGGER.debug(this + " setRepeatIndex(" + id + ", " + index + ")");
this.chibaBean.updateRepeatIndex(id, index); this.chibaBean.updateRepeatIndex(id, index);
final TemplatingService ts = TemplatingService.getInstance(); final FormsService ts = FormsService.getInstance();
final ResponseWriter out = context.getResponseWriter(); final ResponseWriter out = context.getResponseWriter();
ts.writeXML(this.getEventLog(), out); ts.writeXML(this.getEventLog(), out);
out.close(); out.close();
@@ -231,7 +230,7 @@ public class XFormsBean
LOGGER.debug(this + " fireAction(" + id + ")"); LOGGER.debug(this + " fireAction(" + id + ")");
this.chibaBean.dispatch(id, XFormsEventFactory.DOM_ACTIVATE); this.chibaBean.dispatch(id, XFormsEventFactory.DOM_ACTIVATE);
final TemplatingService ts = TemplatingService.getInstance(); final FormsService ts = FormsService.getInstance();
final ResponseWriter out = context.getResponseWriter(); final ResponseWriter out = context.getResponseWriter();
ts.writeXML(this.getEventLog(), out); ts.writeXML(this.getEventLog(), out);
out.close(); out.close();
@@ -247,7 +246,7 @@ public class XFormsBean
final FacesContext context = FacesContext.getCurrentInstance(); final FacesContext context = FacesContext.getCurrentInstance();
final HttpServletRequest request = (HttpServletRequest) final HttpServletRequest request = (HttpServletRequest)
context.getExternalContext().getRequest(); context.getExternalContext().getRequest();
final TemplatingService ts = TemplatingService.getInstance(); final FormsService ts = FormsService.getInstance();
final Document result = ts.parseXML(request.getInputStream()); final Document result = ts.parseXML(request.getInputStream());
this.instanceData.setContent(result); this.instanceData.setContent(result);
@@ -283,7 +282,7 @@ public class XFormsBean
* Generates the xforms based on the schema. * Generates the xforms based on the schema.
*/ */
private Document buildXForm(Document xmlContent, private Document buildXForm(Document xmlContent,
final TemplateType tt, final Form tt,
final String cwdAvmPath, final String cwdAvmPath,
final HttpServletRequest request) final HttpServletRequest request)
throws FormBuilderException throws FormBuilderException
@@ -311,7 +310,7 @@ public class XFormsBean
private Node getEventLog() private Node getEventLog()
{ {
final TemplatingService ts = TemplatingService.getInstance(); final FormsService ts = FormsService.getInstance();
final Document result = ts.newDocument(); final Document result = ts.newDocument();
final Element eventsElement = result.createElement("events"); final Element eventsElement = result.createElement("events");
result.appendChild(eventsElement); result.appendChild(eventsElement);

View File

@@ -14,14 +14,14 @@
* language governing permissions and limitations under the * language governing permissions and limitations under the
* License. * License.
*/ */
package org.alfresco.web.templating.xforms; package org.alfresco.web.forms.xforms;
import java.io.*; import java.io.*;
import javax.faces.context.FacesContext; import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.ServletContext; import javax.servlet.ServletContext;
import org.alfresco.web.templating.*; import org.alfresco.web.forms.*;
import org.chiba.xml.util.DOMUtil; import org.chiba.xml.util.DOMUtil;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
@@ -32,12 +32,12 @@ import org.w3c.dom.Node;
import org.alfresco.web.app.servlet.FacesHelper; import org.alfresco.web.app.servlet.FacesHelper;
import org.chiba.xml.xforms.exception.XFormsException; import org.chiba.xml.xforms.exception.XFormsException;
public class XFormsInputMethod public class XFormsProcessor
implements TemplateInputMethod implements FormProcessor
{ {
private static final Log LOGGER = LogFactory.getLog(XFormsInputMethod.class); private static final Log LOGGER = LogFactory.getLog(XFormsProcessor.class);
public XFormsInputMethod() public XFormsProcessor()
{ {
} }
@@ -46,16 +46,16 @@ public class XFormsInputMethod
* call back into the XFormsBean and get the xform and build the ui. * call back into the XFormsBean and get the xform and build the ui.
*/ */
public void generate(final InstanceData instanceData, public void generate(final InstanceData instanceData,
final TemplateType tt, final Form tt,
final Writer out) final Writer out)
{ {
final TemplatingService ts = TemplatingService.getInstance(); final FormsService ts = FormsService.getInstance();
final FacesContext fc = FacesContext.getCurrentInstance(); final FacesContext fc = FacesContext.getCurrentInstance();
//make the XFormsBean available for this session //make the XFormsBean available for this session
final XFormsBean xforms = (XFormsBean) final XFormsBean xforms = (XFormsBean)
FacesHelper.getManagedBean(fc, "XFormsBean"); FacesHelper.getManagedBean(fc, "XFormsBean");
xforms.setInstanceData(instanceData); xforms.setInstanceData(instanceData);
xforms.setTemplateType(tt); xforms.setForm(tt);
try try
{ {
xforms.init(); xforms.init();

View File

@@ -14,7 +14,7 @@
* language governing permissions and limitations under the * language governing permissions and limitations under the
* License. * License.
*/ */
package org.alfresco.web.templating.xforms; package org.alfresco.web.forms.xforms;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;

View File

@@ -1,184 +0,0 @@
/*
* Copyright (C) 2005 Alfresco, Inc.
*
* Licensed under the Mozilla Public License version 1.1
* with a permitted attribution clause. You may obtain a
* copy of the License at
*
* http://www.alfresco.org/legal/license.txt
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*/
package org.alfresco.web.templating;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import org.alfresco.model.ContentModel;
import org.alfresco.model.WCMModel;
import org.alfresco.repo.avm.AVMNodeConverter;
import org.alfresco.service.cmr.avm.AVMNotFoundException;
import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.service.cmr.repository.ContentReader;
import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.ContentWriter;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.bean.wcm.AVMConstants;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.w3c.dom.Document;
/**
* temporary home of generate and regenerate functionality until i figure
* out a more general way of triggering generate in FormDataRenderer
* every time the xml file is saved.
*
* @author Ariel Backenroth
*/
public class OutputUtil
{
private static final Log LOGGER = LogFactory.getLog(OutputUtil.class);
private static String stripExtension(String s)
{
return s.replaceAll("(.+)\\..*", "$1");
}
public static void generate(String parentPath,
Document xml,
TemplateType tt,
String fileName,
ContentService contentService,
NodeService nodeService,
AVMService avmService)
throws Exception
{
try
{
for (FormDataRenderer tom : tt.getFormDataRenderers())
{
// get the node ref of the node that will contain the content
final String generatedFileName = stripExtension(fileName) + "." + tom.getFileExtension();
final OutputStream fileOut = avmService.createFile(parentPath, generatedFileName);
final String fullAvmPath = parentPath + '/' + generatedFileName;
final String avmStore = parentPath.substring(0, parentPath.indexOf(":/"));
final String sandBoxUrl = AVMConstants.buildAVMStoreUrl(avmStore);
if (LOGGER.isDebugEnabled())
LOGGER.debug("Created file node for file: " +
fullAvmPath);
final OutputStreamWriter out = new OutputStreamWriter(fileOut);
final HashMap<String, String> parameters =
getOutputMethodParameters(sandBoxUrl, fileName, generatedFileName, parentPath);
tom.generate(xml, tt, parameters, out);
out.close();
NodeRef outputNodeRef = AVMNodeConverter.ToNodeRef(-1, fullAvmPath);
Map<QName, Serializable> props = new HashMap<QName, Serializable>(2, 1.0f);
props.put(WCMModel.PROP_FORM_DERIVED_FROM, tt.getNodeRef());
props.put(WCMModel.PROP_FORM_DERIVED_FROM_NAME, tt.getName());
nodeService.addAspect(outputNodeRef, WCMModel.ASPECT_FORM_DERIVED, props);
props = new HashMap<QName, Serializable>(2, 1.0f);
props.put(WCMModel.PROP_FORM_TRANSFORMER_DERIVED_FROM, tom.getNodeRef());
props.put(WCMModel.PROP_PRIMARY_FORM_DERIVED,
AVMNodeConverter.ToNodeRef(-1, parentPath + fileName));
nodeService.addAspect(outputNodeRef, WCMModel.ASPECT_FORM_TRANSFORMER_DERIVED, props);
props = new HashMap<QName, Serializable>(1, 1.0f);
props.put(ContentModel.PROP_TITLE, fileName);
nodeService.addAspect(outputNodeRef, ContentModel.ASPECT_TITLED, props);
LOGGER.debug("generated " + generatedFileName + " using " + tom);
}
}
catch (Exception e)
{
LOGGER.error(e);
e.printStackTrace();
throw e;
}
}
public static void regenerate(final NodeRef nodeRef,
final ContentService contentService,
final NodeService nodeService,
final AVMService avmService)
throws Exception
{
try
{
final TemplatingService ts = TemplatingService.getInstance();
final NodeRef templateTypeNodeRef = (NodeRef)
nodeService.getProperty(nodeRef, WCMModel.PROP_FORM_DERIVED_FROM);
final TemplateType tt = ts.getTemplateType(templateTypeNodeRef);
final ContentReader reader = contentService.getReader(nodeRef, ContentModel.PROP_CONTENT);
final Document xml = ts.parseXML(reader.getContentInputStream());
final String fileName = (String)
nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
final String avmPath = AVMNodeConverter.ToAVMVersionPath(nodeRef).getSecond();
final String avmStore = avmPath.substring(0, avmPath.indexOf(":/"));
final String sandBoxUrl = AVMConstants.buildAVMStoreUrl(avmStore);
final String parentPath = AVMNodeConverter.SplitBase(avmPath)[0];
for (FormDataRenderer tom : tt.getFormDataRenderers())
{
final String generatedFileName = stripExtension(fileName) + "." + tom.getFileExtension();
if (LOGGER.isDebugEnabled())
LOGGER.debug("regenerating file node for : " + fileName + " (" +
nodeRef.toString() + ") to " + parentPath + "/" + generatedFileName);
// get a writer for the content and put the file
OutputStream out = null;
try
{
out = avmService.getFileOutputStream(parentPath + "/" + generatedFileName);
}
catch (AVMNotFoundException e)
{
out = avmService.createFile(parentPath, generatedFileName);
}
final OutputStreamWriter writer = new OutputStreamWriter(out);
final HashMap<String, String> parameters =
getOutputMethodParameters(sandBoxUrl, fileName, generatedFileName, parentPath);
tom.generate(xml, tt, parameters, writer);
writer.close();
LOGGER.debug("generated " + fileName + " using " + tom);
}
}
catch (Exception e)
{
LOGGER.error(e);
e.printStackTrace();
throw e;
}
}
private static HashMap<String, String> getOutputMethodParameters(final String sandBoxUrl,
final String fileName,
final String generatedFileName,
final String parentPath)
{
final HashMap<String, String> parameters = new HashMap<String, String>();
parameters.put("avm_store_url", sandBoxUrl);
parameters.put("derived_from_file_name", fileName);
parameters.put("generated_file_name", generatedFileName);
parameters.put("parent_path", parentPath);
return parameters;
}
}

View File

@@ -22,7 +22,7 @@ import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter; import javax.faces.context.ResponseWriter;
import javax.faces.el.ValueBinding; import javax.faces.el.ValueBinding;
import org.alfresco.web.templating.*; import org.alfresco.web.forms.*;
import org.alfresco.web.ui.common.component.SelfRenderingComponent; import org.alfresco.web.ui.common.component.SelfRenderingComponent;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
@@ -35,9 +35,9 @@ public class UIFormProcessor extends SelfRenderingComponent
private static final Log LOGGER = LogFactory.getLog(UIFormProcessor.class); private static final Log LOGGER = LogFactory.getLog(UIFormProcessor.class);
private TemplateInputMethod.InstanceData formInstanceData = null; private FormProcessor.InstanceData formInstanceData = null;
private TemplateType form = null; private Form form = null;
@@ -57,8 +57,8 @@ public class UIFormProcessor extends SelfRenderingComponent
final Object values[] = (Object[])state; final Object values[] = (Object[])state;
// standard component attributes are restored by the super class // standard component attributes are restored by the super class
super.restoreState(context, values[0]); super.restoreState(context, values[0]);
this.formInstanceData = (TemplateInputMethod.InstanceData)values[1]; this.formInstanceData = (FormProcessor.InstanceData)values[1];
this.form = (TemplateType)values[2]; this.form = (Form)values[2];
} }
public Object saveState(FacesContext context) public Object saveState(FacesContext context)
@@ -85,9 +85,9 @@ public class UIFormProcessor extends SelfRenderingComponent
} }
final ResponseWriter out = context.getResponseWriter(); final ResponseWriter out = context.getResponseWriter();
final TemplateType form = this.getForm(); final Form form = this.getForm();
final TemplateInputMethod.InstanceData formInstanceData = this.getFormInstanceData(); final FormProcessor.InstanceData formInstanceData = this.getFormInstanceData();
final TemplateInputMethod tim = form.getInputMethods().get(0); final FormProcessor tim = form.getFormProcessors().get(0);
tim.generate(formInstanceData, form, out); tim.generate(formInstanceData, form, out);
} }
@@ -99,12 +99,12 @@ public class UIFormProcessor extends SelfRenderingComponent
* *
* @return The instance data to render * @return The instance data to render
*/ */
public TemplateInputMethod.InstanceData getFormInstanceData() public FormProcessor.InstanceData getFormInstanceData()
{ {
final ValueBinding vb = getValueBinding("formInstanceData"); final ValueBinding vb = getValueBinding("formInstanceData");
if (vb != null) if (vb != null)
{ {
this.formInstanceData = (TemplateInputMethod.InstanceData)vb.getValue(getFacesContext()); this.formInstanceData = (FormProcessor.InstanceData)vb.getValue(getFacesContext());
} }
return this.formInstanceData; return this.formInstanceData;
@@ -115,7 +115,7 @@ public class UIFormProcessor extends SelfRenderingComponent
* *
* @param formInstanceData The instance data to render * @param formInstanceData The instance data to render
*/ */
public void setFormInstanceData(final TemplateInputMethod.InstanceData formInstanceData) public void setFormInstanceData(final FormProcessor.InstanceData formInstanceData)
{ {
this.formInstanceData = formInstanceData; this.formInstanceData = formInstanceData;
} }
@@ -125,12 +125,12 @@ public class UIFormProcessor extends SelfRenderingComponent
* *
* @return The form * @return The form
*/ */
public TemplateType getForm() public Form getForm()
{ {
final ValueBinding vb = getValueBinding("form"); final ValueBinding vb = getValueBinding("form");
if (vb != null) if (vb != null)
{ {
this.form = (TemplateType)vb.getValue(getFacesContext()); this.form = (Form)vb.getValue(getFacesContext());
} }
return this.form; return this.form;
@@ -141,7 +141,7 @@ public class UIFormProcessor extends SelfRenderingComponent
* *
* @param form The form * @param form The form
*/ */
public void setForm(final TemplateType form) public void setForm(final Form form)
{ {
this.form = form; this.form = form;
} }

View File

@@ -2723,7 +2723,7 @@
Bean that returns information on a node Bean that returns information on a node
</description> </description>
<managed-bean-name>XFormsBean</managed-bean-name> <managed-bean-name>XFormsBean</managed-bean-name>
<managed-bean-class>org.alfresco.web.templating.xforms.XFormsBean</managed-bean-class> <managed-bean-class>org.alfresco.web.forms.xforms.XFormsBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope> <managed-bean-scope>session</managed-bean-scope>
</managed-bean> </managed-bean>
</faces-config> </faces-config>

View File

@@ -21,6 +21,7 @@
<jsp:directive.page import="java.io.*"/> <jsp:directive.page import="java.io.*"/>
<jsp:directive.page import="org.alfresco.web.bean.FileUploadBean"/> <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 buffer="32kb" contentType="text/html;charset=UTF-8"/>
<jsp:directive.page isELIgnored="false"/> <jsp:directive.page isELIgnored="false"/>
@@ -49,10 +50,10 @@
<h:graphicImage id="required_image_pt" <h:graphicImage id="required_image_pt"
value="/images/icons/required_field.gif" alt="Required Field" /> value="/images/icons/required_field.gif" alt="Required Field" />
<h:outputText id="output_text_pt" <h:outputText id="output_text_pt"
value="#{msg.template_output_method_file}:"/> value="#{msg.rendering_engine_file}:"/>
<% <%
final FileUploadBean upload = (FileUploadBean) final FileUploadBean upload = (FileUploadBean)
session.getAttribute(FileUploadBean.getKey("template-output-method")); session.getAttribute(FileUploadBean.getKey(CreateFormWizard.FILE_RENDERING_ENGINE));
if (upload == null || upload.getFile() == null) if (upload == null || upload.getFile() == null)
{ {
%> %>

View File

@@ -104,6 +104,6 @@ if (upload == null || upload.getFile() == null)
</h:selectOneMenu> </h:selectOneMenu>
<h:graphicImage id="graphic_image_name" value="/images/icons/required_field.gif" alt="Required Field" /> <h:graphicImage id="graphic_image_name" value="/images/icons/required_field.gif" alt="Required Field" />
<h:outputText id="output_text_name" value="#{msg.name}:"/> <h:outputText id="output_text_name" value="#{msg.name}:"/>
<h:inputText id="file-name" value="#{WizardManager.bean.templateName}" <h:inputText id="file-name" value="#{WizardManager.bean.formName}"
maxlength="1024" size="35"/> maxlength="1024" size="35"/>
</h:panelGrid> </h:panelGrid>

View File

@@ -29,4 +29,4 @@ function _xforms_getSubmitButtons()
</script> </script>
<wcm:formProcessor id="form-data-renderer" <wcm:formProcessor id="form-data-renderer"
formInstanceData="#{WizardManager.bean.instanceData}" formInstanceData="#{WizardManager.bean.instanceData}"
form="#{WizardManager.bean.templateType}"/> form="#{WizardManager.bean.form}"/>

View File

@@ -105,7 +105,7 @@ function _xforms_getSubmitButtons()
<wcm:formProcessor id="form-data-renderer" <wcm:formProcessor id="form-data-renderer"
formInstanceData="#{AVMEditBean.instanceData}" formInstanceData="#{AVMEditBean.instanceData}"
form="#{AVMEditBean.templateType}"/> form="#{AVMEditBean.form}"/>
<% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "white"); %> <% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "white"); %>
</td> </td>