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 History Action Size Date Who Comment
Unknown file formatpatch FILELIST.patch r2 r1 manage 3.3 K 2004-07-22 - 08:44 VinodKulkarni Patch to add FILELIST variable
Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 2004-07-23 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.