2

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

plus-
  • 45,453
  • 15
  • 60
  • 73

2 Answers2

1

Just use node.id as seen at the Javascript API Wiki

Tahir Malik
  • 6,623
  • 15
  • 22
  • I've tried it already it doesn't work. This is a config file not javascript – plus- Oct 25 '11 at 05:10
  • But you've defined a custom action right? You can there pick the NodeRef and convert it to Node and do node.id. So post you action where you do have the Freemarker Language and or Javascript available – Tahir Malik Oct 26 '11 at 08:05
  • in Freemarker how do you convert the NodeRef to a Node in the Share webapp? cause it doesn't recognise companyhome for example – plus- Oct 28 '11 at 20:37
  • In Freemarker there is no utillity to convert a String to Node. In Javascript there is: http://wiki.alfresco.com/wiki/3.4_JavaScript_API#Utility_Functions . So you can first get the node from Javascript and then pass it on through the Model to Freemarker.You can preferably post all your files, so I/We can take a look at it. – Tahir Malik Oct 30 '11 at 14:12
1

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:

Florian
  • 1,281
  • 7
  • 17