From 76dcb743a2849a80fe21c83ebc074551f4fad5ca Mon Sep 17 00:00:00 2001 From: Gavin Cornwell Date: Thu, 23 Apr 2009 14:07:20 +0000 Subject: [PATCH] Merged 3.1 to HEAD 13841: Build fix 13988: Applied patch for ETHREEOH-1620 (webdav issues with WebSphere) 13993: Partial (UI portion) fix for ETHREEOH-1500: Remove visibility of Workflow items 13995: Fix for ETHREEOH-1883: Start advanced workflow wizard lists the WCM 'Direct Submit to Staging' workflow as one of the selectable workflows 14061: Fix for ETHREEOH-1891: Form repeat element not working in 3.1 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@14070 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- config/alfresco/web-client-config-wcm.xml | 2 +- .../evaluator/StartWorkflowEvaluator.java | 23 +++++++++++++++---- source/web/scripts/ajax/xforms.js | 12 +++++++--- 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/config/alfresco/web-client-config-wcm.xml b/config/alfresco/web-client-config-wcm.xml index 6d5635602e..c3306553f3 100644 --- a/config/alfresco/web-client-config-wcm.xml +++ b/config/alfresco/web-client-config-wcm.xml @@ -10,7 +10,7 @@ - wcmwf:changerequest + wcmwf:changerequest, wcmwf:submitdirect diff --git a/source/java/org/alfresco/web/action/evaluator/StartWorkflowEvaluator.java b/source/java/org/alfresco/web/action/evaluator/StartWorkflowEvaluator.java index b6c62a2ecc..6350177133 100644 --- a/source/java/org/alfresco/web/action/evaluator/StartWorkflowEvaluator.java +++ b/source/java/org/alfresco/web/action/evaluator/StartWorkflowEvaluator.java @@ -27,9 +27,12 @@ package org.alfresco.web.action.evaluator; import javax.faces.context.FacesContext; import org.alfresco.model.ContentModel; +import org.alfresco.repo.workflow.BPMEngineRegistry; import org.alfresco.web.app.servlet.FacesHelper; import org.alfresco.web.bean.NavigationBean; import org.alfresco.web.bean.repository.Node; +import org.springframework.web.context.WebApplicationContext; +import org.springframework.web.jsf.FacesContextUtils; /** * UI Action Evaluator - Start workflow on a node. @@ -38,6 +41,7 @@ import org.alfresco.web.bean.repository.Node; */ public class StartWorkflowEvaluator extends BaseActionEvaluator { + private static final String BPM_ENGINE_BEAN_NAME = "bpm_engineRegistry"; private static final long serialVersionUID = 3110333488835027710L; /** @@ -45,12 +49,21 @@ public class StartWorkflowEvaluator extends BaseActionEvaluator */ public boolean evaluate(Node node) { + FacesContext facesContext = FacesContext.getCurrentInstance(); NavigationBean nav = - (NavigationBean)FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), NavigationBean.BEAN_NAME); + (NavigationBean)FacesHelper.getManagedBean(facesContext, NavigationBean.BEAN_NAME); - return ( - nav.getIsGuest() == false - && node.hasAspect(ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION) == false - ); + // determine whether the workflow services are active + boolean workflowPresent = false; + WebApplicationContext springContext = FacesContextUtils.getRequiredWebApplicationContext(facesContext); + BPMEngineRegistry bpmReg = (BPMEngineRegistry)springContext.getBean(BPM_ENGINE_BEAN_NAME); + if (bpmReg != null) + { + String[] components = bpmReg.getWorkflowComponents(); + workflowPresent = (components != null && components.length > 0); + } + + return (workflowPresent && nav.getIsGuest() == false && + node.hasAspect(ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION) == false); } } diff --git a/source/web/scripts/ajax/xforms.js b/source/web/scripts/ajax/xforms.js index 678a4131cd..d6b70243cf 100644 --- a/source/web/scripts/ajax/xforms.js +++ b/source/web/scripts/ajax/xforms.js @@ -412,8 +412,14 @@ alfresco.xforms.Widget = new Class({ /** Returns the widget's label. */ getLabel: function() { + var result = ""; var node = this._getChildXFormsNode("label"); - var result = node ? node.firstChild.nodeValue : ""; + + if (node && node.firstChild !== null) + { + result = node.firstChild.nodeValue; + } + if (alfresco.constants.DEBUG) { result += " [" + this.id + "]"; @@ -1259,7 +1265,7 @@ alfresco.xforms.CheckboxSelect = alfresco.xforms.AbstractSelectWidget.extend({ { this.parent(value, forceCommit); this._selectedValues = value.split(' '); - var checkboxes = this.widgets.getElementsByTagName("input"); + var checkboxes = this.widget.getElementsByTagName("input"); for (var i = 0; i < checkboxes.length; i++) { checkboxes[i].checked = @@ -1341,7 +1347,7 @@ alfresco.xforms.ListSelect = alfresco.xforms.AbstractSelectWidget.extend({ { this.parent(value, forceCommit); this._selectedValues = value.split(' '); - var options = this.widgets.getElementsByTagName("option"); + var options = this.widget.getElementsByTagName("option"); for (var i = 0; i < options.length; i++) { options[i].selected =