> >> >
> >> > I use this methods,
> >> hasParent(EntityReference
> expectedParent) and i noticed that
> >>
> I can not use string to set EntityReference.
> >> > Then i must use this before:
> "#set
> >> ($reference =
> >>
> $services.model.resolveSpace('xwiki:Encyclopédie'))"
> >> and
> "$doc.documentReference.hasParent($reference)"
> >> because
> >>
> $doc.documentReference.hasParent('xwiki:Encyclopédie')
> >> doesn't work.
> >> > Am I right? Anyway, I
> >> can understand that.
> >>
> >> There
> >> is one magic thing about Velocity in
> XWiki that you need to
> >> keep
> >> in mind: it automatically convert
> >> parameters to the right type (when
> >> there is
> >> a
> converter provided for that type).
> >>
> >> For example
> the converter for the type
> >>
> EntityReference understand the
> >>
> following
> >> syntax:
> [<entitytype>:]<entityreference> (the
> >> default entity
> >> type is "document"
> >> if you don't provide it) so the
> space with
> >> reference
> "xwiki:Encyclopédie" will
> >> be the string
> >>
> "space:xwiki:Encyclopédie" as in
> >>
> hasParent('space:xwiki:Encyclopédie').
> >
> > Right :-)
> $doc.documentReference.hasParent('space:xwiki:Encyclopédie')
> work well but I don't understand why we must use
> "xwiki" in space name.
> 
> You don't have to use "xwiki".
> "xwiki" is is the wiki in which the
> space is located, if you want the space
> "Encyclopédie" in the current
> wiki then just don't put the wiki as in
> $doc.documentReference.hasParent('space:Encyclopédie').
> Keep it mind
> that we are talking about the
> space reference here, not the space
> name.

Heu .... it is not the same?

Then maybe I found an issue because without "xwiki:" 
documentReference.hasParent doesn't work:
On jetty package 8.4:
I paste this velocity code: in the page: 
http://localhost:8080/xwiki/bin/edit/Paréééént/sousParent/WebHome
$doc.documentReference.hasParent('space:Paréééént') doesn't work (false)
$doc.documentReference.hasParent('space:xwiki:Paréééént') work well (true)

$doc.documentReference.hasParent('space:sousParent') doesn't work (false)
$doc.documentReference.hasParent('space:xwiki:Paréééént.sousParent') work well 
(true)

_______________________________________________
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to