====== Medialist Plugin ====== ---- plugin ---- description: This plugin shows a list of media files for a given wikipage which are either linked in the page itself or belong to its namespace. If there is no media directory named like the page the plugin looks for media in the next upper namespace author : Michael Klier email : chi@chimeric.de type : syntax lastupdate : 2009-05-21 compatible : > 2009-02-14, 2008-05-05 depends : conflicts : similar : filelist tags : media, images, namespace, listing, file, download downloadurl: http://cloud.github.com/downloads/chimeric/dokuwiki-plugin-medialist/plugin-medialist.tgz bugtracker : http://github.com/chimeric/dokuwiki-plugin-medialist/issues sourcerepo : http://github.com/chimeric/dokuwiki-plugin-medialist/ ---- :!: **If you're looking for a really versatile/flexible solution for listing media files I suggest you give the [[plugin:filelist]] plugin a try!** :!: \\ Actually the filelist-plugin currently does not work with Rincewind. Medialist seems to be the only working alternative (if you use the patch below) ^ Download | [[http://cloud.github.com/downloads/chimeric/dokuwiki-plugin-medialist/plugin-medialist.tgz|plugin-medialist.tgz]] | ^ Github URL | [[http://github.com/chimeric/dokuwiki-plugin-medialist]] | ===== Description ===== This plugin shows a list of media files for a given wikipage which are either linked in the page itself or belong to its namespace. If there is no media directory named like the page the plugin looks for media in the next upper namespace. Note, the plugin is aware of your ACLs. :!: **Because the plugin parses the page [[:parser|instructions]] of the wikipage you`ll see the correct output not in the preview but after the page is saved!** :!: ===== Installation ===== Download the archive and unpack it into ''/lib/plugins''. * [[http://cloud.github.com/downloads/chimeric/dokuwiki-plugin-medialist/plugin-medialist.tgz|.tgz]] Plugin Manager The plugin is also available via git. % cd /lib/plugins % git clone git://github.com/chimeric/dokuwiki-plugin-medialist.git medialist ===== Syntax ===== To list the media files linked in the given page use: {{medialist>wikipage}} To list the media files linked in the current page use: {{medialist>@PAGE@}} To list the media files contained in the current namespace use: {{medialist>@NAMESPACE@}} To list both, media files linked in the current page and contained in the current namespace use: {{medialist>@ALL@}} ===== Demo ===== You can see the plugin in action [[http://www.chimeric.de/_demo/plugin:medialist|here]]. - link is dead (404) New demo (work in progress): [[http://ryan.gulix.cl/tests_anteater/doku.php/start|here]]. ===== Changelog ===== A complete changelog is available [[http://github.com/chimeric/dokuwiki-plugin-medialist/commits/|here]]. {{rss>http://github.com/feeds/chimeric/commits/dokuwiki-plugin-medialist/master 10 1d date}} ===== Bugs / Feature Requests ===== Please report bugs and feature requests at the [[http://github.com/chimeric/dokuwiki-plugin-medialist/issues|bug tracker]]. ===== Discussion ===== Thanks for good plugin. But It doesn't work with @PAGE@. so I patched the code below. === Before === syntax.php line 172 if(($mode == 'page') or ($mode == 'all')) { // check permissions for the page if(auth_quickaclcheck($id) >= AUTH_READ) { // get the instructions $ins = p_cached_instructions(wikiFN($id),true,$id); // get linked media files foreach($ins as $node) { if($node[0] == 'internalmedia') { array_push($linked_media,$node[1][0]); } elseif($node[0] == 'externalmedia') { array_push($linked_media,$node[1][0]); } } } } ... // remove unique items $media = array_unique(array_merge($linked_media,$intern_media)); === After === if($mode == 'all') { $dir = utf8_encode('/'); } elseif ($mode == 'page') { $dir = utf8_encode(str_replace(':','/', $id)); } else { // $mode == 'ns' $dir = utf8_encode(str_replace(':','/', getNS($id))); } // check permissions for the page if(@is_dir($conf['mediadir'] . '/' . $dir)) { if(auth_quickaclcheck($dir) >= AUTH_READ) { // get mediafiles of current namespace $res = array(); // search result require_once(DOKU_INC.'inc/search.php'); search($res,$conf['mediadir'],'search_media',array(),$dir); foreach($res as $item) { array_push($intern_media,$item['id']); } } } // remove unique items $media = array_unique(array_merge($linked_media,$intern_media)); \\ --- [[mailto:dev@proarchitect.org|Kim.Jun-Gi]] //2011/02/22//