diff --git a/config/alfresco/messages/webclient.properties b/config/alfresco/messages/webclient.properties index eb41f0a76f..4776aa1a2c 100644 --- a/config/alfresco/messages/webclient.properties +++ b/config/alfresco/messages/webclient.properties @@ -642,7 +642,7 @@ text_content=Plain Text Content html_content=HTML Content xml_content=XML Content create_form_title=Create Form Wizard -create_form_desc=Create Form +create_form_desc=Create an XML Form definition from XML Schema and Templates create_form_step1_title=Upload an XML Schema create_form_step1_desc=Upload an XML Schema create_form_step2_title=Edit the XML Schema diff --git a/config/alfresco/web-client-config-actions.xml b/config/alfresco/web-client-config-actions.xml index c4e078c073..d8bffa8ead 100644 --- a/config/alfresco/web-client-config-actions.xml +++ b/config/alfresco/web-client-config-actions.xml @@ -10,7 +10,7 @@ - Write + Write AddChildren - - CreateChildren - create_form /images/icons/new_content.gif wizard:createForm @@ -356,9 +353,6 @@ - - CreateChildren - create_website /images/icons/create_website.gif diff --git a/config/alfresco/web-client-config-wcm-actions.xml b/config/alfresco/web-client-config-wcm-actions.xml index b6fff204b2..e2b1dc754b 100644 --- a/config/alfresco/web-client-config-wcm-actions.xml +++ b/config/alfresco/web-client-config-wcm-actions.xml @@ -5,6 +5,9 @@ + + Write + edit /images/icons/edit_icon.gif #{AVMEditBean.setupEditAction} @@ -15,6 +18,9 @@ + + Delete + delete /images/icons/delete.gif #{AVMBrowseBean.setupContentAction} @@ -26,6 +32,9 @@ + + Delete + delete /images/icons/delete.gif #{AVMBrowseBean.setupContentAction} @@ -37,6 +46,9 @@ + + Delete + delete /images/icons/delete.gif #{AVMBrowseBean.setupContentAction} @@ -48,6 +60,9 @@ + + Delete + delete /images/icons/delete.gif #{AVMBrowseBean.setupContentAction} @@ -59,6 +74,9 @@ + + Read + submit /images/icons/submit.gif #{AVMBrowseBean.submitNode} @@ -85,6 +103,9 @@ + + CreateChildren + sandbox_create /images/icons/new_content.gif wizard:createWebContent @@ -92,6 +113,9 @@ + + CreateChildren + create_folder /images/icons/create_space.gif dialog:createAvmFolder @@ -99,6 +123,9 @@ + + CreateChildren + add_content /images/icons/add.gif addAvmContent @@ -107,6 +134,9 @@ + + Write + update /images/icons/update.gif #{AVMBrowseBean.setupContentAction} diff --git a/source/java/org/alfresco/web/bean/content/CreateXmlContentTypeWizard.java b/source/java/org/alfresco/web/bean/content/CreateXmlContentTypeWizard.java index b696766a0d..577e2ac44e 100644 --- a/source/java/org/alfresco/web/bean/content/CreateXmlContentTypeWizard.java +++ b/source/java/org/alfresco/web/bean/content/CreateXmlContentTypeWizard.java @@ -66,6 +66,11 @@ public class CreateXmlContentTypeWizard extends BaseWizardBean ///////////////////////////////////////////////////////////////////////////// + private static final String FILE_TEMPLATEOUTPUT = "template-output-method"; + + private static final String FILE_SCHEMA = "schema"; + + /** * Simple wrapper class to represent a template output method */ @@ -204,8 +209,6 @@ public class CreateXmlContentTypeWizard extends BaseWizardBean this.schemaRootTagName = null; this.templateName = null; this.templateOutputMethods = new ArrayList(); - clearUpload("schema"); - clearUpload("template-output-method"); } @Override @@ -275,7 +278,7 @@ public class CreateXmlContentTypeWizard extends BaseWizardBean */ public String removeUploadedSchemaFile() { - clearUpload("schema"); + clearUpload(FILE_SCHEMA); // refresh the current page return null; @@ -286,7 +289,7 @@ public class CreateXmlContentTypeWizard extends BaseWizardBean */ public String removeUploadedTemplateOutputMethodFile() { - clearUpload("template-output-method"); + clearUpload(FILE_TEMPLATEOUTPUT); // refresh the current page return null; @@ -369,7 +372,7 @@ public class CreateXmlContentTypeWizard extends BaseWizardBean */ public File getSchemaFile() { - return this.getFile("schema"); + return this.getFile(FILE_SCHEMA); } /** @@ -379,7 +382,7 @@ public class CreateXmlContentTypeWizard extends BaseWizardBean { // try and retrieve the file and filename from the file upload bean // representing the file we previously uploaded. - return this.getFileName("schema"); + return this.getFileName(FILE_SCHEMA); } /** @@ -387,7 +390,7 @@ public class CreateXmlContentTypeWizard extends BaseWizardBean */ public String getTemplateOutputMethodFileName() { - return this.getFileName("template-output-method"); + return this.getFileName(FILE_TEMPLATEOUTPUT); } /** @@ -395,7 +398,7 @@ public class CreateXmlContentTypeWizard extends BaseWizardBean */ public File getTemplateOutputMethodFile() { - return this.getFile("template-output-method"); + return this.getFile(FILE_TEMPLATEOUTPUT); } /** @@ -490,12 +493,12 @@ public class CreateXmlContentTypeWizard extends BaseWizardBean { // remove the file upload bean from the session FacesContext ctx = FacesContext.getCurrentInstance(); - FileUploadBean fileBean = (FileUploadBean) - ctx.getExternalContext().getSessionMap(). - get(FileUploadBean.getKey(id)); + FileUploadBean fileBean = + (FileUploadBean)ctx.getExternalContext().getSessionMap().get(FileUploadBean.getKey(id)); if (fileBean != null) { fileBean.setFile(null); + fileBean.setFileName(null); } } } diff --git a/source/java/org/alfresco/web/bean/repository/Node.java b/source/java/org/alfresco/web/bean/repository/Node.java index cfab7794b1..f5e3388f19 100644 --- a/source/java/org/alfresco/web/bean/repository/Node.java +++ b/source/java/org/alfresco/web/bean/repository/Node.java @@ -89,7 +89,7 @@ public class Node implements Serializable /** * @return All the properties known about this node. */ - public final Map getProperties() + public Map getProperties() { if (this.propsRetrieved == false) { @@ -289,7 +289,7 @@ public class Node implements Serializable /** * @return The display name for the node */ - public final String getName() + public String getName() { if (this.name == null) { @@ -339,20 +339,20 @@ public class Node implements Serializable public boolean hasPermission(String permission) { Boolean valid = null; - if (permissions != null) + if (this.permissions != null) { - valid = permissions.get(permission); + valid = this.permissions.get(permission); } else { - permissions = new HashMap(5, 1.0f); + this.permissions = new HashMap(8, 1.0f); } if (valid == null) { PermissionService service = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPermissionService(); valid = Boolean.valueOf(service.hasPermission(this.nodeRef, permission) == AccessStatus.ALLOWED); - permissions.put(permission, valid); + this.permissions.put(permission, valid); } return valid.booleanValue(); @@ -369,7 +369,7 @@ public class Node implements Serializable /** * @return The path for the node */ - public final String getPath() + public String getPath() { if (this.path == null) { diff --git a/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java b/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java index 3a893355cb..81a06ebbdc 100644 --- a/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java +++ b/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java @@ -90,6 +90,7 @@ public class AVMBrowseBean implements IContextListener private String username; private String sandboxTitle = null; private String currentPath = null; + private AVMNode currentPathNode = null; /* component references */ private UIRichList foldersRichList; @@ -100,7 +101,7 @@ public class AVMBrowseBean implements IContextListener private List files = null; private List folders = null; - /** Current AVM Node context*/ + /** Current AVM Node action context */ private AVMNode avmNode = null; private String wcmDomain; @@ -415,25 +416,25 @@ public class AVMBrowseBean implements IContextListener } /** - * @return Returns the current AVM node context. + * @return Returns the current AVM node action context. */ - public AVMNode getAvmNode() + public AVMNode getAvmActionNode() { return this.avmNode; } /** - * @param avmNode The AVM node context to set. + * @param avmNode The AVM node action context to set. */ - public void setAvmNode(AVMNode avmNode) + public void setAvmActionNode(AVMNode avmNode) { this.avmNode = avmNode; } /** - * @param avmRef The AVMNodeDescriptor context to set. + * @param avmRef The AVMNodeDescriptor action context to set. */ - public void setAVMNodeDescriptor(AVMNodeDescriptor avmRef) + public void setAVMActionNodeDescriptor(AVMNodeDescriptor avmRef) { AVMNode avmNode = new AVMNode(avmRef); this.avmNode = avmNode; @@ -457,11 +458,29 @@ public class AVMBrowseBean implements IContextListener public void setCurrentPath(String path) { this.currentPath = path; + if (path == null) + { + // clear dependant objects (recreated when the path is reinitialised) + this.currentPathNode = null; + } // update UI state ready for screen refresh UIContextService.getInstance(FacesContext.getCurrentInstance()).notifyBeans(); } + /** + * @return the AVMNode that represents the current browsing path + */ + public AVMNode getCurrentPathNode() + { + if (this.currentPathNode == null) + { + AVMNodeDescriptor node = this.avmService.lookup(-1, getCurrentPath(), true); + this.currentPathNode = new AVMNode(node); + } + return this.currentPathNode; + } + /** * @return Breadcrumb location list */ @@ -638,11 +657,11 @@ public class AVMBrowseBean implements IContextListener if (logger.isDebugEnabled()) logger.debug("Setup content action for path: " + path); AVMNodeDescriptor node = avmService.lookup(-1, path, true); - setAVMNodeDescriptor(node); + setAVMActionNodeDescriptor(node); } else { - setAvmNode(null); + setAvmActionNode(null); } // update UI state ready for return after dialog close @@ -667,14 +686,14 @@ public class AVMBrowseBean implements IContextListener tx.begin(); Action action = this.actionService.createAction(ACTION_AVM_SUBMIT); - this.actionService.executeAction(action, getAvmNode().getNodeRef()); + this.actionService.executeAction(action, getAvmActionNode().getNodeRef()); // commit the transaction tx.commit(); // if we get here, all was well - output friendly status message to the user String msg = MessageFormat.format(Application.getMessage( - context, MSG_SUBMIT_SUCCESS), getAvmNode().getName()); + context, MSG_SUBMIT_SUCCESS), getAvmActionNode().getName()); FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg); String formId = Utils.getParentForm(context, event.getComponent()).getClientId(context); context.addMessage(formId + ':' + COMPONENT_SANDBOXESPANEL, facesMsg); diff --git a/source/java/org/alfresco/web/bean/wcm/AVMEditBean.java b/source/java/org/alfresco/web/bean/wcm/AVMEditBean.java index 7def9e9adf..fd1b00f93a 100644 --- a/source/java/org/alfresco/web/bean/wcm/AVMEditBean.java +++ b/source/java/org/alfresco/web/bean/wcm/AVMEditBean.java @@ -116,7 +116,7 @@ public class AVMEditBean */ public AVMNode getAvmNode() { - return this.avmBrowseBean.getAvmNode(); + return this.avmBrowseBean.getAvmActionNode(); } /** diff --git a/source/java/org/alfresco/web/bean/wcm/AVMNode.java b/source/java/org/alfresco/web/bean/wcm/AVMNode.java index c4a605a879..1ecaa244d6 100644 --- a/source/java/org/alfresco/web/bean/wcm/AVMNode.java +++ b/source/java/org/alfresco/web/bean/wcm/AVMNode.java @@ -20,25 +20,23 @@ import java.util.Collection; import java.util.Map; import java.util.Set; -import javax.faces.context.FacesContext; - import org.alfresco.repo.avm.AVMNodeConverter; import org.alfresco.repo.domain.PropertyValue; -import org.alfresco.service.ServiceRegistry; import org.alfresco.service.cmr.avm.AVMNodeDescriptor; import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.namespace.QName; -import org.alfresco.service.namespace.QNameMap; -import org.alfresco.web.bean.repository.Repository; +import org.alfresco.web.bean.repository.Node; /** + * Node class representing an AVM specific Node. + * + * Handles AVM related notions such as Path and Version. Provides the usual properties and + * property resolving functions, and appropriate method overrides for the AVM world. + * * @author Kevin Roast */ -public class AVMNode implements Map +public class AVMNode extends Node implements Map { - private QNameMap properties = null; - private ServiceRegistry services = null; private AVMNodeDescriptor avmRef; private String path; private int version; @@ -47,46 +45,51 @@ public class AVMNode implements Map /** * Constructor + * + * @param avmRef The AVMNodeDescriptor that describes this node */ public AVMNode(AVMNodeDescriptor avmRef) { + super(AVMNodeConverter.ToNodeRef(-1, avmRef.getPath())); this.avmRef = avmRef; this.version = -1; // TODO: always -1 for now... this.path = avmRef.getPath(); + this.id = this.path; } + /** + * Constructor + * + * @param avmRef The AVMNodeDescriptor that describes this node + * @param deleted True if the node represents a ghosted deleted node + */ public AVMNode(AVMNodeDescriptor avmRef, boolean deleted) { this(avmRef); this.deleted = deleted; } - public String getPath() + public final String getPath() { return this.path; } - public int getVersion() + public final int getVersion() { return this.version; } - public String getName() + public final String getName() { return this.avmRef.getName(); } - public NodeRef getNodeRef() - { - return AVMNodeConverter.ToNodeRef(this.version, this.path); - } - - public boolean isDirectory() + public final boolean isDirectory() { return this.avmRef.isDirectory(); } - public boolean isFile() + public final boolean isFile() { return this.avmRef.isFile(); } @@ -96,10 +99,8 @@ public class AVMNode implements Map */ public final Map getProperties() { - if (this.properties == null) + if (this.propsRetrieved == false) { - this.properties = new QNameMap(getServiceRegistry().getNamespaceService()); - if (this.deleted == false) { Map props = getServiceRegistry().getAVMService().getNodeProperties(this.version, this.path); @@ -117,31 +118,13 @@ public class AVMNode implements Map this.properties.put("created", this.avmRef.getCreateDate()); this.properties.put("modified", this.avmRef.getModDate()); this.properties.put("creator", this.avmRef.getCreator()); + + this.propsRetrieved = true; } return this.properties; } - /** - * Determines whether the given property name is held by this node - * - * @param propertyName Property to test existence of - * @return true if property exists, false otherwise - */ - public final boolean hasProperty(String propertyName) - { - return getProperties().containsKey(propertyName); - } - - private ServiceRegistry getServiceRegistry() - { - if (this.services == null) - { - this.services = Repository.getServiceRegistry(FacesContext.getCurrentInstance()); - } - return this.services; - } - // ------------------------------------------------------------------------------------ // Map implementation - allows the Node bean to be accessed using JSF expression syntax diff --git a/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java b/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java index 202dbf4de3..59dc068122 100644 --- a/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java +++ b/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java @@ -131,7 +131,7 @@ public class CreateWebsiteWizard extends BaseWizardBean { foundCurrentUser = true; } - if (ROLE_CONTENT_MANAGER.equals(userRole)) + if (ROLE_CONTENT_MANAGER.equals(userRole.getRole())) { managers.add(authority); } diff --git a/source/java/org/alfresco/web/bean/wcm/DeleteFileDialog.java b/source/java/org/alfresco/web/bean/wcm/DeleteFileDialog.java index 4f415317b0..a51eb2f879 100644 --- a/source/java/org/alfresco/web/bean/wcm/DeleteFileDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/DeleteFileDialog.java @@ -49,7 +49,7 @@ public class DeleteFileDialog extends BaseDialogBean throws Exception { // get the content to delete - AVMNode node = this.avmBrowseBean.getAvmNode(); + AVMNode node = this.avmBrowseBean.getAvmActionNode(); if (node != null) { if (logger.isDebugEnabled()) @@ -101,6 +101,6 @@ public class DeleteFileDialog extends BaseDialogBean "delete_avm_file_confirm"); return MessageFormat.format(fileConfirmMsg, - new Object[] {this.avmBrowseBean.getAvmNode().getName()}); + new Object[] {this.avmBrowseBean.getAvmActionNode().getName()}); } } diff --git a/source/java/org/alfresco/web/bean/wcm/DeleteFolderDialog.java b/source/java/org/alfresco/web/bean/wcm/DeleteFolderDialog.java index cfb86d0b18..af6c909819 100644 --- a/source/java/org/alfresco/web/bean/wcm/DeleteFolderDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/DeleteFolderDialog.java @@ -49,7 +49,7 @@ public class DeleteFolderDialog extends BaseDialogBean throws Exception { // get the content to delete - AVMNode node = this.avmBrowseBean.getAvmNode(); + AVMNode node = this.avmBrowseBean.getAvmActionNode(); if (node != null) { if (logger.isDebugEnabled()) @@ -101,6 +101,6 @@ public class DeleteFolderDialog extends BaseDialogBean "delete_avm_folder_confirm"); return MessageFormat.format(fileConfirmMsg, - new Object[] {this.avmBrowseBean.getAvmNode().getName()}); + new Object[] {this.avmBrowseBean.getAvmActionNode().getName()}); } } diff --git a/source/java/org/alfresco/web/bean/wcm/EditFilePropertiesDialog.java b/source/java/org/alfresco/web/bean/wcm/EditFilePropertiesDialog.java index b061bb26ab..e349888986 100644 --- a/source/java/org/alfresco/web/bean/wcm/EditFilePropertiesDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/EditFilePropertiesDialog.java @@ -78,7 +78,7 @@ public class EditFilePropertiesDialog extends EditContentPropertiesDialog @Override protected Node initEditableNode() { - return new Node(this.avmBrowseBean.getAvmNode().getNodeRef()); + return new Node(this.avmBrowseBean.getAvmActionNode().getNodeRef()); } @Override @@ -170,7 +170,7 @@ public class EditFilePropertiesDialog extends EditContentPropertiesDialog String name = this.editableNode.getName(); String oldPath = AVMNodeConverter.ToAVMVersionPath(this.editableNode.getNodeRef()).getSecond(); String newPath = oldPath.substring(0, oldPath.lastIndexOf('/') + 1) + name; - this.avmBrowseBean.setAvmNode(new AVMNode(this.avmService.lookup(-1, newPath))); + this.avmBrowseBean.setAvmActionNode(new AVMNode(this.avmService.lookup(-1, newPath))); return outcome; } @@ -194,7 +194,7 @@ public class EditFilePropertiesDialog extends EditContentPropertiesDialog { return MessageFormat.format(Application.getMessage( FacesContext.getCurrentInstance(), Repository.ERROR_NODEREF), - new Object[] {this.avmBrowseBean.getAvmNode().getPath()}); + new Object[] {this.avmBrowseBean.getAvmActionNode().getPath()}); } else { diff --git a/source/java/org/alfresco/web/bean/wcm/EditFolderPropertiesDialog.java b/source/java/org/alfresco/web/bean/wcm/EditFolderPropertiesDialog.java index 77f4690543..9c5e8c6229 100644 --- a/source/java/org/alfresco/web/bean/wcm/EditFolderPropertiesDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/EditFolderPropertiesDialog.java @@ -77,7 +77,7 @@ public class EditFolderPropertiesDialog extends EditSpaceDialog @Override protected Node initEditableNode() { - return new Node(this.avmBrowseBean.getAvmNode().getNodeRef()); + return new Node(this.avmBrowseBean.getAvmActionNode().getNodeRef()); } @Override @@ -154,7 +154,7 @@ public class EditFolderPropertiesDialog extends EditSpaceDialog String name = this.editableNode.getName(); String oldPath = AVMNodeConverter.ToAVMVersionPath(this.editableNode.getNodeRef()).getSecond(); String newPath = oldPath.substring(0, oldPath.lastIndexOf('/') + 1) + name; - this.avmBrowseBean.setAvmNode(new AVMNode(this.avmService.lookup(-1, newPath))); + this.avmBrowseBean.setAvmActionNode(new AVMNode(this.avmService.lookup(-1, newPath))); return outcome; } diff --git a/source/java/org/alfresco/web/bean/wcm/FileDetailsBean.java b/source/java/org/alfresco/web/bean/wcm/FileDetailsBean.java index 8e7236e3ab..f298a6bb95 100644 --- a/source/java/org/alfresco/web/bean/wcm/FileDetailsBean.java +++ b/source/java/org/alfresco/web/bean/wcm/FileDetailsBean.java @@ -35,7 +35,7 @@ public class FileDetailsBean extends AVMDetailsBean @Override public AVMNode getAvmNode() { - return this.avmBrowseBean.getAvmNode(); + return this.avmBrowseBean.getAvmActionNode(); } /** diff --git a/source/java/org/alfresco/web/bean/wcm/FolderDetailsBean.java b/source/java/org/alfresco/web/bean/wcm/FolderDetailsBean.java index 576f03dd65..cdbd8a27f1 100644 --- a/source/java/org/alfresco/web/bean/wcm/FolderDetailsBean.java +++ b/source/java/org/alfresco/web/bean/wcm/FolderDetailsBean.java @@ -35,7 +35,7 @@ public class FolderDetailsBean extends AVMDetailsBean @Override public AVMNode getAvmNode() { - return this.avmBrowseBean.getAvmNode(); + return this.avmBrowseBean.getAvmActionNode(); } /** diff --git a/source/java/org/alfresco/web/templating/OutputUtil.java b/source/java/org/alfresco/web/templating/OutputUtil.java index 6ce5399db3..003cb25127 100644 --- a/source/java/org/alfresco/web/templating/OutputUtil.java +++ b/source/java/org/alfresco/web/templating/OutputUtil.java @@ -18,6 +18,7 @@ package org.alfresco.web.templating; import java.io.OutputStream; import java.io.OutputStreamWriter; +import java.io.Serializable; import java.util.HashMap; import java.util.Map; @@ -30,6 +31,7 @@ import org.alfresco.service.cmr.repository.ContentService; import org.alfresco.service.cmr.repository.ContentWriter; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.namespace.QName; import org.alfresco.web.bean.wcm.AVMConstants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -83,6 +85,9 @@ public class OutputUtil nodeService.setProperty(outputNodeRef, TemplatingService.TT_QNAME, tt.getName()); + Map titledProps = new HashMap(1, 1.0f); + titledProps.put(ContentModel.PROP_TITLE, fileName); + nodeService.addAspect(outputNodeRef, ContentModel.ASPECT_TITLED, titledProps); LOGGER.debug("generated " + generatedFileName + " using " + tom); 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 a760e436e5..aa15a82165 100644 --- a/source/java/org/alfresco/web/ui/wcm/component/UIUserSandboxes.java +++ b/source/java/org/alfresco/web/ui/wcm/component/UIUserSandboxes.java @@ -42,6 +42,8 @@ import org.alfresco.service.cmr.avmsync.AVMSyncService; import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.security.AccessStatus; +import org.alfresco.service.cmr.security.PermissionService; import org.alfresco.service.namespace.RegexQNamePattern; import org.alfresco.web.app.Application; import org.alfresco.web.app.servlet.DownloadContentServlet; @@ -184,6 +186,7 @@ public class UIUserSandboxes extends SelfRenderingComponent ResourceBundle bundle = Application.getBundle(context); AVMService avmService = getAVMService(context); NodeService nodeService = getNodeService(context); + PermissionService permissionService = getPermissionService(context); UserTransaction tx = null; try { @@ -191,13 +194,14 @@ public class UIUserSandboxes extends SelfRenderingComponent tx.begin(); NodeRef websiteRef = getValue(); - if (value == null) + if (websiteRef == null) { throw new IllegalArgumentException("Website NodeRef must be specified."); } String storeRoot = (String)nodeService.getProperty(websiteRef, ContentModel.PROP_AVMSTORE); // get the list of users who have a sandbox in the website + String currentUser = Application.getCurrentUser(context).getUserName(); int index = 0; List userInfoRefs = nodeService.getChildAssocs( websiteRef, ContentModel.ASSOC_WEBUSER, RegexQNamePattern.MATCH_ALL); @@ -213,83 +217,92 @@ public class UIUserSandboxes extends SelfRenderingComponent // check it exists before we render the view if (avmService.getAVMStore(mainStore) != null) { + // check the permissions on this store for the current user if (logger.isDebugEnabled()) - logger.debug("Building sandbox view for user store: " + mainStore); - - // for each user sandbox, generate an outer panel table - PanelGenerator.generatePanelStart(out, - context.getExternalContext().getRequestContextPath(), - "white", - "white"); - - // components for the current username, preview, browse and modified items inner list - out.write(""); - - // modified items panel - out.write("
"); - // show the icon for the sandbox as a clickable browse link image - // this is currently identical to the sandbox_browse action as below - Utils.encodeRecursive(context, aquireAction( - context, mainStore, username, "sandbox_icon", WebResources.IMAGE_USERSANDBOX_32, - "#{AVMBrowseBean.setupSandboxAction}", "browseSandbox", null)); - out.write(""); - out.write(""); - out.write(bundle.getString(MSG_USERNAME)); - out.write(": "); - out.write(username); - out.write(" ("); - out.write(bundle.getString(userrole)); - out.write(")"); - - // direct actions for a sandbox - String sandboxUrl = AVMConstants.buildAVMStoreUrl(mainStore); - Utils.encodeRecursive(context, aquireAction( - context, mainStore, username, "sandbox_preview", "/images/icons/preview_website.gif", - null, null, sandboxUrl)); - out.write(" "); - - Utils.encodeRecursive(context, aquireAction( - context, mainStore, username, "sandbox_create", "/images/icons/new_content.gif", - "#{AVMBrowseBean.setupSandboxAction}", "wizard:createWebContent", null)); - out.write(" "); - - Utils.encodeRecursive(context, aquireAction( - context, mainStore, username, "sandbox_submitall", "/images/icons/submit.gif", - "#{AVMBrowseBean.submitAll}", null, null)); - out.write(" "); - - Utils.encodeRecursive(context, aquireAction( - context, mainStore, username, "sandbox_browse", "/images/icons/space_small.gif", - "#{AVMBrowseBean.setupSandboxAction}", "browseSandbox", null)); - out.write("
"); - String panelImage = WebResources.IMAGE_COLLAPSED; - if (this.expandedPanels.contains(username)) + logger.debug("Checking user permissions for store: " + mainStore); + if (permissionService.hasPermission( + AVMNodeConverter.ToNodeRef(-1, AVMConstants.buildAVMStoreRootPath(mainStore)), + PermissionService.READ) == AccessStatus.ALLOWED) { - panelImage = WebResources.IMAGE_EXPANDED; - } - out.write(Utils.buildImageTag(context, panelImage, 11, 11, "", - Utils.generateFormSubmit(context, this, getClientId(context), username))); - out.write(" "); - out.write(bundle.getString(MSG_MODIFIED_ITEMS)); - out.write(""); - if (this.expandedPanels.contains(username)) - { - out.write("
"); - - // list the modified docs for this sandbox user - renderUserFiles(context, out, username, storeRoot); - } - out.write("
"); - - // end the outer panel for this sandbox - PanelGenerator.generatePanelEnd(out, - context.getExternalContext().getRequestContextPath(), - "white"); - - // spacer row - if (index++ < userInfoRefs.size() - 1) - { - out.write("
"); + if (logger.isDebugEnabled()) + logger.debug("Building sandbox view for user store: " + mainStore); + + // for each user sandbox, generate an outer panel table + PanelGenerator.generatePanelStart(out, + context.getExternalContext().getRequestContextPath(), + "white", + "white"); + + // components for the current username, preview, browse and modified items inner list + out.write(""); + + // modified items panel + out.write("
"); + // show the icon for the sandbox as a clickable browse link image + // this is currently identical to the sandbox_browse action as below + Utils.encodeRecursive(context, aquireAction( + context, mainStore, username, "sandbox_icon", WebResources.IMAGE_USERSANDBOX_32, + "#{AVMBrowseBean.setupSandboxAction}", "browseSandbox", null)); + out.write(""); + out.write(""); + out.write(bundle.getString(MSG_USERNAME)); + out.write(": "); + out.write(username); + out.write(" ("); + out.write(bundle.getString(userrole)); + out.write(")"); + + // direct actions for a sandbox + String sandboxUrl = AVMConstants.buildAVMStoreUrl(mainStore); + Utils.encodeRecursive(context, aquireAction( + context, mainStore, username, "sandbox_preview", "/images/icons/preview_website.gif", + null, null, sandboxUrl)); + out.write(" "); + + // TODO: add this action back once we can create in a specific sub-folder + /*Utils.encodeRecursive(context, aquireAction( + context, mainStore, username, "sandbox_create", "/images/icons/new_content.gif", + "#{AVMBrowseBean.setupSandboxAction}", "wizard:createWebContent", null)); + out.write(" ");*/ + + Utils.encodeRecursive(context, aquireAction( + context, mainStore, username, "sandbox_submitall", "/images/icons/submit.gif", + "#{AVMBrowseBean.submitAll}", null, null)); + out.write(" "); + + Utils.encodeRecursive(context, aquireAction( + context, mainStore, username, "sandbox_browse", "/images/icons/space_small.gif", + "#{AVMBrowseBean.setupSandboxAction}", "browseSandbox", null)); + out.write("
"); + String panelImage = WebResources.IMAGE_COLLAPSED; + if (this.expandedPanels.contains(username)) + { + panelImage = WebResources.IMAGE_EXPANDED; + } + out.write(Utils.buildImageTag(context, panelImage, 11, 11, "", + Utils.generateFormSubmit(context, this, getClientId(context), username))); + out.write(" "); + out.write(bundle.getString(MSG_MODIFIED_ITEMS)); + out.write(""); + if (this.expandedPanels.contains(username)) + { + out.write("
"); + + // list the modified docs for this sandbox user + renderUserFiles(context, out, username, storeRoot); + } + out.write("
"); + + // end the outer panel for this sandbox + PanelGenerator.generatePanelEnd(out, + context.getExternalContext().getRequestContextPath(), + "white"); + + // spacer row + if (index++ < userInfoRefs.size() - 1) + { + out.write("
"); + } } } } @@ -664,6 +677,11 @@ public class UIUserSandboxes extends SelfRenderingComponent return (AVMSyncService)FacesContextUtils.getRequiredWebApplicationContext(fc).getBean("AVMSyncService"); } + private PermissionService getPermissionService(FacesContext fc) + { + return Repository.getServiceRegistry(fc).getPermissionService(); + } + // ------------------------------------------------------------------------------ // Strongly typed component property accessors diff --git a/source/web/jsp/wcm/browse-sandbox.jsp b/source/web/jsp/wcm/browse-sandbox.jsp index b99bc0f883..3391dbecc0 100644 --- a/source/web/jsp/wcm/browse-sandbox.jsp +++ b/source/web/jsp/wcm/browse-sandbox.jsp @@ -79,14 +79,16 @@ <%-- Create actions menu --%> - - - + + + + + <%-- More actions menu --%> - + diff --git a/source/web/jsp/wcm/browse-website.jsp b/source/web/jsp/wcm/browse-website.jsp index 6ee2a8ef21..a173b1c4e5 100644 --- a/source/web/jsp/wcm/browse-website.jsp +++ b/source/web/jsp/wcm/browse-website.jsp @@ -76,7 +76,9 @@ <%-- Import website content action --%> - + + + @@ -106,7 +108,8 @@ - + <%-- TODO: add this action back once we can create in a specific sub-folder --%> + <%----%> diff --git a/source/web/jsp/wcm/create-form-wizard/configure-template-output-methods.jsp b/source/web/jsp/wcm/create-form-wizard/configure-template-output-methods.jsp index 52e9cf3fe2..6768957fbc 100644 --- a/source/web/jsp/wcm/create-form-wizard/configure-template-output-methods.jsp +++ b/source/web/jsp/wcm/create-form-wizard/configure-template-output-methods.jsp @@ -28,11 +28,11 @@ @@ -79,17 +79,16 @@ if (upload == null || upload.getFile() == null) } %> + value="/images/icons/required_field.gif" alt="Required Field" /> - + - diff --git a/source/web/jsp/wcm/file-details.jsp b/source/web/jsp/wcm/file-details.jsp index 29b59318ad..7df7fe7109 100644 --- a/source/web/jsp/wcm/file-details.jsp +++ b/source/web/jsp/wcm/file-details.jsp @@ -132,9 +132,9 @@ - <%----%> + - <%----%> + - <%----%> + - <%----%> +