DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:userannotations

userannotations plugin

Compatible with DokuWiki

2007-06-26b

plugin Create annotations below the regular wiki text. Each user creates his own annotation and can decide for himself if other users can read them or not.

Last updated on
2009-02-23
Provides
Action

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Similar to note

Tagged with annotations, users

This plugin enables users to create annotations and comments for each wiki page. The annotations reside in a special namespace that mirrors the regular namespace structure.

Example: Annotations for the page wiki:formatting_syntax are stored in annotations:user1:wiki:formatting_syntax for user1 and annotations:user2:wiki:formatting_syntax for user2. The contents of the annotation pages are displayed below the text of wiki:formatting_syntax - together with an “edit” link and a comment on whom they belong. Visibility of the annotations can be influenced with the regular ACLs inside the annotations namespace.

The annotations can be styled on a general or on a per-user basis.

Warning: This plugin uses the DirectoryIterator from the SPL library (included in PHP 5) and is not compatible with PHP 4.

Download

Download the plugin here (manually or via Plugin Manager): http://www.d-scribe.de/webtools/userannotations.zip

Release history

  • 2009-02-23 Fixed a bug with permissions. With the right permissions now even anonymous users can post. German translation thanks to Axel Werner. More sourcecode comments.
  • 2008-02-21 Fixed a bug that made the plugin incompatible with DokuWiki 2007-06-26b
  • 2008-02-18 First release

Discussion

  • When I installed this plugin into DokuWiki 2009-12-25c, the normal footer disappeared. Disabling the plugin restores the normal behavior.
  • Echo that - using lemming and this plugin, both header and footer disappear. — Darryl Penny 2010/08/09 19:35
  • 2010-12-15 Get
Fatal error: Uncaught exception 'RuntimeException' with message 'DirectoryIterator::__construct(/home/zfbiz1/docs.fmlymap/data/pages/annotations) [<a href='directoryiterator.--construct'>directoryiterator.--construct</a>]: 
failed to open dir: No such file or directory' in /home/zfbiz1/public_html/subdomains/docs.fmlymap/lib/plugins/userannotations/action.php  

This is using the plugin straight out of the box on a PHP5.3.1 base.

This exception is because /home/zfbiz1/docs.fmlymap/data/pages/annotations cannot be opened. Of course it doesn't exist the first time. It is enough to add try{}catch (Exception $e) { } around the foreach code block in ../lib/plugins/userannotations/action.php (~line 72).

Example:
try{
    foreach (new DirectoryIterator(preg_replace('/\.txt$/', '', wikiFN($privatepath))) as $item )
    {
        if($item->isDir() && !$item->isDot()) {
            $user = $item->getBasename();
            if($user != $current)
            $annotation_ns[] = $user;
        }
    }
}catch (Exception $e){
}

Patch for controlling recursion

joakinenjoakinen

2013/11/25 14:09

As I found annoying the link to make annotations inside annotations, I developed a patch for this plugin so that you can control if recursion of annotations is allowed or not with a new entry in the config file.

Code

Original lines 98 to 103 in action.php

                // The currently logged in user can create his own annotation
                elseif($user == $current && auth_quickaclcheck($privatepath.':'.$user) >= AUTH_CREATE)
                {
                        echo '<div class="annotation"><p class="editannotation createannotation"><a href="'.DOKU_SCRIPT;
                        echo '?id='.$annotation_id.'&do=edit" class="editlink">'.sprintf($this->getLang('create_annotation'), $current).'</a></p></div>';
                }

Change those lines into this:

                // The currently logged in user can create his own annotation
                elseif($user == $current && auth_quickaclcheck($privatepath.':'.$user) >= AUTH_CREATE)
                {
                        // Check recursion allowance
                        if( ($this->getConf('allow_recursion')) || (!$this->getConf('allow_recursion') && strpos($ID, $privatepath) === false))
                        {
                                echo '<div class="annotation"><p class="editannotation createannotation"><a href="'.DOKU_SCRIPT;
                                echo '?id='.$annotation_id.'&do=edit" class="editlink">'.sprintf($this->getLang('create_annotation'), $current).'</a></p></div>';
                        }
                }

Config

This patch needs a new entry in conf/default.php file:

// Allow annotations in annotations
$conf['allow_recursion'] = false;

Changing the value of this entry to 'true' you get the original behaviour of the plugin.

plugin/userannotations.txt · Last modified: 2013-11-25 14:32 by joakinen