As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
<actionSet id="document"> ….. <action type="action-link" id="onActionMyCustomAction" permission="myCustomPermission" label="actions.document.myCustomAction" /> </actionSet>
<@link rel="stylesheet" type="text/css" href="${page.url.context}/components/documentlibrary/myCustomAction.css" />
actions.document.actions.document.myCustomAction=My custom action label message.myCustomAction.success='{0}' successfully executed myCustomAction message.myCustomAction.failure=Couldn't execute myCustomAction for '{0}' …. ….
.doclist .onActionMyCustomAction a { background-image: url(images/myCustomAction.png); }
// Get relevant actions set switch (nodeType) { ….. case "document": …….. /* myCustomAction action evaluator */ if ( <here your condition> ) { permissions["myCustomPermission"] = true; } break; }
/** * MyCustomAction. * * @method onActionMyCustomAction * @param asset {object} Object literal representing the file to be actioned upon */ onActionMyCustomAction: function dlA_onActionMyCustomAction(asset) { var displayName = asset.displayName; var nodeRef = new Alfresco.util.NodeRef(asset.nodeRef); var me = this; Alfresco.util.PopupManager.displayPrompt( { title: this.msg("message.confirm.myCustomAction.title"), text: this.msg("message.confirm.myCustomAction", asset.displayName), buttons: [ { text: this.msg("button.myCustomAction"), handler: function dlA_onActionMyCustomAction_create() { this.destroy(); me._onActionMyCustomActionConfirm.call(me, asset); } }, { text: this.msg("button.cancel"), handler: function dlA_onActionMyCustomAction_cancel() { this.destroy(); }, isDefault: true }] }); }, /** * MyCustomAction confirmed. * * @method _onActionMyCustomActionConfirm * @param asset {object} Object literal representing the file or folder to be actioned * @private */ _onActionMyCustomActionConfirm: function dlA__onActionMyCustomActionConfirm(asset) { var displayName = asset.displayName, nodeRef = new Alfresco.util.NodeRef(asset.nodeRef); this.modules.actions.genericAction( { success: { event: { name: "metadataRefresh" }, message: this.msg("message.myCustomAction.success", displayName) }, failure: { message: this.msg("message.myCustomAction.failure", displayName) }, webscript: { method: Alfresco.util.Ajax.POST, name: "mycustomactionwebscript/node/{nodeRef}", params: { nodeRef: nodeRef.uri } } }); },
8 ) Add the client side javascript code for manage the custom action, in file \tomcat\webapps\share\components\documentlibrary\action.js (in this exmple I open a popup window for action confirmation and then I call a custom web-script):