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

@@ -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.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

View File

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

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.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()
*/

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;
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
*

View File

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

View File

@@ -3271,6 +3271,10 @@
<managed-property>
<property-name>formsService</property-name>
<value>#{FormsService}</value>
</managed-property>
<managed-property>
<property-name>avmBrowseBean</property-name>
<value>#{AVMBrowseBean}</value>
</managed-property>
</managed-bean>
@@ -3543,6 +3547,23 @@
<property-name>avmBrowseBean</property-name>
<value>#{AVMBrowseBean}</value>
</managed-property>
</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>
@@ -3589,6 +3610,27 @@
<property-name>nodeService</property-name>
<value>#{NodeService}</value>
</managed-property>
</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>

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" />
</td>
<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 --%>
<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}" />
@@ -271,6 +271,14 @@
</h:outputText>
</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 --%>
<a:column id="col9" actions="true" style="text-align:left">
<f:facet name="header">

View File

@@ -97,6 +97,19 @@
<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></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>
</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>
</td>
</tr>