This is an old revision of the document!
Table of Contents
MediaList Plugin
Compatible with DokuWiki
> 2009-02-14, 2008-05-05, "Detritus"
Show a list of media files (images/archives ...) referred in a given page using curly brackets "{{...}}", or stored in a given namespace.
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 filelist, filelisting
If you're looking for a really versatile/flexible solution for listing media files I suggest you give the filelist plugin a try!
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. Note, the plugin is aware of your ACLs.
The original plugin author Michael Klier chi [at] chimeric [dot] de does not provide any support since 2009-05-21 release. This plugin has adopted for further development to catch up newer DokuWiki and PHP 7 series.
Installation
Install the plugin through the Extension Manager or Plugin Manager using the download URL above, which points to latest version of the plugin. Refer to plugin installation instructions.
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@}}
NOTE: @ALL@
keyword will be obsoleted in future release. — s.sahara 2016-06-06 14:42
Demo
Changelog
A complete changelog is available here.
- minor fix to prevent PHP Warnings (2016-08-24 12:14)
- update plugin.info (2016-06-30 14:33)
- remove unused handle_content_display() in action (2016-06-30 14:26)
- Add config options: emptyInfo, checkboxes (2016-06-30 14:17)
- add POSTPROCESS eevent handler (2016-06-30 06:04)
- use $INFO['id'] instead of $ID (2016-06-30 05:54)
- bugfix: files not shown in root namespace (2016-06-27 04:20)
- Update README.md (2016-06-25 11:32)
- update sample image (2016-06-25 11:02)
- Merge pull request #12 from ssahara/dev4 (2016-06-25 10:42)
Bugs / Feature Requests
Please report bugs and feature requests at the bug tracker.
ToDO
- show full media id in the list (namespace mode only)
- discontinue
@ALL@
keyword
Discussion before 2016-06-05 release
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));
— Kim.Jun-Gi 2011/02/22
Note, the patched plugin does not work exactly as described for the original. According to the description the plugin is supposed to list all media files linked in the page. The patched plugin ignores links and displays the contents of the media folder associated with the page instead. This is not necessarily the same.
Anyway, thank you for the patch! I was looking for a way to list all files “attached” to a page like twiki does. This comes pretty close. — KaiMartin 2015-10-12 23:52
Install with the Plugin-manager needs rectification
On Detritus the built-in extension manager consistently claimed it could not download the plugin. However, the files got actually downloaded. But they were placed in …/lib/plugins/pluginmedialist
rather than in …/lib/plugins/medialist
. The new syntax would not work even with the above patch applied. After I renamed the folder the plugin runs fine. — KaiMartin 2015-10-14 22:44