- 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
This commit is contained in:
Gavin Cornwell
2006-09-04 09:57:29 +00:00
parent 42b84cb75c
commit be07f90d50
6 changed files with 83 additions and 2 deletions

View File

@@ -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

View File

@@ -5,6 +5,7 @@
<action id="start_workflow">
<label-id>start_workflow</label-id>
<image>/images/icons/new_workflow.gif</image>
<evaluator>org.alfresco.web.action.evaluator.StartWorkflowEvaluator</evaluator>
<action>wizard:startWorkflow</action>
<action-listener>#{WizardManager.setupParameters}</action-listener>
<params>

View File

@@ -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);
}
}

View File

@@ -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<SelectItem> workflows = getStartableWorkflows();
return (workflows.size() > 0);
}
/**
* Returns a list of workflows that can be started.
*

View File

@@ -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;

View File

@@ -19,10 +19,29 @@
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %>
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
<h:panelGrid columns="1" style="border: 1px solid #676767; background-color: #efefef; padding: 6px 12px 12px 6px;">
<%@ page import="org.alfresco.web.ui.common.PanelGenerator" %>
<h:panelGroup rendered="#{WizardManager.bean.hasStartableWorkflows == false}">
<f:verbatim>
<%PanelGenerator.generatePanelStart(out, request.getContextPath(), "yellowInner", "#ffffcc");%>
<table><tr><td>
</f:verbatim>
<h:graphicImage url="/images/icons/info_icon.gif" />
<f:verbatim>
</td><td>
</f:verbatim>
<h:outputText value="#{msg.start_workflow_no_workflows}" />
<f:verbatim>
</td></tr></table>
<%PanelGenerator.generatePanelEnd(out, request.getContextPath(), "yellowInner");%>
</f:verbatim>
</h:panelGroup>
<h:panelGrid columns="1" styleClass="workflowSelection" rendered="#{WizardManager.bean.hasStartableWorkflows}">
<h:outputText value="#{msg.available_workflows}:"/>
<h:selectOneRadio id="selected-workflow" value="#{WizardManager.bean.selectedWorkflow}"
layout="pageDirection">
<f:selectItems value="#{WizardManager.bean.startableWorkflows}" />
</h:selectOneRadio>
</h:panelGrid>
</h:panelGrid>