Medialist Plugin

Compatible with DokuWiki

> 2009-02-14, 2008-05-05

plugin 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

Last updated on
2009-05-21
Provides
Syntax
Repository
Source

Similar to filelist

Tagged with download, file, images, listing, media, namespace

:!: If you're looking for a really versatile/flexible solution for listing media files I suggest you give the 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)

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 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 <dokuwiki>/lib/plugins.

  • .tgz Plugin Manager

The plugin is also available via git.

% cd <dokuwiki>/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 here. - link is dead (404)

New demo (work in progress): here.

Changelog

A complete changelog is available here.

Bugs / Feature Requests

Please report bugs and feature requests at the 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));


Kim.Jun-Gi 2011/02/22

plugin/medialist.txt · Last modified: 2011/10/26 12:25 by 82.95.74.27
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 3.0 Unported
Imprint Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
WikiForumIRCBugsGitXRefTranslate