On 29 Nov 2016, at 10:23, Marius Dumitru Florea <[email protected]> wrote:
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?
If you need it then it means there’s a need (even though possibly not a very common one). The only downside I see is the complexity it adds for the user. We may want to think about an Advanced section in the template provide UI screen and move advanced options there. Thanks -Vincent
Thanks, Marius