Filelist Plugin
Description
The filelist plugin provides a syntax for adding linked and sorted lists of files as selected by wildcard based glob patterns to a wiki page and thus allows dynamically including file listings of arbitrary filesystem locations and media namespaces. Using the additional filename command, one can also add a single link to a file out of a list anywhere in the text, which can be used to automatically keep download links for software releases up to date with the most recent upload.
The Git repository of the plugin can be found at Github.
Updates
Last updated: 2009/11/16
- 2009/11/16:
- Adds new feature: Recursive filelistings for displaying whole directory trees
- Adds new sorting option: Sort by filename case insensitive
- Added german translation
- 2008/04/04:
- Now respects ACLs in media mode and file permissions in direct mode. Files need to be readable in order to be displayed.
Users of Dokuwiki version up to 2007-06-26b: With the release of Dokuwiki version 2007-05-05, the date format got changed1). The filelist plugin incorporates this change, thus dates will not be displayed properly on versions below 2008-05-05.
- 2008/03/13:
- Should fix 24
- 2008/03/02:
- Implements 23 (
filelistoutput is now enclosed in an additionaldivwith classfilelist-pluginwhich can be used to apply specific css to anything contained inside)
- 2008/01/24:
- (Hopefully
) fixes 19 - tested with Linux only as I currently have no access to a Windows-box, so Windows-users please give feedback!
- 2007/11/05:
- Initial release
Acknowledgements
Based on an idea by demod.
Installation
With plugin manager
Let the manager do the dirty work, just give him this link to eat: plugin-filelist.tar.gz
Without plugin manager
- Download the plugin: plugin-filelist.tar.gz
- Extract it into your dokuwiki plugin folder (eg
lib/plugins)
Configuration
The filelist plugin has three configurable options:
| Option | Description |
|---|---|
allow_in_comments | Whether to allow the usage of the filelist/filename syntax in comments by the discussion plugin. Defaults to 0 and thus prohibition of the plugin usage in this scenario. |
allowed_absolute_paths | A comma-separated whitelist of all paths beneath which to allow the scanning using the filelist/filename syntax. Defaults to the Dokuwiki basedir DOKU_INC. |
web_paths | A comma-separated list of URLs via which the previously defined absolut paths are reachable to wiki users. This list MUST contain exactly the same amount of entries as allowed_absolute_paths. Defaults to the Dokuwiki base-URL DOKU_URL as a mapping for DOKU_INC. |
Usage
The filelist plugin provides two new commands to be used in wiki pages, filelist and filename. The general command syntax for both is the following:
{{[ command ]>[ pattern ][ parameterlist ]}}
- command must be either
filelistorfilename. - pattern is a searching pattern for files to include in the generated list, defined using the pattern syntax of the unix fnmatch function. An example: If you want to include all files ending on
.txtin the foldersome/path/2), you would usesome/path/*.txtas the pattern (and the parameterdirect=1, see parameters below). Analogue to this, to include all jpeg media files in:some:namespace, you'd use:some:namespace:*.jpg. - parameterlist can be used to define optional,
&separated parameters (defined as key-value-pairs). For a list of supported parameters, see below.
Paths
The filelist plugin supports both absolute as well as relative paths into the filesystem or Dokuwiki media namespaces. All paths are checked against a whitelist of allowed paths for scanning (as defined via the configuration setting ''allowed_absolute_paths''). Paths which are not located below these whitelisted paths are not allowed for globbing and thus filelist/filename calls to such paths fail. Per default, the Dokuwiki basedir as defined in DOKU_INC is included in this whitelist and mapped to the Dokuwiki base-URL, DOKU_URL.
Relative paths into the filesystem are interpreted relative to the Dokuwiki basedir. Relative media paths (without a leading : that is) are interpreted relative to the namespace of the currently active page. Thus, :snippets:dokuwiki:* and * would be interpreted the same on the current page :snippets:dokuwiki:filelist.
Parameters
| Name | Description | Possible values | Default |
|---|---|---|---|
direct | Whether to interpret the given pattern as a direct path in the file system or as an dokuwiki media id. Defaults to media id. | 0 or 1 | 0 |
sort | The property by which to sort the internal file list. By default, the file name is used, with upper case being sorted before lower case (use iname for a case insensitive sorting criteria). | name, iname, ctime, mtime, size | name |
order | Whether to sort the internal file list ascending or descending. Sorting in ascending order is the default. | asc, desc | asc |
filelist specific parameters | |||
offset | The offset in the internal file list from which on to display the list. Default is an offset of 0. | any numeric value | 0 |
limit | The number of files to display, beginning at index offset. A number of 0 means to display all available files. | any numeric value | 0 |
style | The style to use for display. list creates an unordered bullet list (the default), olist an ordered list, table a table view and page a heading/section based view of the selected files. | list, olist, table, page | list |
tableheader | Whether to show the table header describing the table columns. Off by default. | 0 or 1 | 0 |
tableshowdate | Whether to show the file modification date in the table view. Off by default. | 0 or 1 | 0 |
tableshowsize | Whether to show the file size in the table view. Off by default. | 0 or 1 | 0 |
recursive | Whether to do a recursive file crawl starting at the defined basepath. If this parameter is set to 1, the whitecard part of the search pattern is applied to each found subdirectory. If no files are found, the subdirectory is not included in the search result. All display styles besides table will show the result in a hierarchical structure; table will first flatten the result by prepending all found files with there subtree pathname (note that this happens before sorting). | 0 or 1 | 0 |
titlefile | The filename of a file which to lookup in each subtree if recursive is set to 1 and whose content to use as title for the directory. It will be ignored in the results of the filelisting itself. Defaults to _title.txt. Example: A _title.txt file containing “My special title” found during a crawl on the subpath my/subpath will be rendered as having the name “My special title” instead of “subpath”. | any filename | _title.txt |
filename specific parameters | |||
index | Which specific item to select for display from the internal file list. The default is the first one. | any numeric value | 0 |
Examples
filename
filelist
Example 1
{{filelist>:snippets:dokuwiki:plugin-*.tar.gz&style=table&tableheader=1&tableshowdate=1&tableshowsize=1}}
turns into
| Filename | Filesize | Last modified |
|---|---|---|
| plugin-blockquote.tar.gz | 12.8 KiB | 2008/05/04 11:19 |
| plugin-bloglinks.tar.gz | 9.8 KiB | 2008/07/07 21:07 |
| plugin-charter.tar.gz | 372.7 KiB | 2008/12/21 21:37 |
| plugin-filelist.tar.gz | 7.2 KiB | 2009/11/16 19:36 |
| plugin-flattr.tar.gz | 17.2 KiB | 2011/05/31 18:49 |
| plugin-keyboard.tar.gz | 10.1 KiB | 2008/05/04 11:51 |
| plugin-linkback.tar.gz | 29.8 KiB | 2008/12/07 13:02 |
| plugin-rate.tar.gz | 2.4 KiB | 2008/12/05 14:53 |
Example 2
{{filelist>lib/images/*&style=list&direct=1}}
turns into
- README
- _deprecated.txt
- arrow_down.gif
- arrow_up.gif
- at.gif
- blank.gif
- bullet.png
- close.png
- closed-rtl.png
- closed.png
- del.png
- diff.png
- edit.gif
- email.png
- error.png
- external-link.png
- history.png
- icon-list.png
- icon-sort.png
- index.html
- info.png
- interwiki.png
- larger.gif
- list-minus.gif
- list-plus.gif
- loading.gif
- magnifier.png
- media_align_center.png
- media_align_left.png
- media_align_noalign.png
- media_align_right.png
- media_link_direct.png
- media_link_displaylnk.png
- media_link_lnk.png
- media_link_nolnk.png
- media_size_large.png
- media_size_medium.png
- media_size_original.png
- media_size_small.png
- mediamanager.png
- minus.gif
- notify.png
- ns.png
- open.png
- page.png
- pencil.png
- plus.gif
- resizecol.png
- smaller.gif
- success.png
- throbber.gif
- trash.png
- unc.png
- up.png
- wrap.gif
Example 3
{{filelist>lib/images/*&style=olist&direct=1&recursive=1&sort=iname}}
turns into
- _deprecated.txt
- admin
- arrow_down.gif
- arrow_up.gif
- at.gif
- blank.gif
- bullet.png
- close.png
- closed-rtl.png
- closed.png
- del.png
- diff.png
- edit.gif
- email.png
- error.png
- external-link.png
- fileicons
- 7z.png
- audio.png
- bz2.png
- c.png
- conf.png
- cpp.png
- cs.png
- css.png
- csv.png
- deb.png
- doc.png
- docx.png
- file.png
- gif.png
- gz.png
- htm.png
- html.png
- ico.png
- index.php
- java.png
- jpeg.png
- jpg.png
- js.png
- lua.png
- mp3.png
- odc.png
- odf.png
- odg.png
- odi.png
- odp.png
- ods.png
- odt.png
- ogg.png
- pdf.png
- php.png
- pl.png
- png.png
- ppt.png
- pptx.png
- ps.png
- py.png
- rar.png
- rb.png
- rpm.png
- rtf.png
- sql.png
- swf.png
- sxc.png
- sxd.png
- sxi.png
- sxw.png
- tar.png
- tgz.png
- txt.png
- wav.png
- xls.png
- xlsx.png
- xml.png
- zip.png
- history.png
- icon-list.png
- icon-sort.png
- index.html
- info.png
- interwiki
- interwiki.png
- larger.gif
- license
- list-minus.gif
- list-plus.gif
- loading.gif
- magnifier.png
- media_align_center.png
- media_align_left.png
- media_align_noalign.png
- media_align_right.png
- media_link_direct.png
- media_link_displaylnk.png
- media_link_lnk.png
- media_link_nolnk.png
- media_size_large.png
- media_size_medium.png
- media_size_original.png
- media_size_small.png
- mediamanager.png
- minus.gif
- notify.png
- ns.png
- open.png
- page.png
- pencil.png
- plus.gif
- README
- resizecol.png
- smaller.gif
- smileys
- delete.gif
- facepalm.gif
- fixme.gif
- icon_arrow.gif
- icon_biggrin.gif
- icon_confused.gif
- icon_cool.gif
- icon_cry.gif
- icon_doubt.gif
- icon_doubt2.gif
- icon_eek.gif
- icon_evil.gif
- icon_exclaim.gif
- icon_frown.gif
- icon_fun.gif
- icon_idea.gif
- icon_kaddi.gif
- icon_lol.gif
- icon_mrgreen.gif
- icon_neutral.gif
- icon_question.gif
- icon_razz.gif
- icon_redface.gif
- icon_rolleyes.gif
- icon_sad.gif
- icon_silenced.gif
- icon_smile.gif
- icon_smile2.gif
- icon_surprised.gif
- icon_twisted.gif
- icon_wink.gif
- index.php
- success.png
- throbber.gif
- toolbar
- trash.png
- unc.png
- up.png
- wrap.gif




Discussion
windows UNC paths do not work I post a solution in the project Git ⇒ Issues https://github.com/foosel/dokuwiki-filelist/issues#issue/1
If filename contains Spanish accented chars like “ó”, the name of the file is not showed well. Should I configure something somewhere to fix it ?
Thanks a lot !
A problem was discovered, which is the filelist does not display the files for unregistered user. The ACL is correctly set for ALL and using normal syntax the file is displayed and accessible.
Great Plugin!
Bug: Filelist does not display for registred users that have access to a full specific namespace.
ex: - namespace_a - namespace_a.1 - namespace_b
User has a full access to namespace_a.1 (but not the other namespace). If there is a page that shows a filelist in namespace_a.1, then this user won't be able to see it. The user can still see the files through the “add image or other files” when editing a page, or can see the file and get them is they are linked onto this page. This shows that the plugin's security policy is incorrectly mapped to the Dokuwiki's standard security policy.
Thanks!
Great Plugin and good problem description.
Unfortunately me too I have the same problem. Is there a solution out there?
20120504 fv
Bug?
I get ”[n/a: Access denied]” running on a Windows 2003 server (Apache/Bitnami WAMP stack). The same dokuwiki works fine on a Linux server (tarred and transferred to Windows server). I've tried the latest Git commit (ff48d…) and it makes no difference.
Could it be the non-standard way Bitnami deploys Dokuwiki? Bitnami's install separates data and dokuwiki code into data and htdocs directories. Unfortunately, plugins also go in the htdocs directory, while the media files are under the data directory, so one more level abstracted from the normal install. I'm not conversant enough with php to be able to debug this.