Since Evo, with ditto, ajaxSearch, and some other snippets, to define a list of id (in order to restrict the area of list/search), we use the "classical" parameters
&documents or
&parents with
&depth.
With getResources for Revo, we use always &parents and &depth. With &parents parameter, if you specify &parents=`28,42` you get #28 and all children of #28 (if #28 if a parent document), #42 and children of #42 (if #42 if a parent document).
But this specification is not efficient if I would like:
- Children of #28 but not the document #28 ? For this, I probably need to list ll the children id of #28. Not very convenient
- Document #28 and #36 with the first level of children. If I use depth = 0, I got 28, but not the children of #36. If I choose depth = 1 I get #36 but also the children of #28 >:(
- All the parents of #28 but not #28 nor documenbt #0 and document #1 ?
- All the children of the document #28 but not the children document of #36 which is a child of 28 and a parent of a subtree ? How could I exclude this document sub-tree ?
A solution could be to specify documents parameter like this: &documents=`comma separated list of prefixedId` avec prefixedId=[[ |+|-][ |c|p]id ]
With this specification:
- Children of #28 but not the document #28 ?
&documents=`c28` => c for chidren (#28 excluded)
- Only #28 and #36 with the first child ?
&documents=`28, 36, c36` => #28, #36, and children of #36
- All the parents of #28 but not 28 nor 0 or 1 ?
&documents=`p28, -0, -1` => p for parents (#28 excluded),#0 and #1 excluded (- for excluded)
- All the children of #28 but not the children of #36 ?
&documents=`c28, -c36` => children of #28 and children of #36 excluded (#36 included)
It could be interesting that all addons implement this general &documents parameter like this.
Does it make sense or is it too complicated or sophisticated ?
Hereafter the code which implement for Revo this parameter[Edit] A snippet named GetIds is now available in the utilities section of the repository.