internal package Foswiki::Attach
See PublishedAPI for packages intended to be used by Plugin and Contrib authors, or browse all packages.
See also Developing plugins, Developer's Bible, Technical Overview

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.

ObjectMethod renderMetaData( $topicObject, $args ) → $text

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

ObjectMethod formatVersions ( $topicObject, $attrs ) → $text

Generate a version history table for a single attachment
  • $topicObject - the topic
  • $attrs - Hash of meta-data attributes

  • $topicObject - The topic
  • $name - Name of the attachment

Build a link to the attachment, suitable for insertion in the topic.

Topic revision: r1 - 21 Nov 2014, ProjectContributor
This site is powered by FoswikiCopyright © by the contributing authors. All material on this site is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback