Hi,
Now, what about the other members of the API
interface, namely "Element" and
"User" ?
As far as I can see from looking at the code:
- You'd be unlikely to use Element directly; instead you'd use its
subclasses Property, Collection and Object which are accessible via
several methods you can call on Document.
- The only way to get a com.xpn.xwiki.api.User object is via the
com.xpn.xwiki.XWiki class (not the same as the com.xpn.xwiki.api.XWiki
class -
http://build.xpertnet.biz/doc/api/com/xpn/xwiki/XWiki.html),
so you'd do something like $xwiki.getXWiki().getUser() - note that
this requires programming rights.
But if you want to manipulate user properties, you're more likely to
want to do it via the XWiki.XWikiUsers object representing the user
(note this is an XWiki object, not a Java object.. terminology becomes
confusing at this stage, at least for me). So for example to show a
user's email address you'd do something like:
$xwiki.getDocument("XWiki.SomeUser").getObject("XWiki.XWikiUsers").getProperty("email").getValue()
The above is long winded - there are handy shortcuts to do it quicker
- but it shows how the full "XWiki -> Document -> Object -> Property
-> String" path is accessed with velocity.
Regards,
Robin
On 29/08/06, Jean-Lou Dupont <xwiki(a)jldupont.com> wrote:
> Many thanks for the info: from what I gather, there is naming convention
> applicable here for the plugins.
>
Now, what about the other members of the API
interface, namely "Element" and
> "User" ?
> I have tried accessing methods of "Element" (getName, getBaseElement) to
no
> avail. The same goes for "User".
>
> Jld.
> PS: I must say Xwiki is an excellent piece of engineering design. Kudos to
> the team!
>
> -----Original Message-----
> From: jeremi joslin [mailto:jeremi23@gmail.com]
> Sent: August 29, 2006 04:17
> To: xwiki-users(a)objectweb.org
> Subject: Re: [xwiki-users] Velocity script objects mapping to XWiki API ?
>
> On 8/29/06, Jean-Lou Dupont <xwiki(a)jldupont.com> wrote:
> >
> >
> > I have read
> >
http://www.xwiki.org/xwiki/bin/view/DevGuide/Scripting but I can't
> > seem to find how the XWiki API interface is mapped to Velocity
> > "objects".
> > - I understand that $doc refers to the current document ("put" in the
> > Velocity "context")
> > - $xwiki refers to the current xwiki object etc.
> >
> > but I do not understand how to access the other members of the API
> > interface, namely:
> > (from
> >
http://build.xpertnet.biz/doc/api/com/xpn/xwiki/api/Api.html
> > )
> >
> > AdWordsPluginApi, AlexaPluginApi, Attachment, CalendarPluginApi,
> > Element, FeedPluginApi, FlickrPluginApi, GooglePluginApi,
> > GraphVizPluginApi, IPResolverPluginApi, LDAPPluginApi, MailPluginApi,
> > TerraServerPluginApi, User
> >
> > Any pointer would be appreciated e.g. the source file name where
> > "User" is "put" in the Velocity context as example.
>
> Hi,
> for example you can get the mail plugin by :
> #set($mailPlugin = $xwiki.mail)
>
> So you just put the name of the plugin after $xwiki
>
>
> jeremi
>
>
> --
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.405 / Virus Database: 268.11.6/430 - Release Date: 28/08/2006
>
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.1.405 / Virus Database: 268.11.6/430 - Release Date: 28/08/2006
>
>
>
>
>
>
> --
> You receive this message as a subscriber of the xwiki-users(a)objectweb.org mailing
list.
> To unsubscribe: mailto:xwiki-users-unsubscribe@objectweb.org
> For general help: mailto:sympa@objectweb.org?subject=help
> ObjectWeb mailing lists service home page:
http://www.objectweb.org/wws
>
>
>