plugin:displaywikipage
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
plugin:displaywikipage [2009-08-11 07:38] – moved from "display_wiki_page" tatewake | plugin:displaywikipage [2022-10-03 23:41] (current) – [Is it possible to remove Edit button?] lenehey | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Display Wiki Page for DokuWiki ====== | ====== Display Wiki Page for DokuWiki ====== | ||
+ | |||
+ | |||
---- plugin ---- | ---- plugin ---- | ||
- | description: | + | description: |
author | author | ||
email : tjgrant@tatewake.com | email : tjgrant@tatewake.com | ||
type : admin | type : admin | ||
- | lastupdate : 2007-02-15 | + | lastupdate : 2020-09-19 |
- | compatible : 2006-03-09 | + | compatible : 2020-07-29 " |
depends | depends | ||
conflicts | conflicts | ||
similar | similar | ||
tags : sidebar, include | tags : sidebar, include | ||
+ | |||
+ | downloadurl: | ||
+ | bugtracker: https:// | ||
+ | sourcerepo: https:// | ||
---- | ---- | ||
- | [[http://tatewake.com/wiki/projects:display_wiki_page_for_dokuwiki|Details and Download]] | + | ===== License ===== |
+ | |||
+ | * **Author:** [[tjgrant@tatewake.com|Terence J. Grant]] | ||
+ | * **License: | ||
+ | * **Donate:** [[https:// | ||
+ | |||
+ | ===== Download | ||
+ | Before downloading or using this product, make sure you __**understand and accept**__ the terms of the [[#license]]. | ||
+ | |||
+ | After downloading, | ||
+ | |||
+ | * This is the **latest version**, compatible with **The Latest DokuWiki**: | ||
+ | * Latest Version: {{http:// | ||
+ | * Github URL: [[https:// | ||
+ | |||
+ | * Older downloads are available on request only. | ||
+ | |||
+ | **Note: http:// | ||
+ | |||
+ | ===== Installation ===== | ||
+ | |||
+ | Use the plugin manager to install, or... | ||
+ | |||
+ | - [[# | ||
+ | - unpack it into ''< | ||
+ | - login as admin and change the plugin in the configuration manager | ||
+ | |||
+ | **using git:**\\ | ||
+ | < | ||
+ | % cd < | ||
+ | % git clone git:// | ||
+ | </ | ||
+ | |||
+ | **Debian install (or probably any other distribution): | ||
+ | < | ||
+ | # cd / | ||
+ | # wget http:// | ||
+ | # tar -xvzf displaywikipage-stable.tar.gz | ||
+ | # chown -Rv 33 displaywikipage/ | ||
+ | </ | ||
+ | |||
+ | **Note: http:// | ||
+ | |||
+ | ===== 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 **< | ||
+ | |||
+ | Typically you'll want to do this for any PHP (or HTML) files containing the string "< | ||
+ | |||
+ | <code php> | ||
+ | <?php if (file_exists(DOKU_PLUGIN.' | ||
+ | </ | ||
+ | |||
+ | **Note**: Inserting the code above is **required**, | ||
+ | |||
+ | To display a wiki page at any point in your document, use the following code: | ||
+ | |||
+ | <code php> | ||
+ | <?php if (function_exists(' | ||
+ | </ | ||
+ | |||
+ | 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/ | ||
+ | |||
+ | ===== 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, | ||
+ | |||
+ | 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' | ||
+ | |||
+ | ==== 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 ===== | ===== Discussion ===== | ||
- | Please use the [[http:// | + | **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. | ||
+ | |||
+ | Thanks! | ||
+ | |||
+ | | ||
+ | ===== Recursive stuff ==== | ||
+ | |||
+ | As written on monobook discussion, I added this feature, I changed code.php a bit to reach this: | ||
+ | <code php> | ||
+ | <?php | ||
+ | |||
+ | /** | ||
+ | * Display Wiki Page for DokuWiki | ||
+ | * | ||
+ | * @license | ||
+ | * @author | ||
+ | */ | ||
+ | |||
+ | /* Etienne Gauthier, 23/ | ||
+ | Function that get a wiki page (to insert into into a bar, for instance) | ||
+ | All Wiki parameters are first ' | ||
+ | |||
+ | | ||
+ | Added recursive search, thanks to Christopher Smith and his sidebar template for nice a function | ||
+ | Credits for dwp_display_wiki_page_getFN: | ||
+ | |||
+ | * @link | ||
+ | * @author Christopher Smith < | ||
+ | */ | ||
+ | |||
+ | function dwp_display_wiki_page_getFN($ns, | ||
+ | // check for wiki page = $ns:$file (or $file where no namespace) | ||
+ | $nsFile = ($ns) ? " | ||
+ | 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, | ||
+ | } | ||
+ | |||
+ | function dwp_display_wiki_page ($wikipagename, | ||
+ | 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[' | ||
+ | $backup[' | ||
+ | $backup[' | ||
+ | $backup[' | ||
+ | $backup[' | ||
+ | $backup[' | ||
+ | $backup[' | ||
+ | $backup[' | ||
+ | $backup[' | ||
+ | $backup[' | ||
+ | $backup[' | ||
+ | $backup[' | ||
+ | |||
+ | if (!$checkrecursive) | ||
+ | { | ||
+ | $ID = $wikipagename; | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | $i = strrpos($wikipagename, | ||
+ | $j = strrpos($backup[' | ||
+ | $ID = dwp_display_wiki_page_getFN(($j) ? substr($backup[' | ||
+ | ($i) ? substr($wikipagename, | ||
+ | // gets the page, checking recursive from namespace in | ||
+ | // surrounding wiki page to root | ||
+ | | ||
+ | // -> adds backwards compatibility | ||
+ | } | ||
+ | $ACT = ' | ||
+ | $REV = ''; | ||
+ | $IDX = ''; | ||
+ | $DATE = ''; | ||
+ | $RANGE = ''; | ||
+ | $HIGH = ''; | ||
+ | $TEXT = ''; | ||
+ | $PRE = ''; | ||
+ | $SUF = ''; | ||
+ | $SUM = ''; | ||
+ | |||
+ | |||
+ | //Check the user's rights ont the sidebar page. | ||
+ | if($_SERVER[' | ||
+ | $perm = auth_quickaclcheck($ID); | ||
+ | else | ||
+ | $perm = auth_aclcheck($ID,'', | ||
+ | |||
+ | //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) | ||
+ | { | ||
+ | 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[' | ||
+ | $REV = $backup[' | ||
+ | $ACT = $backup[' | ||
+ | $IDX = $backup[' | ||
+ | $INFO = $backup[' | ||
+ | $DATE = $backup[' | ||
+ | $RANGE = $backup[' | ||
+ | $HIGH = $backup[' | ||
+ | $TEXT = $backup[' | ||
+ | $PRE = $backup[' | ||
+ | $SUF = $backup[' | ||
+ | $SUM = $backup[' | ||
+ | } | ||
+ | ?> | ||
+ | </ | ||
+ | |||
+ | I also added ''?>'' | ||
+ | |||
+ | --- //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. | ||
+ | <code php> | ||
+ | <?php | ||
+ | |||
+ | /** | ||
+ | * Display Wiki Page for DokuWiki | ||
+ | * | ||
+ | * @license GPL 2 (http:// | ||
+ | * @author Etienne Gauthier, Terence J. Grant< | ||
+ | */ | ||
+ | |||
+ | /* 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[' | ||
+ | $backup[' | ||
+ | |||
+ | $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,'', | ||
+ | if ($perm >= AUTH_EDIT) | ||
+ | { | ||
+ | // create and add the ' | ||
+ | $result .='< | ||
+ | . '">' | ||
+ | } | ||
+ | } | ||
+ | else // | ||
+ | { | ||
+ | $result = '< | ||
+ | } | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | if ($perm >= AUTH_CREATE) | ||
+ | { | ||
+ | // create and add the ' | ||
+ | $result .='< | ||
+ | . '">' | ||
+ | } | ||
+ | } | ||
+ | |||
+ | //display page with edits | ||
+ | echo $result; | ||
+ | |||
+ | //restore status | ||
+ | $ID = $backup[' | ||
+ | $REV = $backup[' | ||
+ | } | ||
+ | </ |
plugin/displaywikipage.1249969098.txt.gz · Last modified: 2009-08-11 07:38 by tatewake