Hi all,
Currently adding an entry to the menu on the left-hand side of the user profile requires the modification of the code of the platform (cf XWikiUserSheet.xml).
This is not really nice because it requires to be intrusive of the platform code in order to add new user menu entries.
Following this discussion https://markmail.org/message/ojgmy7pljzwjq7vp, we consider two solutions to migrate to a modular user menu mechanism: UIX or XClass.
While this discussion is broad than the extensibility of our user menu, I will discuss the pro and cons of both choices in the context of the extension of the user menu.
Use case
First, it is important to understand some details of the behavior of the menu.
The menu is composed of multiple entries that are composed of a title, an icon, and a Sheet.
Entries can be displayed according to some criterion, for instance:
- is the profile being accessed the one of the user currently logged in
- is the current user an admin
The visibility of an entry is based on the evaluation of a combination of criteria using boolean conditions.
UIX
Pro
The UIX mechanism is dedicated to such user interface extension.
Cons
The parameters are untyped, but this should not be an issue for our use case, which is quite similar to the one presented in the UIX tutorial.
XClass
Pro
The attributes are typed, which make it safer.
Cons
Following the example of ConfigurableClass
, a non-trivial macro needs to be defined to select the documents that contain objects of type ConfigurableClass.
Conclusion
While using the UIX mechanism is easier and more suited to the task, the need to filter the displayed entries based on intricate and possibly unanticipated criteria makes it easier to realize with XClass.
So unless we find a way to cleanly and safely define the display criterion using UIX, I propose to use XClass to make the user menu extensible.
WDYT?
PS: I will be writing a PoC using XClass. I will share it on this discussion as soon as it is done.