cancel
Showing results for 
Search instead for 
Did you mean: 

How can I get the full path from a nodeRef ?

zengqingyi12
Champ in-the-making
Champ in-the-making
I am using alfresco share 3.0. and I have the nodeRef of an object, how can I get the full path of the object ?
I try to generate the path by myself, but I can not get the site name of the nodeRef

full path:http://localhost:8080/share/page/site/Hello/documentlibrary#path=/2011/3/000
I must know which site the node is in to get the URL above, but I can not find any functions or properties for this, can someone point me the right direction ?

Thanks in advance !
6 REPLIES 6

xinyieric
Champ in-the-making
Champ in-the-making
hi

in my documentlibrary, the url is:http://localhost:8880/share/page/site/ds/documentlibrary
so i use "this.options.siteId" to get the site id
is that you need?

zladuric
Champ on-the-rise
Champ on-the-rise
You can access this through root scope objects.

For example, in freemarker you would use ${url.url} for a full url.

They're listed on wiki here, so check it out:
http://wiki.alfresco.com/wiki/Surf_Platform_-_Freemarker_Template_and_JavaScript_API

zengqingyi12
Champ in-the-making
Champ in-the-making
But I only have a UUID, how can I get it's path and redirect to it ?

zladuric
Champ on-the-rise
Champ on-the-rise
Ah sorry, I've misread your question.

Well, for one, you can use nodeRef.parent to find out about its parent? And go up until the "Sites" reference?

There are probably better ways though, you better not listen to me Smiley Happy

mikeh
Star Contributor
Star Contributor
It's not a trivial problem to solve. We have an internal* helper webscript which you could use if you're on V3.3 or newer (it was introduced with Rules support I believe).

It's in the alfresco.war, at /slingshot/doclib/node/{store_type}/{store_id}/{id}/location, i.e. use the usual client-side or web tier remote calls.

Your other, much easier, option is to navigate to the document-details page instead, which just takes a nodeRef argument.

Thanks,
Mike

(* internal webscripts are not public APIs and therefore not guaranteed to work between upgrades)

zengqingyi12
Champ in-the-making
Champ in-the-making
OK, thanks, finally I use regular expression to capture the "Site" parameter, and generate the URL by myself, thanks