Merged V2.2 to HEAD

7687: Added ability to create/delete layered folders in the staging area, thus allowing folders from other web projects to be shared
            Added title field to create folder dialog
  7688: Added separate dialog for deleting layered folders
  7692: WCM-993: Added ability to edit the defualt webapp for a web project

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8460 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gavin Cornwell
2008-03-07 11:54:47 +00:00
parent a1cfeac9f5
commit cb23859b03
20 changed files with 926 additions and 16 deletions

View File

@@ -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. edit_web_content_desc=This wizard helps you to edit a content item for a website.
create_folder=Create Folder create_folder=Create Folder
create_avm_folder_info=Create a new folder in the website. 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. 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. update_avm_file_desc=Update a file in the website with content from your computer.
file_details_desc=View details about the file. file_details_desc=View details about the file.

View File

@@ -41,7 +41,7 @@
</#if> </#if>
</div> </div>
<div class="webProjectFiles"> <#-- marker class for dynamic click script --> <div class="webProjectFiles"> <#-- marker class for dynamic click script -->
<#assign moditems = avm.getModifiedItems(storeId, username, "ROOT")> <#assign moditems = avm.getModifiedItems(storeId, username, wp.properties["wca:defaultwebapp"])>
<div class="fileTitleRow">My Modified Items</div> <div class="fileTitleRow">My Modified Items</div>
<div class="fileResources"> <div class="fileResources">
<#if moditems?size != 0> <#if moditems?size != 0>

View File

@@ -168,6 +168,10 @@
icon="/images/icons/delete_large.gif" title-id="delete_folder" icon="/images/icons/delete_large.gif" title-id="delete_folder"
description-id="delete_avm_folder_info" /> description-id="delete_avm_folder_info" />
<dialog name="deleteLayeredFolderBrowse" page="/jsp/dialog/delete.jsp" managed-bean="DeleteLayeredFolderBrowseDialog"
icon="/images/icons/delete_large.gif" title-id="delete_layered_folder"
description-id="delete_layered_folder_info" />
<dialog name="promptForWebForm" page="/jsp/wcm/prompt-for-web-form.jsp" managed-bean="PromptForWebFormDialog" <dialog name="promptForWebForm" page="/jsp/wcm/prompt-for-web-form.jsp" managed-bean="PromptForWebFormDialog"
icon="/images/icons/details_large.gif" title-id="prompt_for_web_form" icon="/images/icons/details_large.gif" title-id="prompt_for_web_form"
description-id="prompt_for_web_form_info" /> description-id="prompt_for_web_form_info" />
@@ -176,6 +180,10 @@
icon="/images/icons/create_space_large.gif" title-id="create_folder" icon="/images/icons/create_space_large.gif" title-id="create_folder"
description-id="create_avm_folder_info" /> description-id="create_avm_folder_info" />
<dialog name="createLayeredFolder" page="/jsp/wcm/create-layered-folder-dialog.jsp"
managed-bean="CreateLayeredFolderDialog" icon="/images/icons/create_space_large.gif"
title-id="create_layered_folder" description-id="create_layered_folder_info" />
<dialog name="editAvmFile" page="/jsp/wcm/edit-file.jsp" <dialog name="editAvmFile" page="/jsp/wcm/edit-file.jsp"
managed-bean="EditAvmFileDialog" icon="/images/icons/edit_large.gif" managed-bean="EditAvmFileDialog" icon="/images/icons/edit_large.gif"
title-id="title_edit_file" description-id="editfile_description" title-id="title_edit_file" description-id="editfile_description"

View File

@@ -67,7 +67,7 @@
<permissions> <permissions>
<permission allow="true">Delete</permission> <permission allow="true">Delete</permission>
</permissions> </permissions>
<evaluator>org.alfresco.web.action.evaluator.WCMWorkflowEvaluator</evaluator> <evaluator>org.alfresco.web.action.evaluator.WCMWorkflowLayeredFolderEvaluator</evaluator>
<label-id>delete</label-id> <label-id>delete</label-id>
<image>/images/icons/delete.gif</image> <image>/images/icons/delete.gif</image>
<action-listener>#{AVMBrowseBean.setupContentAction}</action-listener> <action-listener>#{AVMBrowseBean.setupContentAction}</action-listener>
@@ -252,10 +252,10 @@
<!-- Cut a file or folder to the clipboard --> <!-- Cut a file or folder to the clipboard -->
<action id="cut_avm_node"> <action id="cut_avm_node">
<evaluator>org.alfresco.web.action.evaluator.WCMWorkflowEvaluator</evaluator>
<permissions> <permissions>
<permission allow="true">Delete</permission> <permission allow="true">Delete</permission>
</permissions> </permissions>
<evaluator>org.alfresco.web.action.evaluator.WCMWorkflowLayeredFolderEvaluator</evaluator>
<label-id>cut</label-id> <label-id>cut</label-id>
<image>/images/icons/cut.gif</image> <image>/images/icons/cut.gif</image>
<action-listener>#{ClipboardBean.cutNode}</action-listener> <action-listener>#{ClipboardBean.cutNode}</action-listener>
@@ -270,6 +270,7 @@
<permissions> <permissions>
<permission allow="true">Read</permission> <permission allow="true">Read</permission>
</permissions> </permissions>
<evaluator>org.alfresco.web.action.evaluator.WCMLayeredFolderEvaluator</evaluator>
<label-id>copy</label-id> <label-id>copy</label-id>
<image>/images/icons/copy.gif</image> <image>/images/icons/copy.gif</image>
<action-listener>#{ClipboardBean.copyNode}</action-listener> <action-listener>#{ClipboardBean.copyNode}</action-listener>
@@ -293,6 +294,32 @@
</params> </params>
</action> </action>
<!-- Create Layered Folder -->
<action id="create_layered_folder">
<permissions>
<permission allow="true">CreateChildren</permission>
</permissions>
<evaluator>org.alfresco.web.action.evaluator.WCMStagingOnlyEvaluator</evaluator>
<label-id>create_layered_folder</label-id>
<image>/images/icons/create_space.gif</image>
<action>dialog:createLayeredFolder</action>
</action>
<!-- Delete Layered Folder -->
<action id="delete_layered_folder">
<permissions>
<permission allow="true">Delete</permission>
</permissions>
<evaluator>org.alfresco.web.action.evaluator.WCMDeleteLayeredFolderEvaluator</evaluator>
<label-id>delete_layered_folder</label-id>
<image>/images/icons/delete.gif</image>
<action-listener>#{AVMBrowseBean.setupContentAction}</action-listener>
<action>dialog:deleteAvmFolderBrowse</action>
<params>
<param name="id">#{actionContext.id}</param>
</params>
</action>
<!-- Actions for a file in the AVM Browse screen --> <!-- Actions for a file in the AVM Browse screen -->
<action-group id="avm_file_browse"> <action-group id="avm_file_browse">
<show-link>false</show-link> <show-link>false</show-link>
@@ -313,6 +340,7 @@
<action idref="copy_avm_node" /> <action idref="copy_avm_node" />
<action idref="folder_details" /> <action idref="folder_details" />
<action idref="delete_folder_browse" /> <action idref="delete_folder_browse" />
<action idref="delete_layered_folder" />
</action-group> </action-group>
<!-- Actions for a file in Modified Files list --> <!-- Actions for a file in Modified Files list -->
@@ -353,6 +381,7 @@
<action idref="create_avm_content" /> <action idref="create_avm_content" />
<action idref="create_folder" /> <action idref="create_folder" />
<action idref="bulk_import" /> <action idref="bulk_import" />
<action idref="create_layered_folder" />
</action-group> </action-group>
<!-- Actions for the More Actions menu in the sandbox browse screen --> <!-- Actions for the More Actions menu in the sandbox browse screen -->
@@ -376,6 +405,7 @@
<action idref="cut_avm_node" /> <action idref="cut_avm_node" />
<action idref="copy_avm_node" /> <action idref="copy_avm_node" />
<action idref="delete_folder_browse" /> <action idref="delete_folder_browse" />
<action idref="delete_layered_folder" />
</action-group> </action-group>
<!-- Actions for the Web Project Details action menu --> <!-- Actions for the Web Project Details action menu -->

View File

@@ -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<Integer, String> 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())));
}
}

View File

@@ -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<Integer, String> 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());
}
}

View File

@@ -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));
}
}

View File

@@ -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<Integer, String> 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;
}
}

View File

@@ -47,6 +47,7 @@ import org.alfresco.config.ConfigService;
import org.alfresco.linkvalidation.HrefValidationProgress; import org.alfresco.linkvalidation.HrefValidationProgress;
import org.alfresco.model.WCMAppModel; import org.alfresco.model.WCMAppModel;
import org.alfresco.repo.avm.AVMNodeConverter; 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.AVMRevertStoreAction;
import org.alfresco.repo.avm.actions.AVMUndoSandboxListAction; import org.alfresco.repo.avm.actions.AVMUndoSandboxListAction;
import org.alfresco.repo.domain.PropertyValue; import org.alfresco.repo.domain.PropertyValue;
@@ -1123,6 +1124,18 @@ public class AVMBrowseBean implements IContextListener
if (avmRef.isDirectory()) if (avmRef.isDirectory())
{ {
node.getProperties().put("smallIcon", BrowseBean.SPACE_SMALL_DEFAULT); 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); this.folders.add(node);
} }
else else

View File

@@ -56,6 +56,7 @@ public class CreateFolderDialog extends BaseDialogBean
protected AVMBrowseBean avmBrowseBean; protected AVMBrowseBean avmBrowseBean;
protected String name; protected String name;
protected String title;
protected String description; protected String description;
@@ -111,6 +112,22 @@ public class CreateFolderDialog extends BaseDialogBean
this.description = description; 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. * @return Returns the name.
*/ */
@@ -143,10 +160,15 @@ public class CreateFolderDialog extends BaseDialogBean
String path = parent + '/' + this.name; String path = parent + '/' + this.name;
NodeRef nodeRef = AVMNodeConverter.ToNodeRef(-1, path); NodeRef nodeRef = AVMNodeConverter.ToNodeRef(-1, path);
this.getNodeService().addAspect(nodeRef, ApplicationModel.ASPECT_UIFACETS, null); 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) if (this.description != null && this.description.length() != 0)
{ {
this.getAvmService().setNodeProperty(path, ContentModel.PROP_DESCRIPTION, new PropertyValue(DataTypeDefinition.TEXT, this.description)); this.getAvmService().setNodeProperty(path, ContentModel.PROP_DESCRIPTION,
// this.nodeService.setProperty(nodeRef, ContentModel.PROP_DESCRIPTION, this.description); new PropertyValue(DataTypeDefinition.TEXT, this.description));
} }
return outcome; return outcome;

View File

@@ -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<SelectItem> webProjects;
// ------------------------------------------------------------------------------
// Dialog implementation
/**
* @see org.alfresco.web.bean.dialog.BaseDialogBean#init(java.util.Map)
*/
@Override
public void init(Map<String, String> 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<SelectItem> 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<SelectItem>(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;
}
}

View File

@@ -36,6 +36,7 @@ import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent; import javax.faces.event.ActionEvent;
import javax.faces.model.DataModel; import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel; import javax.faces.model.ListDataModel;
import javax.faces.model.SelectItem;
import org.alfresco.model.ApplicationModel; import org.alfresco.model.ApplicationModel;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
@@ -116,6 +117,7 @@ public class CreateWebsiteWizard extends BaseWizardBean
protected String createFrom = null; protected String createFrom = null;
protected String[] sourceWebProject = null; protected String[] sourceWebProject = null;
protected ExpiringValueCache<List<UIListItem>> webProjectsList; protected ExpiringValueCache<List<UIListItem>> webProjectsList;
protected List<SelectItem> webappsList;
protected boolean isSource; protected boolean isSource;
protected boolean showAllSourceProjects; protected boolean showAllSourceProjects;
@@ -941,6 +943,21 @@ public class CreateWebsiteWizard extends BaseWizardBean
return this.showAllSourceProjects; return this.showAllSourceProjects;
} }
/**
* @return List of SelectItem objects representing the webapp folders present in the project
*/
public List<SelectItem> getWebappsList()
{
if (this.webappsList == null)
{
this.webappsList = new ArrayList<SelectItem>(1);
this.webappsList.add(new SelectItem(WEBAPP_DEFAULT, WEBAPP_DEFAULT));
}
return this.webappsList;
}
/** /**
* @see org.alfresco.web.bean.wizard.BaseWizardBean#next() * @see org.alfresco.web.bean.wizard.BaseWizardBean#next()
*/ */

View File

@@ -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()});
}
}

View File

@@ -24,13 +24,16 @@
*/ */
package org.alfresco.web.bean.wcm; package org.alfresco.web.bean.wcm;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.faces.context.FacesContext; import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.model.WCMAppModel; 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.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.RegexQNamePattern; import org.alfresco.service.namespace.RegexQNamePattern;
@@ -43,11 +46,13 @@ import org.alfresco.web.app.AlfrescoNavigationHandler;
*/ */
public class EditWebsiteWizard extends CreateWebsiteWizard public class EditWebsiteWizard extends CreateWebsiteWizard
{ {
private static final long serialVersionUID = -4856350244207566218L;
protected AVMBrowseBean avmBrowseBean;
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
// Wizard implementation // Wizard implementation
private static final long serialVersionUID = -4856350244207566218L;
/** /**
* Initialises the wizard * Initialises the wizard
*/ */
@@ -64,6 +69,8 @@ public class EditWebsiteWizard extends CreateWebsiteWizard
throw new IllegalArgumentException("Edit Web Project wizard requires action node context."); throw new IllegalArgumentException("Edit Web Project wizard requires action node context.");
} }
this.webappsList = null;
loadWebProjectModel(websiteRef, true, false); loadWebProjectModel(websiteRef, true, false);
} }
@@ -74,6 +81,29 @@ public class EditWebsiteWizard extends CreateWebsiteWizard
return false; return false;
} }
/**
* @return List of SelectItem objects representing the webapp folders present in the project
*/
@Override
public List<SelectItem> getWebappsList()
{
if (this.webappsList == null)
{
// get directory listing to show webapps that can be selected
Map<String, AVMNodeDescriptor> dirs = this.getAvmService().getDirectoryListing(
-1, AVMUtil.buildSandboxRootPath(this.dnsName));
// create list of webapps
this.webappsList = new ArrayList<SelectItem>(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) * @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 // the existing methods can be used to apply the modified and previous settings from scratch
clearWebProjectModel(nodeRef); 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) 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); 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 // TODO: allow change of dns name - via store rename functionality
@@ -113,6 +140,14 @@ public class EditWebsiteWizard extends CreateWebsiteWizard
return AlfrescoNavigationHandler.CLOSE_WIZARD_OUTCOME; 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 * Cascade delete the existing Form and Workflow defs attached to the specified Web Project node
* *

View File

@@ -28,6 +28,8 @@ import java.util.List;
import javax.faces.context.FacesContext; 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.app.Application;
import org.alfresco.web.bean.repository.Node; import org.alfresco.web.bean.repository.Node;
@@ -67,6 +69,23 @@ public class FolderDetailsBean extends AVMDetailsBean
return AVMUtil.buildAssetUrl(getAvmNode().getPath()); 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() * @see org.alfresco.web.bean.wcm.AVMDetailsBean#getNodes()
*/ */

View File

@@ -3272,6 +3272,10 @@
<property-name>formsService</property-name> <property-name>formsService</property-name>
<value>#{FormsService}</value> <value>#{FormsService}</value>
</managed-property> </managed-property>
<managed-property>
<property-name>avmBrowseBean</property-name>
<value>#{AVMBrowseBean}</value>
</managed-property>
</managed-bean> </managed-bean>
<managed-bean> <managed-bean>
@@ -3545,6 +3549,23 @@
</managed-property> </managed-property>
</managed-bean> </managed-bean>
<managed-bean>
<description>
The bean that backs up the Delete Layered then browse AVM Folder Dialog
</description>
<managed-bean-name>DeleteLayeredFolderBrowseDialog</managed-bean-name>
<managed-bean-class>org.alfresco.web.bean.wcm.DeleteLayeredFolderBrowseDialog</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>avmService</property-name>
<value>#{AVMLockingAwareService}</value>
</managed-property>
<managed-property>
<property-name>avmBrowseBean</property-name>
<value>#{AVMBrowseBean}</value>
</managed-property>
</managed-bean>
<managed-bean> <managed-bean>
<description> <description>
The bean that backs up the Delete User Sandbox Dialog The bean that backs up the Delete User Sandbox Dialog
@@ -3591,6 +3612,27 @@
</managed-property> </managed-property>
</managed-bean> </managed-bean>
<managed-bean>
<description>
The bean that backs up the Create Layered Folder Dialog
</description>
<managed-bean-name>CreateLayeredFolderDialog</managed-bean-name>
<managed-bean-class>org.alfresco.web.bean.wcm.CreateLayeredFolderDialog</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>avmService</property-name>
<value>#{AVMLockingAwareService}</value>
</managed-property>
<managed-property>
<property-name>avmBrowseBean</property-name>
<value>#{AVMBrowseBean}</value>
</managed-property>
<managed-property>
<property-name>nodeService</property-name>
<value>#{NodeService}</value>
</managed-property>
</managed-bean>
<managed-bean> <managed-bean>
<description> <description>
The bean that backs up the Create AVM Webapp Folder Dialog The bean that backs up the Create AVM Webapp Folder Dialog

View File

@@ -120,7 +120,7 @@
<a:actionLink value="#{msg.sandbox_preview}" image="/images/icons/preview_website.gif" href="#{AVMBrowseBean.sandboxPreviewUrl}" target="new" id="act-prev" /> <a:actionLink value="#{msg.sandbox_preview}" image="/images/icons/preview_website.gif" href="#{AVMBrowseBean.sandboxPreviewUrl}" target="new" id="act-prev" />
</td> </td>
<r:permissionEvaluator value="#{AVMBrowseBean.currentPathNode}" allow="CreateChildren" id="eval1"> <r:permissionEvaluator value="#{AVMBrowseBean.currentPathNode}" allow="CreateChildren" id="eval1">
<td style="padding-left:4px;white-space:nowrap" width=120> <td style="padding-left:4px;white-space:nowrap" width="140">
<%-- Create actions menu --%> <%-- Create actions menu --%>
<a:menu id="createMenu" itemSpacing="4" label="#{msg.create_options}" image="/images/icons/menu.gif" menuStyleClass="moreActionsMenu" style="white-space:nowrap"> <a:menu id="createMenu" itemSpacing="4" label="#{msg.create_options}" image="/images/icons/menu.gif" menuStyleClass="moreActionsMenu" style="white-space:nowrap">
<r:actions id="acts_create" value="avm_create_menu" context="#{AVMBrowseBean.currentPathNode}" /> <r:actions id="acts_create" value="avm_create_menu" context="#{AVMBrowseBean.currentPathNode}" />
@@ -271,6 +271,14 @@
</h:outputText> </h:outputText>
</a:column> </a:column>
<%-- Type column --%>
<a:column id="col8" style="text-align:left">
<f:facet name="header">
<a:sortLink id="col8-sort" label="#{msg.type}" value="folderType" styleClass="header"/>
</f:facet>
<h:outputText id="col8-text" value="#{r.folderType}"></h:outputText>
</a:column>
<%-- Folder Actions column --%> <%-- Folder Actions column --%>
<a:column id="col9" actions="true" style="text-align:left"> <a:column id="col9" actions="true" style="text-align:left">
<f:facet name="header"> <f:facet name="header">

View File

@@ -97,6 +97,19 @@
<f:verbatim> <f:verbatim>
</td> </td>
</tr> </tr>
<tr>
<td></td>
<td>
</f:verbatim>
<h:outputText value="#{msg.title}:" />
<f:verbatim>
</td>
<td>
</f:verbatim>
<h:inputText id="title" value="#{DialogManager.bean.title}" size="35" maxlength="1024" />
<f:verbatim>
</td>
</tr>
<tr> <tr>
<td></td> <td></td>
<td> <td>

View File

@@ -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" %>
<f:verbatim>
<script type="text/javascript" src="<%=request.getContextPath()%>/scripts/validation.js"> </script>
<script type="text/javascript">
var finishButtonPressed = false;
window.onload = pageLoaded;
function pageLoaded()
{
document.getElementById("dialog:dialog-body:name").focus();
document.getElementById("dialog").onsubmit = validate;
document.getElementById("dialog:finish-button").onclick = function() {finishButtonPressed = true; clear_dialog();}
checkButtonState();
}
function checkButtonState()
{
if (document.getElementById("dialog:dialog-body:targetStore").options.length == 0 ||
document.getElementById("dialog:dialog-body:name").value.length == 0 ||
document.getElementById("dialog:dialog-body:targetPath").value.length == 0)
{
document.getElementById("dialog:finish-button").disabled = true;
}
else
{
document.getElementById("dialog:finish-button").disabled = false;
}
}
function validate()
{
if (finishButtonPressed)
{
finishButtonPressed = false;
return validateName(document.getElementById("dialog:dialog-body:name"),
'</f:verbatim><a:outputText value="#{msg.validation_invalid_character}" /><f:verbatim>',
true);
}
else
{
return true;
}
}
</script>
<table cellpadding="2" cellspacing="2" border="0" width="100%">
<tr>
<td colspan="3" class="wizardSectionHeading">
</f:verbatim>
<h:outputText value="#{msg.properties}" />
<f:verbatim>
</td>
</tr>
<tr>
<td align="middle">
</f:verbatim>
<h:graphicImage value="/images/icons/required_field.gif" alt="#{msg.required_field}" />
<f:verbatim>
</td>
<td>
</f:verbatim>
<h:outputText value="#{msg.name}:" />
<f:verbatim>
</td>
<td width="85%">
</f:verbatim>
<h:inputText id="name" value="#{DialogManager.bean.name}" size="35" maxlength="1024"
onkeyup="javascript:checkButtonState();" onchange="javascript:checkButtonState();" />
<f:verbatim>
</td>
</tr>
<tr>
<td></td>
<td>
</f:verbatim>
<h:outputText value="#{msg.title}:" />
<f:verbatim>
</td>
<td>
</f:verbatim>
<h:inputText id="title" value="#{DialogManager.bean.title}" size="35" maxlength="1024" />
<f:verbatim>
</td>
</tr>
<tr>
<td colspan="3"></td>
</tr>
<tr>
<td colspan="3" class="wizardSectionHeading">
</f:verbatim>
<h:outputText value="#{msg.target}" />
<f:verbatim>
</td>
</tr>
<tr>
<td align="middle">
</f:verbatim>
<h:graphicImage value="/images/icons/required_field.gif" alt="#{msg.required_field}" />
<f:verbatim>
</td>
<td>
</f:verbatim>
<h:outputText value="#{msg.web_project}:" />
<f:verbatim>
</td>
<td>
</f:verbatim>
<h:selectOneMenu id="targetStore" value="#{DialogManager.bean.targetStore}">
<f:selectItems value="#{DialogManager.bean.webProjects}" />
</h:selectOneMenu>
<f:verbatim>
</td>
</tr>
<tr>
<td align="middle">
</f:verbatim>
<h:graphicImage value="/images/icons/required_field.gif" alt="#{msg.required_field}" />
<f:verbatim>
</td>
<td>
</f:verbatim>
<h:outputText value="#{msg.target_path}:" />
<f:verbatim>
</td>
<td>
</f:verbatim>
<h:inputText id="targetPath" value="#{DialogManager.bean.targetPath}" size="35" maxlength="1024"
onkeyup="javascript:checkButtonState();" onchange="javascript:checkButtonState();" />
<f:verbatim>
</td>
</tr>
</table>
</f:verbatim>

View File

@@ -140,7 +140,9 @@
</td> </td>
<td> <td>
</f:verbatim> </f:verbatim>
<h:inputText id="webapp" value="#{WizardManager.bean.webapp}" size="45" maxlength="256" disabled="true" /> <h:selectOneMenu id="webapp" value="#{WizardManager.bean.webapp}">
<f:selectItems value="#{WizardManager.bean.webappsList}" />
</h:selectOneMenu>
<f:verbatim> <f:verbatim>
</td> </td>
</tr> </tr>