Main CfdTm Forum Saturne Aster ATAAC TWikiEditRaw editAttachPrint version


TWiki> TWiki Web>AttachLinkPlugin (2008-12-21, X509_2fC_3dUS_2fST_3dMassachusetts_2fL_3dSouthborough_2fO_3dlitts_2enet_2fOU_3dLitt_20family_2fOU_3dNetwork_20Administration_2fCN_3dTimothe_20Litt_2femailAddress_3dtimothe_40litts_2enet)

AttachLinkPlugin

Standard links to attachments


Syntax Rules

%ATTACHMENT{ name="filename" topic="TopicName" web="Webname" label="sometimes_text_sometimes_magic" }%

This apparently trivial plugin turns out to be quite useful. Besides syntactic sugar, it actually makes previously hard things easier!

Until now, referencing an attachment in a TWiki topic has required escape to HTML, with lots of ugly TWiki variables like %PUBURLPATH% and %ATTACHURL% to do the simplest things. AttachLinkPlugin fixes that!

Further, it makes it easy to have clickable images - for example, thumbnails that when clicked, expand to a full-size picture.

Here are the syntax details:

  • name - The filename that you upload. Just the name, no path. The name= is optional, but the quotes are not.
  • topic - the topic that manages the attachment. The default is the current topic, so you can usually omit this.
  • web - the web that contains the topic that manages the attachment. The default is the current web, so again, you can usually omit this.
  • label - the thing that you want visible to represent the link. This can be text - or another object. The default is the filename, so you can omit it too. See the examples for details.

Examples

%ATTACHMENT{ "foo.jpg" }% Create a link to foo.jpg in the current topic, which will look like: foo.jpg underlined. (Can WYSIWYG underline?)

%ATTACHMENT{ "foo.jpg" label="The foomobile afloat" }% gives you a hyperlink to the same file, like this: The foomobile afloat

%ATTACHMENT{ "foo.jpg" label="%IMG{ "foo_thumb.jpg" align="left" width="40" class="none" }%}% will display foo_thumb.jpg inline. You can click on the image, and if you do, foo.jpg will display.

So you essentially have the power of [[WikiWord][PrettyText]] links, for images and other attachments. And anything else that will take an HTML anchor tag.

A rather surprising result for less than 10 executable statements of perl. If %ATT% is not in use (do we have a registry of variables?), I would be receptive to adding the line to add it as an alias for %ATTACHMENT% - I already have 10s of thousands of instances of %ATTACHMENT%

Enjoy it as much as I do.

Plugin Settings

Plugin settings are stored as preferences variables. To reference a plugin setting write %<nop><plugin>_<setting>%, i.e. %<nop>NEWPLUGIN_SHORTDESCRIPTION%

  • One line description, is shown in the TextFormattingRules topic:
    • Set SHORTDESCRIPTION = Painless links to attachments

  • There are no other settings for this plugin.

Plugin Installation Instructions

Note: You do not need to install anything on the browser to use this plugin. The following instructions are for the administrator who installs the plugin on the TWiki server.

  • Download the ZIP file from the Plugin Home (see below)
  • Unzip AttachLinkPlugin.zip in your twiki installation directory. Content:

File: Description:
data/TWiki/AttachLinkPlugin.txt Plugin topic
data/TWiki/AttachLinkPlugin.txt,v Plugin topic repository
lib/TWiki/Plugins/AttachLinkPlugin.pm Plugin Perl module
  • Configure the Plugin:
    • TWiki 4.0 and up: Run the configure script to enable the Plugin
    • Change the Plugin settings as needed
  • Test if the installation was successful:
    • enter samples here

Plugin Info

Plugin Author: TWiki:Main.TimotheLitt
Copyright: 2007, TWiki:Main.TimotheLitt
License: GPL (GNU General Public License)
Plugin Version: 21 Dec 2008 (V1.000)
Change History: <!-- versions below in reverse order -->
20 Dec 2008: Initial version
TWiki Dependency: $TWiki::Plugins::VERSION 1.1
CPAN Dependencies: none
Other Dependencies: none
Perl Version: 5.005
Benchmarks: GoodStyle nn%, FormattedSearch nn%, AttachLinkPlugin nn%
Plugin Home: http://TWiki.org/cgi-bin/view/Plugins/AttachLinkPlugin
Feedback: http://TWiki.org/cgi-bin/view/Plugins/AttachLinkPluginDev
Appraisal: http://TWiki.org/cgi-bin/view/Plugins/AttachLinkPluginAppraisal

Related Topics: TWikiPlugins, DeveloperDocumentationCategory, AdminDocumentationCategory, TWikiPreferences


%TOPICCREATE{ template="Plugins.PluginDevTemplate" topic="AttachLinkPluginDev" disable="NewPluginTemplate" parameters="pluginName=AttachLinkPlugin&RelatedTopics=AttachLinkPlugin, AttachLinkPluginAppraisal " }% %TOPICCREATE{ template="Plugins.PluginAppraisalTemplate" topic="AttachLinkPluginAppraisal" disable="NewPluginTemplate" parameters="RelatedTopics=AttachLinkPlugin, AttachLinkPluginDev " }% -- TWiki:Main.TimotheLitt - 21 Dec 2008

-- TimotheLitt - 21 Dec 2008


Current Tags:
create new tag
, view all tags
Topic revision: r1 - 2008-12-21 - 04:42:28 - X509_2fC_3dUS_2fST_3dMassachusetts_2fL_3dSouthborough_2fO_3dlitts_2enet_2fOU_3dLitt_20family_2fOU_3dNetwork_20Administration_2fCN_3dTimothe_20Litt_2femailAddress_3dtimothe_40litts_2enet
 

Computational Fluid Dynamics and Turbulence Mechanics
@ the University of Manchester
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
Note: Please contribute updates to this topic on TWiki.org at TWiki:TWiki.AttachLinkPlugin