====== MediaList Plugin ====== ---- plugin ---- description: Show a list of media files (images/archives...) referred in a given page or stored in a given namespace author : S.Sahara (previous author: Michael Klier) email : sahara.satoshi@gmail.com type : syntax lastupdate : 2016-08-24 compatible : > 2009-02-14, 2008-05-05, "Detritus", 2016-06-26, 2017-02-19 depends : conflicts : pdfjs similar : filelist tags : media, images, namespace, listing, file, download downloadurl: https://github.com/ssahara/dw-plugin-medialist/zipball/master bugtracker : https://github.com/ssahara/dw-plugin-medialist/issues sourcerepo : https://github.com/ssahara/dw-plugin-medialist donationurl: screenshot_img: https://raw.githubusercontent.com/ssahara/dw-plugin-medialist/master/sample1.png ---- ===== Description ===== {{ https://raw.githubusercontent.com/ssahara/dw-plugin-medialist/master/sample1.png?recache|an example}} 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. In the namespace mode, a button to open the namespace by the [[:fullscreen_mediamanager|Fullscreen Media Manager]] is shown at upper-right corner of the list area; it may be helpful to upload or delete files in the namespace. If you're looking for a really versatile/flexible solution for listing media files, see the [[plugin:filelist]] plugin. ===== Installation ===== Search and install the plugin using the [[plugin:extension|Extension Manager]]. Refer to [[:plugin_installation_instructions|plugin installation instructions]] on how to install plugins manually. ===== Usage / Example ===== Specify a scope parameter that defines the output of the list of media files. The scope can be a "page id" or a "namespace". - **page id**: look up media files linked in the page (i.e. curly brackets ''%%{{...}}%%'' in page text). - **namespace**: look up media files stored the namespace. The parameter ends by ''%%:%%'' or ''%%:*%%'' , Some replacement patterns for [[:namespace templates]] -- ''@ID@'', ''@NS@'', ''@PAGE@'' -- are available in order to specify the scope parameter. To list the media files linked in the current page use: {{medialist>@ID@}} or {{medialist>@NS@:@PAGE@}} To list media files stored in the current namespace use: {{medialist>@NS@:}} To list media files stored in the current namespace and its sub-namesapces use: {{medialist>@NS@:*}} More examples: {{medialist>wikipage}} {{medialist>ns1:ns2:*}} {{medialist>@NS@:start}} {{medialist>@ID@:}} ==== Legacy Syntax Support ==== In the older release 2009-05-21 version, the scope parameter could be one of literal keywords, ''%%@PAGE@%%'', ''%%@NAMESPACE@%%'' and ''%%@ALL@%%''. These literal keywords must be used as is, and are not replacement pattens. * ''%%{{medialist>@PAGE@}}%%'' shows files linked in the current page. * ''%%{{medialist>@NAMESPACE@}}%%'' shows files stored in the current namespace and sub namecpaces. * ''%%{{medialist>@ALL@}}%%'' shows all files when ''%%@PAGE@%%'' and ''%%@NAMESPACE@%%'' keywords given. {{medialist>@PAGE@}} is same as {{medialist>@ID@}} {{medialist>@NAMESPACE@}} is same as {{medialist>@NS@:}} :!: NOTE: ''%%@ALL@%%'' keyword will be obsoleted in future release. --- [[user>s.sahara|s.sahara]] //2016-06-06 14:42// ===== Development ===== The medialist plugin was developed by [[https://github.com/chimeric|Michael Klier]] %%%%, who does not provide any support after 2009-05-21 release. This plugin has adopted for further development to catch up newer DokuWiki and PHP 7 series. ==== Change Log ==== 2016-06-30: added two config options: **emptyInfo** (default off), **checkboxes** (default off) A complete changelog is available [[https://github.com/ssahara/dw-plugin-medialist/commits/|here]]. {{rss>https://github.com/ssahara/dw-plugin-medialist/commits/master.atom date}} ==== Bugs / Feature Requests ==== Please report bugs and feature requests at the [[https://github.com/ssahara/dokuwiki-plugin-medialist/issues|bug tracker]]. ===== 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)); \\ --- [[mailto:lloyd@flowide.com|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. --- [[user>KaiMartin|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. --- [[user>KaiMartin|KaiMartin]] //2015-10-14 22:44//