- adding a primitive select default workflow screen

- improved output path expressions
- got the details screen pretty much in sync with wireframes.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@4358 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Ariel Backenroth
2006-11-15 04:25:07 +00:00
parent b800048730
commit 67aab090e5
13 changed files with 277 additions and 199 deletions

View File

@@ -641,23 +641,30 @@ text_content=Plain Text Content
html_content=HTML Content
xml_content=XML Content
create_form_title=Create Form Wizard
create_form_desc=Create an XML Form definition from XML Schema and Rendering Engines
create_form_step1_title=Upload an XML Schema
create_form_step1_desc=Upload an XML Schema
create_form_step2_title=Configure Rendering Engines
create_form_step2_desc=Select rendering engines and rendering engine template to render form instance data processed by the form.
create_form_desc=This wizard helps you create a new form.
create_form_form_details_title=Step One - Specify details
create_form_form_details_desc=Enter information about the web form you want to create.
create_form_form_details_step1_desc=Select XML schema to use
create_form_form_details_step2_desc=Specify details for new form.
create_form_form_details_no_schema_selected=<no schema selected>
create_form_configure_rendering_engine_templates_title=Step Two - Configure Rendering Engine Templates
create_form_configure_rendering_engine_templates_desc=Enter information about the rendering engine templates you want to use for this form.
create_form_select_default_workflow_title=Stop Three - Select default workflow
create_form_select_default_workflow_desc=Select the workflow you want to be used by default for this form.
selected_rendering_engines=Selected Rendering Engines
configure_rendering_engines_step1_desc=Upload rendering engine template and specify the extension to use for its renditions.
create_form_configure_rendering_engines_title=Configure Rendering Engines
create_form_configure_rendering_engines_step1_desc=Upload rendering engine template and specify the extension to use for its renditions.
rendering_engine_file=Rendering Engine Template File
rendering_engine_type=Rendering Engine Type
extension_for_renditions=Extension for renditions
output_path_pattern=Output path pattern
mimetype_for_renditions=Mimetype for renditions
file_extension=Extension
schema=Schema
schema_root_element_name=Root Element
edit_xml_schema=Edit XML Schema
schema_root_element_name=Root element
form=Form
configure_rendering_engines=Configure Rendering Engines
# Rule and Action Wizard messages
run_action_title=Run Action Wizard

View File

@@ -57,9 +57,6 @@
<constructor-arg>
<ref bean="AVMService" />
</constructor-arg>
<constructor-arg>
<ref bean="TemplateService" />
</constructor-arg>
</bean>
</beans>

View File

@@ -238,21 +238,33 @@
</wizard>
<!-- Definition of the Create XML Type wizard -->
<wizard name="createForm" managed-bean="CreateFormWizard"
title-id="create_form_title" description-id="create_form_desc"
<wizard name="createForm"
managed-bean="CreateFormWizard"
title-id="create_form_title"
description-id="create_form_desc"
icon="/images/icons/new_content_large.gif">
<step name="details" title-id="details" description-id="create_form_step1_desc">
<step name="form_details"
title-id="create_form_form_details_title"
description-id="create_form_form_details_desc">
<page path="/jsp/wcm/create-form-wizard/details.jsp"
title-id="create_form_step1_title"
description-id="create_form_step1_desc"
title-id="create_form_form_details_title"
description-id="create_form_form_details_desc"
instruction-id="default_instruction" />
</step>
<step name="configure_rendering_engines"
title-id="configure_rendering_engines"
description-id="create_form_step2_desc">
<step name="configure_rendering_engine_templates"
title-id="create_form_configure_rendering_engine_templates_title"
description-id="create_form_configure_rendering_engine_templates_desc">
<page path="/jsp/wcm/create-form-wizard/configure-rendering-engines.jsp"
title-id="create_form_step2_title"
description-id="create_form_step2_desc"
title-id="create_form_configure_rendering_engine_templates_title"
description-id="create_form_configure_rendering_engine_templates_desc"
instruction-id="default_instruction" />
</step>
<step name="select_default_workflow"
title-id="create_form_select_default_workflow_title"
description-id="create_form_select_default_workflow_desc">
<page path="/jsp/wcm/create-form-wizard/select-default-workflow.jsp"
title-id="create_form_select_default_workflow_title"
description-id="create_form_select_default_workflow_desc"
instruction-id="default_instruction" />
</step>
<step name="summary" title-id="summary" description-id="summary_step_description">

View File

@@ -70,7 +70,7 @@
<from-email-address>alfresco@alfresco.org</from-email-address>
<!-- WCM domain and port for virtualisation server -->
<wcm-domain>127-0-0-1.ip.alfrescodemo.net</wcm-domain>
<wcm-domain>arielbackenroth.dyndns.org</wcm-domain>
<wcm-port>8180</wcm-port>
</client>
</config>

View File

@@ -41,6 +41,8 @@ import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.ContentWriter;
import org.alfresco.service.cmr.repository.MimetypeService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.workflow.WorkflowDefinition;
import org.alfresco.service.cmr.workflow.WorkflowService;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.FileUploadBean;
@@ -49,7 +51,9 @@ import org.alfresco.web.data.IDataContainer;
import org.alfresco.web.data.QuickSort;
import org.alfresco.web.forms.*;
import org.alfresco.web.forms.xforms.SchemaFormBuilder;
import org.alfresco.web.ui.common.component.UIListItem;
import org.alfresco.web.ui.common.Utils;
import org.alfresco.web.ui.wcm.WebResources;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.xerces.xs.*;
@@ -135,13 +139,15 @@ public class CreateFormWizard
private final static Log LOGGER = LogFactory.getLog(CreateFormWizard.class);
private String schemaRootElementName;
private String formName;
private String formTitle;
private String formDescription;
private String schemaRootElementName = null;
private String formName = null;
private String formTitle = null;
private String formDescription = null;
private String defaultWorkflowId = null;
private RenderingEngine renderingEngine = null;
protected ContentService contentService;
protected MimetypeService mimetypeService;
protected WorkflowService workflowService;
private DataModel renderingEngineTemplatesDataModel;
private List<RenderingEngineTemplateData> renderingEngineTemplates = null;
private String outputPathPatternForFormInstanceData = null;
@@ -191,6 +197,10 @@ public class CreateFormWizard
this.getSchemaRootElementName());
props.put(WCMModel.PROP_OUTPUT_PATH_PATTERN_FOR_FORM_INSTANCE_DATA,
this.getOutputPathPatternForFormInstanceData());
if (this.defaultWorkflowId != null)
{
props.put(WCMModel.PROP_DEFAULT_WORKFLOW_ID, this.defaultWorkflowId);
}
this.nodeService.addAspect(folderInfo.getNodeRef(), WCMModel.ASPECT_FORM, props);
for (RenderingEngineTemplateData retd : this.renderingEngineTemplates)
@@ -272,6 +282,7 @@ public class CreateFormWizard
this.outputPathPatternForFormInstanceData = null;
this.outputPathPatternForRendition = null;
this.mimetypeForRendition = null;
this.defaultWorkflowId = null;
}
@Override
@@ -318,11 +329,9 @@ public class CreateFormWizard
*/
public String getOutputPathPatternForRendition()
{
if (this.outputPathPatternForRendition == null && this.mimetypeForRendition != null)
if (this.outputPathPatternForRendition == null)
{
this.outputPathPatternForRendition =
("${formInstanceData.name}." +
this.mimetypeService.getExtension(this.mimetypeForRendition));
this.outputPathPatternForRendition = "${name}.${extension}";
}
return this.outputPathPatternForRendition;
}
@@ -655,7 +664,7 @@ public class CreateFormWizard
{
if (this.outputPathPatternForFormInstanceData == null)
{
this.outputPathPatternForFormInstanceData = "${formInstanceData.name}.xml";
this.outputPathPatternForFormInstanceData = "${name}.xml";
}
return this.outputPathPatternForFormInstanceData;
}
@@ -702,6 +711,54 @@ public class CreateFormWizard
return this.formDescription;
}
public void setDefaultWorkflowId(final String[] defaultWorkflowId)
{
assert defaultWorkflowId.length == 1;
this.defaultWorkflowId = ("no_default_workflow_selected".equals(defaultWorkflowId[0])
? null
: defaultWorkflowId[0]);
}
public String[] getDefaultWorkflowId()
{
return new String[] {
(this.defaultWorkflowId == null
? "no_default_workflow_selected"
: this.defaultWorkflowId)
};
}
/**
* @return List of UI items to represent the available Workflows for all websites
*/
public List<UIListItem> getDefaultWorkflowChoices()
{
// TODO: add list of workflows from config
// @see org.alfresco.web.wcm.FormDetailsDialog#getWorkflowList()
final List<WorkflowDefinition> workflowDefs = this.workflowService.getDefinitions();
final List<UIListItem> result = new ArrayList<UIListItem>(workflowDefs.size() + 1);
UIListItem item = new UIListItem();
item.setValue("no_default_workflow_selected");
item.setLabel("None");
item.setDescription("");
item.setImage(WebResources.IMAGE_WORKFLOW_32);
result.add(item);
for (WorkflowDefinition workflowDef : workflowDefs)
{
item = new UIListItem();
item.setValue(workflowDef.id);
item.setLabel(workflowDef.title);
item.setDescription(workflowDef.description);
item.setImage(WebResources.IMAGE_WORKFLOW_32);
result.add(item);
}
return result;
}
/**
* @return Returns the summary data for the wizard.
*/
@@ -743,6 +800,14 @@ public class CreateFormWizard
this.mimetypeService = mimetypeService;
}
/**
* @param workflowService The workflowService to set.
*/
public void setWorkflowService(final WorkflowService workflowService)
{
this.workflowService = workflowService;
}
// ------------------------------------------------------------------------------
// Helper Methods

View File

@@ -1021,6 +1021,11 @@ public class CreateWebsiteWizard extends BaseWizardBean
*/
public WorkflowWrapper getWorkflow()
{
WorkflowDefinition wf = this.form.getDefaultWorkflow();
if (this.workflow == null && wf != null)
{
this.workflow = new WorkflowWrapper(wf.name);
}
return this.workflow;
}

View File

@@ -17,6 +17,7 @@
package org.alfresco.web.forms;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.workflow.WorkflowDefinition;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
import java.io.IOException;
@@ -45,6 +46,12 @@ public interface Form
/** the output path pattern for form instance data */
public String getOutputPathPattern();
/**
* @return the default workflow associated with this form or <tt>null</tt>
* if none is configured.
*/
public WorkflowDefinition getDefaultWorkflow();
/** the xml schema for this template type */
public Document getSchema()
throws IOException, SAXException;

View File

@@ -27,16 +27,21 @@ import java.io.*;
import java.net.URI;
import java.io.Serializable;
import java.util.*;
import javax.faces.context.FacesContext;
import org.alfresco.model.ContentModel;
import org.alfresco.model.WCMModel;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.repository.AssociationRef;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.TemplateService;
import org.alfresco.service.cmr.workflow.WorkflowDefinition;
import org.alfresco.service.cmr.workflow.WorkflowService;
import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.RegexQNamePattern;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.wcm.AVMConstants;
import org.alfresco.web.forms.xforms.XFormsProcessor;
import org.alfresco.web.app.servlet.DownloadContentServlet;
@@ -51,9 +56,6 @@ public class FormImpl
private static final Log LOGGER = LogFactory.getLog(FormImpl.class);
private final NodeRef folderNodeRef;
private final NodeService nodeService;
private final ContentService contentService;
private final TemplateService templateService;
private final static LinkedList<FormProcessor> PROCESSORS =
new LinkedList<FormProcessor>();
@@ -62,87 +64,56 @@ public class FormImpl
FormImpl.PROCESSORS.add(new XFormsProcessor());
}
public FormImpl(final NodeRef folderNodeRef,
final NodeService nodeService,
final ContentService contentService,
final TemplateService templateService)
public FormImpl(final NodeRef folderNodeRef)
{
this.folderNodeRef = folderNodeRef;
this.nodeService = nodeService;
this.contentService = contentService;
this.templateService = templateService;
}
public String getName()
{
return (String)
this.nodeService.getProperty(this.folderNodeRef,
final NodeService nodeService = this.getServiceRegistry().getNodeService();
return (String)nodeService.getProperty(this.folderNodeRef,
ContentModel.PROP_TITLE);
}
public String getDescription()
{
return (String)
this.nodeService.getProperty(this.folderNodeRef,
final NodeService nodeService = this.getServiceRegistry().getNodeService();
return (String)nodeService.getProperty(this.folderNodeRef,
ContentModel.PROP_DESCRIPTION);
}
public String getOutputPathPattern()
{
return (String)
this.nodeService.getProperty(this.folderNodeRef,
final NodeService nodeService = this.getServiceRegistry().getNodeService();
return (String)nodeService.getProperty(this.folderNodeRef,
WCMModel.PROP_OUTPUT_PATH_PATTERN_FOR_FORM_INSTANCE_DATA);
}
public WorkflowDefinition getDefaultWorkflow()
{
final NodeService nodeService = this.getServiceRegistry().getNodeService();
final String defaultWorkflowId = (String)nodeService.getProperty(this.folderNodeRef,
WCMModel.PROP_DEFAULT_WORKFLOW_ID);
final WorkflowService workflowService = this.getServiceRegistry().getWorkflowService();
return (defaultWorkflowId != null
? workflowService.getDefinitionById(defaultWorkflowId)
: null);
}
public String getOutputPathForFormInstanceData(final String parentAVMPath,
final String formInstanceDataFileName,
final String formInstanceDataName,
final Document formInstanceData)
{
final String outputPathPattern = (String)
this.nodeService.getProperty(this.folderNodeRef,
WCMModel.PROP_OUTPUT_PATH_PATTERN_FOR_FORM_INSTANCE_DATA);
final String outputPathPattern = this.getOutputPathPattern();
final TemplateHashModel formInstanceDataModel = new TemplateHashModel()
{
private TemplateModel formInstanceDataModel;
public TemplateModel get(final String key)
{
LOGGER.debug("looking up property " + key);
if ("xml".equals(key))
{
try
{
if (formInstanceDataModel == null)
{
formInstanceDataModel = NodeModel.wrap(formInstanceData);
}
return formInstanceDataModel;
}
catch (Exception e)
{
LOGGER.error(e);
return null;
}
}
else if ("name".equals(key))
{
return new SimpleScalar(formInstanceDataFileName);
}
return null;
}
public boolean isEmpty()
{
return false;
}
};
final Map<String, TemplateModel> root = new HashMap<String, TemplateModel>();
root.put("formInstanceData", formInstanceDataModel);
final Map<String, Object> root = new HashMap<String, Object>();
root.put("xml", NodeModel.wrap(formInstanceData));
root.put("name", formInstanceDataName);
root.put("date", new SimpleDate(new Date(), SimpleDate.DATETIME));
final TemplateService templateService = this.getServiceRegistry().getTemplateService();
String result = templateService.processTemplateString(null,
outputPathPattern,
new SimpleHash(root));
@@ -153,8 +124,8 @@ public class FormImpl
public String getSchemaRootElementName()
{
return (String)
this.nodeService.getProperty(folderNodeRef,
final NodeService nodeService = this.getServiceRegistry().getNodeService();
return (String)nodeService.getProperty(folderNodeRef,
WCMModel.PROP_XML_SCHEMA_ROOT_ELEMENT_NAME);
}
@@ -163,8 +134,8 @@ public class FormImpl
SAXException
{
final FormsService ts = FormsService.getInstance();
final NodeRef schemaNodeRef = (NodeRef)
this.nodeService.getProperty(folderNodeRef,
final NodeService nodeService = this.getServiceRegistry().getNodeService();
final NodeRef schemaNodeRef = (NodeRef)nodeService.getProperty(folderNodeRef,
WCMModel.PROP_XML_SCHEMA);
return ts.parseXML(schemaNodeRef);
}
@@ -182,24 +153,21 @@ public class FormImpl
public List<RenderingEngineTemplate> getRenderingEngineTemplates()
{
final List<AssociationRef> refs = this.nodeService.getTargetAssocs(this.folderNodeRef,
final NodeService nodeService = this.getServiceRegistry().getNodeService();
final List<AssociationRef> refs = nodeService.getTargetAssocs(this.folderNodeRef,
WCMModel.ASSOC_RENDERING_ENGINE_TEMPLATES);
final List<RenderingEngineTemplate> result = new ArrayList<RenderingEngineTemplate>(refs.size());
for (AssociationRef assoc : refs)
{
final NodeRef retNodeRef = assoc.getTargetRef();
for (ChildAssociationRef assoc2 : this.nodeService.getChildAssocs(retNodeRef,
for (ChildAssociationRef assoc2 : nodeService.getChildAssocs(retNodeRef,
WCMModel.ASSOC_RENDITION_PROPERTIES,
RegexQNamePattern.MATCH_ALL))
{
final NodeRef renditionPropertiesNodeRef = assoc2.getChildRef();
final RenderingEngineTemplate ret =
new RenderingEngineTemplateImpl(retNodeRef,
renditionPropertiesNodeRef,
this.nodeService,
this.contentService,
this.templateService);
new RenderingEngineTemplateImpl(retNodeRef, renditionPropertiesNodeRef);
LOGGER.debug("loaded rendering engine template " + ret);
result.add(ret);
}
@@ -209,10 +177,11 @@ public class FormImpl
public void registerFormInstanceData(final NodeRef formInstanceDataNodeRef)
{
final NodeService nodeService = this.getServiceRegistry().getNodeService();
final Map<QName, Serializable> props = new HashMap<QName, Serializable>(2, 1.0f);
props.put(WCMModel.PROP_PARENT_FORM, this.folderNodeRef);
props.put(WCMModel.PROP_PARENT_FORM_NAME, this.getName());
this.nodeService.addAspect(formInstanceDataNodeRef, WCMModel.ASPECT_FORM_INSTANCE_DATA, props);
nodeService.addAspect(formInstanceDataNodeRef, WCMModel.ASPECT_FORM_INSTANCE_DATA, props);
}
public int hashCode()
@@ -228,4 +197,10 @@ public class FormImpl
"renderingEngineTemplates: " + this.getRenderingEngineTemplates() +
"}");
}
private ServiceRegistry getServiceRegistry()
{
final FacesContext fc = FacesContext.getCurrentInstance();
return Repository.getServiceRegistry(fc);
}
}

View File

@@ -55,6 +55,7 @@ import org.alfresco.service.cmr.model.FileFolderService;
import org.alfresco.service.cmr.repository.AssociationRef;
import org.alfresco.service.cmr.repository.ContentReader;
import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.MimetypeService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.TemplateService;
@@ -105,7 +106,6 @@ public final class FormsService
private final NamespaceService namespaceService;
private final SearchService searchService;
private final AVMService avmService;
private final TemplateService templateService;
private NodeRef contentFormsNodeRef;
@@ -116,8 +116,7 @@ public final class FormsService
final DictionaryService dictionaryService,
final NamespaceService namespaceService,
final SearchService searchService,
final AVMService avmService,
final TemplateService templateService)
final AVMService avmService)
{
this.contentService = contentService;
this.nodeService = nodeService;
@@ -126,7 +125,6 @@ public final class FormsService
this.namespaceService = namespaceService;
this.searchService = searchService;
this.avmService = avmService;
this.templateService = templateService;
if (INSTANCE == null)
INSTANCE = this;
}
@@ -266,10 +264,7 @@ public final class FormsService
{
if (LOGGER.isDebugEnabled())
LOGGER.debug("loading form for " + nodeRef);
final Form result = new FormImpl(nodeRef,
this.nodeService,
this.contentService,
this.templateService);
final Form result = new FormImpl(nodeRef);
if (LOGGER.isDebugEnabled())
LOGGER.debug("loaded form " + result);
return result;

View File

@@ -29,15 +29,20 @@ import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import javax.faces.context.FacesContext;
import org.alfresco.model.ContentModel;
import org.alfresco.model.WCMModel;
import org.alfresco.repo.avm.AVMNodeConverter;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.repository.ContentReader;
import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.MimetypeService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.TemplateNode;
import org.alfresco.service.cmr.repository.TemplateService;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.wcm.AVMConstants;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -54,41 +59,31 @@ public class RenderingEngineTemplateImpl
private final NodeRef nodeRef;
private final NodeRef renditionPropertiesNodeRef;
private final NodeService nodeService;
private final ContentService contentService;
private final TemplateService templateService;
protected RenderingEngineTemplateImpl(final NodeRef nodeRef,
final NodeRef renditionPropertiesNodeRef,
final NodeService nodeService,
final ContentService contentService,
final TemplateService templateService)
final NodeRef renditionPropertiesNodeRef)
{
this.nodeRef = nodeRef;
this.renditionPropertiesNodeRef = renditionPropertiesNodeRef;
this.nodeService = nodeService;
this.contentService = contentService;
this.templateService = templateService;
}
public String getName()
{
return (String)
this.nodeService.getProperty(this.nodeRef,
ContentModel.PROP_NAME);
final NodeService nodeService = this.getServiceRegistry().getNodeService();
return (String)nodeService.getProperty(this.nodeRef, ContentModel.PROP_NAME);
}
public String getDescription()
{
return (String)
this.nodeService.getProperty(this.nodeRef,
final NodeService nodeService = this.getServiceRegistry().getNodeService();
return (String)nodeService.getProperty(this.nodeRef,
ContentModel.PROP_DESCRIPTION);
}
public String getOutputPathPattern()
{
return (String)
this.nodeService.getProperty(this.renditionPropertiesNodeRef,
final NodeService nodeService = this.getServiceRegistry().getNodeService();
return (String)nodeService.getProperty(this.renditionPropertiesNodeRef,
WCMModel.PROP_OUTPUT_PATH_PATTERN_FOR_RENDITION);
}
@@ -105,8 +100,9 @@ public class RenderingEngineTemplateImpl
public InputStream getInputStream()
throws IOException
{
final ContentService contentService = this.getServiceRegistry().getContentService();
final ContentReader contentReader =
this.contentService.getReader(this.nodeRef, ContentModel.TYPE_CONTENT);
contentService.getReader(this.nodeRef, ContentModel.TYPE_CONTENT);
return contentReader.getContentInputStream();
}
@@ -117,8 +113,9 @@ public class RenderingEngineTemplateImpl
*/
public RenderingEngine getRenderingEngine()
{
final NodeService nodeService = this.getServiceRegistry().getNodeService();
final String renderingEngineName = (String)
this.nodeService.getProperty(this.nodeRef,
nodeService.getProperty(this.nodeRef,
WCMModel.PROP_PARENT_RENDERING_ENGINE_NAME);
final FormsService fs = FormsService.getInstance();
return fs.getRenderingEngine(renderingEngineName);
@@ -131,62 +128,37 @@ public class RenderingEngineTemplateImpl
*/
public String getOutputPathForRendition(final NodeRef formInstanceDataNodeRef)
{
final ServiceRegistry sr = this.getServiceRegistry();
final NodeService nodeService = this.getServiceRegistry().getNodeService();
final String outputPathPattern = (String)
this.nodeService.getProperty(this.renditionPropertiesNodeRef,
nodeService.getProperty(this.renditionPropertiesNodeRef,
WCMModel.PROP_OUTPUT_PATH_PATTERN_FOR_RENDITION);
final String formInstanceDataAVMPath =
AVMNodeConverter.ToAVMVersionPath(formInstanceDataNodeRef).getSecond();
final TemplateHashModel formInstanceDataModel = new TemplateHashModel()
{
private TemplateModel formInstanceDataModel;
final Map<String, Object> root = new HashMap<String, Object>();
final String formInstanceDataName = (String)
sr.getNodeService().getProperty(formInstanceDataNodeRef, ContentModel.PROP_NAME);
root.put("name",
formInstanceDataName.replaceAll("(.+)\\..*", "$1"));
root.put("extension",
sr.getMimetypeService().getExtension(this.getMimetypeForRendition()));
public TemplateModel get(final String key)
{
LOGGER.debug("looking up property " + key);
if ("xml".equals(key))
{
try
{
if (formInstanceDataModel == null)
{
final FormsService fs = FormsService.getInstance();
final Document formInstanceData = fs.parseXML(formInstanceDataNodeRef);
formInstanceDataModel = NodeModel.wrap(formInstanceData);
}
return formInstanceDataModel;
root.put("xml", NodeModel.wrap(fs.parseXML(formInstanceDataNodeRef)));
}
catch (Exception e)
{
LOGGER.error(e);
return null;
}
}
else
{
final Map<QName, Serializable> properties =
nodeService.getProperties(formInstanceDataNodeRef);
for (QName qname : properties.keySet())
{
if (qname.getLocalName().equals(key))
{
return new SimpleScalar((String)properties.get(qname));
}
}
}
return null;
}
public boolean isEmpty()
{
return false;
}
};
final Map<String, TemplateModel> root = new HashMap<String, TemplateModel>();
root.put("formInstanceData", formInstanceDataModel);
root.put("node", new TemplateNode(formInstanceDataNodeRef, sr, null));
root.put("date", new SimpleDate(new Date(), SimpleDate.DATETIME));
final TemplateService templateService = sr.getTemplateService();
String result = templateService.processTemplateString(null,
outputPathPattern,
new SimpleHash(root));
@@ -203,17 +175,25 @@ public class RenderingEngineTemplateImpl
*/
public String getMimetypeForRendition()
{
return (String)
this.nodeService.getProperty(this.renditionPropertiesNodeRef,
final NodeService nodeService = this.getServiceRegistry().getNodeService();
return (String)nodeService.getProperty(this.renditionPropertiesNodeRef,
WCMModel.PROP_MIMETYPE_FOR_RENDITION);
}
public void registerRendition(final NodeRef renditionNodeRef,
final NodeRef primaryFormInstanceDataNodeRef)
{
final NodeService nodeService = this.getServiceRegistry().getNodeService();
final Map<QName, Serializable> props = new HashMap<QName, Serializable>(2, 1.0f);
props.put(WCMModel.PROP_PARENT_RENDERING_ENGINE_TEMPLATE, this.nodeRef);
props.put(WCMModel.PROP_PRIMARY_FORM_INSTANCE_DATA, primaryFormInstanceDataNodeRef);
this.nodeService.addAspect(renditionNodeRef, WCMModel.ASPECT_RENDITION, props);
nodeService.addAspect(renditionNodeRef, WCMModel.ASPECT_RENDITION, props);
}
private ServiceRegistry getServiceRegistry()
{
final FacesContext fc = FacesContext.getCurrentInstance();
return Repository.getServiceRegistry(fc);
}
}

View File

@@ -2070,6 +2070,10 @@
<property-name>mimetypeService</property-name>
<value>#{MimetypeService}</value>
</managed-property>
<managed-property>
<property-name>workflowService</property-name>
<value>#{WorkflowService}</value>
</managed-property>
</managed-bean>
<managed-bean>

View File

@@ -61,7 +61,9 @@
<h:panelGrid id="panel_grid_2"
columns="1" cellpadding="3" cellspacing="3" border="0" width="100%">
<h:outputText id="step-1-text" value="1. #{msg.create_form_details_step1_desc}" escape="false" />
<h:outputText id="step-1-text"
value="1. #{msg.create_form_form_details_step1_desc}"
escape="false" />
<h:panelGrid id="schema_panel_grid"
columns="3" cellpadding="3" cellspacing="3" border="0" width="100%">
@@ -113,11 +115,11 @@ if (upload == null || upload.getFile() == null)
</h:selectOneMenu>
<h:outputText id="schema-root-element-name-no-choices"
rendered="#{empty WizardManager.bean.schemaRootElementNameChoices}"
value="#{msg.no_schema_selected}"/>
value="#{msg.create_form_form_details_no_schema_selected}"/>
</h:panelGrid>
<h:outputText id="step-2-text" value="2. #{msg.create_form_details_step2_desc}" escape="false" />
<h:outputText id="step-2-text" value="2. #{msg.create_form_form_details_step2_desc}" escape="false" />
<h:panelGrid id="details_panel_grid"
columns="3" cellpadding="3" cellspacing="3" border="0" width="100%">
@@ -149,7 +151,7 @@ if (upload == null || upload.getFile() == null)
value="/images/icons/required_field.gif"
alt="Required Field" />
<h:outputText id="output_text_form_instance_data_output_path_pattern"
value="#{msg.form_instance_data_output_path_pattern}:"/>
value="#{msg.output_path_pattern}:"/>
<h:inputText id="form_instance_data_output_path_pattern"
value="#{WizardManager.bean.outputPathPatternForFormInstanceData}"
style="width:100%"/>

View File

@@ -0,0 +1,29 @@
<%--
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.
--%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %>
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
<h:panelGroup>
<f:verbatim><div style="height:108px;*height:112px;width:300px;overflow:auto" class="selectListTable"></f:verbatim>
<a:selectList id="workflow-list" multiSelect="false" style="width:276px" itemStyleClass="selectListItem"
value="#{WizardManager.bean.defaultWorkflowId}">
<a:listItems value="#{WizardManager.bean.defaultWorkflowChoices}" />
</a:selectList>
<f:verbatim></div></f:verbatim>
</h:panelGroup>