diff --git a/config/alfresco/templates/webscripts/org/alfresco/portlets/doclist_get_html.ftl b/config/alfresco/templates/webscripts/org/alfresco/portlets/doclist_get_html.ftl index 0dc8bec6e4..3d81bf10e3 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/portlets/doclist_get_html.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/portlets/doclist_get_html.ftl @@ -273,27 +273,32 @@ a.filterLinkSelected:link, a.filterLinkSelected:visited border-bottom: none; border-right: none; } + .docActionEditDetails { background-image: url(../images/icons/doclist_action_edit.png); border-bottom: none; } + .docActionUpdate { background-image: url(../images/icons/doclist_action_update.png); border-bottom: none; border-right: none; } + .docActionViewContent { background-image: url(../images/icons/doclist_action_view.png); border-bottom: none; } + .docActionDelete { background-image: url(../images/icons/doclist_action_delete.png); border-right: none; } + .docActionMoreActions { padding-left: 20px; @@ -305,10 +310,9 @@ a.filterLinkSelected:link, a.filterLinkSelected:visited background-image: url(../images/icons/ajax_anim.gif); background-position: center; background-repeat: no-repeat; - width: 699px; + width: 696px; height: 150px; overflow: hidden; } - \ No newline at end of file diff --git a/config/alfresco/templates/webscripts/org/alfresco/portlets/mywebforms_get_html.ftl b/config/alfresco/templates/webscripts/org/alfresco/portlets/mywebforms_get_html.ftl index 2f8c0d9f6f..f6eb51f48e 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/portlets/mywebforms_get_html.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/portlets/mywebforms_get_html.ftl @@ -11,13 +11,13 @@ <#assign formcount=0> <#assign projectcount=0> <#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> <#if user.properties["wca:username"] = person.properties.userName> <#assign projectcount=projectcount+1> + <#assign sandbox=wp.properties["wca:avmstore"] + "--" + person.properties.userName>
- <#-- TEMP: ${url.context}/navigate/wizard/createWebsite --> ${wp.name} <#if wp.properties.description?exists && wp.properties.description?length!=0>
@@ -31,7 +31,7 @@ <#assign formcount=formcount+1>
- ${form.properties["wca:formname"]} + ${form.properties.title} <#--${form.properties.description}-->
@@ -119,8 +119,11 @@ span.websiteLink 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%; } diff --git a/config/alfresco/web-client-config.xml b/config/alfresco/web-client-config.xml index 1f08579734..bc7aff4add 100644 --- a/config/alfresco/web-client-config.xml +++ b/config/alfresco/web-client-config.xml @@ -157,6 +157,7 @@ + diff --git a/source/java/org/alfresco/web/app/Application.java b/source/java/org/alfresco/web/app/Application.java index 8ae6b56571..b21d6577b7 100644 --- a/source/java/org/alfresco/web/app/Application.java +++ b/source/java/org/alfresco/web/app/Application.java @@ -189,7 +189,7 @@ public class Application */ 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() { - 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() { - return (DashboardManager)FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "DashboardManager"); + return (DashboardManager)FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), DashboardManager.BEAN_NAME); } /** diff --git a/source/java/org/alfresco/web/app/servlet/CommandServlet.java b/source/java/org/alfresco/web/app/servlet/CommandServlet.java index 6bfc2b9bfb..bb8d8d7133 100644 --- a/source/java/org/alfresco/web/app/servlet/CommandServlet.java +++ b/source/java/org/alfresco/web/app/servlet/CommandServlet.java @@ -42,6 +42,7 @@ import org.alfresco.service.ServiceRegistry; import org.alfresco.web.app.Application; import org.alfresco.web.app.servlet.command.CommandFactory; import org.alfresco.web.app.servlet.command.CommandProcessor; +import org.alfresco.web.app.servlet.command.ExtCommandProcessor; import org.alfresco.web.config.CommandServletConfigElement; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -147,7 +148,14 @@ public class CommandServlet extends BaseServlet txn.begin(); // inform the processor to execute the specified command - processor.process(serviceRegistry, req, command); + if (processor instanceof ExtCommandProcessor) + { + ((ExtCommandProcessor)processor).process(serviceRegistry, req, res, command); + } + else + { + processor.process(serviceRegistry, req, command); + } // commit the transaction txn.commit(); diff --git a/source/java/org/alfresco/web/app/servlet/ExternalAccessServlet.java b/source/java/org/alfresco/web/app/servlet/ExternalAccessServlet.java index 5e48add12e..4bcc2db882 100644 --- a/source/java/org/alfresco/web/app/servlet/ExternalAccessServlet.java +++ b/source/java/org/alfresco/web/app/servlet/ExternalAccessServlet.java @@ -42,6 +42,7 @@ import org.alfresco.service.cmr.security.AccessStatus; import org.alfresco.service.cmr.security.PermissionService; import org.alfresco.web.app.Application; import org.alfresco.web.bean.BrowseBean; +import org.alfresco.web.bean.NavigationBean; import org.alfresco.web.bean.dashboard.DashboardManager; import org.apache.commons.logging.Log; 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 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)); } @@ -254,6 +255,12 @@ public class ExternalAccessServlet extends BaseServlet { 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.handleNavigation(fc, null, outcome + ':' + args[0]); } diff --git a/source/java/org/alfresco/web/app/servlet/command/BaseUIActionCommand.java b/source/java/org/alfresco/web/app/servlet/command/BaseUIActionCommand.java new file mode 100644 index 0000000000..808b2eab35 --- /dev/null +++ b/source/java/org/alfresco/web/app/servlet/command/BaseUIActionCommand.java @@ -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"; +} diff --git a/source/java/org/alfresco/web/app/servlet/command/CreateWebContentCommand.java b/source/java/org/alfresco/web/app/servlet/command/CreateWebContentCommand.java new file mode 100644 index 0000000000..c02ad01e91 --- /dev/null +++ b/source/java/org/alfresco/web/app/servlet/command/CreateWebContentCommand.java @@ -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. + *

+ * 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 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 params = new HashMap(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; + } +} diff --git a/source/java/org/alfresco/web/app/servlet/command/ExtCommandProcessor.java b/source/java/org/alfresco/web/app/servlet/command/ExtCommandProcessor.java new file mode 100644 index 0000000000..651eef7afb --- /dev/null +++ b/source/java/org/alfresco/web/app/servlet/command/ExtCommandProcessor.java @@ -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. + *

+ * 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); +} diff --git a/source/java/org/alfresco/web/app/servlet/command/UIActionCommandProcessor.java b/source/java/org/alfresco/web/app/servlet/command/UIActionCommandProcessor.java new file mode 100644 index 0000000000..80cd371128 --- /dev/null +++ b/source/java/org/alfresco/web/app/servlet/command/UIActionCommandProcessor.java @@ -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. + *

+ * Responsible for executing specific UI actions via a REST style URL interface. + *

+ * 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. + *
+ * 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 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 args, String[] urlElements) + { + this.sc = sc; + if (args.size() != 0) + { + this.args = new HashMap(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 properties = new HashMap(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); + } +} diff --git a/source/java/org/alfresco/web/bean/dashboard/DashboardManager.java b/source/java/org/alfresco/web/bean/dashboard/DashboardManager.java index c133d18bff..cac42d6c88 100644 --- a/source/java/org/alfresco/web/bean/dashboard/DashboardManager.java +++ b/source/java/org/alfresco/web/bean/dashboard/DashboardManager.java @@ -47,6 +47,8 @@ import org.apache.commons.logging.LogFactory; */ public class DashboardManager { + public static final String BEAN_NAME = "DashboardManager"; + private static Log logger = LogFactory.getLog(DashboardManager.class); private static final String PREF_DASHBOARD = "dashboard"; diff --git a/source/java/org/alfresco/web/bean/dialog/DialogManager.java b/source/java/org/alfresco/web/bean/dialog/DialogManager.java index 2ab547743b..f9bc76d72e 100644 --- a/source/java/org/alfresco/web/bean/dialog/DialogManager.java +++ b/source/java/org/alfresco/web/bean/dialog/DialogManager.java @@ -46,6 +46,8 @@ import org.alfresco.web.ui.common.component.UIActionLink; */ public final class DialogManager { + public final static String BEAN_NAME = "DialogManager"; + private DialogState currentDialogState; private Map paramsToApply; diff --git a/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java b/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java index 59491edc43..cd14044a72 100644 --- a/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java +++ b/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java @@ -1066,7 +1066,7 @@ public class AVMBrowseBean implements IContextListener // pass form ID to the wizard - to be picked up in init() FacesContext fc = FacesContext.getCurrentInstance(); - WizardManager manager = (WizardManager)FacesHelper.getManagedBean(fc, "WizardManager"); + WizardManager manager = (WizardManager)FacesHelper.getManagedBean(fc, WizardManager.BEAN_NAME); manager.setupParameters(event); fc.getApplication().getNavigationHandler().handleNavigation(fc, null, "wizard:createWebContent"); } diff --git a/source/java/org/alfresco/web/bean/wizard/WizardManager.java b/source/java/org/alfresco/web/bean/wizard/WizardManager.java index 29e5899ac1..b76036e4b8 100644 --- a/source/java/org/alfresco/web/bean/wizard/WizardManager.java +++ b/source/java/org/alfresco/web/bean/wizard/WizardManager.java @@ -52,6 +52,9 @@ import org.apache.commons.logging.LogFactory; */ public final class WizardManager { + /** public JSF bean name */ + public final static String BEAN_NAME = "WizardManager"; + private static Log logger = LogFactory.getLog(WizardManager.class); private WizardState currentWizardState;