Hi devs,
I have an XWiki application that creates two types of pages. Let's call
them Category and Procedure. The application has two template providers
that allow the users to create Categories and Procedures anywhere on the
wiki using the Create Page menu. I would like to restrict the creation like
this:
* You can create a new Category page either as a top level page or as a
child of an existing Category page
* You can create a new Procedure page only as a child of an existing
Category or Procedure page
Category -> ... Category -> Procedure -> ... -> Procedure
One solution to achieve this is to add a new property to the template
provider, e.g. "parentType", that specifies the type of pages (XClass
references) that are allowed as parent. We would use a Database List with
multiple selection and relational storage. We can use the empty string to
represent "no parent" (i.e. top level page). An empty list would mean no
parent type restriction.
Category template provider: {parentType: ["CategoryClass", ""]}
Procedure template provider: {parentType: ["CategoryClass",
"ProcedureClass"]}
Do you think this is useful? Do you see any problem with this solution? Is
it worth implementing?
Thanks,
Marius