mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
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:
@@ -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())));
|
||||
}
|
||||
}
|
@@ -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());
|
||||
}
|
||||
}
|
@@ -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));
|
||||
}
|
||||
}
|
@@ -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;
|
||||
}
|
||||
}
|
@@ -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
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
@@ -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<List<UIListItem>> webProjectsList;
|
||||
protected List<SelectItem> 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<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()
|
||||
*/
|
||||
|
@@ -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()});
|
||||
}
|
||||
}
|
@@ -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<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)
|
||||
@@ -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
|
||||
*
|
||||
|
@@ -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()
|
||||
|
Reference in New Issue
Block a user