diff --git a/config/alfresco/messages/webclient.properties b/config/alfresco/messages/webclient.properties index 1be9f6b5c1..29f9856def 100644 --- a/config/alfresco/messages/webclient.properties +++ b/config/alfresco/messages/webclient.properties @@ -1167,6 +1167,15 @@ create_web_content_desc=This wizard helps you to create a new content item for a edit_web_content_desc=This wizard helps you to edit a content item for a website. create_folder=Create Folder create_avm_folder_info=Create a new folder in the website. +create_layered_folder=Create Layered Folder +create_layered_folder_info=Create a layered folder in the website. +target=Target +target_path=Target Path +target_does_not_exists=Failed to create layered folder as the target path {0} does not exist in the web project selected. +delete_layered_folder=Delete Layered Folder +folder=Folder +shared_folder=Shared Folder +shared_from=Shared from {0} add_avm_content_dialog_desc=This dialog helps you to add content to a folder. update_avm_file_desc=Update a file in the website with content from your computer. file_details_desc=View details about the file. diff --git a/config/alfresco/templates/webscripts/org/alfresco/portlets/mywebfiles.get.html.ftl b/config/alfresco/templates/webscripts/org/alfresco/portlets/mywebfiles.get.html.ftl index dfe1c6ce74..27071e1af1 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/portlets/mywebfiles.get.html.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/portlets/mywebfiles.get.html.ftl @@ -41,7 +41,7 @@
<#-- marker class for dynamic click script --> - <#assign moditems = avm.getModifiedItems(storeId, username, "ROOT")> + <#assign moditems = avm.getModifiedItems(storeId, username, wp.properties["wca:defaultwebapp"])>
My Modified Items
<#if moditems?size != 0> diff --git a/config/alfresco/web-client-config-dialogs.xml b/config/alfresco/web-client-config-dialogs.xml index c68e1ab4f7..8001c7a85b 100644 --- a/config/alfresco/web-client-config-dialogs.xml +++ b/config/alfresco/web-client-config-dialogs.xml @@ -167,6 +167,10 @@ + + + + Delete - org.alfresco.web.action.evaluator.WCMWorkflowEvaluator + org.alfresco.web.action.evaluator.WCMWorkflowLayeredFolderEvaluator delete /images/icons/delete.gif #{AVMBrowseBean.setupContentAction} @@ -252,10 +252,10 @@ - org.alfresco.web.action.evaluator.WCMWorkflowEvaluator Delete + org.alfresco.web.action.evaluator.WCMWorkflowLayeredFolderEvaluator cut /images/icons/cut.gif #{ClipboardBean.cutNode} @@ -270,6 +270,7 @@ Read + org.alfresco.web.action.evaluator.WCMLayeredFolderEvaluator copy /images/icons/copy.gif #{ClipboardBean.copyNode} @@ -293,6 +294,32 @@ + + + + CreateChildren + + org.alfresco.web.action.evaluator.WCMStagingOnlyEvaluator + create_layered_folder + /images/icons/create_space.gif + dialog:createLayeredFolder + + + + + + Delete + + org.alfresco.web.action.evaluator.WCMDeleteLayeredFolderEvaluator + delete_layered_folder + /images/icons/delete.gif + #{AVMBrowseBean.setupContentAction} + dialog:deleteAvmFolderBrowse + + #{actionContext.id} + + + false @@ -313,6 +340,7 @@ + @@ -353,6 +381,7 @@ + @@ -376,6 +405,7 @@ + diff --git a/source/java/org/alfresco/web/action/evaluator/WCMDeleteLayeredFolderEvaluator.java b/source/java/org/alfresco/web/action/evaluator/WCMDeleteLayeredFolderEvaluator.java new file mode 100644 index 0000000000..e7ce250c60 --- /dev/null +++ b/source/java/org/alfresco/web/action/evaluator/WCMDeleteLayeredFolderEvaluator.java @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2005-2007 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing + */ +package org.alfresco.web.action.evaluator; + +import javax.faces.context.FacesContext; + +import org.alfresco.repo.avm.AVMNodeConverter; +import org.alfresco.repo.avm.AVMNodeType; +import org.alfresco.service.cmr.avm.AVMNodeDescriptor; +import org.alfresco.service.cmr.avm.AVMService; +import org.alfresco.util.Pair; +import org.alfresco.web.bean.repository.Node; +import org.alfresco.web.bean.repository.Repository; +import org.alfresco.web.bean.wcm.AVMUtil; + +/** + * Evaluator to return if an item path is within a staging area sandbox and is a + * layered directory with a primary indirection. + * + * @author Gavin Cornwell + */ +public class WCMDeleteLayeredFolderEvaluator extends BaseActionEvaluator +{ + private static final long serialVersionUID = -130286568044703852L; + + /** + * @return true if the item is not locked by another user + */ + public boolean evaluate(final Node node) + { + FacesContext facesContext = FacesContext.getCurrentInstance(); + AVMService avmService = Repository.getServiceRegistry(facesContext).getAVMService(); + + Pair p = AVMNodeConverter.ToAVMVersionPath(node.getNodeRef()); + AVMNodeDescriptor nodeDesc = avmService.lookup(-1, p.getSecond()); + + // allow delete if we are in the main store and the node is a layeredfolder + // with a primary indirection + return (AVMUtil.isMainStore(AVMUtil.getStoreName(p.getSecond())) && + ((nodeDesc.getType() == AVMNodeType.LAYERED_DIRECTORY && nodeDesc.isPrimary()))); + } +} diff --git a/source/java/org/alfresco/web/action/evaluator/WCMLayeredFolderEvaluator.java b/source/java/org/alfresco/web/action/evaluator/WCMLayeredFolderEvaluator.java new file mode 100644 index 0000000000..5b8181de08 --- /dev/null +++ b/source/java/org/alfresco/web/action/evaluator/WCMLayeredFolderEvaluator.java @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2005-2007 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" + */ +package org.alfresco.web.action.evaluator; + +import javax.faces.context.FacesContext; + +import org.alfresco.repo.avm.AVMNodeConverter; +import org.alfresco.repo.avm.AVMNodeType; +import org.alfresco.service.cmr.avm.AVMNodeDescriptor; +import org.alfresco.service.cmr.avm.AVMService; +import org.alfresco.util.Pair; +import org.alfresco.web.bean.repository.Node; +import org.alfresco.web.bean.repository.Repository; + +/** + * UI Action Evaluator - return true if the node is not a layered folder or if + * the layered folder is not a primary indirection + * + * @author Gavin Cornwell + */ +public class WCMLayeredFolderEvaluator extends WCMWorkflowEvaluator +{ + private static final long serialVersionUID = 8507016785287243649L; + + /** + * @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node) + */ + public boolean evaluate(final Node node) + { + FacesContext facesContext = FacesContext.getCurrentInstance(); + AVMService avmService = Repository.getServiceRegistry(facesContext).getAVMService(); + + Pair p = AVMNodeConverter.ToAVMVersionPath(node.getNodeRef()); + AVMNodeDescriptor nodeDesc = avmService.lookup(-1, p.getSecond()); + + // don't allow action if its a 'layeredfolder' and a primary indirection + return !(nodeDesc.getType() == AVMNodeType.LAYERED_DIRECTORY && nodeDesc.isPrimary()); + } +} diff --git a/source/java/org/alfresco/web/action/evaluator/WCMStagingOnlyEvaluator.java b/source/java/org/alfresco/web/action/evaluator/WCMStagingOnlyEvaluator.java new file mode 100644 index 0000000000..3330d9cf44 --- /dev/null +++ b/source/java/org/alfresco/web/action/evaluator/WCMStagingOnlyEvaluator.java @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2005-2007 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing + */ +package org.alfresco.web.action.evaluator; + +import org.alfresco.repo.avm.AVMNodeConverter; +import org.alfresco.web.bean.repository.Node; +import org.alfresco.web.bean.wcm.AVMUtil; + +/** + * Evaluator to return if an item path is within a staging area sandbox. + * + * @author Gavin Cornwell + */ +public class WCMStagingOnlyEvaluator extends BaseActionEvaluator +{ + private static final long serialVersionUID = -130286568044703852L; + + /** + * @return true if the item is not locked by another user + */ + public boolean evaluate(final Node node) + { + String path = AVMNodeConverter.ToAVMVersionPath(node.getNodeRef()).getSecond(); + return AVMUtil.isMainStore(AVMUtil.getStoreName(path)); + } +} diff --git a/source/java/org/alfresco/web/action/evaluator/WCMWorkflowLayeredFolderEvaluator.java b/source/java/org/alfresco/web/action/evaluator/WCMWorkflowLayeredFolderEvaluator.java new file mode 100644 index 0000000000..f9cd390497 --- /dev/null +++ b/source/java/org/alfresco/web/action/evaluator/WCMWorkflowLayeredFolderEvaluator.java @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2005-2007 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" + */ +package org.alfresco.web.action.evaluator; + +import javax.faces.context.FacesContext; + +import org.alfresco.repo.avm.AVMNodeConverter; +import org.alfresco.repo.avm.AVMNodeType; +import org.alfresco.service.cmr.avm.AVMNodeDescriptor; +import org.alfresco.service.cmr.avm.AVMService; +import org.alfresco.util.Pair; +import org.alfresco.web.bean.repository.Node; +import org.alfresco.web.bean.repository.Repository; + +/** + * UI Action Evaluator - return true if the node is not a layered folder or if + * the layered folder is not a primary indirection + * + * @author Gavin Cornwell + */ +public class WCMWorkflowLayeredFolderEvaluator extends WCMWorkflowEvaluator +{ + private static final long serialVersionUID = 8507016785287243649L; + + /** + * @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node) + */ + public boolean evaluate(final Node node) + { + boolean proceed = super.evaluate(node); + + if (proceed) + { + FacesContext facesContext = FacesContext.getCurrentInstance(); + AVMService avmService = Repository.getServiceRegistry(facesContext).getAVMService(); + + Pair p = AVMNodeConverter.ToAVMVersionPath(node.getNodeRef()); + AVMNodeDescriptor nodeDesc = avmService.lookup(-1, p.getSecond()); + int type = nodeDesc.getType(); + + // if the node is a 'layeredfolder' and a primary indirection don't allow + if (type == AVMNodeType.LAYERED_DIRECTORY && nodeDesc.isPrimary()) + { + proceed = false; + } + } + + return proceed; + } +} diff --git a/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java b/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java index bb6bdff80c..285159bbf8 100644 --- a/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java +++ b/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java @@ -47,6 +47,7 @@ import org.alfresco.config.ConfigService; import org.alfresco.linkvalidation.HrefValidationProgress; import org.alfresco.model.WCMAppModel; import org.alfresco.repo.avm.AVMNodeConverter; +import org.alfresco.repo.avm.AVMNodeType; import org.alfresco.repo.avm.actions.AVMRevertStoreAction; import org.alfresco.repo.avm.actions.AVMUndoSandboxListAction; import org.alfresco.repo.domain.PropertyValue; @@ -1123,6 +1124,18 @@ public class AVMBrowseBean implements IContextListener if (avmRef.isDirectory()) { node.getProperties().put("smallIcon", BrowseBean.SPACE_SMALL_DEFAULT); + + String type = ""; + if (avmRef.getType() == AVMNodeType.LAYERED_DIRECTORY && avmRef.isPrimary()) + { + type = Application.getMessage(FacesContext.getCurrentInstance(), "shared_folder"); + } + else + { + type = Application.getMessage(FacesContext.getCurrentInstance(), "folder"); + } + node.getProperties().put("folderType", type); + this.folders.add(node); } else diff --git a/source/java/org/alfresco/web/bean/wcm/CreateFolderDialog.java b/source/java/org/alfresco/web/bean/wcm/CreateFolderDialog.java index 27cc6d35b8..34b81e5612 100644 --- a/source/java/org/alfresco/web/bean/wcm/CreateFolderDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/CreateFolderDialog.java @@ -56,6 +56,7 @@ public class CreateFolderDialog extends BaseDialogBean protected AVMBrowseBean avmBrowseBean; protected String name; + protected String title; protected String description; @@ -110,6 +111,22 @@ public class CreateFolderDialog extends BaseDialogBean { this.description = description; } + + /** + * @return Returns the title. + */ + public String getTitle() + { + return this.title; + } + + /** + * @param title The title to set. + */ + public void setTitle(String title) + { + this.title = title; + } /** * @return Returns the name. @@ -143,10 +160,15 @@ public class CreateFolderDialog extends BaseDialogBean String path = parent + '/' + this.name; NodeRef nodeRef = AVMNodeConverter.ToNodeRef(-1, path); this.getNodeService().addAspect(nodeRef, ApplicationModel.ASPECT_UIFACETS, null); + if (this.title != null && this.title.length() != 0) + { + this.getAvmService().setNodeProperty(path, ContentModel.PROP_TITLE, + new PropertyValue(DataTypeDefinition.TEXT, this.title)); + } if (this.description != null && this.description.length() != 0) { - this.getAvmService().setNodeProperty(path, ContentModel.PROP_DESCRIPTION, new PropertyValue(DataTypeDefinition.TEXT, this.description)); - // this.nodeService.setProperty(nodeRef, ContentModel.PROP_DESCRIPTION, this.description); + this.getAvmService().setNodeProperty(path, ContentModel.PROP_DESCRIPTION, + new PropertyValue(DataTypeDefinition.TEXT, this.description)); } return outcome; diff --git a/source/java/org/alfresco/web/bean/wcm/CreateLayeredFolderDialog.java b/source/java/org/alfresco/web/bean/wcm/CreateLayeredFolderDialog.java new file mode 100644 index 0000000000..e03da9cf18 --- /dev/null +++ b/source/java/org/alfresco/web/bean/wcm/CreateLayeredFolderDialog.java @@ -0,0 +1,225 @@ +/* + * Copyright (C) 2005-2007 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" + */ +package org.alfresco.web.bean.wcm; + +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import javax.faces.context.FacesContext; +import javax.faces.model.SelectItem; + +import org.alfresco.model.ApplicationModel; +import org.alfresco.model.ContentModel; +import org.alfresco.model.WCMAppModel; +import org.alfresco.repo.avm.AVMNodeConverter; +import org.alfresco.repo.domain.PropertyValue; +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.cmr.search.ResultSet; +import org.alfresco.service.cmr.search.ResultSetRow; +import org.alfresco.service.cmr.search.SearchService; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.web.app.Application; +import org.alfresco.web.bean.repository.Repository; +import org.alfresco.web.data.IDataContainer; +import org.alfresco.web.data.QuickSort; +import org.alfresco.web.ui.common.Utils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Bean implementation for the AVM "Create Layered Folder" dialog. + * + * @author Gavin Cornwell + */ +public class CreateLayeredFolderDialog extends CreateFolderDialog +{ + private static final long serialVersionUID = -2922225296046521490L; + + private static final Log logger = LogFactory.getLog(CreateLayeredFolderDialog.class); + + protected String targetStore; + protected String targetPath; + protected List webProjects; + + // ------------------------------------------------------------------------------ + // Dialog implementation + + /** + * @see org.alfresco.web.bean.dialog.BaseDialogBean#init(java.util.Map) + */ + @Override + public void init(Map parameters) + { + super.init(parameters); + + this.targetStore = null; + this.targetPath = null; + this.webProjects = null; + } + + /** + * @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(); + + if (this.targetPath.startsWith("/") == false) + { + this.targetPath = "/" + this.targetPath; + } + + String layeredPath = AVMUtil.buildSandboxRootPath(this.targetStore) + this.targetPath; + + if (logger.isDebugEnabled()) + logger.debug("Creating layered folder named '" + this.name + "' in '" + + parent + "' pointing to '" + layeredPath + "'"); + + // Check the target path exists, display warning if not + AVMNodeDescriptor nodeDesc = getAvmService().lookup(-1, layeredPath); + if (nodeDesc != null) + { + // create the layered directory + getAvmService().createLayeredDirectory(layeredPath, parent, this.name); + + // add titled aspect and set the title (if supplied) and description + String newDirPath = parent + "/" + this.name; + NodeRef nodeRef = AVMNodeConverter.ToNodeRef(-1, newDirPath); + getNodeService().addAspect(nodeRef, ApplicationModel.ASPECT_UIFACETS, null); + if (this.title != null && this.title.length() != 0) + { + this.getAvmService().setNodeProperty(newDirPath, ContentModel.PROP_TITLE, + new PropertyValue(DataTypeDefinition.TEXT, this.title)); + } + + String desc = MessageFormat.format( + Application.getMessage(FacesContext.getCurrentInstance(), "shared_from"), + layeredPath); + this.getAvmService().setNodeProperty(newDirPath, ContentModel.PROP_DESCRIPTION, + new PropertyValue(DataTypeDefinition.TEXT, desc)); + } + else + { + String pattern = Application.getMessage(context, "target_does_not_exists"); + Utils.addErrorMessage(MessageFormat.format(pattern, this.targetPath)); + } + + return outcome; + } + + // ------------------------------------------------------------------------------ + // Bean getters and setters + + /** + * @return List of UISelectItem objects representing the web projects to select from + */ + public List getWebProjects() + { + if (this.webProjects == null) + { + // get the current web project dns name + String thisStoreName = this.avmBrowseBean.getWebProject().getStagingStore(); + + FacesContext fc = FacesContext.getCurrentInstance(); + + // construct the query to retrieve the web projects + String path = Application.getRootPath(fc) + "/" + Application.getWebsitesFolderName(fc) + "/*"; + StringBuilder query = new StringBuilder(200); + query.append("PATH:\"/").append(path).append("\""); + query.append(" +TYPE:\"{").append(NamespaceService.WCMAPP_MODEL_1_0_URI).append("}webfolder\""); + + ResultSet results = null; + try + { + // execute the query + results = getSearchService().query(Repository.getStoreRef(), + SearchService.LANGUAGE_LUCENE, query.toString()); + this.webProjects = new ArrayList(results.length()); + for (ResultSetRow row : results) + { + NodeRef ref = row.getNodeRef(); + String name = (String)getNodeService().getProperty(ref, ContentModel.PROP_NAME); + String dns = (String)getNodeService().getProperty(ref, WCMAppModel.PROP_AVMSTORE); + + // don't add ourself to the list of projects + if (thisStoreName.equals(dns) == false) + { + this.webProjects.add(new SelectItem(dns, name)); + } + } + } + finally + { + if (results != null) + { + results.close(); + } + } + + // sort the projects by their name + QuickSort sorter = new QuickSort(this.webProjects, "label", true, IDataContainer.SORT_CASEINSENSITIVE); + sorter.sort(); + } + + return this.webProjects; + } + + /** + * @param targetStore The store the layered folder is in + */ + public void setTargetStore(String targetStore) + { + this.targetStore = targetStore; + } + + /** + * @return The target store the layered folder is in + */ + public String getTargetStore() + { + return this.targetStore; + } + + /** + * @return The target path for the layered folder + */ + public String getTargetPath() + { + return this.targetPath; + } + + /** + * @param targetPath The target path of the layered folder + */ + public void setTargetPath(String targetPath) + { + this.targetPath = targetPath; + } +} diff --git a/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java b/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java index d7a2c39d1c..019db58231 100644 --- a/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java +++ b/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java @@ -36,6 +36,7 @@ import javax.faces.context.FacesContext; import javax.faces.event.ActionEvent; import javax.faces.model.DataModel; import javax.faces.model.ListDataModel; +import javax.faces.model.SelectItem; import org.alfresco.model.ApplicationModel; import org.alfresco.model.ContentModel; @@ -116,6 +117,7 @@ public class CreateWebsiteWizard extends BaseWizardBean protected String createFrom = null; protected String[] sourceWebProject = null; protected ExpiringValueCache> webProjectsList; + protected List webappsList; protected boolean isSource; protected boolean showAllSourceProjects; @@ -941,6 +943,21 @@ public class CreateWebsiteWizard extends BaseWizardBean return this.showAllSourceProjects; } + /** + * @return List of SelectItem objects representing the webapp folders present in the project + */ + public List getWebappsList() + { + if (this.webappsList == null) + { + this.webappsList = new ArrayList(1); + + this.webappsList.add(new SelectItem(WEBAPP_DEFAULT, WEBAPP_DEFAULT)); + } + + return this.webappsList; + } + /** * @see org.alfresco.web.bean.wizard.BaseWizardBean#next() */ diff --git a/source/java/org/alfresco/web/bean/wcm/DeleteLayeredFolderBrowseDialog.java b/source/java/org/alfresco/web/bean/wcm/DeleteLayeredFolderBrowseDialog.java new file mode 100644 index 0000000000..72440e807d --- /dev/null +++ b/source/java/org/alfresco/web/bean/wcm/DeleteLayeredFolderBrowseDialog.java @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2005-2007 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" + */ +package org.alfresco.web.bean.wcm; + +import java.text.MessageFormat; + +import javax.faces.context.FacesContext; + +import org.alfresco.web.app.Application; + +/** + * Dialog implementation for deleting layered folders. + * + * @author Gavin Cornwell + */ +public class DeleteLayeredFolderBrowseDialog extends DeleteFolderBrowseDialog +{ + private static final long serialVersionUID = -9108783368135918603L; + + // ------------------------------------------------------------------------------ + // Bean Getters and Setters + + /** + * Returns the confirmation to display to the user before deleting the folder. + * + * @return The formatted message to display + */ + @Override + public String getConfirmMessage() + { + String fileConfirmMsg = Application.getMessage(FacesContext.getCurrentInstance(), + "delete_layered_folder_confirm"); + + return MessageFormat.format(fileConfirmMsg, + new Object[] {this.avmBrowseBean.getAvmActionNode().getName()}); + } +} diff --git a/source/java/org/alfresco/web/bean/wcm/EditWebsiteWizard.java b/source/java/org/alfresco/web/bean/wcm/EditWebsiteWizard.java index ad43ed28d9..12d47d7a39 100644 --- a/source/java/org/alfresco/web/bean/wcm/EditWebsiteWizard.java +++ b/source/java/org/alfresco/web/bean/wcm/EditWebsiteWizard.java @@ -24,13 +24,16 @@ */ package org.alfresco.web.bean.wcm; +import java.util.ArrayList; import java.util.List; import java.util.Map; import javax.faces.context.FacesContext; +import javax.faces.model.SelectItem; import org.alfresco.model.ContentModel; import org.alfresco.model.WCMAppModel; +import org.alfresco.service.cmr.avm.AVMNodeDescriptor; import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.namespace.RegexQNamePattern; @@ -43,11 +46,13 @@ import org.alfresco.web.app.AlfrescoNavigationHandler; */ public class EditWebsiteWizard extends CreateWebsiteWizard { + private static final long serialVersionUID = -4856350244207566218L; + + protected AVMBrowseBean avmBrowseBean; + // ------------------------------------------------------------------------------ // Wizard implementation - private static final long serialVersionUID = -4856350244207566218L; - /** * Initialises the wizard */ @@ -64,6 +69,8 @@ public class EditWebsiteWizard extends CreateWebsiteWizard throw new IllegalArgumentException("Edit Web Project wizard requires action node context."); } + this.webappsList = null; + loadWebProjectModel(websiteRef, true, false); } @@ -73,6 +80,29 @@ public class EditWebsiteWizard extends CreateWebsiteWizard // always allow Finish as we are editing existing settings return false; } + + /** + * @return List of SelectItem objects representing the webapp folders present in the project + */ + @Override + public List getWebappsList() + { + if (this.webappsList == null) + { + // get directory listing to show webapps that can be selected + Map dirs = this.getAvmService().getDirectoryListing( + -1, AVMUtil.buildSandboxRootPath(this.dnsName)); + + // create list of webapps + this.webappsList = new ArrayList(dirs.size()); + for (String dirName : dirs.keySet()) + { + this.webappsList.add(new SelectItem(dirName, dirName)); + } + } + + return this.webappsList; + } /** * @see org.alfresco.web.bean.dialog.BaseDialogBean#finishImpl(javax.faces.context.FacesContext, java.lang.String) @@ -92,16 +122,13 @@ public class EditWebsiteWizard extends CreateWebsiteWizard // the existing methods can be used to apply the modified and previous settings from scratch clearWebProjectModel(nodeRef); - // change/create the root webapp name for the website + // change the root webapp name for the website if (this.webapp != null && this.webapp.length() != 0) { - String stagingStore = AVMUtil.buildStagingStoreName(this.dnsName); - String webappPath = AVMUtil.buildStoreWebappPath(stagingStore, this.webapp); - if (getAvmService().lookup(-1, webappPath) == null) - { - getAvmService().createDirectory(AVMUtil.buildSandboxRootPath(stagingStore), this.webapp); - } getNodeService().setProperty(nodeRef, WCMAppModel.PROP_DEFAULTWEBAPP, this.webapp); + + // inform the AVMBrowseBean of the potential change + this.avmBrowseBean.setWebapp(this.webapp); } // TODO: allow change of dns name - via store rename functionality @@ -113,6 +140,14 @@ public class EditWebsiteWizard extends CreateWebsiteWizard return AlfrescoNavigationHandler.CLOSE_WIZARD_OUTCOME; } + /** + * @param avmBrowseBean The AVMBrowseBean to set. + */ + public void setAvmBrowseBean(AVMBrowseBean avmBrowseBean) + { + this.avmBrowseBean = avmBrowseBean; + } + /** * Cascade delete the existing Form and Workflow defs attached to the specified Web Project node * diff --git a/source/java/org/alfresco/web/bean/wcm/FolderDetailsBean.java b/source/java/org/alfresco/web/bean/wcm/FolderDetailsBean.java index c28ee4433e..12fdbcc6c5 100644 --- a/source/java/org/alfresco/web/bean/wcm/FolderDetailsBean.java +++ b/source/java/org/alfresco/web/bean/wcm/FolderDetailsBean.java @@ -28,6 +28,8 @@ import java.util.List; import javax.faces.context.FacesContext; +import org.alfresco.repo.avm.AVMNodeType; +import org.alfresco.service.cmr.avm.AVMNodeDescriptor; import org.alfresco.web.app.Application; import org.alfresco.web.bean.repository.Node; @@ -66,6 +68,23 @@ public class FolderDetailsBean extends AVMDetailsBean { return AVMUtil.buildAssetUrl(getAvmNode().getPath()); } + + /** + * @return true if the folder is a layered folder with a primary indirection + */ + public boolean getIsPrimaryLayeredFolder() + { + boolean result = false; + + String path = getAvmNode().getPath(); + AVMNodeDescriptor nodeDesc = getAvmService().lookup(-1, path); + if (nodeDesc != null) + { + result = (nodeDesc.getType() == AVMNodeType.LAYERED_DIRECTORY && nodeDesc.isPrimary()); + } + + return result; + } /** * @see org.alfresco.web.bean.wcm.AVMDetailsBean#getNodes() diff --git a/source/web/WEB-INF/faces-config-beans.xml b/source/web/WEB-INF/faces-config-beans.xml index 65606393b7..2dba46c78c 100644 --- a/source/web/WEB-INF/faces-config-beans.xml +++ b/source/web/WEB-INF/faces-config-beans.xml @@ -3271,6 +3271,10 @@ formsService #{FormsService} + + + avmBrowseBean + #{AVMBrowseBean} @@ -3543,6 +3547,23 @@ avmBrowseBean #{AVMBrowseBean} + + + + + The bean that backs up the Delete Layered then browse AVM Folder Dialog + + DeleteLayeredFolderBrowseDialog + org.alfresco.web.bean.wcm.DeleteLayeredFolderBrowseDialog + session + + avmService + #{AVMLockingAwareService} + + + avmBrowseBean + #{AVMBrowseBean} + @@ -3589,6 +3610,27 @@ nodeService #{NodeService} + + + + + The bean that backs up the Create Layered Folder Dialog + + CreateLayeredFolderDialog + org.alfresco.web.bean.wcm.CreateLayeredFolderDialog + session + + avmService + #{AVMLockingAwareService} + + + avmBrowseBean + #{AVMBrowseBean} + + + nodeService + #{NodeService} + diff --git a/source/web/jsp/wcm/browse-sandbox.jsp b/source/web/jsp/wcm/browse-sandbox.jsp index 454ed111dd..83d676d2aa 100644 --- a/source/web/jsp/wcm/browse-sandbox.jsp +++ b/source/web/jsp/wcm/browse-sandbox.jsp @@ -120,7 +120,7 @@ - + <%-- Create actions menu --%> @@ -271,6 +271,14 @@ + <%-- Type column --%> + + + + + + + <%-- Folder Actions column --%> diff --git a/source/web/jsp/wcm/create-folder-dialog.jsp b/source/web/jsp/wcm/create-folder-dialog.jsp index 93603769a7..c14e3f25f9 100644 --- a/source/web/jsp/wcm/create-folder-dialog.jsp +++ b/source/web/jsp/wcm/create-folder-dialog.jsp @@ -97,6 +97,19 @@ + + + + + + + + + + + + + diff --git a/source/web/jsp/wcm/create-layered-folder-dialog.jsp b/source/web/jsp/wcm/create-layered-folder-dialog.jsp new file mode 100644 index 0000000000..14b0b13b2c --- /dev/null +++ b/source/web/jsp/wcm/create-layered-folder-dialog.jsp @@ -0,0 +1,163 @@ +<%-- + * Copyright (C) 2005-2007 Alfresco Software Limited. + + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" +--%> +<%@ 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" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + + + + + + + +
+ + + + + + + +
+ + + +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + +
+
diff --git a/source/web/jsp/wcm/create-website-wizard/details.jsp b/source/web/jsp/wcm/create-website-wizard/details.jsp index 3cfddd3495..caee690cf2 100644 --- a/source/web/jsp/wcm/create-website-wizard/details.jsp +++ b/source/web/jsp/wcm/create-website-wizard/details.jsp @@ -140,7 +140,9 @@
- + + +