diff --git a/config/alfresco/web-client-config-actions.xml b/config/alfresco/web-client-config-actions.xml index 4817bbb163..b77e6510cd 100644 --- a/config/alfresco/web-client-config-actions.xml +++ b/config/alfresco/web-client-config-actions.xml @@ -10,7 +10,7 @@ - Write + Write AddChildren @@ -378,7 +379,6 @@ manage_deleted_items /images/icons/trashcan.gif - #{TrashcanBean.setupTrashcan} dialog:manageDeletedItems @@ -431,7 +431,11 @@ other_action /images/icons/action.gif - wizard:runAction + wizard:runAction + #{WizardManager.setupParameters} + + #{actionContext.id} + @@ -581,6 +585,7 @@ + diff --git a/config/alfresco/web-client-config-forum-actions.xml b/config/alfresco/web-client-config-forum-actions.xml index e5c1f2eaa2..64539be46d 100644 --- a/config/alfresco/web-client-config-forum-actions.xml +++ b/config/alfresco/web-client-config-forum-actions.xml @@ -263,6 +263,7 @@ + diff --git a/source/java/org/alfresco/web/bean/actions/RunActionWizard.java b/source/java/org/alfresco/web/bean/actions/RunActionWizard.java index 5fbe9fc0b6..e9b140ad25 100644 --- a/source/java/org/alfresco/web/bean/actions/RunActionWizard.java +++ b/source/java/org/alfresco/web/bean/actions/RunActionWizard.java @@ -1,13 +1,21 @@ package org.alfresco.web.bean.actions; import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; import java.util.Map; import java.util.ResourceBundle; import javax.faces.context.FacesContext; +import javax.faces.model.SelectItem; import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.action.ActionDefinition; +import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.web.app.Application; +import org.alfresco.web.bean.repository.Repository; +import org.alfresco.web.data.IDataContainer; +import org.alfresco.web.data.QuickSort; /** * Bean implementation for the "Run Action" wizard. @@ -37,12 +45,38 @@ public class RunActionWizard extends BaseActionWizard action.setParameterValues(repoActionParams); // execute the action on the current document node - this.actionService.executeAction(action, this.browseBean.getDocument().getNodeRef()); + NodeRef nodeRef = new NodeRef(Repository.getStoreRef(), this.parameters.get("id")); + this.actionService.executeAction(action, nodeRef); } return outcome; } + @Override + public List getActions() + { + if (this.actions == null) + { + NodeRef nodeRef = new NodeRef(Repository.getStoreRef(), this.parameters.get("id")); + List ruleActions = this.actionService.getActionDefinitions(nodeRef); + this.actions = new ArrayList(); + for (ActionDefinition ruleActionDef : ruleActions) + { + this.actions.add(new SelectItem(ruleActionDef.getName(), ruleActionDef.getTitle())); + } + + // make sure the list is sorted by the label + QuickSort sorter = new QuickSort(this.actions, "label", true, IDataContainer.SORT_CASEINSENSITIVE); + sorter.sort(); + + // add the select an action item at the start of the list + this.actions.add(0, new SelectItem("null", + Application.getMessage(FacesContext.getCurrentInstance(), "select_an_action"))); + } + + return this.actions; + } + @Override protected String doPostCommitProcessing(FacesContext context, String outcome) {