On Mon, Jun 18, 2012 at 10:15 PM, Vincent Massol <[email protected]> wrote: > > On Jun 18, 2012, at 8:57 PM, Marius Dumitru Florea wrote: > >> Hi devs, >> >> While fixing http://jira.xwiki.org/browse/XWIKI-7889 I introduced an >> API to resolve and serialize entity references on the client side >> (JavaScript code). See >> https://github.com/xwiki/xwiki-platform/commit/cfa8ec3315a32fed875949ff21a5dcaa9d2c7f35. >> >> XWiki Explorer tree has an input displayed at the bottom where you can >> type a _pseudo_ entity reference which is parsed and the specified >> entity is selected in the tree. The basic problem (very simplified) >> was that this reference was parsed on the client side and the parsing >> code did not handle special characters in entity name (no escaping). >> Of course, I had to options: >> >> * add a service (REST?) to resolve/serialize the reference on the server or >> * (as I did) port part of the code from xwiki-platform-model (with >> unit tests!) to JavaScript to be able to resolve/serialize entity >> references on the client side. >> >> There are pros and cons for each option but for me the main reason was >> that it is painful to modify xwikiexplorer.js to make AJAX requests >> each time you type into that input box (the tree node is selected as >> you type). An almost complete rewrite was needed and since we're >> looking to replace that tree I thought the second option was better. >> >> Would be great if you can review my commit. I'm interested in the API >> naming and places where I put the JS code. Also, I'm not sure where to >> document the new API (that is if no one is against it). >
> The only problem is maintenance and consistency, unless you generate the JS > code from our model resolver/serializer written in java. The JavaScript code is not generated, it's written by hand, but I count on the fact that the code from xwiki-platform-model#reference is pretty stable and is not going to change very often. Of course, I commit to update the JavaScript code whenever there are important changes on the server side. Thanks, Marius > > Thanks > -Vincent > _______________________________________________ > devs mailing list > [email protected] > http://lists.xwiki.org/mailman/listinfo/devs _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs

