Actions are defined globally in the share-documentlibrary-config.xml file, in the DocLibActions config section. This means they can be overridden and extended by using a share-config-custom.xml file. These customizations can be by using the AMP, JAR or web-extension folder mechanism, or a mixture of all three.
Actions are also now grouped by view type instead of node “state”.
The actions are located in the <actions> config container element with the following structure:
<actionidtype (icon) label> <param name /> <evaluator negate /> <permissions> <permissions allow /> </permissions> <override /> </action>
where:
-
<action>: Action config container element with the following
attributes:
- id: Unique action id
- type: Action type. Javascript, link, and pagelink are supported
- icon: Optionally, override the icon name. If not set, the ID is used
- label: The action’s i18n message ID
-
<param>: Action parameter elements with the following
attribute:
- name: Parameter name
-
<evaluator>: Bean ID of evaluator that determines whether the
action is valid for this node or not. Evaluator extends
org.alfresco.web.evaluator.BaseEvaluator and contains the
following attribute:
- negate: If set to true, the output of the evaluator is inverted.
- <permissions>: Permission config container element.
-
<permission>: List of permissions required for the actions, as
defined in the applicationScriptUtils bean config with the
following attributes:
- allow: If the permission specifies, the action is allowed.
- deny: If the permission specifies, the action is hidden.
- Only one of the “allow” or “deny” permissions can be specified
- <override>: If this action should override the visibility of other actions, they are specified using this element.
Example config
<configevaluator="string-compare"condition="DocLibActions"> ... <!-- Inline edit --> <action id="document-inline-edit" type="pagelink" label="actions.document.inline-edit"> <param name="page">inline-edit?nodeRef={node.nodeRef}</param> <permissions> <permission allow="true">Write</permission> </permissions> <evaluator>evaluator.doclib.action.inlineEdit</evaluator> </action> </config>
<!-- Checkin from Google Docs --> <config evaluator="string-compare" condition="DocLibActions"> ... <action id="document-checkin-from-googledocs" type="javascript" label="actions.document.checkin-google"> <param name="function">onActionCheckinFromGoogleDocs</param> <evaluator>evaluator.doclib.action.googleDocsCheckIn</evaluator> <override>document-checkout-to-googledocs</override> </action> </config>
An action can be disabled across the whole application using the following configuration. For example the following config removes the “Upload New Version” action from users.
<configevaluator="string-compare"condition="DocLibActions"> ... <actions> <action id="document-upload-new-version"> <evaluator>evaluator.doclib.action.disableAction</evaluator> </action> </actions> </config>
Add an evaluator, used on an out-of-the-box action:
<configevaluator="string-compare"condition="DocLibActions"> <actions> <action id="document-publish"> <evaluator negate="true">wcmqs.evaluator.doclib.action.isWebsiteContainerType</evaluator> </action> </actions> </config>