On Mon, Jun 18, 2012 at 8:57 PM, Marius Dumitru Florea
<[email protected]> 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).

Counting on Ajax call each time you need to parse/serialize a
reference sounds pretty bad for performances anyway so better having a
client side implementation. I agree with Vincent that it's going to be
some work to maintain it but I don't see much choice.

What I see in 
https://github.com/xwiki/xwiki-platform/commit/cfa8ec3315a32fed875949ff21a5dcaa9d2c7f35
is very different from the Java modele API, If we go for having a JS
version of the reference API I think I would prefer to start something
a lot more in sync (even if partial) grouped with the Java modele
module under the same parent or something on git/maven so that it's
clear that they are supposed to be in sync as much as possible. Not
sure how we can package the JS lib, zip ? It's a lot easier to keep in
synch two things that look like each other.

>
> Thanks,
> Marius
> _______________________________________________
> devs mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/devs



-- 
Thomas Mortagne
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to