Tags:
create new tag
, view all tags

Proposal: Formatted variable approach for attachment lists.

Introduce a standard variable called FILELIST that can be used to list attachments available in topic anywhere in the topic (or other topics.)

Related topics: BetterAttachmentTable.

Example

%FILELIST{format="   [[$fileUrl][$fileName]]" selection="File1,File2"}%

Syntax

%FILELIST{args}% Where args can be:

Argument Description Defaults
web (optional) Choice of web current web
topic (optional) Attachments in this topic current topic (specified/default web)
selection (optional) Allow a selection of comma separated (partial) file names. Example: =selection="file1, file2, ppt" all files
format Format string to output. Can contain different variables as listed in a table below. Bullet lists of " * [[$fileUrl][$file]]: $fileComment"

Format variables can be one of the following:

Name What it stands for
$fileName File name
$fileUrl URL of the file
$fileIcon Image tage for corresponding icon
$fileComment Comments
$fileSize File size
$fileDate File date
$fileUser Who uploaded the file
$fileManage Link to "manage" page for this attachment

The following variables are detected:

Suggested Patch

Patch is against TWiki20040507beta, made to TWiki.pm (that's where it fits best):

Please use this as a guide only. (For e.g. $n and other variables don't work in this.)

Caveats

The attached path currently supports above syntax, but some caveats:

  • It use LISTFILES and not FILELIST as variable.
  • Doesn't yet handle access controls.
  • A regexp is used for selection and used with basic conversion. There might be perl caveats.
  • Defaults would need to be set appropriately.
  • %FILELIST% to all attachments not yet implemented.
  • The name (FILELIST? ATTACHMENTLIST?) to be decided.
  • Icons not tested.

Important note: The patch erraneously contained an unrelated part (related to ambar skin). Please use the updated patch. - VK 22 July 2004

-- VinodKulkarni - 22 Jul 2004

I like this better than the solution currently implemented in TWikiSkins#AttachmentTables (which we always knew was a stop-gap only). Standard attachment tables could be done using a %FILELIST in the template. %FILELIST should expand the same set of variables, and no more - the $fileManage link is unneccesary (it is trivial to compose).

-- CrawfordCurrie - 21 Jul 2004 - 23:32

Realized that I should also recognized "$n" and other such variables - "$web", "$topic" etc. Better still, this is ideally a function in TWiki::Attr code (in SharedCode).

-- VinodKulkarni - 22 Jul 2004 - 03:24

Topic attachments
I Attachment Action Size Date Who Comment
elsepatch FILELIST.patch manage 3.3 K 22 Jul 2004 - 08:44 VinodKulkarni Patch to add FILELIST variable
Topic revision: r4 - 23 Jul 2004 - 06:58:26 - PeterThoeny
 
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback