diff --git a/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java b/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java index 46ac770d09..9ec0d9604f 100644 --- a/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java +++ b/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java @@ -123,7 +123,7 @@ public class AVMBrowseBean implements IContextListener private UIRichList filesRichList; private UIUserSandboxes userSandboxes; - /* transient lists of files/folders for a directory */ + /** transient lists of files/folders for a directory */ private List files = null; private List folders = null; diff --git a/source/java/org/alfresco/web/bean/wcm/SubmitDialog.java b/source/java/org/alfresco/web/bean/wcm/SubmitDialog.java index 91094d0ebb..994d986b58 100644 --- a/source/java/org/alfresco/web/bean/wcm/SubmitDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/SubmitDialog.java @@ -48,7 +48,9 @@ import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.RegexQNamePattern; import org.alfresco.util.ISO8601DateFormat; import org.alfresco.util.NameMatcher; +import org.alfresco.web.app.Application; import org.alfresco.web.app.servlet.DownloadContentServlet; +import org.alfresco.web.bean.BrowseBean; import org.alfresco.web.bean.dialog.BaseDialogBean; import org.alfresco.web.forms.Form; import org.alfresco.web.forms.FormsService; @@ -62,6 +64,9 @@ import org.alfresco.web.ui.wcm.WebResources; */ public class SubmitDialog extends BaseDialogBean { + private static final String SPACE_ICON = "/images/icons/" + BrowseBean.SPACE_SMALL_DEFAULT + ".gif"; + private static final String MSG_DELETED_ITEM = "avm_node_deleted"; + private String comment; private String label; private String[] workflowSelectedValue; @@ -371,7 +376,7 @@ public class SubmitDialog extends BaseDialogBean selected = new ArrayList(diffs.size()); for (AVMDifference diff : diffs) { - AVMNodeDescriptor node = this.avmService.lookup(-1, diff.getSourcePath()); + AVMNodeDescriptor node = this.avmService.lookup(-1, diff.getSourcePath(), true); selected.add(node); } } @@ -388,64 +393,73 @@ public class SubmitDialog extends BaseDialogBean { if (hasAssociatedWorkflow(AVMNodeConverter.ToNodeRef(-1, node.getPath())) == false) { - // lookup if this item was created via a form - then lookup the workflow defaults - // for that form and store into the list of available workflows NodeRef ref = AVMNodeConverter.ToNodeRef(-1, node.getPath()); if (submittedPaths.contains(node.getPath()) == false) { - if (this.nodeService.hasAspect(ref, WCMAppModel.ASPECT_FORM_INSTANCE_DATA)) + if (node.isDeleted() == false) { - NodeRef formInstanceDataRef = ref; - - // check if this is a rendition - as they also have the forminstancedata aspect - if (this.nodeService.hasAspect(ref, WCMAppModel.ASPECT_RENDITION)) + // lookup if this item was created via a form - then lookup the workflow defaults + // for that form and store into the list of available workflows + if (this.nodeService.hasAspect(ref, WCMAppModel.ASPECT_FORM_INSTANCE_DATA)) { - // found a generated rendition asset - locate the parent form instance data file - // and use this to find all generated assets that are appropriate - // NOTE: this ref will be in the 'preview' store convert back to user store first - String formInstanceDataPath = AVMNodeConverter.ToAVMVersionPath( - (NodeRef)this.nodeService.getProperty( - ref, WCMAppModel.PROP_PRIMARY_FORM_INSTANCE_DATA)).getSecond(); - formInstanceDataPath = formInstanceDataPath.replaceFirst(AVMConstants.STORE_PREVIEW, - AVMConstants.STORE_MAIN); - formInstanceDataRef = AVMNodeConverter.ToNodeRef(-1, formInstanceDataPath); - } - - // add the form instance data file to the list for submission - AVMNodeDescriptor formInstanceNode = this.avmService.lookup( - -1, AVMNodeConverter.ToAVMVersionPath(formInstanceDataRef).getSecond()); - this.submitItems.add(new ItemWrapper(formInstanceNode)); - submittedPaths.add(formInstanceNode.getPath()); - - // locate renditions for this form instance data file and add to list for submission - NodeRef formNodeRef = (NodeRef)this.nodeService.getProperty( - formInstanceDataRef, WCMAppModel.PROP_PARENT_FORM); - Form form = FormsService.getInstance().getForm(formNodeRef); - for (RenderingEngineTemplate ret : form.getRenderingEngineTemplates()) - { - String renditionAvmPath = FormsService.getOutputAvmPathForRendition( - ret, formInstanceDataRef); - AVMNodeDescriptor renditionNode = this.avmService.lookup(-1, renditionAvmPath); - this.submitItems.add(new ItemWrapper(renditionNode)); - submittedPaths.add(renditionNode.getPath()); - } - - // lookup the associated Form workflow from the parent form property - String formName = (String)this.nodeService.getProperty( - formInstanceDataRef, WCMAppModel.PROP_PARENT_FORM_NAME); - FormWorkflowWrapper wrapper = this.formWorkflowMap.get(formName); - if (wrapper != null && wrapper.Params != null) - { - // found a workflow with params attached to the form - this.workflows.add(wrapper); + NodeRef formInstanceDataRef = ref; + + // check if this is a rendition - as they also have the forminstancedata aspect + if (this.nodeService.hasAspect(ref, WCMAppModel.ASPECT_RENDITION)) + { + // found a generated rendition asset - locate the parent form instance data file + // and use this to find all generated assets that are appropriate + // NOTE: this ref will be in the 'preview' store convert back to user store first + String formInstanceDataPath = AVMNodeConverter.ToAVMVersionPath( + (NodeRef)this.nodeService.getProperty( + ref, WCMAppModel.PROP_PRIMARY_FORM_INSTANCE_DATA)).getSecond(); + formInstanceDataPath = formInstanceDataPath.replaceFirst(AVMConstants.STORE_PREVIEW, + AVMConstants.STORE_MAIN); + formInstanceDataRef = AVMNodeConverter.ToNodeRef(-1, formInstanceDataPath); + } + + // add the form instance data file to the list for submission + AVMNodeDescriptor formInstanceNode = this.avmService.lookup( + -1, AVMNodeConverter.ToAVMVersionPath(formInstanceDataRef).getSecond()); + this.submitItems.add(new ItemWrapper(formInstanceNode)); + submittedPaths.add(formInstanceNode.getPath()); + + // locate renditions for this form instance data file and add to list for submission + NodeRef formNodeRef = (NodeRef)this.nodeService.getProperty( + formInstanceDataRef, WCMAppModel.PROP_PARENT_FORM); + Form form = FormsService.getInstance().getForm(formNodeRef); + for (RenderingEngineTemplate ret : form.getRenderingEngineTemplates()) + { + String renditionAvmPath = FormsService.getOutputAvmPathForRendition( + ret, formInstanceDataRef); + AVMNodeDescriptor renditionNode = this.avmService.lookup(-1, renditionAvmPath); + this.submitItems.add(new ItemWrapper(renditionNode)); + submittedPaths.add(renditionNode.getPath()); + } + + // lookup the associated Form workflow from the parent form property + String formName = (String)this.nodeService.getProperty( + formInstanceDataRef, WCMAppModel.PROP_PARENT_FORM_NAME); + FormWorkflowWrapper wrapper = this.formWorkflowMap.get(formName); + if (wrapper != null && wrapper.Params != null) + { + // found a workflow with params attached to the form + this.workflows.add(wrapper); + } } } else { + // found a deleted node for submit this.submitItems.add(new ItemWrapper(node)); submittedPaths.add(node.getPath()); } } + else + { + this.submitItems.add(new ItemWrapper(node)); + submittedPaths.add(node.getPath()); + } } else { @@ -551,9 +565,22 @@ public class SubmitDialog extends BaseDialogBean this.descriptor = descriptor; } + public boolean getDeleted() + { + return descriptor.isDeleted(); + } + public String getName() { - return descriptor.getName(); + if (descriptor.isDeleted() == false) + { + return descriptor.getName(); + } + else + { + return descriptor.getName() + " [" + + Application.getMessage(FacesContext.getCurrentInstance(), MSG_DELETED_ITEM) + "]"; + } } public String getModifiedDate() @@ -563,8 +590,15 @@ public class SubmitDialog extends BaseDialogBean public String getDescription() { - return (String)nodeService.getProperty( - AVMNodeConverter.ToNodeRef(-1, descriptor.getPath()), ContentModel.PROP_DESCRIPTION); + if (descriptor.isDeleted() == false) + { + return (String)nodeService.getProperty( + AVMNodeConverter.ToNodeRef(-1, descriptor.getPath()), ContentModel.PROP_DESCRIPTION); + } + else + { + return ""; + } } public String getPath() @@ -580,7 +614,15 @@ public class SubmitDialog extends BaseDialogBean public String getIcon() { - return Utils.getFileTypeImage(descriptor.getName(), true); + // TODO: handle deleted file types here once implemented in the AVMNodeType enum + if (descriptor.isFile()) + { + return Utils.getFileTypeImage(descriptor.getName(), true); + } + else + { + return SPACE_ICON; + } } @Override diff --git a/source/java/org/alfresco/web/ui/wcm/component/UIUserSandboxes.java b/source/java/org/alfresco/web/ui/wcm/component/UIUserSandboxes.java index f8f8ab3a74..4d73a5e315 100644 --- a/source/java/org/alfresco/web/ui/wcm/component/UIUserSandboxes.java +++ b/source/java/org/alfresco/web/ui/wcm/component/UIUserSandboxes.java @@ -623,6 +623,7 @@ public class UIUserSandboxes extends SelfRenderingComponent // must have been deleted from this sandbox - show as ghosted String name = node.getName(); out.write(""); + // TODO: need new solution - isFile() and isFolder() both return false for a deleted node! if (node.isFile()) { out.write(Utils.buildImageTag(fc, Utils.getFileTypeImage(fc, name, true), "")); diff --git a/source/web/jsp/wcm/submit-dialog.jsp b/source/web/jsp/wcm/submit-dialog.jsp index 4d2a969aac..679e2384a0 100644 --- a/source/web/jsp/wcm/submit-dialog.jsp +++ b/source/web/jsp/wcm/submit-dialog.jsp @@ -83,9 +83,10 @@ - + - + + <%-- Description columns --%> @@ -136,9 +137,10 @@ - + - + + <%-- Description columns --%>