Evelina Slatineanu wrote:
  Hi Guys,
 I am working on XE-14 (the new Administration UI)
 
http://dev.xwiki.org/xwiki/bin/view/Design/ImproveWikiAdministration .
 Since the admin templates will be deleted and replaced by an AdminSheet
 which will be included by default in XwikiPreferences (wiki level) and
 WebPreferences (space level), I need to create the WebPreferences document
 for each space, attach an Xwiki.XwikiPreferences object to it and include
 the AdminSheet.
 To do that, I need to write some java code in the core . So , here's my
 proposal:
 -          At xwiki intitialization create all the WebPreferences for the
 currently existing spaces in the wiki (this should be done for all the
 wikis, if in a multi-wiki).
 -          Then, use a notification system to create the WebPreferences for
 any new space in the wiki in one of two ways:
 a)      When calling the "view" action on AnySpace.WebPreferences, check if
 it exists, if not create it, attach the obj. and include the sheet
 b)      When calling the "save" action on AnySpace.AnyDoc,  check if
 AnySpace.WebPreferences exists, if not, create it etc.
  
a) should be used, as there will probably be more save calls on ALL
documents in a space, than view on one administration document. Plus, I
can view the administration page before saving any document in that
space, right? And anyway, the check is not that expensive.
 I am for the second one, since the 'view' is much more often performed than
 'save'.
 So, my questions: what should I use for the notifications? I found this
 function in the Stats notification system:
 // Adding the rule which will allow this module to be called on each page
 view
             context.getWiki().getNotificationManager().addGeneralRule(
                 new XWikiActionRule(this, true, true));
 But Thomas said the method above registers all types of notifs, not only on
 page view.
 There is also:
 notify(XWikiNotificationRule rule, XWikiDocument doc, String action,
         XWikiContext context)
 and I can perform an if(action == "save") to use the notif system for the
 "save" action.
 Thomas Mortagne also told me that this notif system is a little bit outdated
 and would be replaced by the observation component, but I have no idea which
 I should use.
  
Use the new observation component. The code is in
trunks/xwiki-platform-core/xwiki-observation, but there's no example yet
on how to register a new listener. I can help you with that, if you want.
 Also, according to the specifs in the draft above, so far I created the
 Xwiki.AdminSheet, that will display the main categories (General,
 Presentation, Rights, Users, Groups, Import/Export etc). For each section of
 this menu I created a sheet (General - > Xwiki.GeneralSheet etc.) in which I
 can personalize the display. I also created Xwiki.AdminSectionSheet which
 contains the common code to display the fields necessary from the
 Xwiki.XwikiPreferences object and this sheet will be included in the
 sections where is needed (Genera, Presentation etc.) The reason I created
 separated sheets for each section of the menu (which are fixed as number) is
 to keep the code clean and allow the possibility to display something else
 than fields from the xwiki prefs. object (for example for rights, users,
 groups, import/export).
  
+1 for several distinct sheets. More extensible and modular.
--
Sergiu Dumitriu
http://purl.org/net/sergiu/