Search code examples
sharealfrescodocument-library

In Alfresco Share, how to refer to a nodeRef id in the custom config file?


I'm trying to extend Share DocumentLibrary with a new action that provide a link to some url based on the nodeRef Id (through share-config-custom.xml)

 <action id="blabla" type="link" label="label">
         <param name="page">../../alfresco/wcs/myPlugin/editor/{node.nodeRef.id}/param>
        <param name="target">_blank</param>
 </action>

But Share does not interpret {node.nodeRef.id}

It does interpret {node.nodeRef} correctly but I don't need the full URI

Like: workspace://SpacesStore/158f0ed4-a575-40c2-a6ef-7e7ed386ba94 I just want the node ref id : 158f0ed4-a575-40c2-a6ef-7e7ed386ba94

Anyone can explain me the logic behind this and suggest a solution? Thanks


Solution

  • First of all I assume you are asking for Alfresco 4.0. The way how actions can be extended is completely new in 4.0 and most of us haven't used that yet.

    The logic that creates the place holders is probably in Java code in the Share webapp (haven't found the exact location). The node.nodeRef is a String so you can not call nodeRef.id. In my opinion you have two options:

    • You can keep type="link" and node.nodeRef but you link to a custom repository side webscript which then generates the correct URL and forwards (HTTP Status 301) to the correct destination.
    • You change the type to type="javascript" and implement a callback function in Javascript. This will be called when the link is clicked and can build the correct Url. To include custom javascript you can use the dependencies in the Share config:

    As far as I know the only documentation available for extending the new actions is: