cancel
Showing results for 
Search instead for 
Did you mean: 

Convert link text on actionlink

billerby
Champ on-the-rise
Champ on-the-rise
Background:

We have done some customisation for a customer that involved generating a unique id that we append at the end of "cm:name" for some our types. The requirement is that two nodes in the same folder should have the possibility to have the same name, since that is forbidden in Alfresco we implemented this solution and our goal is to hide the unique extension everywhere to the end user. We have managed to hide it in the navigation tree, by extending the NavigationPluginBean.

The real challenge seems to strip the id from the "browse spaces" view in browse.jsp. I have tried almost everything and are now seeking some advice.

What I have tried:

    * Override the a:actionLink trying to manipulate the value parameter passed in. This failed since the value still contained #{r.name} (and not the value returned from Node.getName() which is the one I want to manipulate).

    * Override BrowseBean.getNodes(), trying to loop through all nodes manipulating the name property. However the lightweight Node class have no visible way to manipulate the name. I can only do getName Smiley Sad

    * Write a converter and nest it inside the actionLink-tag. This however fails since the actionLink implementation does not implement the ValueHolder interface. I even tried to implement this interface in my overridden version of the a:actionLink. I however never understod completely how to write the methods needed.

    * Nest a hSmiley SurprisedutputText inside the a:actionLink feeding this one with my converter. The value attribute is however mandatory in a:actionLink and the corresponding <a href> is closed before the </a:actionLink> (it is actually closed at the end of the opening actionlink-tag. Smiley Sad

    * Tried to use the core jstl-taglib and the <c:set var="myNodeName" value=#{r.name}"/>, this seems like a bad ideas as my variable is stored in the pageContext and the jsf ones are stored in some other place (FacesContext?) Well it did not work anyway, my var was empty when I tried to use it.
I have not so many ideas left. Maybe writing a new tag? Overriding the RichList and at some point feed it with a overridden Node where I do the manipulation? Write a javascript onLoad method that manipulates the label of the href on the client side? Another option that I'm trying to avoid is of course to patch my Alfresco installation changing the visibility of the name field of the Node class…

Any help would be greatly appreciated.

Thanks
/Erik
2 REPLIES 2

gyro_gearless
Champ in-the-making
Champ in-the-making
If you are speaking of MapNode objects, it should be easy to set their name attribute by just saying

MapNode n = ….; 
n.put("name", some_quirky_name);

I remember i had to overwite BrowseBeans queryBrowseNodes() method for a similar requirement (hiding some folders from users), but i had to change the methods visibilty to "protected" to allow overriding that method  :twisted:

HTH

Gyro

billerby
Champ on-the-rise
Champ on-the-rise
Gyro,

Thank you for your quick reply, I will try this tomorrow.  I'm running a patched version of Alfresco, so I guess patching it again wont ruin my world Smiley Happy

/Erik