From 280cff0999d132742cd9eb2fe77d3bd634e4f12f Mon Sep 17 00:00:00 2001 From: Kevin Roast Date: Wed, 27 Sep 2006 17:12:56 +0000 Subject: [PATCH] - Create Folder action dialog added to website browsing screen - Fix to bug in client AVMNode where it was not correctly dealing with additional avm node properties set using the nodeservice git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3951 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- config/alfresco/messages/webclient.properties | 2 + config/alfresco/web-client-config-dialogs.xml | 4 + .../web-client-config-wcm-actions.xml | 21 +++ .../org/alfresco/web/bean/wcm/AVMNode.java | 3 +- .../web/bean/wcm/CreateFolderDialog.java | 124 ++++++++++++++++++ .../web/bean/wcm/CreateWebsiteWizard.java | 27 ++++ source/web/WEB-INF/faces-config-beans.xml | 21 +++ source/web/jsp/wcm/browse-sandbox.jsp | 8 +- source/web/jsp/wcm/create-folder-dialog.jsp | 106 +++++++++++++++ 9 files changed, 313 insertions(+), 3 deletions(-) create mode 100644 source/java/org/alfresco/web/bean/wcm/CreateFolderDialog.java create mode 100644 source/web/jsp/wcm/create-folder-dialog.jsp diff --git a/config/alfresco/messages/webclient.properties b/config/alfresco/messages/webclient.properties index 8a529d69aa..a34cc2fc72 100644 --- a/config/alfresco/messages/webclient.properties +++ b/config/alfresco/messages/webclient.properties @@ -843,6 +843,8 @@ delete_avm_folder_confirm=Are you sure you want to remove \"{0}\" and its conten error_delete_folder=Unable to delete Folder due to system error: create_web_content_title=Create Web Content Wizard create_web_content_desc=This wizard helps you to create a new content item for a website. +create_folder=Create Folder +create_avm_folder_info=Create a new folder in the website. # New User Wizard messages new_user_title=New User Wizard diff --git a/config/alfresco/web-client-config-dialogs.xml b/config/alfresco/web-client-config-dialogs.xml index fb171144ae..ba207124f4 100644 --- a/config/alfresco/web-client-config-dialogs.xml +++ b/config/alfresco/web-client-config-dialogs.xml @@ -125,6 +125,10 @@ + + diff --git a/config/alfresco/web-client-config-wcm-actions.xml b/config/alfresco/web-client-config-wcm-actions.xml index 4ac0af3df5..b76762dc66 100644 --- a/config/alfresco/web-client-config-wcm-actions.xml +++ b/config/alfresco/web-client-config-wcm-actions.xml @@ -61,6 +61,20 @@ new + + + sandbox_create + /images/icons/new_content.gif + wizard:createWebContent + + + + + create_folder + /images/icons/create_space.gif + dialog:createAvmFolder + + @@ -100,6 +114,13 @@ + + + false + + + + diff --git a/source/java/org/alfresco/web/bean/wcm/AVMNode.java b/source/java/org/alfresco/web/bean/wcm/AVMNode.java index 708c9a623f..b0a988a433 100644 --- a/source/java/org/alfresco/web/bean/wcm/AVMNode.java +++ b/source/java/org/alfresco/web/bean/wcm/AVMNode.java @@ -26,6 +26,7 @@ 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; @@ -95,7 +96,7 @@ public class AVMNode implements Map for (QName qname: props.keySet()) { PropertyValue propValue = props.get(qname); - this.properties.put(qname.toString(), propValue.getSerializableValue()); + this.properties.put(qname.toString(), propValue.getValue(DataTypeDefinition.ANY)); } } diff --git a/source/java/org/alfresco/web/bean/wcm/CreateFolderDialog.java b/source/java/org/alfresco/web/bean/wcm/CreateFolderDialog.java new file mode 100644 index 0000000000..b1c18e10bf --- /dev/null +++ b/source/java/org/alfresco/web/bean/wcm/CreateFolderDialog.java @@ -0,0 +1,124 @@ +/* + * Copyright (C) 2005 Alfresco, Inc. + * + * Licensed under the Mozilla Public License version 1.1 + * with a permitted attribution clause. You may obtain a + * copy of the License at + * + * http://www.alfresco.org/legal/license.txt + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + */ +package org.alfresco.web.bean.wcm; + +import javax.faces.context.FacesContext; + +import org.alfresco.model.ContentModel; +import org.alfresco.repo.avm.AVMNodeConverter; +import org.alfresco.service.cmr.avm.AVMService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.web.bean.dialog.BaseDialogBean; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Bean implementation for the AVM "Create Folder" dialog + * + * @author Kevin Roast + */ +public class CreateFolderDialog extends BaseDialogBean +{ + private static final Log logger = LogFactory.getLog(CreateFolderDialog.class); + + protected AVMService avmService; + protected AVMBrowseBean avmBrowseBean; + protected NodeService nodeService; + + private String name; + private String description; + + + /** + * @param avmBrowseBean The avmBrowseBean to set. + */ + public void setAvmBrowseBean(AVMBrowseBean avmBrowseBean) + { + this.avmBrowseBean = avmBrowseBean; + } + + /** + * @param avmService The avmService to set. + */ + public void setAvmService(AVMService avmService) + { + this.avmService = avmService; + } + + /** + * @param nodeService The NodeService to set. + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * @return Returns the description. + */ + public String getDescription() + { + return this.description; + } + + /** + * @param description The description to set. + */ + public void setDescription(String description) + { + this.description = description; + } + + /** + * @return Returns the name. + */ + public String getName() + { + return this.name; + } + + /** + * @param name The name to set. + */ + public void setName(String name) + { + this.name = name; + } + + + // ------------------------------------------------------------------------------ + // Dialog implementation + + /** + * @see org.alfresco.web.bean.dialog.BaseDialogBean#finishImpl(javax.faces.context.FacesContext, java.lang.String) + */ + @Override + protected String finishImpl(FacesContext context, String outcome) throws Exception + { + String parent = this.avmBrowseBean.getCurrentPath(); + this.avmService.createDirectory(parent, this.name); + String path = parent + '/' + this.name; + if (this.description != null && this.description.length() != 0) + { + NodeRef nodeRef = AVMNodeConverter.ToNodeRef(-1, path); + this.nodeService.setProperty(nodeRef, ContentModel.PROP_DESCRIPTION, this.description); + } + + return outcome; + } +} diff --git a/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java b/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java index 04d9940a78..61054340fd 100644 --- a/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java +++ b/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java @@ -272,6 +272,7 @@ public class CreateWebsiteWizard extends BaseWizardBean * Identifier for store-types: .sandbox.staging.main and .sandbox.staging.preview * Store-id: .sandbox-id. (unique across all stores in the sandbox) * DNS: .dns. = + * Website Name: .website.name = website name * * @param name The store name to create the sandbox for */ @@ -328,6 +329,12 @@ public class CreateWebsiteWizard extends BaseWizardBean this.avmService.setStoreProperty(previewStore, QName.createQName(null, sandboxIdProp), new PropertyValue(DataTypeDefinition.TEXT, null)); + + if (logger.isDebugEnabled()) + { + dumpStoreProperties(stagingStore); + dumpStoreProperties(previewStore); + } } /** @@ -412,6 +419,12 @@ public class CreateWebsiteWizard extends BaseWizardBean new PropertyValue(DataTypeDefinition.TEXT, null)); this.avmService.setStoreProperty(previewStore, QName.createQName(null, sandboxIdProp), new PropertyValue(DataTypeDefinition.TEXT, null)); + + if (logger.isDebugEnabled()) + { + dumpStoreProperties(userStore); + dumpStoreProperties(previewStore); + } } /** @@ -428,4 +441,18 @@ public class CreateWebsiteWizard extends BaseWizardBean this.avmService.setStoreProperty(store, QName.createQName(null, dnsProp), new PropertyValue(DataTypeDefinition.TEXT, path)); } + + /** + * Debug helper method to dump the properties of a store + * + * @param store Store name to dump properties for + */ + private void dumpStoreProperties(String store) + { + Map props = avmService.getStoreProperties(store); + for (QName name : props.keySet()) + { + logger.debug(" " + name + ": " + props.get(name)); + } + } } diff --git a/source/web/WEB-INF/faces-config-beans.xml b/source/web/WEB-INF/faces-config-beans.xml index e7a87534a3..c8bac3e208 100644 --- a/source/web/WEB-INF/faces-config-beans.xml +++ b/source/web/WEB-INF/faces-config-beans.xml @@ -762,6 +762,27 @@ + + + The bean that backs up the Create AVM Folder Dialog + + CreateFolderDialog + org.alfresco.web.bean.wcm.CreateFolderDialog + session + + avmService + #{AVMService} + + + avmBrowseBean + #{AVMBrowseBean} + + + nodeService + #{NodeService} + + + The bean that backs up the Set Content Properties Dialog diff --git a/source/web/jsp/wcm/browse-sandbox.jsp b/source/web/jsp/wcm/browse-sandbox.jsp index c40de90d0c..cad6d528cb 100644 --- a/source/web/jsp/wcm/browse-sandbox.jsp +++ b/source/web/jsp/wcm/browse-sandbox.jsp @@ -76,8 +76,12 @@ -   - + + + <%-- Create actions menu --%> + + + diff --git a/source/web/jsp/wcm/create-folder-dialog.jsp b/source/web/jsp/wcm/create-folder-dialog.jsp new file mode 100644 index 0000000000..c4d736aee4 --- /dev/null +++ b/source/web/jsp/wcm/create-folder-dialog.jsp @@ -0,0 +1,106 @@ +<%-- + Copyright (C) 2005 Alfresco, Inc. + + Licensed under the Mozilla Public License version 1.1 + with a permitted attribution clause. You may obtain a + copy of the License at + + http://www.alfresco.org/legal/license.txt + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + either express or implied. See the License for the specific + language governing permissions and limitations under the + License. +--%> +<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> +<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> +<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> +<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + + + + + + + +
+ + + + + + + +
+