From 406f9b4f4e8e3926a749d5556f33cc2be14ee298 Mon Sep 17 00:00:00 2001 From: Ariel Backenroth Date: Thu, 7 Dec 2006 21:03:58 +0000 Subject: [PATCH] - 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 --- .../alfresco/web/bean/wcm/AVMEditBean.java | 4 ++- .../web/bean/wcm/CreateWebContentWizard.java | 26 ++++++++++------ .../alfresco/web/forms/FormInstanceData.java | 4 +++ .../web/forms/FormInstanceDataImpl.java | 28 ++++++++++++++++++ .../org/alfresco/web/forms/FormsService.java | 16 +++++----- .../web/forms/RenderingEngineTemplate.java | 1 - .../forms/RenderingEngineTemplateImpl.java | 7 ++++- .../org/alfresco/web/forms/RenditionImpl.java | 9 +++++- source/web/images/icons/arrow_down.gif | Bin 791 -> 248 bytes source/web/images/icons/arrow_up.gif | Bin 791 -> 248 bytes source/web/images/icons/minus.gif | Bin 1006 -> 241 bytes source/web/images/icons/plus.gif | Bin 1010 -> 253 bytes .../jsp/wcm/create-form-wizard/summary.jsp | 4 +-- .../wcm/create-web-content-wizard/summary.jsp | 28 ++++++++++++------ 14 files changed, 95 insertions(+), 32 deletions(-) diff --git a/source/java/org/alfresco/web/bean/wcm/AVMEditBean.java b/source/java/org/alfresco/web/bean/wcm/AVMEditBean.java index 9e62d54931..719f77fec8 100644 --- a/source/java/org/alfresco/web/bean/wcm/AVMEditBean.java +++ b/source/java/org/alfresco/web/bean/wcm/AVMEditBean.java @@ -43,6 +43,8 @@ import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.forms.Form; import org.alfresco.web.forms.FormProcessor; 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.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -269,7 +271,7 @@ public class AVMEditBean { if (LOGGER.isDebugEnabled()) 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 p = AVMNodeConverter.ToAVMVersionPath(avmRef); if (LOGGER.isDebugEnabled()) diff --git a/source/java/org/alfresco/web/bean/wcm/CreateWebContentWizard.java b/source/java/org/alfresco/web/bean/wcm/CreateWebContentWizard.java index f4bdc9896f..52e92d9c6c 100644 --- a/source/java/org/alfresco/web/bean/wcm/CreateWebContentWizard.java +++ b/source/java/org/alfresco/web/bean/wcm/CreateWebContentWizard.java @@ -232,6 +232,12 @@ public class CreateWebContentWizard extends BaseContentWizard AVMDifference.NEWER)); } 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) { @@ -317,6 +323,7 @@ public class CreateWebContentWizard extends BaseContentWizard this.nodeService.setProperty(packageNodeRef, WorkflowModel.PROP_IS_SYSTEM_PACKAGE, true); parameters.put(WorkflowModel.ASSOC_PACKAGE, packageNodeRef); // 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_FROM_PATH, AVMConstants.buildAVMStoreRootPath( this.avmBrowseBean.getSandbox())); @@ -371,20 +378,21 @@ public class CreateWebContentWizard extends BaseContentWizard throws Exception { 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 + String fileName = this.fileName; + if (LOGGER.isDebugEnabled()) + LOGGER.debug("saving file content to " + fileName); + String path = this.avmBrowseBean.getCurrentPath(); path = path.replaceFirst(AVMConstants.STORE_MAIN, AVMConstants.STORE_PREVIEW); if (MimetypeMap.MIMETYPE_XML.equals(this.mimeType) && this.formName != null) { 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); path = sb[0]; - this.fileName = sb[1]; + fileName = sb[1]; } if (LOGGER.isDebugEnabled()) @@ -399,20 +407,20 @@ public class CreateWebContentWizard extends BaseContentWizard fs.makeAllDirectories(path); 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 avmService.createFile(path, - this.fileName, + fileName, new ByteArrayInputStream((this.content == null ? "" : this.content).getBytes())); // remember the created path - this.createdPath = path + '/' + this.fileName; + this.createdPath = path + '/' + fileName; // add titled aspect for the read/edit properties screens final NodeRef formInstanceDataNodeRef = AVMNodeConverter.ToNodeRef(-1, this.createdPath); Map titledProps = new HashMap(1, 1.0f); - titledProps.put(ContentModel.PROP_TITLE, this.fileName); + titledProps.put(ContentModel.PROP_TITLE, fileName); this.nodeService.addAspect(formInstanceDataNodeRef, ContentModel.ASPECT_TITLED, titledProps); if (MimetypeMap.MIMETYPE_XML.equals(this.mimeType) && this.formName != null) diff --git a/source/java/org/alfresco/web/forms/FormInstanceData.java b/source/java/org/alfresco/web/forms/FormInstanceData.java index e26e36dc6a..9a85ce0216 100644 --- a/source/java/org/alfresco/web/forms/FormInstanceData.java +++ b/source/java/org/alfresco/web/forms/FormInstanceData.java @@ -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 getRenditions(); } diff --git a/source/java/org/alfresco/web/forms/FormInstanceDataImpl.java b/source/java/org/alfresco/web/forms/FormInstanceDataImpl.java index 971b449bfc..5a7a9100c7 100644 --- a/source/java/org/alfresco/web/forms/FormInstanceDataImpl.java +++ b/source/java/org/alfresco/web/forms/FormInstanceDataImpl.java @@ -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 getRenditions() + { + final AVMService avmService = this.getServiceRegistry().getAVMService(); + final List result = new LinkedList(); + 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(); diff --git a/source/java/org/alfresco/web/forms/FormsService.java b/source/java/org/alfresco/web/forms/FormsService.java index 5a5b5d3f01..0e7ad90457 100644 --- a/source/java/org/alfresco/web/forms/FormsService.java +++ b/source/java/org/alfresco/web/forms/FormsService.java @@ -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; } diff --git a/source/java/org/alfresco/web/forms/RenderingEngineTemplate.java b/source/java/org/alfresco/web/forms/RenderingEngineTemplate.java index 78ffb72521..20bf0dc022 100644 --- a/source/java/org/alfresco/web/forms/RenderingEngineTemplate.java +++ b/source/java/org/alfresco/web/forms/RenderingEngineTemplate.java @@ -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(); diff --git a/source/java/org/alfresco/web/forms/RenderingEngineTemplateImpl.java b/source/java/org/alfresco/web/forms/RenderingEngineTemplateImpl.java index abe9d86947..e5b2633bcf 100644 --- a/source/java/org/alfresco/web/forms/RenderingEngineTemplateImpl.java +++ b/source/java/org/alfresco/web/forms/RenderingEngineTemplateImpl.java @@ -192,7 +192,12 @@ public class RenderingEngineTemplateImpl final NodeService nodeService = this.getServiceRegistry().getNodeService(); final Map props = new HashMap(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); } diff --git a/source/java/org/alfresco/web/forms/RenditionImpl.java b/source/java/org/alfresco/web/forms/RenditionImpl.java index 60a673d6df..bf76100d86 100644 --- a/source/java/org/alfresco/web/forms/RenditionImpl.java +++ b/source/java/org/alfresco/web/forms/RenditionImpl.java @@ -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); } diff --git a/source/web/images/icons/arrow_down.gif b/source/web/images/icons/arrow_down.gif index 0c9b4f906ac01abe2d3533e8ea489f7be54d8046..db3ffe23d94ac0f51b65cdcc5549ab34a5b85e60 100644 GIT binary patch literal 248 zcmZ?wbhEHb6krfwIKlt||Ns9tNnKJj|NPGL&#zv)dgbbsNmC}yo;z#F(#7)^%$qxJ z&dgaercIwZW$NVKzMggK*G`@?ao@hZ^XAQ+JbBWWFJC@?{(SA)wPVMQ0nGuMhe9a+ zWMO1rkYvySiGu88U@c8hOKWRV;anu~IKpy*>iG%5JKYW6hZWwDZ1+>s;7Vg<*EACr z;Bb%XeBScO=Sq4>*{P^<&SR-LGCVzxxtk}6&A9*EBz5Ax9rv4l9Wq#X|8u6Wj-XIo lL$ZXRk|=*`X{HdrgQTcnZNISKWMwvP5nkS69c4uZYXD~dWS#&3 literal 791 zcmZ?wbhEHblwgoxc*ekxm6?-~o|BfEotBoJo}QhVnNw6$l9iQHTwK!H+Sbz2`uFeO zKY#xG{{8#cuU|iZ{`~Rd$M^5wzkU1m_3PI!U%q_){Q1+TPai*i{P5w!`}gnPy?gie z?b|nR-n@SO`qisfFJHcV@#4kv=g*%#d-n9{(IL5Yinz5Z3WuPFf@VUPZmZ71}6p`kn=%t!odE&!Kta) zNkP}h+}PN}NL#LDLbHOAiH5w4w3LLDilI^e#3oI%X>zhMQj!wlq9U?p>I?OalojOV zW~>w!6BQN`(bJxwy+v``a_LoTMD_{r>uqdOFjrANCNFElaGQbML`YD8Pr!IV@6}_= zY?$6KG2R#C=i`;oZ#7X>QF?jv?YsNuWDFuc9CGd!`?;nu;Q4!5i%MRx5)Z}4E{C%J z-m>H|??1@wqVBW6`r6{e-n388E;gtZwQxksd1cvfo||bSq2s-Sr_ft%H-p)XMs9Y- zW4t12Lia9AJnVj0)-bhQRd^$6)m6GYiHXZ2=fsl= zX5Ij&pfe6RKifO`P8c2RFne*7XG!(?N`tEhop}-`2Hi=RxaF3efPwd&1li0*2L@{Z?Cdj% diff --git a/source/web/images/icons/arrow_up.gif b/source/web/images/icons/arrow_up.gif index f26caab535a9418a5c5097320ec34d3c762fd453..a32f33cded03dacf6ef0d8bbd828f41faa599d13 100644 GIT binary patch literal 248 zcmZ?wbhEHb6krfwIKlt||Ns9tNn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0K<%$CUbe*;(ITJpI;`ac9}I z4-@Op1ljyJyzl4B7oUq`zph_;Ak_9{eZ|kyM;>Px`cq@PZmZ7hIR%W zkZqtm!N75vfuB>xV?%-?GuM-Zl?CZX#GBi>3{E^|WtnNL_{c#cBB4W3&FqFuf%4H) z(k9HjZ$2n6b4(WvpL6BI!GlM*8%6%Suw-~~tYJR0(w2gQ&I`H>q**v4PL=S^HFRQ` z7qIw=bHnNg#y_2kZVD4k47Mbk{nc_ouF*5Yhk<#)+GsJ?z65~?CnqK$%{xpHNednO zb(x-D(KL2;kZ0gNlaWz;u%o%r_rZ-$CROG>zSbWhiU9)rU3wt`3IY?AIntXW>v%2+ QW^hen7f2T8;b5=^0D=NtoB#j- diff --git a/source/web/images/icons/plus.gif b/source/web/images/icons/plus.gif index 91c38ac0ca8b073057a2cbf7ca3cd7a5a1db268d..78d509b21450564513ee38ce62ddfa273450adf9 100644 GIT binary patch literal 253 zcmZ?wbhEHb6krfwIKlt||NsBLdhP0!t5+sXnK*myEWcT7A#-?(FNy7Z*}Y`x;`s~a z&7C)A=Bydhrca$Rb#iZC&${(%Cr_EUZ{OZ|^X5*TJn74qFP}euzIN@}v17-8MuCk) z5Q;xp7#SF(7<52FAUhdYs}`tb9S+j)+Q{=b!}g-;`HRUrTMXV$cepdF-7if;Dy@lK z)67^!$UUm_dCMmsm&cbSYz5~h6ogznkigTi#VXgpTq{lQcE&n`GZiL_dXF2hiPTor tq>1PV30JbSw@3;pi3xPpRtO6?NQntGP7x8Bq0G!9%EwoxqpZka4FF@xWd#5L literal 1010 zcmZ?wbhEHb6krfw_}E;U!~&6|3lY1xHob8k$#{_fI|J3Dq= z+c@)LckRyX>Bn2^H)WNrNuPYSW6RxDHHWj~=7ep&yRz$i?VXP|O18(8Y>%$klCt3D zv;{Y(=53A0-x|5>#DdUizI&f+JNNSBl*?U3JEOPXTIJktk+vw}=!*kAryHBL=5_2S zw{0`+-B-Q!{+hlsE$i+0cILsctToYXCu_FeUh&}5ovHhqQdfsgI@)mh*nf7w(JS zd~<2r_QF+H=1#lZS$8nA>R9&dgVR@EnKS#~jGA33FFroo{$PFW&a9L7jwH^D07ekQ zD4EwoK>KX4r6oc(W&gr>#0MThjq6 znG-1!gCD2MFtSwK2~;UK%Vwrum&Gc;FkwCmQ@x1crli;B8F<)w1$MZeneUMMW)82z zQ6F&)ro$BiL23OBn|&wfY*6w@U{vTh=fL|w#YM -
${WizardManager.bean.formDescription}
+
${msg.description}: ${WizardManager.bean.formDescription}
${msg.schema_root_element_name}: ${WizardManager.bean.schemaRootElementName}
-
${msg.schema_root_element_name}: ${WizardManager.bean.outputPathPatternForFormInstanceData}
+
${msg.output_path_pattern}: ${WizardManager.bean.outputPathPatternForFormInstanceData}
diff --git a/source/web/jsp/wcm/create-web-content-wizard/summary.jsp b/source/web/jsp/wcm/create-web-content-wizard/summary.jsp index 46a00bb57b..fb529307b3 100644 --- a/source/web/jsp/wcm/create-web-content-wizard/summary.jsp +++ b/source/web/jsp/wcm/create-web-content-wizard/summary.jsp @@ -31,12 +31,20 @@ - - - - - - + + + +
${msg.form}: ${WizardManager.bean.formInstanceData.form.name}
+
${msg.location}: ${WizardManager.bean.formInstanceData.webappRelativePath}
+
+
+
- - + -