On 12/18/2009 04:42 PM, Flavius Olaru wrote:
+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; }
This is wrong, /xwiki/ is pretty often customized, and the /bin/ is also customizable. And either of them can also be missing.
/* 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; }
-- Sergiu Dumitriu http://purl.org/net/sergiu/