internal package
Foswiki::
Attach
internal package
Foswiki::Attach
A singleton object of this class is used to deal with attachments to topics.
ClassMethod
new($session)
Constructor.
ObjectMethod
finish()
Break circular references.
Generate a table of attachments suitable for the bottom of a topic
view, using templates for the header, footer and each row.
-
$topicObject
the topic
-
$args
hash of attachment arguments
Renders these tokens for each attachment:
- %A_ATTRS% - attributes
- %A_COMMENT% - comment
- %A_DATE% - upload date in user friendly format
- %A_EPOCH% - upload date in epoch seconds
- %A_EFILE% - encoded file name
- %A_EXT% - file extension
- %A_FILE% - file name
- %A_FILESIZE% - filesize in bytes to be used in sorting
- %A_ICON% -
%ICON{}%
macro around file extension
- %A_REV% - revision
- %A_SIZE% - filesize in user friendly notation
- %A_URL% - attachment file url
- %A_USER% - user who has uploaded the last version in 'web.usertopic' notation
- %A_USERNAME% - user who has uploaded the last version in 'usertopic' notation
- %A_COUNT% - attachment number (starting from 1)
Renders these row helper tokens:
- %R_STARTROW_N% - where N is the desired number of attachments in a row; true if a new row should be started
- %R_ENDROW_N% - where N is the desired number of attachments in a row; true if a row should be closed
Generate a version history table for a single attachment
-
$topicObject
- the topic
-
$attrs
- Hash of meta-data attributes
ObjectMethod
getAttachmentLink( $topicObject, $name ) → $html
-
$topicObject
- The topic
-
$name
- Name of the attachment
Build a link to the attachment, suitable for insertion in the topic.