- adding in a getRenditions call to forminstancedata
- some further cleanup and fixes for summary screens - adding new repeat icons from linton - fix for filename expanding endlessly when pressing the back button at the summary page for create web content. - making the primaryfominstancedata property of rendition a sandbox relative path so as to make it easier to retrieve the corresponding xml in the same sandbox git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4557 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
@@ -43,6 +43,8 @@ import org.alfresco.web.bean.repository.Repository;
|
|||||||
import org.alfresco.web.forms.Form;
|
import org.alfresco.web.forms.Form;
|
||||||
import org.alfresco.web.forms.FormProcessor;
|
import org.alfresco.web.forms.FormProcessor;
|
||||||
import org.alfresco.web.forms.FormsService;
|
import org.alfresco.web.forms.FormsService;
|
||||||
|
import org.alfresco.web.forms.Rendition;
|
||||||
|
import org.alfresco.web.forms.RenditionImpl;
|
||||||
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;
|
||||||
@@ -269,7 +271,7 @@ public class AVMEditBean
|
|||||||
{
|
{
|
||||||
if (LOGGER.isDebugEnabled())
|
if (LOGGER.isDebugEnabled())
|
||||||
LOGGER.debug(avmRef + " is a rendition, editing primary rendition instead");
|
LOGGER.debug(avmRef + " is a rendition, editing primary rendition instead");
|
||||||
avmRef = (NodeRef)this.nodeService.getProperty(avmRef, WCMAppModel.PROP_PRIMARY_FORM_INSTANCE_DATA);
|
avmRef = new RenditionImpl(avmRef).getPrimaryFormInstanceData().getNodeRef();
|
||||||
|
|
||||||
final Pair<Integer, String> p = AVMNodeConverter.ToAVMVersionPath(avmRef);
|
final Pair<Integer, String> p = AVMNodeConverter.ToAVMVersionPath(avmRef);
|
||||||
if (LOGGER.isDebugEnabled())
|
if (LOGGER.isDebugEnabled())
|
||||||
|
@@ -233,6 +233,12 @@ public class CreateWebContentWizard extends BaseContentWizard
|
|||||||
}
|
}
|
||||||
this.avmSyncService.update(diffList, null, true, true, true, true, null, null);
|
this.avmSyncService.update(diffList, null, true, true, true, true, null, null);
|
||||||
|
|
||||||
|
// reset all paths and structures to the main store
|
||||||
|
this.createdPath = this.createdPath.replaceFirst(AVMConstants.STORE_PREVIEW,
|
||||||
|
AVMConstants.STORE_MAIN);
|
||||||
|
this.formInstanceData = new FormInstanceDataImpl(AVMNodeConverter.ToNodeRef(-1, this.createdPath));
|
||||||
|
this.renditions = this.formInstanceData.getRenditions();
|
||||||
|
|
||||||
if (this.startWorkflow)
|
if (this.startWorkflow)
|
||||||
{
|
{
|
||||||
WorkflowDefinition wd = null;
|
WorkflowDefinition wd = null;
|
||||||
@@ -317,6 +323,7 @@ public class CreateWebContentWizard extends BaseContentWizard
|
|||||||
this.nodeService.setProperty(packageNodeRef, WorkflowModel.PROP_IS_SYSTEM_PACKAGE, true);
|
this.nodeService.setProperty(packageNodeRef, WorkflowModel.PROP_IS_SYSTEM_PACKAGE, true);
|
||||||
parameters.put(WorkflowModel.ASSOC_PACKAGE, packageNodeRef);
|
parameters.put(WorkflowModel.ASSOC_PACKAGE, packageNodeRef);
|
||||||
// TODO: capture label and comment?
|
// TODO: capture label and comment?
|
||||||
|
// ariel to kev: this.fileName may be inaccurate. use formInstanceData.getName() instead
|
||||||
parameters.put(AVMWorkflowUtil.PROP_LABEL, this.fileName);
|
parameters.put(AVMWorkflowUtil.PROP_LABEL, this.fileName);
|
||||||
parameters.put(AVMWorkflowUtil.PROP_FROM_PATH, AVMConstants.buildAVMStoreRootPath(
|
parameters.put(AVMWorkflowUtil.PROP_FROM_PATH, AVMConstants.buildAVMStoreRootPath(
|
||||||
this.avmBrowseBean.getSandbox()));
|
this.avmBrowseBean.getSandbox()));
|
||||||
@@ -371,20 +378,21 @@ public class CreateWebContentWizard extends BaseContentWizard
|
|||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
final FormsService fs = FormsService.getInstance();
|
final FormsService fs = FormsService.getInstance();
|
||||||
if (LOGGER.isDebugEnabled())
|
|
||||||
LOGGER.debug("saving file content to " + this.fileName);
|
|
||||||
|
|
||||||
// get the parent path of the location to save the content
|
// get the parent path of the location to save the content
|
||||||
|
String fileName = this.fileName;
|
||||||
|
if (LOGGER.isDebugEnabled())
|
||||||
|
LOGGER.debug("saving file content to " + fileName);
|
||||||
|
|
||||||
String path = this.avmBrowseBean.getCurrentPath();
|
String path = this.avmBrowseBean.getCurrentPath();
|
||||||
path = path.replaceFirst(AVMConstants.STORE_MAIN, AVMConstants.STORE_PREVIEW);
|
path = path.replaceFirst(AVMConstants.STORE_MAIN, AVMConstants.STORE_PREVIEW);
|
||||||
if (MimetypeMap.MIMETYPE_XML.equals(this.mimeType) && this.formName != null)
|
if (MimetypeMap.MIMETYPE_XML.equals(this.mimeType) && this.formName != null)
|
||||||
{
|
{
|
||||||
final Document formInstanceData = fs.parseXML(this.content);
|
final Document formInstanceData = fs.parseXML(this.content);
|
||||||
|
|
||||||
path = this.getForm().getOutputPathForFormInstanceData(path, this.fileName, formInstanceData);
|
path = this.getForm().getOutputPathForFormInstanceData(path, fileName, formInstanceData);
|
||||||
final String[] sb = AVMNodeConverter.SplitBase(path);
|
final String[] sb = AVMNodeConverter.SplitBase(path);
|
||||||
path = sb[0];
|
path = sb[0];
|
||||||
this.fileName = sb[1];
|
fileName = sb[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LOGGER.isDebugEnabled())
|
if (LOGGER.isDebugEnabled())
|
||||||
@@ -399,20 +407,20 @@ public class CreateWebContentWizard extends BaseContentWizard
|
|||||||
fs.makeAllDirectories(path);
|
fs.makeAllDirectories(path);
|
||||||
|
|
||||||
if (LOGGER.isDebugEnabled())
|
if (LOGGER.isDebugEnabled())
|
||||||
LOGGER.debug("creating file " + this.fileName + " in " + path);
|
LOGGER.debug("creating file " + fileName + " in " + path);
|
||||||
|
|
||||||
// put the content of the file into the AVM store
|
// put the content of the file into the AVM store
|
||||||
avmService.createFile(path,
|
avmService.createFile(path,
|
||||||
this.fileName,
|
fileName,
|
||||||
new ByteArrayInputStream((this.content == null ? "" : this.content).getBytes()));
|
new ByteArrayInputStream((this.content == null ? "" : this.content).getBytes()));
|
||||||
|
|
||||||
// remember the created path
|
// remember the created path
|
||||||
this.createdPath = path + '/' + this.fileName;
|
this.createdPath = path + '/' + fileName;
|
||||||
|
|
||||||
// add titled aspect for the read/edit properties screens
|
// add titled aspect for the read/edit properties screens
|
||||||
final NodeRef formInstanceDataNodeRef = AVMNodeConverter.ToNodeRef(-1, this.createdPath);
|
final NodeRef formInstanceDataNodeRef = AVMNodeConverter.ToNodeRef(-1, this.createdPath);
|
||||||
Map<QName, Serializable> titledProps = new HashMap<QName, Serializable>(1, 1.0f);
|
Map<QName, Serializable> titledProps = new HashMap<QName, Serializable>(1, 1.0f);
|
||||||
titledProps.put(ContentModel.PROP_TITLE, this.fileName);
|
titledProps.put(ContentModel.PROP_TITLE, fileName);
|
||||||
this.nodeService.addAspect(formInstanceDataNodeRef, ContentModel.ASPECT_TITLED, titledProps);
|
this.nodeService.addAspect(formInstanceDataNodeRef, ContentModel.ASPECT_TITLED, titledProps);
|
||||||
|
|
||||||
if (MimetypeMap.MIMETYPE_XML.equals(this.mimeType) && this.formName != null)
|
if (MimetypeMap.MIMETYPE_XML.equals(this.mimeType) && this.formName != null)
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
package org.alfresco.web.forms;
|
package org.alfresco.web.forms;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -42,4 +43,7 @@ public interface FormInstanceData
|
|||||||
|
|
||||||
/** the noderef containing the form instance data */
|
/** the noderef containing the form instance data */
|
||||||
public NodeRef getNodeRef();
|
public NodeRef getNodeRef();
|
||||||
|
|
||||||
|
/** returns all renditions of this form instance data */
|
||||||
|
public List<Rendition> getRenditions();
|
||||||
}
|
}
|
||||||
|
@@ -16,11 +16,14 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.web.forms;
|
package org.alfresco.web.forms;
|
||||||
|
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import javax.faces.context.FacesContext;
|
import javax.faces.context.FacesContext;
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.model.WCMAppModel;
|
import org.alfresco.model.WCMAppModel;
|
||||||
|
import org.alfresco.service.cmr.avm.AVMService;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.repo.avm.AVMNodeConverter;
|
import org.alfresco.repo.avm.AVMNodeConverter;
|
||||||
import org.alfresco.service.ServiceRegistry;
|
import org.alfresco.service.ServiceRegistry;
|
||||||
@@ -46,6 +49,8 @@ public class FormInstanceDataImpl
|
|||||||
implements FormInstanceData
|
implements FormInstanceData
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private static final Log LOGGER = LogFactory.getLog(RenditionImpl.class);
|
||||||
|
|
||||||
private final NodeRef nodeRef;
|
private final NodeRef nodeRef;
|
||||||
|
|
||||||
public FormInstanceDataImpl(final NodeRef nodeRef)
|
public FormInstanceDataImpl(final NodeRef nodeRef)
|
||||||
@@ -92,6 +97,29 @@ public class FormInstanceDataImpl
|
|||||||
return AVMConstants.buildAVMAssetUrl(AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond());
|
return AVMConstants.buildAVMAssetUrl(AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Rendition> getRenditions()
|
||||||
|
{
|
||||||
|
final AVMService avmService = this.getServiceRegistry().getAVMService();
|
||||||
|
final List<Rendition> result = new LinkedList<Rendition>();
|
||||||
|
for (RenderingEngineTemplate ret : this.getForm().getRenderingEngineTemplates())
|
||||||
|
{
|
||||||
|
final String renditionAvmPath =
|
||||||
|
FormsService.getOutputAvmPathForRendition(ret, this.getNodeRef());
|
||||||
|
if (avmService.lookup(-1, renditionAvmPath) == null)
|
||||||
|
{
|
||||||
|
LOGGER.warn("unable to locate rendition " + renditionAvmPath +
|
||||||
|
" for form instance data " + this.getName());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final NodeRef renditionNodeRef =
|
||||||
|
AVMNodeConverter.ToNodeRef(-1, renditionAvmPath);
|
||||||
|
result.add(new RenditionImpl(renditionNodeRef));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
private ServiceRegistry getServiceRegistry()
|
private ServiceRegistry getServiceRegistry()
|
||||||
{
|
{
|
||||||
final FacesContext fc = FacesContext.getCurrentInstance();
|
final FacesContext fc = FacesContext.getCurrentInstance();
|
||||||
|
@@ -389,15 +389,15 @@ public final class FormsService
|
|||||||
public static String getOutputAvmPathForRendition(final RenderingEngineTemplate ret,
|
public static String getOutputAvmPathForRendition(final RenderingEngineTemplate ret,
|
||||||
final NodeRef formInstanceDataNodeRef)
|
final NodeRef formInstanceDataNodeRef)
|
||||||
{
|
{
|
||||||
final String formInstanceDataAvmPath =
|
// final String formInstanceDataAvmPath =
|
||||||
AVMNodeConverter.ToAVMVersionPath(formInstanceDataNodeRef).getSecond();
|
// AVMNodeConverter.ToAVMVersionPath(formInstanceDataNodeRef).getSecond();
|
||||||
String formInstanceDataFileName = AVMNodeConverter.SplitBase(formInstanceDataAvmPath)[1];
|
// String formInstanceDataFileName = AVMNodeConverter.SplitBase(formInstanceDataAvmPath)[1];
|
||||||
formInstanceDataFileName = FormsService.stripExtension(formInstanceDataFileName);
|
// formInstanceDataFileName = FormsService.stripExtension(formInstanceDataFileName);
|
||||||
String result = ret.getOutputPathForRendition(formInstanceDataNodeRef);
|
String result = ret.getOutputPathForRendition(formInstanceDataNodeRef);
|
||||||
if (result != null && result.charAt(0) == '/')
|
// if (result != null && result.charAt(0) == '/')
|
||||||
{
|
// {
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -55,7 +55,6 @@ public interface RenderingEngineTemplate
|
|||||||
* Provides the noderef for this template.
|
* Provides the noderef for this template.
|
||||||
*
|
*
|
||||||
* @return the noderef for this template.
|
* @return the noderef for this template.
|
||||||
* @deprecated i'd rather not expose this
|
|
||||||
*/
|
*/
|
||||||
public NodeRef getNodeRef();
|
public NodeRef getNodeRef();
|
||||||
|
|
||||||
|
@@ -192,7 +192,12 @@ public class RenderingEngineTemplateImpl
|
|||||||
final NodeService nodeService = this.getServiceRegistry().getNodeService();
|
final NodeService nodeService = this.getServiceRegistry().getNodeService();
|
||||||
final Map<QName, Serializable> props = new HashMap<QName, Serializable>(2, 1.0f);
|
final Map<QName, Serializable> props = new HashMap<QName, Serializable>(2, 1.0f);
|
||||||
props.put(WCMAppModel.PROP_PARENT_RENDERING_ENGINE_TEMPLATE, this.nodeRef);
|
props.put(WCMAppModel.PROP_PARENT_RENDERING_ENGINE_TEMPLATE, this.nodeRef);
|
||||||
props.put(WCMAppModel.PROP_PRIMARY_FORM_INSTANCE_DATA, primaryFormInstanceDataNodeRef);
|
|
||||||
|
// extract a store relative path for the primary form instance data
|
||||||
|
String path = AVMNodeConverter.ToAVMVersionPath(primaryFormInstanceDataNodeRef).getSecond();
|
||||||
|
path = path.substring(path.indexOf(':') + 1);
|
||||||
|
props.put(WCMAppModel.PROP_PRIMARY_FORM_INSTANCE_DATA, path);
|
||||||
|
|
||||||
nodeService.addAspect(renditionNodeRef, WCMAppModel.ASPECT_RENDITION, props);
|
nodeService.addAspect(renditionNodeRef, WCMAppModel.ASPECT_RENDITION, props);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -47,6 +47,8 @@ public class RenditionImpl
|
|||||||
implements Rendition
|
implements Rendition
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private static final Log LOGGER = LogFactory.getLog(RenditionImpl.class);
|
||||||
|
|
||||||
private final NodeRef nodeRef;
|
private final NodeRef nodeRef;
|
||||||
|
|
||||||
public RenditionImpl(final NodeRef nodeRef)
|
public RenditionImpl(final NodeRef nodeRef)
|
||||||
@@ -76,9 +78,14 @@ public class RenditionImpl
|
|||||||
public FormInstanceData getPrimaryFormInstanceData()
|
public FormInstanceData getPrimaryFormInstanceData()
|
||||||
{
|
{
|
||||||
final NodeService nodeService = this.getServiceRegistry().getNodeService();
|
final NodeService nodeService = this.getServiceRegistry().getNodeService();
|
||||||
final NodeRef fidNodeRef = (NodeRef)
|
final String fidAVMStoreRelativePath = (String)
|
||||||
nodeService.getProperty(this.nodeRef,
|
nodeService.getProperty(this.nodeRef,
|
||||||
WCMAppModel.PROP_PRIMARY_FORM_INSTANCE_DATA);
|
WCMAppModel.PROP_PRIMARY_FORM_INSTANCE_DATA);
|
||||||
|
String avmStore = AVMNodeConverter.ToAVMVersionPath(this.nodeRef).getSecond();
|
||||||
|
avmStore = avmStore.substring(0, avmStore.indexOf(':'));
|
||||||
|
|
||||||
|
final NodeRef fidNodeRef =
|
||||||
|
AVMNodeConverter.ToNodeRef(-1, avmStore + ':' + fidAVMStoreRelativePath);
|
||||||
return new FormInstanceDataImpl(fidNodeRef);
|
return new FormInstanceDataImpl(fidNodeRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 791 B After Width: | Height: | Size: 248 B |
Before Width: | Height: | Size: 791 B After Width: | Height: | Size: 248 B |
Before Width: | Height: | Size: 1006 B After Width: | Height: | Size: 241 B |
Before Width: | Height: | Size: 1010 B After Width: | Height: | Size: 253 B |
@@ -40,9 +40,9 @@
|
|||||||
value="${WizardManager.bean.formName}"
|
value="${WizardManager.bean.formName}"
|
||||||
image="/images/icons/webform_large.gif">
|
image="/images/icons/webform_large.gif">
|
||||||
<jsp:attribute name="description">
|
<jsp:attribute name="description">
|
||||||
<div>${WizardManager.bean.formDescription}</div>
|
<div>${msg.description}: ${WizardManager.bean.formDescription}</div>
|
||||||
<div>${msg.schema_root_element_name}: ${WizardManager.bean.schemaRootElementName}</div>
|
<div>${msg.schema_root_element_name}: ${WizardManager.bean.schemaRootElementName}</div>
|
||||||
<div>${msg.schema_root_element_name}: ${WizardManager.bean.outputPathPatternForFormInstanceData}</div>
|
<div>${msg.output_path_pattern}: ${WizardManager.bean.outputPathPatternForFormInstanceData}</div>
|
||||||
</jsp:attribute>
|
</jsp:attribute>
|
||||||
</a:listItem>
|
</a:listItem>
|
||||||
</a:selectList>
|
</a:selectList>
|
||||||
|
@@ -31,12 +31,20 @@
|
|||||||
</h:panelGrid>
|
</h:panelGrid>
|
||||||
|
|
||||||
<h:panelGrid columns="2" cellpadding="3" cellspacing="3" border="0">
|
<h:panelGrid columns="2" cellpadding="3" cellspacing="3" border="0">
|
||||||
<h:outputText value="#{msg.name}:"/>
|
<a:selectList id="form-instance-data-list"
|
||||||
<h:outputText value="#{WizardManager.bean.formInstanceData.name}"/>
|
multiSelect="false"
|
||||||
<h:outputText value="#{msg.location}:"/>
|
activeSelect="true"
|
||||||
<h:outputText value="#{WizardManager.bean.formInstanceData.webappRelativePath}"/>
|
style="width:100%"
|
||||||
<h:outputText value="#{msg.form}:"/>
|
itemStyleClass="selectListItem">
|
||||||
<h:outputText value="#{WizardManager.bean.formInstanceData.form.name}"/>
|
<a:listItem label="${WizardManager.bean.formInstanceData.name}"
|
||||||
|
value="${WizardManager.bean.formInstanceData.name}"
|
||||||
|
image="/images/filetypes32/xml.gif">
|
||||||
|
<jsp:attribute name="description">
|
||||||
|
<div>${msg.form}: ${WizardManager.bean.formInstanceData.form.name}</div>
|
||||||
|
<div>${msg.location}: ${WizardManager.bean.formInstanceData.webappRelativePath}</div>
|
||||||
|
</jsp:attribute>
|
||||||
|
</a:listItem>
|
||||||
|
</a:selectList>
|
||||||
</h:panelGrid>
|
</h:panelGrid>
|
||||||
|
|
||||||
<h:panelGrid columns="1" cellpadding="2" style="padding-top: 4px; padding-bottom: 4px;"
|
<h:panelGrid columns="1" cellpadding="2" style="padding-top: 4px; padding-bottom: 4px;"
|
||||||
@@ -50,13 +58,15 @@
|
|||||||
activeSelect="true"
|
activeSelect="true"
|
||||||
style="width:100%"
|
style="width:100%"
|
||||||
itemStyleClass="selectListItem">
|
itemStyleClass="selectListItem">
|
||||||
<c:forEach items="${WizardManager.bean.renditions}" var="rendition">
|
<c:forEach items="${WizardManager.bean.renditions}" var="rendition" varStatus="status">
|
||||||
<a:listItem label="${rendition.name}"
|
<a:listItem id="listItem${status.index}"
|
||||||
|
label="${rendition.name}"
|
||||||
value="${rendition.name}"
|
value="${rendition.name}"
|
||||||
image="${rendition.fileTypeImage}">
|
image="${rendition.fileTypeImage}">
|
||||||
<jsp:attribute name="description">
|
<jsp:attribute name="description">
|
||||||
<span style="float:right">
|
<span style="float:right">
|
||||||
<a:actionLink value="${rendition.name}"
|
<a:actionLink id="preview${status.index}"
|
||||||
|
value="${rendition.name}"
|
||||||
image="/images/icons/preview_website.gif"
|
image="/images/icons/preview_website.gif"
|
||||||
showLink="false"
|
showLink="false"
|
||||||
href="${rendition.url}"
|
href="${rendition.url}"
|
||||||
|