diff --git a/config/alfresco/templates/webscripts/org/alfresco/portlets/mytaskspanel.get.html.ftl b/config/alfresco/templates/webscripts/org/alfresco/portlets/mytaskspanel.get.html.ftl index a1af27a992..3e7e305510 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/portlets/mytaskspanel.get.html.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/portlets/mytaskspanel.get.html.ftl @@ -50,6 +50,9 @@
${t.name?html}:
+
+ Manage Task Details +
diff --git a/source/java/org/alfresco/web/app/servlet/command/ManageTaskDialogCommand.java b/source/java/org/alfresco/web/app/servlet/command/ManageTaskDialogCommand.java new file mode 100644 index 0000000000..10160a7085 --- /dev/null +++ b/source/java/org/alfresco/web/app/servlet/command/ManageTaskDialogCommand.java @@ -0,0 +1,105 @@ +/* + * 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.bean.workflow.WorkflowBean; +import org.alfresco.web.ui.wcm.component.UIUserSandboxes; + +/** + * Command to execute the Manage Task dialog via url. + *

+ * Arguments: id = the id of the task + * type = the qname type of the task + * + * @author Kevin Roast + */ +public class ManageTaskDialogCommand extends BaseUIActionCommand +{ + public static final String PROP_TASKID = "id"; + public static final String PROP_TASKTYPE = "type"; + + private static final String[] PROPERTIES = new String[] { + PROP_SERVLETCONTEXT, PROP_REQUEST, PROP_RESPONSE, PROP_TASKID, PROP_TASKTYPE}; + + /** + * @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); + WorkflowBean wfBean = (WorkflowBean)FacesHelper.getManagedBean(fc, WorkflowBean.BEAN_NAME); + + // setup dialog context from url args in properties map + String taskId = (String)properties.get(PROP_TASKID); + ParameterCheck.mandatoryString(PROP_TASKID, taskId); + String taskType = (String)properties.get(PROP_TASKTYPE); + ParameterCheck.mandatoryString(PROP_TASKTYPE, taskType); + + wfBean.setupTaskDialog(taskId, taskType); + + NavigationHandler navigationHandler = fc.getApplication().getNavigationHandler(); + navigationHandler.handleNavigation(fc, null, "dialog:manageTask"); + 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/UIActionCommandProcessor.java b/source/java/org/alfresco/web/app/servlet/command/UIActionCommandProcessor.java index b753d99353..1527ddd097 100644 --- a/source/java/org/alfresco/web/app/servlet/command/UIActionCommandProcessor.java +++ b/source/java/org/alfresco/web/app/servlet/command/UIActionCommandProcessor.java @@ -63,6 +63,7 @@ public class UIActionCommandProcessor implements ExtCommandProcessor { // add our commands to the command registry CommandFactory.getInstance().registerCommand("createwebcontent", CreateWebContentCommand.class); + CommandFactory.getInstance().registerCommand("managetask", ManageTaskDialogCommand.class); } diff --git a/source/java/org/alfresco/web/bean/workflow/WorkflowBean.java b/source/java/org/alfresco/web/bean/workflow/WorkflowBean.java index 7e0614d8f4..1a3293dca9 100644 --- a/source/java/org/alfresco/web/bean/workflow/WorkflowBean.java +++ b/source/java/org/alfresco/web/bean/workflow/WorkflowBean.java @@ -25,6 +25,7 @@ package org.alfresco.web.bean.workflow; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -41,6 +42,7 @@ import org.alfresco.service.cmr.workflow.WorkflowTaskDefinition; import org.alfresco.service.cmr.workflow.WorkflowTaskState; import org.alfresco.service.cmr.workflow.WorkflowTransition; import org.alfresco.service.namespace.QName; +import org.alfresco.util.ParameterCheck; import org.alfresco.web.app.Application; import org.alfresco.web.bean.NavigationBean; import org.alfresco.web.bean.repository.Node; @@ -69,6 +71,9 @@ public class WorkflowBean private static final Log logger = LogFactory.getLog(WorkflowBean.class); + public static final String BEAN_NAME = "WorkflowBean"; + + // ------------------------------------------------------------------------------ // Bean Getters and Setters @@ -251,6 +256,7 @@ public class WorkflowBean this.nodeService = nodeService; } + // ------------------------------------------------------------------------------ // Navigation handlers @@ -269,6 +275,23 @@ public class WorkflowBean Application.getDialogManager().setupParameters(event); } + public void setupTaskDialog(String id, String type) + { + ParameterCheck.mandatoryString("Task ID", id); + ParameterCheck.mandatoryString("Task Type", type); + + // setup the dispatch context with the task we're opening a dialog for + TransientNode node = new TransientNode(QName.createQName(type), id, null); + this.navigationBean.setupDispatchContext(node); + + // pass on parameters for the dialog + Map params = new HashMap(2, 1.0f); + params.put("id", id); + params.put("type", type); + Application.getDialogManager().setupParameters(params); + } + + // ------------------------------------------------------------------------------ // Helper methods