1 # <a name="Package <code>TWiki::Attach="></a> Package =TWiki::Attach
3 A singleton object of this class is used to deal with attachments to topics.
7 <li><a href="#Package =TWiki::Attach="> Package TWiki::Attach</a><ul>
8 <li><a href="#ClassMethod <strong>new</strong> ($session)"> ClassMethod new <tt>($session)</tt></a></li>
9 <li><a href="#ObjectMethod <strong>render_MetaData</strong> ("> ObjectMethod renderMetaData <tt>($web,$topic,$meta,$args) -> $text</tt></a></li>
10 <li><a href="#ObjectMethod <strong>formatVersions</strong> ($"> ObjectMethod formatVersions <tt>($web,$topic,$attrs) -> $text</tt></a></li>
11 <li><a href="#ObjectMethod *get_AttachmentLink"> ObjectMethod getAttachmentLink <tt>($user,$web,$topic,$name,$meta) -> $html</tt></a></li>
12 <li><a href="#ObjectMethod *migrate_ToFileAtta"> ObjectMethod migrateToFileAttachmentMacro <tt>($meta,$text) -> $text</tt></a></li>
13 <li><a href="#ObjectMethod *upgradeFrom1v0beta"> ObjectMethod upgradeFrom1v0beta <tt>($meta) -> $text</tt></a></li>
19 ## <a name="ClassMethod <strong>new</strong> ($session)"></a> [[ClassMethod]] **new** `($session)`
23 ## <a name="ObjectMethod <strong>render_MetaData</strong> ("></a> [[ObjectMethod]] **renderMetaData** `($web,$topic,$meta,$args) -> $text`
25 Generate a table of attachments suitable for the bottom of a topic view, using templates for the header, footer and each row.
29 - `$meta` meta-data hash for the topic
30 - `$args` hash of attachment arguments
32 ## <a name="ObjectMethod <strong>formatVersions</strong> ($"></a> [[ObjectMethod]] **formatVersions** `($web,$topic,$attrs) -> $text`
34 Generate a version history table for a single attachment
37 - `$topic` - the topic
38 - `$attrs` - Hash of meta-data attributes
40 ## <a name="ObjectMethod <strong>get_AttachmentLink"></a> [[ObjectMethod]] \*getAttachmentLink `($user,$web,$topic,$name,$meta) -> $html`
42 - `$user` - User doing the reading
43 - `$web` - Name of the web
44 - `$topic` - Name of the topic
45 - `$name` - Name of the attachment
46 - `$meta` - Meta object that contains the meta info
48 Build a link to the attachment, suitable for insertion in the topic.
50 ## <a name="ObjectMethod <strong>migrate_ToFileAtta"></a> [[ObjectMethod]] \*migrateToFileAttachmentMacro `($meta,$text) -> $text`
52 Migrate old HTML format
54 ## <a name="ObjectMethod <strong>upgradeFrom1v0beta"></a> [[ObjectMethod]] \*upgradeFrom1v0beta `($meta) -> $text`
56 CODE\_SMELL: Is this really necessary? upgradeFrom1v0beta?