====== Display Wiki Page for DokuWiki ====== ---- plugin ---- description: Plugin that defines an additional template function such that you can display more than one wiki page at a time on any given document. author : Terence J. Grant email : tjgrant@tatewake.com type : admin lastupdate : 2020-09-19 compatible : 2020-07-29 "Hogfather", 2018-04-22 "Greebo", 2017-02-19 "Frusterick Manners", 2016-06-26 "Elenor Of Tsort" depends : conflicts : similar : include, sidebar tags : sidebar, include downloadurl: https://github.com/tatewake/dokuwiki-plugin-displaywikipage/archive/master.zip bugtracker: https://github.com/tatewake/dokuwiki-plugin-displaywikipage/issues sourcerepo: https://github.com/tatewake/dokuwiki-plugin-displaywikipage ---- ===== License ===== * **Author:** [[tjgrant@tatewake.com|Terence J. Grant]] * **License:** [[http://www.opensource.org/licenses/gpl-license.php|GNU GPL v2]] * **Donate:** [[https://www.paypal.com/xclick/business=tjgrant%40tatewake.com&item_name=Display%20wiki%20page%20for%20DokuWiki%20Donation&no_shipping=1&no_note=1&tax=0¤cy_code=USD&lc=US|Click here.]] ===== Download ===== Before downloading or using this product, make sure you __**understand and accept**__ the terms of the [[#license]]. After downloading, make sure to follow the [[#install]] instructions or [[#upgrading]] instructions below; trust me, they're worth reading. * This is the **latest version**, compatible with **The Latest DokuWiki**: * Latest Version: {{http://cloud.github.com/downloads/tatewake/dokuwiki-plugin-displaywikipage/displaywikipage-stable.tar.gz}} * Github URL: [[https://github.com/tatewake/dokuwiki-plugin-displaywikipage]] * Older downloads are available on request only. **Note: http://cloud.github.com/downloads/tatewake/dokuwiki-plugin-displaywikipage/displaywikipage-stable.tar.gz always points to the latest stable version!** ===== Installation ===== Use the plugin manager to install, or... - [[#download]] the tarball/zip-file - unpack it into ''/lib/plugins/'' - login as admin and change the plugin in the configuration manager **using git:**\\ % cd /lib/plugins/ % git clone git://github.com/tatewake/dokuwiki-plugin-displaywikipage.git displaywikipage **Debian install (or probably any other distribution):** # cd /usr/share/dokuwiki/lib/plugins/ # wget http://cloud.github.com/downloads/tatewake/dokuwiki-plugin-displaywikipage/displaywikipage-stable.tar.gz # tar -xvzf displaywikipage-stable.tar.gz # chown -Rv 33 displaywikipage/ **Note: http://cloud.github.com/downloads/tatewake/dokuwiki-plugin-displaywikipage/displaywikipage-stable.tar.gz always points to the latest stable version!** ===== About ===== This plugin defines an additional template function such that you can display more than one wiki page at a time on any given document. The plugin also exports a function for use with your template, so you will have to insert the following code into your template, somewhere inside of the **** tags. Typically you'll want to do this for any PHP (or HTML) files containing the string ""; at a minimum you can do just main.php.((If you only do main.php though you'll miss some types of pages (like upload file), so I suggest searching for head tags through all the PHP files in a template to make sure you get them all.)) **Note**: Inserting the code above is **required**, not optional. To display a wiki page at any point in your document, use the following code: Doing it in this fashion will allow your users to use the template whether or not you have the plugin installed. ===== Upgrading ===== To upgrade, remove the original lib/plugins/displaywikipage folder, and install the new version as instructed above. ===== What's New ===== ==== Sep 19, 2020 ==== * Updated release with nicer documentation and code cleanup ==== May 28, 2009 ==== * A work-around to the ACL issue has been implemented, thanks to an anonymous contributor. Apparently **auth_aclquickcheck** can't handle leading colons in IDs-- so I feel this is still broken in DokuWiki, but at least the plugin can honor ACL properly. ==== February 15, 2007 ==== * Cleaner rewrite, but nothing new otherwise. The problem regarding ACL is something broken in the DokuWiki source; it's nothing on my end. I've reported it, and there's not much else I can do from here. ==== November 18, 2006 ==== * Display Wiki Page now honors page permissions for read. Thanks anonymous. ==== August 23, 2006 ==== * Initial release ===== Sites using this plugin ===== //List your site here if you wish!// ===== Discussion ===== **Start all subtopics with H2.** ==== Is it possible to remove Edit button? ==== I love this for adding a copyright notice and header notice to existing dokuwiki template. However, it is obtrusive because it adds a blank line then another "EDIT" button (if the user has editing privileges). Is it possible to remove the EDIT button and minimize the space around the included wiki page? Thanks! --- [[user>lenehey|lenehey]] //2022-10-03 23:24// ===== Recursive stuff ==== As written on monobook discussion, I added this feature, I changed code.php a bit to reach this: */ /* Etienne Gauthier, 23/04/2006 Function that get a wiki page (to insert into into a bar, for instance) All Wiki parameters are first 'backup', to totally separate the rendering of the sidebar, and the display of the main content. Martin Schleyer, 29/11/2006 Added recursive search, thanks to Christopher Smith and his sidebar template for nice a function :) Credits for dwp_display_wiki_page_getFN: * @link http://wiki.jalakai.co.uk/dokuwiki/doku.php?id=tutorials:dev:navigation_sidebar * @author Christopher Smith */ function dwp_display_wiki_page_getFN($ns, $file) { // check for wiki page = $ns:$file (or $file where no namespace) $nsFile = ($ns) ? "$ns:$file" : $file; if (file_exists(wikiFN($nsFile)) && auth_quickaclcheck($nsFile)) return $nsFile; // remove deepest namespace level and call function recursively // no namespace left, exit with empty if (!$ns) return ''; $i = strrpos($ns, ":"); $ns = ($i) ? substr($ns, 0, $i) : false; return dwp_display_wiki_page_getFN($ns, $file); } function dwp_display_wiki_page ($wikipagename, $checkrecursive = false) { global $ID; global $REV; global $ACT; global $IDX; global $DATE; global $RANGE; global $HIGH; global $TEXT; global $PRE; global $SUF; global $SUM; global $lang; global $_SERVER; // Save the configuration for the current page: $backup['ID'] = $ID; $backup['REV'] = $REV; $backup['ACT'] = $ACT; $backup['IDX'] = $IDX; $backup['INFO'] = $INFO; $backup['DATE'] = $DATE; $backup['RANGE'] = $RANGE; $backup['HIGH'] = $HIGH; $backup['TEXT'] = $TEXT; $backup['PRE'] = $PRE; $backup['SUF'] = $SUF; $backup['SUM'] = $SUM; if (!$checkrecursive) { $ID = $wikipagename; } else { $i = strrpos($wikipagename, ":"); // finds pagename in wikipage to display $j = strrpos($backup['ID'], ":"); // finds complete namespace in surrounding wiki page $ID = dwp_display_wiki_page_getFN(($j) ? substr($backup['ID'], 0, $j) : $wikipagename, ($i) ? substr($wikipagename, $i + 1) : $wikipagename); // gets the page, checking recursive from namespace in // surrounding wiki page to root if($ID == '') { $ID = $wikipagename; } // if not found use complete path of wikipage to display // -> adds backwards compatibility } $ACT = 'show'; $REV = ''; $IDX = ''; $DATE = ''; $RANGE = ''; $HIGH = ''; $TEXT = ''; $PRE = ''; $SUF = ''; $SUM = ''; //Check the user's rights ont the sidebar page. if($_SERVER['REMOTE_USER']) $perm = auth_quickaclcheck($ID); else $perm = auth_aclcheck($ID,'',null); //Use of wiki content : if this page exists, else we do nothing (the Edit link will be there, it's enough). $file = wikiFN($ID); if (@file_exists($file)) { if($perm >= AUTH_READ) //11-18-2006 User must have proper permissions. (Anonymous contribution.) { tpl_content(); } //Add the edit link, for this page. if($perm >= AUTH_EDIT) { echo ''; } } else { //Add the create link, for this page. if($perm >= AUTH_EDIT) { echo ''; } } //Rest ore previous value for $ID and $ACT. $ID = $backup['ID']; $REV = $backup['REV']; $ACT = $backup['ACT']; $IDX = $backup['IDX']; $INFO = $backup['INFO']; $DATE = $backup['DATE']; $RANGE = $backup['RANGE']; $HIGH = $backup['HIGH']; $TEXT = $backup['TEXT']; $PRE = $backup['PRE']; $SUF = $backup['SUF']; $SUM = $backup['SUM']; } ?> I also added ''?>'' at the end to avoid whitespace problems somewhere, or did it have a special reason which I didn't see? --- //Martin Schleyer 11/29/2006 13:46// To make displaywikipage working with the last DokuWiki, I change code.php like this (might broke something, but it seems to work. */ /* History... Etienne Gauthier, 04/23/2006 - Initial version Terence J. Grant, 02/14/2007 - Rewrite */ function dwp_display_wiki_page($wikipagename) { global $conf, $lang; global $auth; global $ID, $REV; //save status $backup['ID'] = $ID; $backup['REV'] = $REV; $result = ''; //Check user permissions... $perm = auth_quickaclcheck($ID); if(@file_exists(wikiFN($wikipagename))) { //check page permissions if ($perm >= AUTH_READ) { $result = p_wiki_xhtml($wikipagename,'',false); if ($perm >= AUTH_EDIT) { // create and add the 'edit' button $result .=''; } } else //show access denied { $result = 'Access Denied'; } } else { if ($perm >= AUTH_CREATE) { // create and add the 'create' button $result .=''; } } //display page with edits echo $result; //restore status $ID = $backup['ID']; $REV = $backup['REV']; }