- Added the notion of actions only being applicable for certain node types

- 'Run Action' is now available on folder details page

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2837 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Roy Wetherall
2006-05-11 10:38:42 +00:00
parent 0b58f9ff7f
commit 36f8dcc123
3 changed files with 45 additions and 5 deletions

View File

@@ -10,7 +10,7 @@
<!-- a list of permissions to evaluate action against before checking other preconditions -->
<permissions>
<!-- each permission can be an Allow or Deny check -->
<permission allow="true">Write</permission>
<permission allow="te">Write</permission>
<permission allow="false">AddChildren</permission>
</permissions>
<!-- the evaluator is a class implementing the org.alfresco.web.action.ActionEvaluator contract,
@@ -318,7 +318,8 @@
</permissions>
<label-id>create_content</label-id>
<image>/images/icons/new_content.gif</image>
<action>wizard:createContent</action>
<action>createContent</action>
<action-listener>#{CreateContentWizard.startWizard}</action-listener>
</action>
<!-- Create space -->
@@ -378,7 +379,6 @@
</permissions>
<label-id>manage_deleted_items</label-id>
<image>/images/icons/trashcan.gif</image>
<action-listener>#{TrashcanBean.setupTrashcan}</action-listener>
<action>dialog:manageDeletedItems</action>
</action>
@@ -431,7 +431,11 @@
<action id="run_action">
<label-id>other_action</label-id>
<image>/images/icons/action.gif</image>
<action>wizard:runAction</action>
<action>wizard:runAction</action>
<action-listener>#{WizardManager.setupParameters}</action-listener>
<params>
<param name="id">#{actionContext.id}</param>
</params>
</action>
<!-- Import into Space -->
@@ -581,6 +585,7 @@
<action idref="manage_space_users" />
<action idref="manage_space_rules" />
<action idref="preview_space" />
<action idref="run_action" />
</action-group>
<!-- Actions Menu for File Link Details screen -->

View File

@@ -263,6 +263,7 @@
<action idref="discuss_node" />
<action idref="create_forum_node" />
<action idref="preview_space" />
<action idref="run_action" />
</action-group>
<!-- Actions Menu for Forums Details page -->

View File

@@ -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<SelectItem> getActions()
{
if (this.actions == null)
{
NodeRef nodeRef = new NodeRef(Repository.getStoreRef(), this.parameters.get("id"));
List<ActionDefinition> ruleActions = this.actionService.getActionDefinitions(nodeRef);
this.actions = new ArrayList<SelectItem>();
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)
{