-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-svn-id: http://svn.foswiki.org/trunk/AttachmentUrlShortcutPlugin@2031 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
- Loading branch information
EugenMayer
authored and
EugenMayer
committed
Jan 17, 2009
1 parent
774ce20
commit 5db9ca8
Showing
7 changed files
with
374 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
ce318f803a2ee7ad219dff4e54cc1273 AttachmentUrlShortcutPlugin.tgz | ||
e8910f8c39916eaf32a6a6b20ff5c31a AttachmentUrlShortcutPlugin_installer | ||
1f58c8ef648338eac4e7bdd1c2e7922c AttachmentUrlShortcutPlugin.zip |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
%META:TOPICINFO{author="EugenMayer" date="1229041003" format="1.1" reprev="1.2" version="1.2"}% | ||
---+ !AttachmentUrlShortcutPlugin | ||
Gives you the ability to you use shortened syntaxes for links to attachments !%A% | ||
|
||
%TOC% | ||
|
||
---++ Usage | ||
%BR% | ||
*Hint:* You can choose the *Macro-Name*, whi should be used for the attachment-shortcut, so e.g. like in AttachLinkPlugin, you can use ATTACHMENT instead A%BR%%BR% | ||
Use the macro !%A% *or the one you configured in the Configuration-System under AttachmentUrlShortcutPlugin* to create a link to an attachement: | ||
%BR% | ||
| *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! | | ||
| _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 | ||
Different ways to link the attachment TestAttachement.pdf of this topic | ||
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. | ||
|
||
---+++ Installation instructions | ||
* just use the installer attached to the topic or even easier, use the configure-system/Extension to easy install it trough an user-interface | ||
|
||
<!-- * Set SHORTDESCRIPTION = Easy linking to attachments for everyone !%A% --> | ||
----- | ||
| Plugin Author: | Foswiki:Main.EugenMayer | | ||
| Copyright: | © 2006, Impressive.media | | ||
| License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) | | ||
| Plugin Version: | 07 Jan 2008 (V0.3) | | ||
| Change History: | <!-- versions below in reverse order --> | | ||
| 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 | | ||
| Foswiki Dependency: | | | ||
| CPAN Dependencies: | | | ||
| Other Dependencies: | | | ||
| Perl Version: | 5.005 | | ||
| Add-on Home: | http://foswiki.org/Extensions/%TOPIC% | | ||
| Feedback: | http://foswiki.org/Extensions/%TOPIC%Dev | | ||
| Appraisal: | http://foswiki.org/Extensions/%TOPIC%Appraisal | | ||
__Related Topic:__ | ||
|
||
-- Foswiki:Main/EugenMayer - 11 Dez 2008 | ||
|
||
%META:FILEATTACHMENT{name="TestAttachment.pdf" attachment="TestAttachment.pdf" attr="" comment="" date="1229040729" path="TestAttachment.pdf" size="14728" stream="IO::File=GLOB(0x8993660)" tmpFilename="/var/tmp/CGItemp36464" user="EugenMayer" version="1"}% | ||
%META:FORM{name="PackageForm"}% | ||
%META:FIELD{name="TopicClassification" attributes="" title="TopicClassification" value="PluginPackage"}% | ||
%META:FIELD{name="Compatibility" attributes="" title="[[Compatibility]]" value=""}% | ||
%META:FIELD{name="DemoUrl" attributes="" title="DemoUrl" value="http://"}% | ||
%META:FIELD{name="DevelopedInSVN" attributes="" title="DevelopedInSVN" value="Yes"}% | ||
%META:FIELD{name="ModificationPolicy" attributes="" title="ModificationPolicy" value="PleaseFeelFreeToModify"}% |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
#!perl | ||
# | ||
# Install script for AttachmentUrlShortcutPlugin | ||
# | ||
# Copyright (C) 2004-2007 Foswiki Contributors. All Rights Reserved. | ||
# Foswiki Contributors are listed in the AUTHORS file in the root of | ||
# this distribution. NOTE: Please extend that file, not this notice. | ||
# | ||
# This program is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU General Public License | ||
# as published by the Free Software Foundation; either version 2 | ||
# of the License, or (at your option) any later version. For | ||
# more details read LICENSE in the root of this distribution. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
# | ||
# As per the GPL, removal of this notice is prohibited. | ||
# | ||
# Author: Crawford Currie http://c-dot.co.uk | ||
# | ||
# NOTE TO THE DEVELOPER: THIS FILE IS GENERATED AUTOMATICALLY | ||
# BY THE BUILD PROCESS DO NOT EDIT IT - IT WILL BE OVERWRITTEN | ||
# | ||
use strict; | ||
use warnings; | ||
require 5.008; | ||
|
||
use File::Spec; | ||
use Cwd; | ||
|
||
=pod | ||
---+ AttachmentUrlShortcutPlugin_installer | ||
This is the installer script. The basic function of this script is to | ||
locate an archive and unpack it. | ||
It will also check the dependencies listed in DEPENDENCIES and assist | ||
the user in installing any that are missing. The script also automatically | ||
maintains the revision histories of any files that are being installed by the | ||
package but already have ,v files on disc (indicating that they are | ||
revision controlled). | ||
The script also functions as an *uninstaller* by passing the parameter | ||
=uninstall= on the command-line. Note that uninstallation does *not* revert | ||
the history of any topic changed during the installation. | ||
The script allows the definition of PREINSTALL and POSTINSTALL scripts. | ||
These scripts can be used for example to modify the configuration during | ||
installation, using the functions described below. | ||
Refer to the documentation of =configure= | ||
=cut | ||
|
||
# This is all done in package Foswiki so that reading LocalSite.cfg and Foswiki.cfg | ||
# will put the config vars into the right namespace. | ||
package Foswiki; | ||
|
||
# The root of package URLs | ||
my $PACKAGES_URL = 'http://foswiki.org/pub/Extensions'; | ||
|
||
# Extract MANIFEST and DEPENDENCIES from the __DATA__ | ||
undef $/; | ||
my @DATA = split( /<<<< (.*?) >>>>\s*\n/, <DATA> ); | ||
shift @DATA; # remove empty first element | ||
|
||
# Establish where we are | ||
my @path = ( 'tools', 'extender.pl' ); | ||
my $wd = Cwd::cwd(); | ||
$wd =~ /^(.*)$/; # untaint | ||
unshift( @path, $1 ) if $1; | ||
my $script = File::Spec->catfile(@path); | ||
|
||
unless ( my $return = do $script ) { | ||
my $message = <<MESSAGE; | ||
************************************************************ | ||
Could not load $script | ||
MESSAGE | ||
if ($@) { | ||
$message .= "There was a compile error: $@\n"; | ||
} | ||
elsif (defined $return) { | ||
$message .= "There was a file error: $!\n"; | ||
} | ||
else { | ||
$message .= "An unspecified error occurred\n"; | ||
} | ||
$message .= <<MESSAGE; | ||
(if this is a TWiki release prior to 4.2, you can download this | ||
file from: http://twiki.org/cgi-bin/view/Codev/ExtenderScript | ||
and place it in | ||
$wd/tools | ||
Create the directory if necessary). | ||
************************************************************ | ||
MESSAGE | ||
|
||
# Try again, using open. This cures some uncooperative platforms. | ||
if ( open( F, '<', $script ) ) { | ||
local $/; | ||
my $data = <F>; | ||
close(F); | ||
$data =~ /^(.*)$/s; # untaint | ||
eval $1; | ||
if ($@) { | ||
$message .= "Error when trying to eval the file content: $@\n"; | ||
} | ||
else { | ||
print STDERR | ||
"'do $script failed, but install was able to proceed: $message"; | ||
undef $message; | ||
} | ||
} | ||
else { | ||
$message .= "Could not open file using open() either: $!\n"; | ||
} | ||
die $message if $message; | ||
} | ||
|
||
sub preuninstall { | ||
|
||
# # No PREUNINSTALL script; | ||
} | ||
|
||
sub postuninstall { | ||
|
||
# # No POSTUNINSTALL script; | ||
} | ||
|
||
sub preinstall { | ||
|
||
# # No PREINSTALL script; | ||
} | ||
|
||
sub postinstall { | ||
|
||
# # No POSTINSTALL script; | ||
} | ||
|
||
Foswiki::Extender::install( $PACKAGES_URL, 'AttachmentUrlShortcutPlugin', 'AttachmentUrlShortcutPlugin', @DATA ); | ||
|
||
1; | ||
|
||
# MANIFEST and DEPENDENCIES are done this way | ||
# to make it easy to extract them from this script. | ||
|
||
__DATA__ | ||
<<<< MANIFEST >>>> | ||
lib/Foswiki/Plugins/AttachmentUrlShortcutPlugin.pm,0444,Plugin Perl module | ||
data/System/AttachmentUrlShortcutPlugin.txt,0664,Plugin topic | ||
pub/System/AttachmentUrlShortcutPlugin/TestAttachment.pdf,0664, | ||
lib/Foswiki/Plugins/AttachmentUrlShortcutPlugin/Config.spec,0644, | ||
<<<< DEPENDENCIES >>>> | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
#!perl | ||
# | ||
# Install script for AttachmentUrlShortcutPlugin | ||
# | ||
# Copyright (C) 2004-2007 Foswiki Contributors. All Rights Reserved. | ||
# Foswiki Contributors are listed in the AUTHORS file in the root of | ||
# this distribution. NOTE: Please extend that file, not this notice. | ||
# | ||
# This program is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU General Public License | ||
# as published by the Free Software Foundation; either version 2 | ||
# of the License, or (at your option) any later version. For | ||
# more details read LICENSE in the root of this distribution. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
# | ||
# As per the GPL, removal of this notice is prohibited. | ||
# | ||
# Author: Crawford Currie http://c-dot.co.uk | ||
# | ||
# NOTE TO THE DEVELOPER: THIS FILE IS GENERATED AUTOMATICALLY | ||
# BY THE BUILD PROCESS DO NOT EDIT IT - IT WILL BE OVERWRITTEN | ||
# | ||
use strict; | ||
use warnings; | ||
require 5.008; | ||
|
||
use File::Spec; | ||
use Cwd; | ||
|
||
=pod | ||
---+ AttachmentUrlShortcutPlugin_installer | ||
This is the installer script. The basic function of this script is to | ||
locate an archive and unpack it. | ||
It will also check the dependencies listed in DEPENDENCIES and assist | ||
the user in installing any that are missing. The script also automatically | ||
maintains the revision histories of any files that are being installed by the | ||
package but already have ,v files on disc (indicating that they are | ||
revision controlled). | ||
The script also functions as an *uninstaller* by passing the parameter | ||
=uninstall= on the command-line. Note that uninstallation does *not* revert | ||
the history of any topic changed during the installation. | ||
The script allows the definition of PREINSTALL and POSTINSTALL scripts. | ||
These scripts can be used for example to modify the configuration during | ||
installation, using the functions described below. | ||
Refer to the documentation of =configure= | ||
=cut | ||
|
||
# This is all done in package Foswiki so that reading LocalSite.cfg and Foswiki.cfg | ||
# will put the config vars into the right namespace. | ||
package Foswiki; | ||
|
||
# The root of package URLs | ||
my $PACKAGES_URL = 'http://foswiki.org/pub/Extensions'; | ||
|
||
# Extract MANIFEST and DEPENDENCIES from the __DATA__ | ||
undef $/; | ||
my @DATA = split( /<<<< (.*?) >>>>\s*\n/, <DATA> ); | ||
shift @DATA; # remove empty first element | ||
|
||
# Establish where we are | ||
my @path = ( 'tools', 'extender.pl' ); | ||
my $wd = Cwd::cwd(); | ||
$wd =~ /^(.*)$/; # untaint | ||
unshift( @path, $1 ) if $1; | ||
my $script = File::Spec->catfile(@path); | ||
|
||
unless ( my $return = do $script ) { | ||
my $message = <<MESSAGE; | ||
************************************************************ | ||
Could not load $script | ||
MESSAGE | ||
if ($@) { | ||
$message .= "There was a compile error: $@\n"; | ||
} | ||
elsif (defined $return) { | ||
$message .= "There was a file error: $!\n"; | ||
} | ||
else { | ||
$message .= "An unspecified error occurred\n"; | ||
} | ||
$message .= <<MESSAGE; | ||
(if this is a TWiki release prior to 4.2, you can download this | ||
file from: http://twiki.org/cgi-bin/view/Codev/ExtenderScript | ||
and place it in | ||
$wd/tools | ||
Create the directory if necessary). | ||
************************************************************ | ||
MESSAGE | ||
|
||
# Try again, using open. This cures some uncooperative platforms. | ||
if ( open( F, '<', $script ) ) { | ||
local $/; | ||
my $data = <F>; | ||
close(F); | ||
$data =~ /^(.*)$/s; # untaint | ||
eval $1; | ||
if ($@) { | ||
$message .= "Error when trying to eval the file content: $@\n"; | ||
} | ||
else { | ||
print STDERR | ||
"'do $script failed, but install was able to proceed: $message"; | ||
undef $message; | ||
} | ||
} | ||
else { | ||
$message .= "Could not open file using open() either: $!\n"; | ||
} | ||
die $message if $message; | ||
} | ||
|
||
sub preuninstall { | ||
|
||
# # No PREUNINSTALL script; | ||
} | ||
|
||
sub postuninstall { | ||
|
||
# # No POSTUNINSTALL script; | ||
} | ||
|
||
sub preinstall { | ||
|
||
# # No PREINSTALL script; | ||
} | ||
|
||
sub postinstall { | ||
|
||
# # No POSTINSTALL script; | ||
} | ||
|
||
Foswiki::Extender::install( $PACKAGES_URL, 'AttachmentUrlShortcutPlugin', 'AttachmentUrlShortcutPlugin', @DATA ); | ||
|
||
1; | ||
|
||
# MANIFEST and DEPENDENCIES are done this way | ||
# to make it easy to extract them from this script. | ||
|
||
__DATA__ | ||
<<<< MANIFEST >>>> | ||
lib/Foswiki/Plugins/AttachmentUrlShortcutPlugin.pm,0444,Plugin Perl module | ||
data/System/AttachmentUrlShortcutPlugin.txt,0664,Plugin topic | ||
pub/System/AttachmentUrlShortcutPlugin/TestAttachment.pdf,0664, | ||
lib/Foswiki/Plugins/AttachmentUrlShortcutPlugin/Config.spec,0644, | ||
<<<< DEPENDENCIES >>>> | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters