mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Create Project action added to Projects folder Create menu (only for this folder). Create Project dialog. Config to wire in new action/evaluators and Create Project dialog. Project placeholder icons added. Project type removed from list of types in Advanced Space wizard.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@7523 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* 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.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.repository.Path;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.app.servlet.FacesHelper;
|
||||
import org.alfresco.web.bean.NavigationBean;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
|
||||
/**
|
||||
* UI Action Evaluator - Create Project Collaboration Space in the Projects folder
|
||||
*
|
||||
* @author Kevin Roast
|
||||
*/
|
||||
public class CreateProjectEvaluator extends BaseActionEvaluator
|
||||
{
|
||||
/**
|
||||
* @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
|
||||
*/
|
||||
public boolean evaluate(Node node)
|
||||
{
|
||||
FacesContext fc = FacesContext.getCurrentInstance();
|
||||
ServiceRegistry services = Repository.getServiceRegistry(fc);
|
||||
NavigationBean navigator = (NavigationBean)FacesHelper.getManagedBean(fc, NavigationBean.BEAN_NAME);
|
||||
|
||||
// get the path to the current name - compare last element with the Website folder assoc name
|
||||
Path path = navigator.getCurrentNode().getNodePath();
|
||||
Path.Element element = path.get(path.size() - 1);
|
||||
String endPath = element.getPrefixedString(services.getNamespaceService());
|
||||
|
||||
if (Application.getProjectsFolderName(fc).equals(endPath))
|
||||
{
|
||||
// check we have the permission to create nodes in the Projects folder
|
||||
return navigator.getCurrentNode().hasPermission(PermissionService.ADD_CHILDREN);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@@ -36,7 +36,7 @@ import org.alfresco.web.bean.repository.Node;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
|
||||
/**
|
||||
* UI Action Evaluator - Create Web Project in the Websites folders
|
||||
* UI Action Evaluator - Create Web Project in the Websites folder
|
||||
*
|
||||
* @author Kevin Roast
|
||||
*/
|
||||
@@ -50,10 +50,12 @@ public class CreateWebProjectEvaluator extends BaseActionEvaluator
|
||||
FacesContext fc = FacesContext.getCurrentInstance();
|
||||
ServiceRegistry services = Repository.getServiceRegistry(fc);
|
||||
NavigationBean navigator = (NavigationBean)FacesHelper.getManagedBean(fc, NavigationBean.BEAN_NAME);
|
||||
|
||||
// get the path to the current name - compare last element with the Website folder assoc name
|
||||
Path path = services.getNodeService().getPath(navigator.getCurrentNode().getNodeRef());
|
||||
Path path = navigator.getCurrentNode().getNodePath();
|
||||
Path.Element element = path.get(path.size() - 1);
|
||||
String endPath = element.getPrefixedString(services.getNamespaceService());
|
||||
|
||||
if (Application.getWebsitesFolderName(fc).equals(endPath))
|
||||
{
|
||||
// check we have the permission to create nodes in that Website folder
|
||||
|
@@ -88,6 +88,7 @@ public class Application
|
||||
private static String websitesFolderName;
|
||||
private static String webContentFormsFolderName;
|
||||
private static String contentFormsFolderName;
|
||||
private static String projectsFolderName;
|
||||
|
||||
private static Boolean isDynamicConfig = null;
|
||||
|
||||
@@ -553,6 +554,22 @@ public class Application
|
||||
return getContentFormsFolderName(FacesContextUtils.getRequiredWebApplicationContext(context));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the Projects folder name
|
||||
*/
|
||||
public static String getProjectsFolderName(ServletContext context)
|
||||
{
|
||||
return getProjectsFolderName(WebApplicationContextUtils.getRequiredWebApplicationContext(context));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the Projects folder name
|
||||
*/
|
||||
public static String getProjectsFolderName(FacesContext context)
|
||||
{
|
||||
return getProjectsFolderName(FacesContextUtils.getRequiredWebApplicationContext(context));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the language locale for the current user context
|
||||
*
|
||||
@@ -950,6 +967,24 @@ public class Application
|
||||
return websitesFolderName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Projects folder name
|
||||
*
|
||||
* @param context The Spring context
|
||||
* @return The Projects folder name
|
||||
*/
|
||||
private static String getProjectsFolderName(WebApplicationContext context)
|
||||
{
|
||||
if (projectsFolderName == null)
|
||||
{
|
||||
ImporterBootstrap bootstrap = (ImporterBootstrap)context.getBean(BEAN_IMPORTER_BOOTSTRAP);
|
||||
Properties configuration = bootstrap.getConfiguration();
|
||||
projectsFolderName = configuration.getProperty("spaces.projects.childname");
|
||||
}
|
||||
|
||||
return projectsFolderName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the WCM Content Forms folder name
|
||||
*
|
||||
|
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* 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.projects;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.model.ApplicationModel;
|
||||
import org.alfresco.web.app.AlfrescoNavigationHandler;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.spaces.CreateSpaceWizard;
|
||||
|
||||
/**
|
||||
* Dialog bean to create a Project.
|
||||
*
|
||||
* Uses the CreateSpaceWizard and overrides the space type, finish button label
|
||||
* and the default outcomes.
|
||||
*
|
||||
* @author Kevin Roast
|
||||
*/
|
||||
public class CreateProjectDialog extends CreateSpaceWizard
|
||||
{
|
||||
// ------------------------------------------------------------------------------
|
||||
// Wizard implementation
|
||||
|
||||
@Override
|
||||
public void init(Map<String, String> parameters)
|
||||
{
|
||||
super.init(parameters);
|
||||
setSpaceType(ApplicationModel.TYPE_PROJECTSPACE.toString());
|
||||
setIcon("project");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFinishButtonLabel()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), "create_project");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDefaultCancelOutcome()
|
||||
{
|
||||
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDefaultFinishOutcome()
|
||||
{
|
||||
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user