Re: extending page metadata?

[email protected] (John Cappiello) Wed, 2 Feb 2005 14:28:45 -0500
Newsgroups perl.kwiki
Message-ID <[email protected]>
On Feb 2, 2005, at 1:12 PM, Kevin Walker wrote:
> I already have a replacement for Kwiki::Edit which adds a "describe 
> your changes" field to the page edit web form.  But I don't see a way 
> to store this info in the RCS file without  a lot more work. 
> Kwiki::Archive::Rcs stores info from the page metadata, but I don't 
> see a way to hook into the page metadata storage.  (The metadata 
> fields are hard-coded in Kwiki::PageMeta.)  Is there a way to subclass 
> Kwiki::PageMeta without also messing with Kwiki::Pages? (They are 
> contained in the same file.)  Alternatively, I could subclass 
> Kwiki::Archive::Rcs, but that won't work because it doesn't 
> communicate directly with the edit class.

Kevin,
   As you suggest, you have to override Kwiki::Pages. I'm doing this now 
to add two extra metadata fields.

   You need to override, Kwiki::PageMeta, and also Kwiki::Page and 
Kwiki::Pages to tell it
to use your PageMeta module.  You have to add a method for each field, 
into your Page module.
You also have to define your "fields" in your new PageMeta module, as 
well as override the
sort_order method, adding your new fields there as well.  Finally you 
need to override
the update method of PageMeta and make sure to tell it to save your new 
fields.

   When you're done, tell config.yaml: pages_class: YourKwiki::Pages

   I can help you in more detail if need be, but this should get you 
going. Also, I could
be doing any number of these things, the "wrong" way, but they work for 
me.

John

--
jc