Hi devs,
One of the features of the new sheet system is that it can
automatically detect and apply sheets. For instance, if you have:
Space.YourClass (no objects)
Space.YourClassSheet (no objects)
Space.YourDocument (with an object of type YourClass and no include
macro call to YourSheet in the content)
YourDocument will be automatically displayed with YourSheet. This
introduces a backward compatibility problem because the new sheet
system will be triggered for existing XWiki applications that haven't
been updated to use the new system. One way to prevent this is to
trigger the new system only if XWikDocumenti#getDefaultEditMode()
returns "edit" (it should return "inline" for current XWiki
applications). XWikiDocument#getDefaultEditMode() uses two classes,
EditModeClass and SheetClass, to determine the default edit mode.
EditModeClass was recently introduced so most of the current XWiki
applications are still using the deprecated SheetClass.
In the new sheet system I needed a class to describe a sheet and I
opted for reusing the name of an existing class, SheetClass, because
IMO it is the best name for a class describing a sheet. As a
consequence the current implementation of
XWikiDocument#getDefaultEditMode() will return "inline" if you try to
include a sheet in the content of a document. This limits the new
sheet system because you should be able to do anything with the
document content, even including another sheet.
I talked with Vincent about this and we found three solutions:
(1) Change XWikiDocument#getDefaultEditMode() to use only the
EditModeClass. The breaks backward compatibility because current
applications have to update their sheets to use EditModeClass instead
of SheetClass (if they want to keep the old behavior)
(2) Use XWikiDocument#getDefaultEditMode() only if a backward
compatibility configuration flag is set. This means that the
limitation I mentioned above (can't include a sheet in the document
content) will be true only if you want backward compatibility.
(3) Use a different name for the class describing the sheet, e.g.
SheetDescriptorClass. This way XWikiDocument#getDefaultEditMode() will
keep returning "inline" for applications that are still using the
deprecated SheetClass.
I'm going to implement (3) if no one is against it.
Thanks,
Marius