[dokuwiki] Subpage scheme

  • From: Luke Howson <mail@xxxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Sat, 26 May 2007 16:55:58 +1000

Hi,

I would like to propose an option be added to the advanced settings of Dokuwiki to change the namespace semantics.

At the moment there are namespaces and any number of pages and media within each namespace.

An alternative organizational scheme is what I will call the subpage
scheme, in which each page itself contains the other media. End users
seem to find this scheme easier to comprehend.

I have already implemented it at one site (without the config option), and it looks to be running quite well. There is one slightly insidious problem in that getNS($id) from /root/inc/pageutils.php occasionally gets called as though it is (the imaginary function) parentNS($id). (Under namespace semantics, they share the same implementation.) I say insidious because in addition to the files listed below there may be plugins I don't use that are affected.

I have written the following summary of the required changes elsewhere (the ACL and mediamanager components also need altering) :


     Page / subpage semantics

  1.
     Every page contains precisely one file of dokuwiki markup, (and
     arbitrarily many media etc).
  2.
     Any page, PARENT, can contain subpages designated PARENT:CHILD.
  3.
     Permissions set for PARENT propagate through its descendents in
     the usual way.


     Translation of page / subpage into Dokuwiki file structure

By default, Dokuwiki uses the usual namespace semantics. In particular,
it allows multiple pages in each namespace.

It implements namespaces as directories and pages as *.txt files. So,
grandparent:parent:child:page would be reflected as
/data/pages/grandparent/parent/child/page.txt.

We translate as follows:

PARENTPAGE:SUBPAGE → /data/pages/PARENTPAGE/SUBPAGE/page.txt

page.txt is the canonical name used to store the Dokuwiki markup for
each page.

The attic (/data/attic) is the version control system of Dokuwiki. It
adds some kind of GUID to the end of the filename for a file no longer current.


     Implementation in Dokuwiki code

There are two changes required to the Dokuwiki code:

  1.
     /root/inc/pageutils.php needs getNS($id) renamed as parentNS($id)
     and has getNS replaced with getNS($id) { return $id; }
  2.
     /root/inc/pageutils.php/wikiFN is edited (see source) to return
     the right page.txt.

A number of Dokuwiki routines have been programmed to getNS’s
implementation rather than its interface. Where this has occurred, they
need to call parentNS instead. In particular,

   *
     /inc/auth.php
   *
     /acl/admin.php
   *
     /inc/io.php


     Conversion of already existing pages

There are four Perl programs to convert between the two directory
structures. (Back + forth = 2) x (/data/attic + /data/page) = 4. They
have the following limitations:

  1.
     a round trip will not leave things as they were. There will be a
     bunch of empty directories floating around. (Should not affect
     functionality.)
  2.
     spaces in directory names break the scripts.
  3.
     acls will remain unchanged. (Fix manually.)


    Also

The mediamanager and the ACL manager also need alteration.

Let me know what you need if you would like to proceed.

Regards,

Luke Howson.
--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: