ListFiles module (Files module Improvements)
leiger wrote on 20 Mar 2010 09:36
The Files module should allow the user to restrict it's results to show only specific extensions. It should also be renamed to be the "ListFiles" module.
This design assumes that the module only displays files displayed on the same page as the module, and that multiple modules can be placed on the same page.
[[module ListFiles file_extension="zip 7z rar"]]
[[module ListFiles file_type="images"]]
Specify one or more of these selectors to refine the set of files that this module displays. Each selector adds additional constraints:
||Select by type of file
||Select by file extension
||Select by date uploaded
||Select by uploader's screen name
||Select by category (works the same as in ListPages)
||Select by page (works the same as in ListPages)
Note: All ListPages arguments should be supported. The only difference is that the ones listed above have a slightly different implementation when used in the ListFiles module.
File type selector:
- "*" means all files, ignoring file type (default)
- "images" means images
- "files" means everything except images
File extension selector:
- "*" means all file extensions
- else, a list of space/comma delimited file extensions
- file extensions are by default additive (ext OR ext OR ext)
- "-ext" means exclude files with this extension (AND NOT)
Creation date selector:
- "=" means uploaded on same day as the page was created
- "yyyy" means specified year
- "yyyy.mm" means specified year and month
- "last n unit" where 'n' is a count (defaults to 1) and unit is "hours", "day", "week", or "month"
- optionally prefixed by ">", "<", "=", "<=", ">=", "<>" (default is "=")
- dates are not site-local but currently all UTC (GMT)
Created by selector:
- "=" means by uploaded by author of current page
- "-=" means by not uploaded by author of current page
- else, a single user name
- "." current page category (default)
- "*" all categories (equivalent to page="*")
- "." current page (default)
- "*" all pages (equivalent to category="*")
To order the pages, use:
||Specify order criteria
- "property" means "ascending by this property"
- optionally followed by " desc" meaning "descending"
- optionally followed by " desc desc" meaning "ascending", which makes "desc" safe to add after any sort order
- default is "created_at desc"
||Order by file name
||Order by date uploaded
||Order by uploader's screen name
||Order by file size
||Order randomly, cached for 60 seconds
For example to order by file size in descending order:
Note that "property asc" is not allowed and unknown order criteria give you the default order, which is "created_at desc".
Arguments that affect the module body
The body of the module allows you to specify how page properties and content is formatted. To control this formatting, you can use these module arguments:
||Show the link "Manage attachments"?
Manage attachments link specifier:
- "yes"|"true" means show the link.
- "no"|"false" means hide the link (users can still click on "files" in page options).
- default is "yes".
- This only works when page=".", otherwise the attribute is ignored
Variables that are used in the module body
All arguments listed above should have corresponding variables in the module body. For example: %%file_type%% and %%file_extension%%
Start a new sub-thread
We discourage direct comments on this thread: to discuss it, please start a sub-thread.
page revision: 11, last edited: 03 Jun 2010 00:07