On Tue, Dec 20, 2016 at 3:47 PM, matmassa <matma...@eng.it> wrote:

> Hi,
>
>

> I modified the Navigation panel menu in order to have a structured tree
> menu
>

I would rather create a new panel, because otherwise you may have to
resolve merge conflicts when upgrading XWiki (if the default Navigation
panel changes in any way).


> that always shows FOO page root and the opened path to reach the current
> node (FOO project has nested pages).
>
> {{velocity}}
> #panelheader("FOO MENU")
> ## Escape special characters in macro parameter values.
> #set ($openTo = $services.model.serialize($doc.documentReference,
> 'default').replaceAll('([~"])', '~$1'))
> {{documentTree showTranslations="false" showAttachments="false"
> compact="true" showRoot="true" openTo="document:$openTo"
> root="document:xwiki:FOO.WebHome" /}}
> #panelfooter()
> {{/velocity}}
>
>

> Considering all my projects are inside Main\projects page, is there a way
> to
>

This part "inside Main\projects page" is not clear. Can you give an example
of a project reference / URL?


> find dinamically the toplevel page node without having to specify the root
> page name (FOO.WebHome)?
>

All pages that are nested inside FOO have "FOO" as part of their reference:

FOO.A.WebHome
FOO.A.B.WebHome
FOO.X.Y.Z.WebHome

You have the reference of the current document, $doc.documentReference. I
guess you need to find the top level parent of the current document. You
need to use the entity reference API in this case. See
http://extensions.xwiki.org/xwiki/bin/view/Extension/Model+Module

Hope this helps,
Marius


>
> Thanks for reply
> -Matteo
>
>
>
>
>
>
>
> --
> View this message in context: http://xwiki.475771.n2.nabble.
> com/How-to-get-top-level-page-node-in-documentTree-tp7602158.html
> Sent from the XWiki- Users mailing list archive at Nabble.com.
>

Reply via email to