Proposal for an Advanced Category System

How categories work now

Right now the information to which categories a page belongs is stored inside the page itself.
This leads to some problems:
(There might be more, feel free to add them.)

Possible solution

Move the information about categories out of the pages and store them in 2 seperate tables, one for the categories and their hierarchy, one for the relations between pages and categories.


Relationship between categories
The categories can be modelled as a tree. (This allows a non-hierarchical system too by simply placing all categories directly under the root node of the tree and hiding the root node itself from beeing displayed).
Since most of the time information about categories is read and only seldom written, Nested Sets are a good way to map our category tree to the mysql database. (See (english) or (german) for details on how nested sets work).

Relationship between categories and pages
One category can have 0 to n pages, so the most simple way is a table with two 'foreign keys', with each entry mapping a page(-version) to a category-id (so you can simply rename a category).
One page can belong to 0 to n categories (explicit; I would prefer 1 to n categories, with the root category beeing implicit if no other category is specified for a page)

Problems here

Which parts of wikka need to be modified

Extras possible with the new system
With the new system it would be possible to handle ACLs more easily (and add inheritance to the ACL system). In my development version for each category I store ACLs as well (the fields can be NULL). My plan is as follows:
  1. From all categories a page belongs to, one (and only one) can be marked as the "main parent"
  1. If a page has no page-specific ACLs assigned it will inherit the ACLs of its main parent
  1. If the main parent has no ACLs assigned it will inherit them (recursivly) from their parent
  1. If the root category has no ACLs assigned the default ACLs from wikka.config.php will be used.
Now if you have a set of pages that should only be edited by certain users, for example official documentation to your software, simply create a category, assign ACLs to that category and add the set of pages to it (the category management action will allow to add/remove a group of pages to/from a category in 1, maybe 2 steps).

When will this all be available
I hope to get this done within the next week, maybe two, but I can not promise anything. I will update this page whenever I have news.

State of the code
Right now approximately 20% of the code are working.

There are 4 comments on this page. [Show comments]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki