Jean-Vincent Drean wrote:
Right, a quick fix could be to put something like this in our HTML header:
------------------------------8<------------------------------------ <script type="text/javascript" src="/xwiki/resources/js/prototype/prototype.js"></script> <script type="text/javascript"> // <![CDATA[ var XWiki = { webapppath : "xwiki/", servletpath : "bin/", currentWiki : "currentwiki", mainWiki : "xwiki", etc : "etc", } // ]]> </script> <script type="text/javascript" src="/xwiki/bin/skin/resources/js/xwiki/xwiki.js"></script> ------------------------------8<------------------------------------
We already have the current wiki in the header, as a meta element. Just do: var wiki = $$("meta[name='wiki']")[0].content;
But this would lead to a huge header in the future.
The current problem also raises the question of translations management + caching of our JS files. May be we could add some parameters to the JS file URL, those parameters could be added by getSkinFile when the file to serve is a javascript file and forceSkinAction is true. We could specify the list of parameters that invalidate JS caching, for example: - wiki - language
We'd get URLs looking like: /xwiki/bin/skin/resources/js/xwiki/xwiki.js?wiki=xwiki&language=en
Links already contain the language, exactly for this reason. When I wrote the sx plugins, the multiwiki-as-path wasn't implemented yet, so there was no need to specify the wiki. The skin extensions API allows to specify additional parameters to place in the URL, just call: $jsx.use("My.Extension", {'database': $context.wiki, 'mainDatabase': $context.getMainWikiName()}) There's no jsfx API that accepts both a map and the forceSkinAction parameter yet.
WDYT ?
JV.
On Wed, Mar 4, 2009 at 11:15 AM, Sergiu Dumitriu <[email protected]> wrote:
jvdrean (SVN) wrote:
Author: jvdrean Date: 2009-03-03 23:40:14 +0100 (Tue, 03 Mar 2009) New Revision: 17211
Added: platform/web/trunk/standard/src/main/webapp/resources/js/xwiki/xwikiexplorer/ platform/web/trunk/standard/src/main/webapp/resources/js/xwiki/xwikiexplorer/xwikiexplorer.js Modified: platform/web/trunk/standard/src/main/webapp/resources/js/xwiki/xwiki.js Log: XWIKI-3287 : Provide a tree widget allowing to browse a XWiki farm (wikis>spaces>pages>attachments)
First version of XWikiExplorer widget. +constants: { + /** + * Current wiki. + */ + currentWiki: "$context.getDatabase()",
+ /** + * Main wiki. + */ + mainWiki: "$context.getMainWikiName()", This could make the file hard to cache in multiwiki mode using paths as identifiers, since the JS will have the same address for all wikis.
-- Sergiu Dumitriu http://purl.org/net/sergiu/ _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Sergiu Dumitriu http://purl.org/net/sergiu/