You are here: start » Snippets » dokuwiki » Filelist Plugin

Filelist Plugin

I no longer actively maintain this plugin, it therefore is only provided “as is”.

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
    • Fixes 26, 37, 40
    • 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:
    • Fixes 21, 22
    • Implements 23 (filelist output is now enclosed in an additional div with class filelist-plugin which 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

  1. Download the plugin: plugin-filelist.tar.gz
  2. 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 filelist or filename.
  • 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 .txt in the folder some/path/2), you would use some/path/*.txt as the pattern (and the parameter direct=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

{{filename>:snippets:dokuwiki:*filelist*}}

turns into

plugin-filelist.tar.gz

filelist

Example 1
{{filelist>:snippets:dokuwiki:plugin-*.tar.gz&style=table&tableheader=1&tableshowdate=1&tableshowsize=1}}

turns into

FilenameFilesizeLast modified
plugin-blockquote.tar.gz12.8 KiB2008/05/04 11:19
plugin-bloglinks.tar.gz9.8 KiB2008/07/07 21:07
plugin-charter.tar.gz372.7 KiB2008/12/21 21:37
plugin-filelist.tar.gz7.2 KiB2009/11/16 19:36
plugin-flattr.tar.gz17.2 KiB2011/05/31 18:49
plugin-keyboard.tar.gz10.1 KiB2008/05/04 11:51
plugin-linkback.tar.gz29.8 KiB2008/12/07 13:02
plugin-rate.tar.gz2.4 KiB2008/12/05 14:53
Example 2
Example 3
{{filelist>lib/images/*&style=olist&direct=1&recursive=1&sort=iname}}

turns into

  1. _deprecated.txt
  2. admin
    1. acl.png
    2. config.png
    3. plugin.png
    4. popularity.png
    5. README
    6. revert.png
    7. usermanager.png
  3. arrow_down.gif
  4. arrow_up.gif
  5. at.gif
  6. blank.gif
  7. bullet.png
  8. close.png
  9. closed-rtl.png
  10. closed.png
  11. del.png
  12. diff.png
  13. edit.gif
  14. email.png
  15. error.png
  16. external-link.png
  17. fileicons
    1. 7z.png
    2. audio.png
    3. bz2.png
    4. c.png
    5. conf.png
    6. cpp.png
    7. cs.png
    8. css.png
    9. csv.png
    10. deb.png
    11. doc.png
    12. docx.png
    13. file.png
    14. gif.png
    15. gz.png
    16. htm.png
    17. html.png
    18. ico.png
    19. index.php
    20. java.png
    21. jpeg.png
    22. jpg.png
    23. js.png
    24. lua.png
    25. mp3.png
    26. odc.png
    27. odf.png
    28. odg.png
    29. odi.png
    30. odp.png
    31. ods.png
    32. odt.png
    33. ogg.png
    34. pdf.png
    35. php.png
    36. pl.png
    37. png.png
    38. ppt.png
    39. pptx.png
    40. ps.png
    41. py.png
    42. rar.png
    43. rb.png
    44. rpm.png
    45. rtf.png
    46. sql.png
    47. swf.png
    48. sxc.png
    49. sxd.png
    50. sxi.png
    51. sxw.png
    52. tar.png
    53. tgz.png
    54. txt.png
    55. wav.png
    56. xls.png
    57. xlsx.png
    58. xml.png
    59. zip.png
  18. history.png
  19. icon-list.png
  20. icon-sort.png
  21. index.html
  22. info.png
  23. interwiki
    1. amazon.de.gif
    2. amazon.gif
    3. amazon.uk.gif
    4. bug.gif
    5. callto.gif
    6. coral.gif
    7. doku.gif
    8. dokubug.gif
    9. ghissue.gif
    10. google.gif
    11. meatball.gif
    12. paypal.gif
    13. phpfn.gif
    14. sb.gif
    15. skype.gif
    16. thing.gif
    17. wiki.gif
    18. wp.gif
    19. wpde.gif
    20. wpes.gif
    21. wpfr.gif
    22. wpjp.gif
    23. wpmeta.gif
    24. wppl.gif
  24. interwiki.png
  25. larger.gif
  26. license
    1. badge
      1. cc-by-nc-nd.png
      2. cc-by-nc-sa.png
      3. cc-by-nc.png
      4. cc-by-nd.png
      5. cc-by-sa.png
      6. cc-by.png
      7. cc-zero.png
      8. cc.png
      9. gnufdl.png
      10. publicdomain.png
    2. button
      1. cc-by-nc-nd.png
      2. cc-by-nc-sa.png
      3. cc-by-nc.png
      4. cc-by-nd.png
      5. cc-by-sa.png
      6. cc-by.png
      7. cc-zero.png
      8. cc.png
      9. gnufdl.png
      10. publicdomain.png
  27. list-minus.gif
  28. list-plus.gif
  29. loading.gif
  30. magnifier.png
  31. media_align_center.png
  32. media_align_left.png
  33. media_align_noalign.png
  34. media_align_right.png
  35. media_link_direct.png
  36. media_link_displaylnk.png
  37. media_link_lnk.png
  38. media_link_nolnk.png
  39. media_size_large.png
  40. media_size_medium.png
  41. media_size_original.png
  42. media_size_small.png
  43. mediamanager.png
  44. minus.gif
  45. notify.png
  46. ns.png
  47. open.png
  48. page.png
  49. pencil.png
  50. plus.gif
  51. README
  52. resizecol.png
  53. smaller.gif
  54. smileys
    1. delete.gif
    2. facepalm.gif
    3. fixme.gif
    4. icon_arrow.gif
    5. icon_biggrin.gif
    6. icon_confused.gif
    7. icon_cool.gif
    8. icon_cry.gif
    9. icon_doubt.gif
    10. icon_doubt2.gif
    11. icon_eek.gif
    12. icon_evil.gif
    13. icon_exclaim.gif
    14. icon_frown.gif
    15. icon_fun.gif
    16. icon_idea.gif
    17. icon_kaddi.gif
    18. icon_lol.gif
    19. icon_mrgreen.gif
    20. icon_neutral.gif
    21. icon_question.gif
    22. icon_razz.gif
    23. icon_redface.gif
    24. icon_rolleyes.gif
    25. icon_sad.gif
    26. icon_silenced.gif
    27. icon_smile.gif
    28. icon_smile2.gif
    29. icon_surprised.gif
    30. icon_twisted.gif
    31. icon_wink.gif
    32. index.php
  55. success.png
  56. throbber.gif
  57. toolbar
    1. bold.png
    2. chars.png
    3. h.png
    4. h1.png
    5. h2.png
    6. h3.png
    7. h4.png
    8. h5.png
    9. hequal.png
    10. hminus.png
    11. hplus.png
    12. hr.png
    13. image.png
    14. italic.png
    15. link.png
    16. linkextern.png
    17. mono.png
    18. ol.png
    19. sig.png
    20. smiley.png
    21. strike.png
    22. ul.png
    23. underline.png
  58. trash.png
  59. unc.png
  60. up.png
  61. wrap.gif
1) use of strftime instead of date on $conf['dformat']
2) relative to your dokuwiki root

Discussion

JacqJacq, 2011/02/17 18:08

windows UNC paths do not work I post a solution in the project Git ⇒ Issues https://github.com/foosel/dokuwiki-filelist/issues#issue/1

Álvaro FernándezÁlvaro Fernández, 2011/02/24 10:12

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 !

r19r19, 2011/07/12 08:08

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.

mkmk, 2011/10/25 21:03

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!

fvfv, 2012/05/04 17:04

Great Plugin and good problem description.

Unfortunately me too I have the same problem. Is there a solution out there?

20120504 fv

AlanAlan, 2012/08/16 19:25

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.

You could leave a comment if you were logged in.
snippets/dokuwiki/filelist.txt · Last modified: 2013/02/04 19:23 by foosel