On Mon, Sep 19, 2011 at 4:34 PM, Marius Dumitru Florea
<mariusdumitru.florea(a)xwiki.com> wrote:
Hi devs,
Here's the sheet resolution algorithm I have implemented in
https://github.com/xwiki/xwiki-platform/blob/cbad868094b9cc9d811621670e3205…
.
getSheets(document, action) : List<DocumentReference>
(1) If there is a "sheet" request parameter that points to a sheet
that supports the passed action, return a reference to that sheet.
+1
(2) For each object of type XWiki.DocumentSheetBinding attached to the
passed document check if the "sheet" property points to a sheet that
supports the passed action. Return the computed list, if not empty.
+1
(3) For each type of object attached to the passed document:
(3.1) For each object of type XWiki.ClassSheetBinding attached to
the document defining the class check if the "sheet" property points
to a sheet that supports the passed action.
(3.2) If the class doesn't have any XWiki.ClassSheetBinding object
then check if <ClassName><ActionName>Sheet exists
(3.3) If not, then check if <ClassName>Sheet exists and supports
the passed action
I like a lot the idea of separating data from display and even (3.1)
put display stuff in what should be metadata definition. But I'm OK
with it for the same reason as XWiki.DocumentSheetBinding: we don't
know all the use case so it's safer to provide on overwrite for the
main system.
Now for how this separation is implemented I agree that name
convention based system sounds a bit dangerous to me too but it's more
a 0 than a -1 since I don't really have real use case against this
particular proposal. Another solution could be to indicate the
supported class like we indicate the supported action in the sheet but
this one require to define a good security rule on who and where a
sheet can be defined.
(3.4) If not, then check if
"sheet.defaultClassSheetBinding"
configuration property specifies a sheet for the class we're looking
at
Return the computed list if not empty.
(4) If the passed document is a class (holds a class definition) then
return a reference to the default class sheet (XWiki.ClassSheet) if it
supports the passed action.
Otherwise return an empty list.
I'd like you to vote on each of the steps of the algorithm. Are there
steps you think I should drop?
Since the naming convention does not get unanimous support I would say
lets drop it for 3.2 and discuss it during 3.3.
I'm obviously +1 for each of the steps.
Thanks,
Marius
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs
--
Thomas Mortagne