Skip to content

Commit

Permalink
Item1061: Simplifieng syntax for the default use case
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk/AttachmentUrlShortcutPlugin@2466 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
EugenMayer authored and EugenMayer committed Feb 12, 2009
1 parent f0442eb commit 1253f41
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions data/System/AttachmentUrlShortcutPlugin.txt
Expand Up @@ -12,15 +12,15 @@ Use the macro !%A% *or the one you configured in the Configuration-System under
| *Parameter* (both working, but only use one) | *Default* | *Description* |
| _web_ or _Bereich_ | Current web | Sets the web of the topic, where the attachment is attached to |
| _topic_ or _Dokument_ | Current topic | Sets the topic name, where the attachment is attached to |
| _name_ or _Anhang_ | - | Sets the name of the attachment. It must match the filename! |
| _name_ or _Anhang_ or default (=%A{"file"}%=)| required | Sets the name of the attachment. It must match the filename! |
| _Label_ or _Name__ | _name_ | Optional to set the name of the link. If its not set, _file is used as name |
If you use file to define the file to attache to, the link is create automatically, so you dont need to use braces<verbtim>[[]]</varbatim> like in example 1.
---+++ Example
---+++ Examples
Different ways to link the attachment TestAttachement.pdf of this topic
1 <verbatim>%A{"TestAttachment.pdf"}%</verbatim> %A{"TestAttachment.pdf"}%
1 <verbatim>%A{name="TestAttachment.pdf" label="Test attachment"}%</verbatim> %A{name="TestAttachment.pdf" label="Test attachment"}%
1 <verbatim>[[%A{web="System" topic="AttachmentUrlShortcutPlugin"}%TestAttachment.pdf][Test attachment]]</verbatim> [[%A{web="System" topic="AttachmentUrlShortcutPlugin"}%TestAttachment.pdf][Test attachment]]
1 <verbatim>%A{web="System" topic="AttachmentUrlShortcutPlugin" name="TestAttachment.pdf" label="Test attachment"}%</verbatim> %A{web="System" topic="AttachmentUrlShortcutPlugin" file="TestAttachment.pdf" name="Test attachment"}%
1 <verbatim>%A{name="TestAttachment.pdf" label="Test attachment"}%</verbatim> %A{name="TestAttachment.pdf" label="Test attachment"}%
1 <verbatim>%A{name="TestAttachment.pdf"}%</verbatim> %A{file="TestAttachment.pdf"}%
---++ 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 server where Foswiki is running.
Expand All @@ -33,8 +33,9 @@ __Note:__ You do not need to install anything on the browser to use this Plugin.
| Plugin Author: | Foswiki:Main.EugenMayer |
| Copyright: | &copy; 2009, Collaborganize [[www.collaborganize.com]] |
| License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) |
| Plugin Version: | 07 Jan 2008 (V0.3) |
| Plugin Version: | 12 Feb 2009 (V0.4) |
| Change History: | <!-- versions below in reverse order --> |
| 12 Feb 2009: | Simplified default use-case ( you can use =%A{"filename.ext"}= for linking the file in the current topic ). All other sytanxes are still supported |
| 07 Jan 2009: | * You can now choose the MacroName to fit your own needs %BR% Changed the name / label systax to be conform with AttachLinkPlugin |
| 11 Dez 2008: | Renewed plugin for Foswiki |
| 01 Dez 2007: | Initial version for TWiki |
Expand Down
2 changes: 1 addition & 1 deletion lib/Foswiki/Plugins/AttachmentUrlShortcutPlugin.pm
Expand Up @@ -46,7 +46,7 @@ sub _AURLSHORT {
my($this, $params, $topic, $web) = @_;
$web = $params->{'Bereich'} || $params->{'web'} || $web;
$topic = $params->{'Dokument'} || $params->{'topic'} || $topic;
my $file = $params->{'Anhang'} || $params->{'name'} || "";
my $file = $params->{'Anhang'} || $params->{'name'} || $params->{_DEFAULT} || "";
my $name = $params->{'Name'} || $params->{'label'} || $file;
my $url;
if($file eq "") {
Expand Down

0 comments on commit 1253f41

Please sign in to comment.