Obsolete Pages{{Obsolete}}
The official documentation is at: http://docs.alfresco.com
Actions
IMPORTANT: This document details the Custom Action UI for Alfresco pre-1.3. For more recent versions then please see this document: Custom Action UI. Note that this page will no longer be maintained or updated except to correct any mistakes.
Adding UI for a Custom Action
During this tutorial we will assume that we have already created a custom action with the id 'action-id' and that it requires one parameter value with id 'param-name'.
Adding the navigation configuration for the custom action
- Open faces-config-navigation.xml found in web/WEB-INF.
- Search for '/jsp/wizard/new-rule/*'.
- Add the navigation case to the rule wizard:
<navigation-case>
<from-outcome>action-id</from-outcome>
<to-view-id>/jsp/wizard/new-rule/action-id.jsp</to-view-id>
</navigation-case>
- Search for '/jsp/wizard/create-action/*'.
- Add the navigation case to the new action wizard:
<navigation-case>
<from-outcome>action-id</from-outcome>
<to-view-id>/jsp/wizard/create-action/action-id.jsp</to-view-id>
</navigation-case>
Create the action UI
- Navigate to /web/jsp/wizard/new-rule.
- Create action-id.jsp. See action-add-features.jsp. Things to note:
- The title id must be unique and is used to I18N the title of the page.
- The form should also have a unique id.
- Add the controls that will allow the user to enter the parameter values of the action. Things to note:
- Any methods that need to be added to support the population of a control should be added to BaseActionWizard.java
- The values of parameters should be stored in the actionProperties map found on the BaseActionWizard.
Adding the display strings for the action
- Open config/alfresco/messages/webclient.properties.
- Add the title string:
this_is_the_title_id_of_the_new_action=This is the title of the action
- Add the summary string for the action:
action_<the id of the action with dashes replaced with underscores>=The description of the action used in the summary
- Open config/alfresco/messages/action-config.properties.
- Add the title and description strings. These will appear in drop down lists when selecting and configuring the action. Follow the entries under # Actions, such as:
action.title=This is the title of the action
action.description=This is the description of the action
Modify backing bean to correctly set parameters and summaries
- Open org.alfresco.web.bean.wizard.BaseActionWizard.java.
- Search for 'protected Map<String, Serializable> buildActionParams()'.
- Add the code to map the parameters from the actionProperties map into the action itsself.
- Search for 'protected void populateActionFromProperties(Map<String, Serializable> actionProps)'.
- Add the code to map the parameters of the action back into the actionProperties map.
- Open org.alfresco.web.bean.wizard.NewRuleWizard.java
- Search for 'protected String buildActionSummary(Map<String, Serializable> props)'
- Add the code to generate the summary message for the action.
Enabling the action in the 'Run Action' dialog
- Follow the steps for creating the action UI, but create a new file in /web/jsp/wizard/create-action.