mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Added new command processor to execute UI Action based commands
For new commands such as 'createwebcontent' - launches the Create Web Content wizard via URL. Some clean up of JSF Bean name constants. Minor fixes to webscript templates for demo. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5595 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -273,27 +273,32 @@ a.filterLinkSelected:link, a.filterLinkSelected:visited
|
|||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
border-right: none;
|
border-right: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.docActionEditDetails
|
.docActionEditDetails
|
||||||
{
|
{
|
||||||
background-image: url(../images/icons/doclist_action_edit.png);
|
background-image: url(../images/icons/doclist_action_edit.png);
|
||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.docActionUpdate
|
.docActionUpdate
|
||||||
{
|
{
|
||||||
background-image: url(../images/icons/doclist_action_update.png);
|
background-image: url(../images/icons/doclist_action_update.png);
|
||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
border-right: none;
|
border-right: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.docActionViewContent
|
.docActionViewContent
|
||||||
{
|
{
|
||||||
background-image: url(../images/icons/doclist_action_view.png);
|
background-image: url(../images/icons/doclist_action_view.png);
|
||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.docActionDelete
|
.docActionDelete
|
||||||
{
|
{
|
||||||
background-image: url(../images/icons/doclist_action_delete.png);
|
background-image: url(../images/icons/doclist_action_delete.png);
|
||||||
border-right: none;
|
border-right: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.docActionMoreActions
|
.docActionMoreActions
|
||||||
{
|
{
|
||||||
padding-left: 20px;
|
padding-left: 20px;
|
||||||
@@ -305,10 +310,9 @@ a.filterLinkSelected:link, a.filterLinkSelected:visited
|
|||||||
background-image: url(../images/icons/ajax_anim.gif);
|
background-image: url(../images/icons/ajax_anim.gif);
|
||||||
background-position: center;
|
background-position: center;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
width: 699px;
|
width: 696px;
|
||||||
height: 150px;
|
height: 150px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
</STYLE>
|
</STYLE>
|
@@ -11,13 +11,13 @@
|
|||||||
<#assign formcount=0>
|
<#assign formcount=0>
|
||||||
<#assign projectcount=0>
|
<#assign projectcount=0>
|
||||||
<#assign search="TYPE:\"{http://www.alfresco.org/model/wcmappmodel/1.0}webfolder\"">
|
<#assign search="TYPE:\"{http://www.alfresco.org/model/wcmappmodel/1.0}webfolder\"">
|
||||||
<#list companyhome.childrenByLuceneSearch[search] as wp>
|
<#list companyhome.childrenByLuceneSearch[search]?sort_by('name') as wp>
|
||||||
<#list wp.childAssocs["wca:webuser"] as user>
|
<#list wp.childAssocs["wca:webuser"] as user>
|
||||||
<#if user.properties["wca:username"] = person.properties.userName>
|
<#if user.properties["wca:username"] = person.properties.userName>
|
||||||
<#assign projectcount=projectcount+1>
|
<#assign projectcount=projectcount+1>
|
||||||
|
<#assign sandbox=wp.properties["wca:avmstore"] + "--" + person.properties.userName>
|
||||||
<div class="webProjectRow">
|
<div class="webProjectRow">
|
||||||
<div class="webProjectTitle">
|
<div class="webProjectTitle">
|
||||||
<#-- TEMP: ${url.context}/navigate/wizard/createWebsite -->
|
|
||||||
<a class="webProjectLink" href="${url.context}${wp.url}" target="new"><img src="${url.context}/images/icons/website_large.gif" width=32 height=32 border=0><span class="websiteLink">${wp.name}</span></a>
|
<a class="webProjectLink" href="${url.context}${wp.url}" target="new"><img src="${url.context}/images/icons/website_large.gif" width=32 height=32 border=0><span class="websiteLink">${wp.name}</span></a>
|
||||||
<#if wp.properties.description?exists && wp.properties.description?length!=0>
|
<#if wp.properties.description?exists && wp.properties.description?length!=0>
|
||||||
<br>
|
<br>
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
<#assign formcount=formcount+1>
|
<#assign formcount=formcount+1>
|
||||||
<div class="formsRow">
|
<div class="formsRow">
|
||||||
<img src="${url.context}/images/icons/webform_large.gif" width=32 height=32 border=0>
|
<img src="${url.context}/images/icons/webform_large.gif" width=32 height=32 border=0>
|
||||||
<span class="webformLink">${form.properties["wca:formname"]}</span>
|
<a class="webformLink" href="${url.context}/command/ui/createwebcontent?sandbox=${sandbox}&webproject=${wp.id}&form=${form.properties["wca:formname"]}" target="new">${form.properties.title}</a>
|
||||||
<#--<span>${form.properties.description}</span>-->
|
<#--<span>${form.properties.description}</span>-->
|
||||||
</div>
|
</div>
|
||||||
</#list>
|
</#list>
|
||||||
@@ -119,8 +119,11 @@ span.websiteLink
|
|||||||
vertical-align:60%;
|
vertical-align:60%;
|
||||||
}
|
}
|
||||||
|
|
||||||
span.webformLink
|
a.webformLink:link, a.webformLink:visited, a.webformLink:hover
|
||||||
{
|
{
|
||||||
|
color: #5A5741;
|
||||||
|
font-family: Trebuchet MS, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 13px;
|
||||||
vertical-align:50%;
|
vertical-align:50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -157,6 +157,7 @@
|
|||||||
<command-processor name="workflow" class="org.alfresco.web.app.servlet.command.WorkflowCommandProcessor" />
|
<command-processor name="workflow" class="org.alfresco.web.app.servlet.command.WorkflowCommandProcessor" />
|
||||||
<command-processor name="task" class="org.alfresco.web.app.servlet.command.TaskCommandProcessor" />
|
<command-processor name="task" class="org.alfresco.web.app.servlet.command.TaskCommandProcessor" />
|
||||||
<command-processor name="script" class="org.alfresco.web.app.servlet.command.ScriptCommandProcessor" />
|
<command-processor name="script" class="org.alfresco.web.app.servlet.command.ScriptCommandProcessor" />
|
||||||
|
<command-processor name="ui" class="org.alfresco.web.app.servlet.command.UIActionCommandProcessor" />
|
||||||
</command-servlet>
|
</command-servlet>
|
||||||
</config>
|
</config>
|
||||||
|
|
||||||
|
@@ -189,7 +189,7 @@ public class Application
|
|||||||
*/
|
*/
|
||||||
public static DialogManager getDialogManager()
|
public static DialogManager getDialogManager()
|
||||||
{
|
{
|
||||||
return (DialogManager)FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "DialogManager");
|
return (DialogManager)FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), DialogManager.BEAN_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -199,7 +199,7 @@ public class Application
|
|||||||
*/
|
*/
|
||||||
public static WizardManager getWizardManager()
|
public static WizardManager getWizardManager()
|
||||||
{
|
{
|
||||||
return (WizardManager)FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "WizardManager");
|
return (WizardManager)FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), WizardManager.BEAN_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -209,7 +209,7 @@ public class Application
|
|||||||
*/
|
*/
|
||||||
public static DashboardManager getDashboardManager()
|
public static DashboardManager getDashboardManager()
|
||||||
{
|
{
|
||||||
return (DashboardManager)FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "DashboardManager");
|
return (DashboardManager)FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), DashboardManager.BEAN_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -42,6 +42,7 @@ import org.alfresco.service.ServiceRegistry;
|
|||||||
import org.alfresco.web.app.Application;
|
import org.alfresco.web.app.Application;
|
||||||
import org.alfresco.web.app.servlet.command.CommandFactory;
|
import org.alfresco.web.app.servlet.command.CommandFactory;
|
||||||
import org.alfresco.web.app.servlet.command.CommandProcessor;
|
import org.alfresco.web.app.servlet.command.CommandProcessor;
|
||||||
|
import org.alfresco.web.app.servlet.command.ExtCommandProcessor;
|
||||||
import org.alfresco.web.config.CommandServletConfigElement;
|
import org.alfresco.web.config.CommandServletConfigElement;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
@@ -147,7 +148,14 @@ public class CommandServlet extends BaseServlet
|
|||||||
txn.begin();
|
txn.begin();
|
||||||
|
|
||||||
// inform the processor to execute the specified command
|
// inform the processor to execute the specified command
|
||||||
|
if (processor instanceof ExtCommandProcessor)
|
||||||
|
{
|
||||||
|
((ExtCommandProcessor)processor).process(serviceRegistry, req, res, command);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
processor.process(serviceRegistry, req, command);
|
processor.process(serviceRegistry, req, command);
|
||||||
|
}
|
||||||
|
|
||||||
// commit the transaction
|
// commit the transaction
|
||||||
txn.commit();
|
txn.commit();
|
||||||
|
@@ -42,6 +42,7 @@ import org.alfresco.service.cmr.security.AccessStatus;
|
|||||||
import org.alfresco.service.cmr.security.PermissionService;
|
import org.alfresco.service.cmr.security.PermissionService;
|
||||||
import org.alfresco.web.app.Application;
|
import org.alfresco.web.app.Application;
|
||||||
import org.alfresco.web.bean.BrowseBean;
|
import org.alfresco.web.bean.BrowseBean;
|
||||||
|
import org.alfresco.web.bean.NavigationBean;
|
||||||
import org.alfresco.web.bean.dashboard.DashboardManager;
|
import org.alfresco.web.bean.dashboard.DashboardManager;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
@@ -242,7 +243,7 @@ public class ExternalAccessServlet extends BaseServlet
|
|||||||
// setup the Dashboard Manager ready for the page we want to display
|
// setup the Dashboard Manager ready for the page we want to display
|
||||||
if (req.getParameter(ARG_PAGE) != null)
|
if (req.getParameter(ARG_PAGE) != null)
|
||||||
{
|
{
|
||||||
DashboardManager manager = (DashboardManager)FacesHelper.getManagedBean(fc, "DashboardManager");
|
DashboardManager manager = (DashboardManager)FacesHelper.getManagedBean(fc, DashboardManager.BEAN_NAME);
|
||||||
manager.getPageConfig().setCurrentPage(req.getParameter(ARG_PAGE));
|
manager.getPageConfig().setCurrentPage(req.getParameter(ARG_PAGE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -254,6 +255,12 @@ public class ExternalAccessServlet extends BaseServlet
|
|||||||
{
|
{
|
||||||
if (args.length != 0)
|
if (args.length != 0)
|
||||||
{
|
{
|
||||||
|
if (args.length > 1)
|
||||||
|
{
|
||||||
|
// if a GUID was passed, use it to init the NavigationBean current context
|
||||||
|
NavigationBean navigator = (NavigationBean)FacesHelper.getManagedBean(fc, NavigationBean.BEAN_NAME);
|
||||||
|
navigator.setCurrentNodeId(args[1]);
|
||||||
|
}
|
||||||
NavigationHandler navigationHandler = fc.getApplication().getNavigationHandler();
|
NavigationHandler navigationHandler = fc.getApplication().getNavigationHandler();
|
||||||
navigationHandler.handleNavigation(fc, null, outcome + ':' + args[0]);
|
navigationHandler.handleNavigation(fc, null, outcome + ':' + args[0]);
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* 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.app.servlet.command;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.alfresco.service.ServiceRegistry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Kevin Roast
|
||||||
|
*/
|
||||||
|
public abstract class BaseUIActionCommand implements Command
|
||||||
|
{
|
||||||
|
public static final String PROP_SERVLETCONTEXT = "ServletContext";
|
||||||
|
public static final String PROP_REQUEST = "Request";
|
||||||
|
public static final String PROP_RESPONSE = "Response";
|
||||||
|
}
|
@@ -0,0 +1,117 @@
|
|||||||
|
/*
|
||||||
|
* 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.app.servlet.command;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.faces.application.NavigationHandler;
|
||||||
|
import javax.faces.context.FacesContext;
|
||||||
|
import javax.servlet.ServletContext;
|
||||||
|
import javax.servlet.ServletRequest;
|
||||||
|
import javax.servlet.ServletResponse;
|
||||||
|
|
||||||
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
|
import org.alfresco.service.ServiceRegistry;
|
||||||
|
import org.alfresco.util.ParameterCheck;
|
||||||
|
import org.alfresco.web.app.servlet.BaseServlet;
|
||||||
|
import org.alfresco.web.app.servlet.FacesHelper;
|
||||||
|
import org.alfresco.web.bean.NavigationBean;
|
||||||
|
import org.alfresco.web.bean.wcm.AVMBrowseBean;
|
||||||
|
import org.alfresco.web.bean.wizard.WizardManager;
|
||||||
|
import org.alfresco.web.ui.wcm.component.UIUserSandboxes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Command to execute the Create Web Content wizard via url.
|
||||||
|
* <p>
|
||||||
|
* Arguments: webproject = the GUID of the webproject to create the content in
|
||||||
|
* sandbox = the sandbox to create the content in
|
||||||
|
* form = optional form name as the default selection in the content wizard
|
||||||
|
*
|
||||||
|
* @author Kevin Roast
|
||||||
|
*/
|
||||||
|
public class CreateWebContentCommand extends BaseUIActionCommand
|
||||||
|
{
|
||||||
|
public static final String PROP_WEBPROJECTID = "webproject";
|
||||||
|
public static final String PROP_SANDBOX = "sandbox";
|
||||||
|
public static final String PROP_FORMNAME = "form"; // optional
|
||||||
|
|
||||||
|
private static final String[] PROPERTIES = new String[] {
|
||||||
|
PROP_SERVLETCONTEXT, PROP_REQUEST, PROP_RESPONSE, PROP_WEBPROJECTID, PROP_SANDBOX, PROP_FORMNAME};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.web.app.servlet.command.Command#execute(org.alfresco.service.ServiceRegistry, java.util.Map)
|
||||||
|
*/
|
||||||
|
public Object execute(ServiceRegistry serviceRegistry, Map<String, Object> properties)
|
||||||
|
{
|
||||||
|
ServletContext sc = (ServletContext)properties.get(PROP_SERVLETCONTEXT);
|
||||||
|
ServletRequest req = (ServletRequest)properties.get(PROP_REQUEST);
|
||||||
|
ServletResponse res = (ServletResponse)properties.get(PROP_RESPONSE);
|
||||||
|
FacesContext fc = FacesHelper.getFacesContext(req, res, sc);
|
||||||
|
AVMBrowseBean avmBrowseBean = (AVMBrowseBean)FacesHelper.getManagedBean(fc, AVMBrowseBean.BEAN_NAME);
|
||||||
|
NavigationBean navigator = (NavigationBean)FacesHelper.getManagedBean(fc, NavigationBean.BEAN_NAME);
|
||||||
|
|
||||||
|
// setup context from url args in properties map
|
||||||
|
String webProjectId = (String)properties.get(PROP_WEBPROJECTID);
|
||||||
|
ParameterCheck.mandatoryString(PROP_WEBPROJECTID, webProjectId);
|
||||||
|
String sandbox = (String)properties.get(PROP_SANDBOX);
|
||||||
|
ParameterCheck.mandatoryString(PROP_SANDBOX, sandbox);
|
||||||
|
navigator.setCurrentNodeId(webProjectId);
|
||||||
|
avmBrowseBean.setSandbox(sandbox);
|
||||||
|
|
||||||
|
// form name is optional, but if set we need to init the wizard manager with params
|
||||||
|
String formName = (String)properties.get(PROP_FORMNAME);
|
||||||
|
if (formName != null && formName.length() != 0)
|
||||||
|
{
|
||||||
|
WizardManager manager = (WizardManager)FacesHelper.getManagedBean(fc, WizardManager.BEAN_NAME);
|
||||||
|
Map<String, String> params = new HashMap<String, String>(1, 1.0f);
|
||||||
|
params.put(UIUserSandboxes.PARAM_FORM_NAME, formName);
|
||||||
|
manager.setupParameters(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
NavigationHandler navigationHandler = fc.getApplication().getNavigationHandler();
|
||||||
|
navigationHandler.handleNavigation(fc, null, "wizard:createWebContent");
|
||||||
|
String viewId = fc.getViewRoot().getViewId();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
sc.getRequestDispatcher(BaseServlet.FACES_SERVLET + viewId).forward(req, res);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
throw new AlfrescoRuntimeException("Unable to forward to viewId: " + viewId, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.web.app.servlet.command.Command#getPropertyNames()
|
||||||
|
*/
|
||||||
|
public String[] getPropertyNames()
|
||||||
|
{
|
||||||
|
return PROPERTIES;
|
||||||
|
}
|
||||||
|
}
|
@@ -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.app.servlet.command;
|
||||||
|
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.servlet.ServletContext;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import org.alfresco.service.ServiceRegistry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This interfaces defines the contract and lifecycle of a Servlet Command Processor.
|
||||||
|
* <p>
|
||||||
|
* The ExtCommandProcessor adds an overloaded process() method to allow the
|
||||||
|
* HttpServletResponse to be passed.
|
||||||
|
*
|
||||||
|
* @author Kevin Roast
|
||||||
|
*/
|
||||||
|
public interface ExtCommandProcessor extends CommandProcessor
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Process the supplied command name. It is the responsibility of the Command Processor
|
||||||
|
* to lookup the specified command name using the CommandFactory registry. For that reason
|
||||||
|
* it also has the responsiblity to initially register commands it is responsible for so
|
||||||
|
* they can be constructed later. If the supplied command is unknown to it then an
|
||||||
|
* exception should be thrown to indicate this.
|
||||||
|
*
|
||||||
|
* @param serviceRegistry ServiceRegistry
|
||||||
|
* @param request HttpServletRequest
|
||||||
|
* @param response HttpServletResponse
|
||||||
|
* @param command Name of the command to construct and execute
|
||||||
|
*/
|
||||||
|
public void process(ServiceRegistry serviceRegistry, HttpServletRequest request, HttpServletResponse response, String command);
|
||||||
|
}
|
@@ -0,0 +1,113 @@
|
|||||||
|
/*
|
||||||
|
* 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.app.servlet.command;
|
||||||
|
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.faces.context.FacesContext;
|
||||||
|
import javax.servlet.ServletContext;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
|
import org.alfresco.service.ServiceRegistry;
|
||||||
|
import org.alfresco.web.app.servlet.FacesHelper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UI action command processor implementation.
|
||||||
|
* <p>
|
||||||
|
* Responsible for executing specific UI actions via a REST style URL interface.
|
||||||
|
* <p>
|
||||||
|
* The URL postfix for each specific command depends on the context that is required
|
||||||
|
* for that command. For example, a command to launch the Create Web Content dialog may
|
||||||
|
* require the current sandbox and the current web project as its context e.g.
|
||||||
|
* <br>
|
||||||
|
* http://server/alfresco/command/ui/createwebcontent?sandbox=website1&webproject=1234567890
|
||||||
|
*
|
||||||
|
* @author Kevin Roast
|
||||||
|
*/
|
||||||
|
public class UIActionCommandProcessor implements ExtCommandProcessor
|
||||||
|
{
|
||||||
|
private ServletContext sc = null;
|
||||||
|
private String command = null;
|
||||||
|
private Map<String, String> args = null;
|
||||||
|
|
||||||
|
static
|
||||||
|
{
|
||||||
|
// add our commands to the command registry
|
||||||
|
CommandFactory.getInstance().registerCommand("createwebcontent", CreateWebContentCommand.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.web.app.servlet.command.CommandProcessor#validateArguments(javax.servlet.ServletContext, java.lang.String, java.util.Map, java.lang.String[])
|
||||||
|
*/
|
||||||
|
public boolean validateArguments(ServletContext sc, String command, Map<String, String> args, String[] urlElements)
|
||||||
|
{
|
||||||
|
this.sc = sc;
|
||||||
|
if (args.size() != 0)
|
||||||
|
{
|
||||||
|
this.args = new HashMap<String, String>(args);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void process(ServiceRegistry serviceRegistry, HttpServletRequest request, String command)
|
||||||
|
{
|
||||||
|
// not implemented in ExtCommandProcessor!
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.web.app.servlet.command.ExtCommandProcessor#process(org.alfresco.service.ServiceRegistry, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String)
|
||||||
|
*/
|
||||||
|
public void process(ServiceRegistry serviceRegistry, HttpServletRequest request, HttpServletResponse response, String command)
|
||||||
|
{
|
||||||
|
Map<String, Object> properties = new HashMap<String, Object>(this.args);
|
||||||
|
|
||||||
|
properties.put(BaseUIActionCommand.PROP_SERVLETCONTEXT, this.sc);
|
||||||
|
properties.put(BaseUIActionCommand.PROP_REQUEST, request);
|
||||||
|
properties.put(BaseUIActionCommand.PROP_RESPONSE, response);
|
||||||
|
Command cmd = CommandFactory.getInstance().createCommand(command);
|
||||||
|
if (cmd == null)
|
||||||
|
{
|
||||||
|
throw new AlfrescoRuntimeException("Unregistered UI Action command specified: " + command);
|
||||||
|
}
|
||||||
|
cmd.execute(serviceRegistry, properties);
|
||||||
|
this.command = command;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.web.app.servlet.command.CommandProcessor#outputStatus(java.io.PrintWriter)
|
||||||
|
*/
|
||||||
|
public void outputStatus(PrintWriter out)
|
||||||
|
{
|
||||||
|
out.print("UI Action command: '");
|
||||||
|
out.print(this.command);
|
||||||
|
out.print("' executed with args: ");
|
||||||
|
out.println(this.args);
|
||||||
|
}
|
||||||
|
}
|
@@ -47,6 +47,8 @@ import org.apache.commons.logging.LogFactory;
|
|||||||
*/
|
*/
|
||||||
public class DashboardManager
|
public class DashboardManager
|
||||||
{
|
{
|
||||||
|
public static final String BEAN_NAME = "DashboardManager";
|
||||||
|
|
||||||
private static Log logger = LogFactory.getLog(DashboardManager.class);
|
private static Log logger = LogFactory.getLog(DashboardManager.class);
|
||||||
|
|
||||||
private static final String PREF_DASHBOARD = "dashboard";
|
private static final String PREF_DASHBOARD = "dashboard";
|
||||||
|
@@ -46,6 +46,8 @@ import org.alfresco.web.ui.common.component.UIActionLink;
|
|||||||
*/
|
*/
|
||||||
public final class DialogManager
|
public final class DialogManager
|
||||||
{
|
{
|
||||||
|
public final static String BEAN_NAME = "DialogManager";
|
||||||
|
|
||||||
private DialogState currentDialogState;
|
private DialogState currentDialogState;
|
||||||
private Map<String, String> paramsToApply;
|
private Map<String, String> paramsToApply;
|
||||||
|
|
||||||
|
@@ -1066,7 +1066,7 @@ public class AVMBrowseBean implements IContextListener
|
|||||||
|
|
||||||
// pass form ID to the wizard - to be picked up in init()
|
// pass form ID to the wizard - to be picked up in init()
|
||||||
FacesContext fc = FacesContext.getCurrentInstance();
|
FacesContext fc = FacesContext.getCurrentInstance();
|
||||||
WizardManager manager = (WizardManager)FacesHelper.getManagedBean(fc, "WizardManager");
|
WizardManager manager = (WizardManager)FacesHelper.getManagedBean(fc, WizardManager.BEAN_NAME);
|
||||||
manager.setupParameters(event);
|
manager.setupParameters(event);
|
||||||
fc.getApplication().getNavigationHandler().handleNavigation(fc, null, "wizard:createWebContent");
|
fc.getApplication().getNavigationHandler().handleNavigation(fc, null, "wizard:createWebContent");
|
||||||
}
|
}
|
||||||
|
@@ -52,6 +52,9 @@ import org.apache.commons.logging.LogFactory;
|
|||||||
*/
|
*/
|
||||||
public final class WizardManager
|
public final class WizardManager
|
||||||
{
|
{
|
||||||
|
/** public JSF bean name */
|
||||||
|
public final static String BEAN_NAME = "WizardManager";
|
||||||
|
|
||||||
private static Log logger = LogFactory.getLog(WizardManager.class);
|
private static Log logger = LogFactory.getLog(WizardManager.class);
|
||||||
|
|
||||||
private WizardState currentWizardState;
|
private WizardState currentWizardState;
|
||||||
|
Reference in New Issue
Block a user