cancel
Showing results for 
Search instead for 
Did you mean: 

Display link to the parent folder of a document on a webscript

staifresco
Champ in-the-making
Champ in-the-making
Hi all!

I'm crating a web script in alfresco where I implement a kind of custom search on my document,
after the data are entered on the form the documents are listed on the page.

For each documents I would like to print a link to the parent folder on the ftl template as it appens on the standard search.

This is the format for the link to the parent folder
https://xxxx.com/share/page/repository#filter=path%7C%2Fxxxx%2FProducts%2FImages%2FPrivate%2Fxxxxxxx...

What is the best way to generate this link from the element I have on the script node of the document ?
3 REPLIES 3

mlagneaux
Champ on-the-rise
Champ on-the-rise
Hi,

You can get the parent node directly on the script node. The parent node has a "url" property but I don't think it matches the format you described. However there is a "displayPath" property that makes it possible to build your "url". You should take a look at the source code of the standard search results page to see how Alfresco build this kind of url.

staifresco
Champ in-the-making
Champ in-the-making
Hi mlagneaux thanks for the quick answer,

I already tried to download the alfresco source via SVN but I always get a timeout, from wich repos you suggest me to download it ?

mlagneaux
Champ on-the-rise
Champ on-the-rise
I think you should take a look to the source code of "search.get" Share webscript. You'll find the source code in the share.war file (../WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components/search/search.get*).

I think that what you're looking for is located in search.js file (../components/search). That's the javascript code related to the search.get webscript.
See _getBrowseUrlForRecord method.