. CreateWebContentWizard can now be used to create inline TXT and HTML files again...

. Fix to display of deleted file/folder icons in Submit Dialog

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4575 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2006-12-11 23:01:45 +00:00
parent 87e57b8fac
commit 66ca97a16a
2 changed files with 41 additions and 27 deletions

View File

@@ -236,9 +236,12 @@ public class CreateWebContentWizard extends BaseContentWizard
// reset all paths and structures to the main store // reset all paths and structures to the main store
this.createdPath = this.createdPath.replaceFirst(AVMConstants.STORE_PREVIEW, this.createdPath = this.createdPath.replaceFirst(AVMConstants.STORE_PREVIEW,
AVMConstants.STORE_MAIN); AVMConstants.STORE_MAIN);
this.formInstanceData = new FormInstanceDataImpl(AVMNodeConverter.ToNodeRef(-1, this.createdPath)); boolean form = (MimetypeMap.MIMETYPE_XML.equals(this.mimeType) && this.formName != null);
this.renditions = this.formInstanceData.getRenditions(); if (form)
{
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;
@@ -291,27 +294,41 @@ public class CreateWebContentWizard extends BaseContentWizard
String stagingPath = AVMConstants.buildAVMStoreRootPath(this.avmBrowseBean.getStagingStore()); String stagingPath = AVMConstants.buildAVMStoreRootPath(this.avmBrowseBean.getStagingStore());
String packagesPath = AVMWorkflowUtil.createAVMLayeredPackage(this.avmService, stagingPath); String packagesPath = AVMWorkflowUtil.createAVMLayeredPackage(this.avmService, stagingPath);
List<AVMDifference> diffs = new ArrayList<AVMDifference>(8);
// construct diffs for selected items for submission // construct diffs for selected items for submission
String webapp = (String)website.getProperties().get(WCMAppModel.PROP_DEFAULTWEBAPP); String webapp = (String)website.getProperties().get(WCMAppModel.PROP_DEFAULTWEBAPP);
String sandboxPath = AVMConstants.buildAVMStoreRootPath(this.avmBrowseBean.getSandbox()); String sandboxPath = AVMConstants.buildAVMStoreRootPath(this.avmBrowseBean.getSandbox());
List<AVMDifference> diffs = new ArrayList<AVMDifference>(8); if (form)
for (Rendition rendition : this.getRenditions())
{ {
String renditionPath = AVMNodeConverter.ToAVMVersionPath(rendition.getNodeRef()).getSecond(); // collect diffs for form data instance and all renditions
int webappIndex = renditionPath.indexOf('/' + webapp); for (Rendition rendition : this.getRenditions())
renditionPath = renditionPath.substring(webappIndex); {
String srcPath = sandboxPath + renditionPath; String renditionPath = AVMNodeConverter.ToAVMVersionPath(rendition.getNodeRef()).getSecond();
String destPath = packagesPath + renditionPath; int webappIndex = renditionPath.indexOf('/' + webapp);
renditionPath = renditionPath.substring(webappIndex);
String srcPath = sandboxPath + renditionPath;
String destPath = packagesPath + renditionPath;
AVMDifference diff = new AVMDifference(-1, srcPath, -1, destPath, AVMDifference.NEWER);
diffs.add(diff);
}
String instancePath = AVMNodeConverter.ToAVMVersionPath(this.formInstanceData.getNodeRef()).getSecond();
int webappIndex = instancePath.indexOf('/' + webapp);
instancePath = instancePath.substring(webappIndex);
String srcPath = sandboxPath + instancePath;
String destPath = packagesPath + instancePath;
AVMDifference diff = new AVMDifference(-1, srcPath, -1, destPath, AVMDifference.NEWER);
diffs.add(diff);
}
else
{
// diff for txt or html content
int webappIndex = this.createdPath.indexOf('/' + webapp);
String itemPath = this.createdPath.substring(webappIndex);
String srcPath = sandboxPath + itemPath;
String destPath = packagesPath + itemPath;
AVMDifference diff = new AVMDifference(-1, srcPath, -1, destPath, AVMDifference.NEWER); AVMDifference diff = new AVMDifference(-1, srcPath, -1, destPath, AVMDifference.NEWER);
diffs.add(diff); diffs.add(diff);
} }
String instancePath = AVMNodeConverter.ToAVMVersionPath(this.formInstanceData.getNodeRef()).getSecond();
int webappIndex = instancePath.indexOf('/' + webapp);
instancePath = instancePath.substring(webappIndex);
String srcPath = sandboxPath + instancePath;
String destPath = packagesPath + instancePath;
AVMDifference diff = new AVMDifference(-1, srcPath, -1, destPath, AVMDifference.NEWER);
diffs.add(diff);
// write changes to layer so files are marked as modified // write changes to layer so files are marked as modified
this.avmSyncService.update(diffs, null, true, true, false, false, null, null); this.avmSyncService.update(diffs, null, true, true, false, false, null, null);
@@ -323,8 +340,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, form ? this.formInstanceData.getName() : 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()));
@@ -396,8 +412,7 @@ public class CreateWebContentWizard extends BaseContentWizard
} }
if (LOGGER.isDebugEnabled()) if (LOGGER.isDebugEnabled())
LOGGER.debug("reseting layer " + path.split(":")[0] + LOGGER.debug("reseting layer " + path.split(":")[0] + ":/" + AVMConstants.DIR_APPBASE);
":/" + AVMConstants.DIR_APPBASE);
this.avmSyncService.resetLayer(path.split(":")[0] + ":/" + AVMConstants.DIR_APPBASE); this.avmSyncService.resetLayer(path.split(":")[0] + ":/" + AVMConstants.DIR_APPBASE);

View File

@@ -444,12 +444,11 @@ public class SubmitDialog extends BaseDialogBean
{ {
// found a generated rendition asset - locate the parent form instance data file // found a generated rendition asset - locate the parent form instance data file
// and use this to find all generated assets that are appropriate // 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 // NOTE: this path value is store relative
String strFormInstance = (String)this.nodeService.getProperty( String strFormInstance = (String)this.nodeService.getProperty(
ref, WCMAppModel.PROP_PRIMARY_FORM_INSTANCE_DATA); ref, WCMAppModel.PROP_PRIMARY_FORM_INSTANCE_DATA);
strFormInstance = strFormInstance.replaceFirst(AVMConstants.STORE_PREVIEW, strFormInstance = this.avmBrowseBean.getSandbox() + ':' + strFormInstance;
AVMConstants.STORE_MAIN); formInstanceDataRef = AVMNodeConverter.ToNodeRef(-1, strFormInstance);
formInstanceDataRef = new NodeRef(strFormInstance);
} }
// add the form instance data file to the list for submission // add the form instance data file to the list for submission
@@ -674,7 +673,7 @@ public class SubmitDialog extends BaseDialogBean
public String getIcon() public String getIcon()
{ {
if (descriptor.isDeletedFile()) if (descriptor.isFile() || descriptor.isDeletedFile())
{ {
return Utils.getFileTypeImage(descriptor.getName(), true); return Utils.getFileTypeImage(descriptor.getName(), true);
} }