+1,
For now we need to add the XWiki.currentPage variable to access the current
xwiki document name.
Variables in javascript should be more OO, in XWiki namespace and each
module/application in their own namespace inside XWiki namespace.

As for XWiki.

XWiki.doc.id
XWiki.doc.name
XWiki.doc.space
XWiki.doc.wiki
XWiki.doc.fullName and/or XWiki.doc.getFullName = function() { return
XWiki.doc.space + '.' + XWiki.doc.name; }
/*
  also action variable can be restricted to valid actions... or just leave
it this way
*/
XWiki.doc.getURL = function(action) { return 'xwiki/bin/' + action + '/' +
XWiki.doc.space + '/' + XWiki.doc.name; }
/* attachment is the name of the attached file to the current xwiki
document  */
XWiki.doc.getAttachmentURL = function(filename) { return return
'xwiki/bin/download/' + XWiki.doc.space + '/' + XWiki.doc.name + '/' +
filename; }


On Fri, Dec 18, 2009 at 1:39 PM, Marius Dumitru Florea <
[email protected]> wrote:

> Jerome Velociter wrote:
> > +0.5 to add "currentPage", since it's obviously missing with regard to
> > the other current* APIs.
> >
> > Now in the future I think we should define cleaner APIs for retrieving
> > infos about the model.
> > I propose that we wait for the discussion about new Java APIs of
> > xwiki-model to be a bit more advanced, then based on that see what's the
> > good way to have this in JS.
>
> I fill the same way. The JavaScript API should be more object oriented
> (e.g. have some of the objects available in velocity context, like $doc,
> "available" also in the JavaScript context, in a XWiki namespace to
> avoid collisions). For now, the currentPage information needs to be
> added to the XWiki object.
>
> Marius
>
> >
> > Jerome.
> >
> > On 12/18/09 11:58 AM, Anca Luca wrote:
> >> Hi devs,
> >>
> >> right now we have 2 ways to get (some) information about the current
> document in
> >> javascript:
> >>
> >> * the meta tags (which store the page, the space, the wiki, version,
> etc) -- set
> >> in htmlheader.vm
> >> * the XWiki object set in xwiki.js and filled in with info in
> javascript.vm
> >> which contains currentWiki, mainWiki, currentSpace, action, etc, but
> *not* the
> >> currentPage.
> >>
> >> Between the two, I propose to use the second as the 'recommended' way to
> get
> >> information about XWiki in some javascript in a document (the action,
> the wiki,
> >> the space, etc) and, to make it complete, to add a currentPage to it.
> >>
> >> WDYT?
> >>
> >> Thanks,
> >> Anca
> >> _______________________________________________
> >> devs mailing list
> >> [email protected]
> >> http://lists.xwiki.org/mailman/listinfo/devs
> >>
> >
> > _______________________________________________
> > devs mailing list
> > [email protected]
> > http://lists.xwiki.org/mailman/listinfo/devs
> _______________________________________________
> devs mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/devs
>



-- 
Cu stima,
Flavius Olaru
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to