- 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
This commit is contained in:
Ariel Backenroth
2006-12-07 21:03:58 +00:00
parent c513c17e70
commit 406f9b4f4e
14 changed files with 95 additions and 32 deletions

View File

@@ -17,6 +17,7 @@
package org.alfresco.web.forms;
import java.io.Serializable;
import java.util.List;
import org.alfresco.service.cmr.repository.NodeRef;
/**
@@ -42,4 +43,7 @@ public interface FormInstanceData
/** the noderef containing the form instance data */
public NodeRef getNodeRef();
/** returns all renditions of this form instance data */
public List<Rendition> getRenditions();
}

View File

@@ -16,11 +16,14 @@
*/
package org.alfresco.web.forms;
import java.util.LinkedList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.faces.context.FacesContext;
import org.alfresco.model.ContentModel;
import org.alfresco.model.WCMAppModel;
import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.repo.avm.AVMNodeConverter;
import org.alfresco.service.ServiceRegistry;
@@ -46,6 +49,8 @@ public class FormInstanceDataImpl
implements FormInstanceData
{
private static final Log LOGGER = LogFactory.getLog(RenditionImpl.class);
private final NodeRef nodeRef;
public FormInstanceDataImpl(final NodeRef nodeRef)
@@ -92,6 +97,29 @@ public class FormInstanceDataImpl
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()
{
final FacesContext fc = FacesContext.getCurrentInstance();

View File

@@ -389,15 +389,15 @@ public final class FormsService
public static String getOutputAvmPathForRendition(final RenderingEngineTemplate ret,
final NodeRef formInstanceDataNodeRef)
{
final String formInstanceDataAvmPath =
AVMNodeConverter.ToAVMVersionPath(formInstanceDataNodeRef).getSecond();
String formInstanceDataFileName = AVMNodeConverter.SplitBase(formInstanceDataAvmPath)[1];
formInstanceDataFileName = FormsService.stripExtension(formInstanceDataFileName);
// final String formInstanceDataAvmPath =
// AVMNodeConverter.ToAVMVersionPath(formInstanceDataNodeRef).getSecond();
// String formInstanceDataFileName = AVMNodeConverter.SplitBase(formInstanceDataAvmPath)[1];
// formInstanceDataFileName = FormsService.stripExtension(formInstanceDataFileName);
String result = ret.getOutputPathForRendition(formInstanceDataNodeRef);
if (result != null && result.charAt(0) == '/')
{
}
// if (result != null && result.charAt(0) == '/')
// {
//
// }
return result;
}

View File

@@ -55,7 +55,6 @@ public interface RenderingEngineTemplate
* Provides the noderef for this template.
*
* @return the noderef for this template.
* @deprecated i'd rather not expose this
*/
public NodeRef getNodeRef();

View File

@@ -192,7 +192,12 @@ public class RenderingEngineTemplateImpl
final NodeService nodeService = this.getServiceRegistry().getNodeService();
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_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);
}

View File

@@ -47,6 +47,8 @@ public class RenditionImpl
implements Rendition
{
private static final Log LOGGER = LogFactory.getLog(RenditionImpl.class);
private final NodeRef nodeRef;
public RenditionImpl(final NodeRef nodeRef)
@@ -76,9 +78,14 @@ public class RenditionImpl
public FormInstanceData getPrimaryFormInstanceData()
{
final NodeService nodeService = this.getServiceRegistry().getNodeService();
final NodeRef fidNodeRef = (NodeRef)
final String fidAVMStoreRelativePath = (String)
nodeService.getProperty(this.nodeRef,
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);
}