NAME

Konstrukt::Plugin::wiki::backend::article - Base class for article backends

SYNOPSIS

        use base 'Konstrukt::Plugin::wiki::backend::article';
        #overwrite the methods
        
        #note that you can use $self->backend_method() in the action methods as
        #only an instance of the backend class will be created and it will inherit your methods.

DESCRIPTION

Base class for a backend class that implements the backend functionality (store, retrieve, ...) for wiki articles.

Includes the control/display code for wiki articles as it won't change with different backend types (DBI, file, ...). So the implementing backend class will inherit this code but must overwrite the date retrieval and update code.

Although currently only DBI-backends exist, it should be easy to develop other backends (e.g. file based).

Note that the name of wiki articles will be normalized. All characters but letters, numbers and parenthesis will be replaced by underscores. Internally links are case insensitive. So SomeLink will point to the same page as [[somelink]].

METHODS

init

Initialization for this plugin.

If you overwrite this one in your implementation, make sure to call $self-SUPER::init(@_);> to let the base class (this class) also do its init work.

install

Installs the templates.

Parameters:

none

actions

See "actions" in Konstrukt::Plugin::wiki::backend for a description of this one.

Responsible for the actions to show and edit wiki articles.

get_title

Will return the wiki page which has been requested.

These sources are checked in this order:

  • page passed through ?wiki_page= cgi parameter

  • page specified in the tag attribute: <& wiki page="somepage" / &>

  • default page set in wiki/default_page

article_show

Will handle the action to show a wiki article.

Will load a wiki article, convert it and return it.

Parameters:

  • $tag - The wiki tag node which executed the plugin

article_edit_show

Will handle the action to show the form to edit a wiki article.

Will load the source of a wiki article (if exists) and display a form to edit the source.

Parameters:

  • $tag - The wiki tag node which executed the plugin

article_edit

Will handle the action to update a wiki article.

Will save the markup for the given page.

Parameters:

  • $tag - The wiki tag node which executed the plugin

article_revision_list

Will handle the action to show the revision history of an article.

Parameters:

  • $tag - The wiki tag node which executed the plugin

article_restore_diff

Will handle this action and run the method, which the user selected (restore or diff)

article_restore

Will handle the action to restore an article's content.

article_diff

Will handle the action to show the diff between two revisions of an article

exists

This method will return true, if a specified article exists. It will return undef otherwise.

Must be overwritten by the implementing class.

Parameters:

  • $title - The title of the article

  • $revision - Optional: A specific revision of an article

revision

This method will return the latest revision number/number of revisions of a specified article. It will return undef if the specified article does not exist.

Must be overwritten by the implementing class.

Parameters:

  • $title - The title of the article

revisions

This method will return all revisions of the specified article as an array of hash references:

        [
                { revision => 1, author => 'foo', host => '123.123.123.123', year => 2005, month => 1, day => 1, hour => 0, => minute => 0 },
                { revision => 2, ...},
                ...
        ]

Will return undef, if the file doesn't exist.

Must be overwritten by the implementing class.

Parameters:

  • $title - The title of the article

get

This method will return the article as a hashref:

                { revision => 1, content => '= wiki stuff', author => 'foo', host => '123.123.123.123', year => 2005, month => 1, day => 1, hour => 0, => minute => 0 },

Will return undef, if the requested article doesn't exist.

Must be overwritten by the implementing class.

Parameters:

  • $title - The title of the article

  • $revision - Optional: A specific revision of an article. When not specified, the latest revision will be returned.

store

This method will add a new article (or new revision if the article already exists) to the store.

Will return -1 if no change has been made (which is the case, when no new content has been passed and the article already exists in the database).

Will return true on success and undef otherwise.

Must be overwritten by the implementing class.

Parameters:

  • $title - The title of the article

  • $content - The content that should be stored

  • $author - User id of the creator

  • $host - Internet address of the creator

AUTHOR

Copyright 2006 Thomas Wittek (mail at gedankenkonstrukt dot de). All rights reserved.

This document is free software. It is distributed under the same terms as Perl itself.

SEE ALSO

Konstrukt::Plugin, Konstrukt::Plugin, Konstrukt