DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:userannotations

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
plugin:userannotations [2010-10-03 15:43] HåkanSplugin:userannotations [2023-12-21 18:50] (current) – new download url Aleksandr
Line 1: Line 1:
-====== userannotations plugin ======+====== UserAnnotations Plugin ======
  
 ---- plugin ---- ---- plugin ----
Line 11: Line 11:
 tags       : annotations, users tags       : annotations, users
  
-downloadurl: http://www.d-scribe.de/webtools/userannotations.zip+downloadurl: https://trello.com/1/cards/5b006247cd369cc163bf92d1/attachments/5b00625f3707188f36e1b5d5/download/userannotations.zip #http://www.d-scribe.de/webtools/userannotations.zip 
 +bugtracker :  
 +sourcerepo :  
 +donationurl:  
 + 
 +screenshot_img: 
 ---- ----
  
-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+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. 
  
-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.
  
-**Warning:** This plugin uses the DirectoryIterator from the SPL library (included in PHP 5) and is not compatible with PHP 4.+===== Example ===== 
  
-===== Download =====+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. 
  
-Download the plugin here (manually or via Plugin Manager): [[http://www.d-scribe.de/webtools/userannotations.zip]]+The annotations can be styled on a general or on a per-user basis.
  
 ===== Release history ===== ===== Release history =====
Line 34: Line 39:
    * When I installed this plugin into DokuWiki 2009-12-25c, the normal footer disappeared. Disabling the plugin restores the normal behavior.    * 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@gmail.com|Darryl Penny]] 2010/08/09 19:35//    * **Echo that** - using lemming and this plugin, both header and footer disappear.  --- //[[darryl.penny@gmail.com|Darryl Penny]] 2010/08/09 19:35//
 +   * 2010-12-15 Get 
 +<code>
 +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  
 +</code>
 +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:
 +> <code php>
 +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){
 +}
 +</code>
 +
 +==== Patch for controlling recursion ====
 + --- [[user>joakinen|joakinen]] //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
 +
 +<code 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>';
 +                }
 +</code>
 +
 +Change those lines into this:
 +
 +<code php>
 +                // 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>';
 +                        }
 +                }
 +</code>
 +
 +=== Config ===
 +
 +This patch needs a new entry in conf/default.php file:
 +
 +<code>
 +// Allow annotations in annotations
 +$conf['allow_recursion'] = false;
 +</code>
 +
 +Changing the value of this entry to 'true' you get the original behaviour of the plugin.
plugin/userannotations.1286113436.txt.gz · Last modified: 2010-10-03 15:43 by HåkanS

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki