On Fri, May 9, 2008 at 11:12 AM, Jean-Vincent Drean <jv(a)xwiki.com> wrote:
On Fri, May 9, 2008 at 2:30 AM, Evelina Slatineanu
<evelina.slatineanu(a)xwiki.com> wrote:
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:
1) 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).
I guess a migrator would be the best way to do this.
After discussing this with vincent it looks like migrators can't be
used for this kind of wiki stuff.
2) 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.
I'm +1 for 2) b) :
* saving the WebPreferences document on a view action looks bad to me :
** we'd have to bypass context user rights when he don't have edit
rights on the space
** we'd have to check that there's at least 1 page within the
requested space before creating the WebPreferences
** it will slow down the view request
* it seems logical that the first user to create a page within a
space gets the admin right on it
Afterthoughts : It seems complicated to do it that way and having the
administration application relying on new core java code would be bad.
I guess the best solution is, as Sergiu pointed it before :
* keep the admin action (with admin.vm)
* make it create the preferences if needed (current behavior)
* instead of including sub-templates (admin${editor}.vm) from
admin.vm, call contentview.vm
--
Jean-Vincent Drean