From be07f90d509410dbd4bfdf03fd96ec23b048d14a Mon Sep 17 00:00:00 2001 From: Gavin Cornwell Date: Mon, 4 Sep 2006 09:57:29 +0000 Subject: [PATCH] - Added action evaluator to start workflow action so the guest user can not start workflows - Handled the case in the start workflow wizard where there are no workflows to start (info message displayed) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3667 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- config/alfresco/messages/webclient.properties | 1 + .../web-client-config-workflow-actions.xml | 1 + .../evaluator/StartWorkflowEvaluator.java | 42 +++++++++++++++++++ .../bean/workflow/StartWorkflowWizard.java | 11 +++++ source/web/css/main.css | 7 ++++ .../start-workflow-wizard/choose-workflow.jsp | 23 +++++++++- 6 files changed, 83 insertions(+), 2 deletions(-) create mode 100644 source/java/org/alfresco/web/action/evaluator/StartWorkflowEvaluator.java diff --git a/config/alfresco/messages/webclient.properties b/config/alfresco/messages/webclient.properties index 6266c85a09..c78a7e4771 100644 --- a/config/alfresco/messages/webclient.properties +++ b/config/alfresco/messages/webclient.properties @@ -963,6 +963,7 @@ start_workflow_options_title=Workflow Options start_workflow_options_desc=Select options for the workflow start_workflow_finish_instruction=To start the workflow press Finish. To review or change your selections click Back. start_workflow_no_metadata=There is no metadata to collect for this particular workflow. +start_workflow_no_workflows=There are no workflows currently deployed in the repository, press Cancel to exit the wizard. users_and_roles=Users and their Roles resources=Resources manage_task=Manage Task diff --git a/config/alfresco/web-client-config-workflow-actions.xml b/config/alfresco/web-client-config-workflow-actions.xml index 56516bb451..72e628e7e0 100644 --- a/config/alfresco/web-client-config-workflow-actions.xml +++ b/config/alfresco/web-client-config-workflow-actions.xml @@ -5,6 +5,7 @@ start_workflow /images/icons/new_workflow.gif + org.alfresco.web.action.evaluator.StartWorkflowEvaluator wizard:startWorkflow #{WizardManager.setupParameters} diff --git a/source/java/org/alfresco/web/action/evaluator/StartWorkflowEvaluator.java b/source/java/org/alfresco/web/action/evaluator/StartWorkflowEvaluator.java new file mode 100644 index 0000000000..0d0de2e2d7 --- /dev/null +++ b/source/java/org/alfresco/web/action/evaluator/StartWorkflowEvaluator.java @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2005 Alfresco, Inc. + * + * Licensed under the Mozilla Public License version 1.1 + * with a permitted attribution clause. You may obtain a + * copy of the License at + * + * http://www.alfresco.org/legal/license.txt + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + */ +package org.alfresco.web.action.evaluator; + +import javax.faces.context.FacesContext; + +import org.alfresco.web.action.ActionEvaluator; +import org.alfresco.web.app.servlet.FacesHelper; +import org.alfresco.web.bean.NavigationBean; +import org.alfresco.web.bean.repository.Node; + +/** + * UI Action Evaluator - Start workflow on a node. + * + * @author gavinc + */ +public class StartWorkflowEvaluator implements ActionEvaluator +{ + /** + * @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node) + */ + public boolean evaluate(Node node) + { + NavigationBean nav = + (NavigationBean)FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "NavigationBean"); + return (nav.getIsGuest() == false); + } +} diff --git a/source/java/org/alfresco/web/bean/workflow/StartWorkflowWizard.java b/source/java/org/alfresco/web/bean/workflow/StartWorkflowWizard.java index 3e79a173dc..c8e5d0a086 100644 --- a/source/java/org/alfresco/web/bean/workflow/StartWorkflowWizard.java +++ b/source/java/org/alfresco/web/bean/workflow/StartWorkflowWizard.java @@ -447,6 +447,17 @@ public class StartWorkflowWizard extends BaseWizardBean new String[] {workflowName}); } + /** + * Determines whether there are any workflows to start + * @return + */ + public boolean getHasStartableWorkflows() + { + // get the list of startable workflow, this will intialise the list if necessary + List workflows = getStartableWorkflows(); + return (workflows.size() > 0); + } + /** * Returns a list of workflows that can be started. * diff --git a/source/web/css/main.css b/source/web/css/main.css index 9e3053357c..2a6e4c1746 100644 --- a/source/web/css/main.css +++ b/source/web/css/main.css @@ -529,6 +529,13 @@ a.topToolbarLinkHighlight, a.topToolbarLinkHighlight:link, a.topToolbarLinkHighl border-color: #AAAAAA; } +.workflowSelection +{ + border: 1px solid #676767; + background-color: #efefef; + padding: 6px 12px 12px 6px; +} + .workflowSummary { margin-left: 6px; diff --git a/source/web/jsp/workflow/start-workflow-wizard/choose-workflow.jsp b/source/web/jsp/workflow/start-workflow-wizard/choose-workflow.jsp index a3799bbefb..1d90b698a0 100644 --- a/source/web/jsp/workflow/start-workflow-wizard/choose-workflow.jsp +++ b/source/web/jsp/workflow/start-workflow-wizard/choose-workflow.jsp @@ -19,10 +19,29 @@ <%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> <%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> - +<%@ page import="org.alfresco.web.ui.common.PanelGenerator" %> + + + + <%PanelGenerator.generatePanelStart(out, request.getContextPath(), "yellowInner", "#ffffcc");%> +
+ + + + + + + +
+ <%PanelGenerator.generatePanelEnd(out, request.getContextPath(), "yellowInner");%> +
+
+ + - \ No newline at end of file +
+