Skip to content

Commit

Permalink
Item14070: Merge branch 'phkehl-Item14070'
Browse files Browse the repository at this point in the history
  • Loading branch information
gac410 committed Mar 15, 2017
2 parents 91ce45d + 6aa7aa1 commit ec6610d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
10 changes: 5 additions & 5 deletions core/data/System/DefaultPreferences.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" date="1489206078" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" date="1489539478" format="1.1" version="1"}%
%META:TOPICPARENT{name="AdminToolsCategory"}%
---+!! <nop>%WIKITOOLNAME% Site-Level Preferences

Expand Down Expand Up @@ -113,16 +113,16 @@ been removed from Foswiki 2.0.
* Set ATTACHLINKBOX =

* Format of file link when the *link* check box is checked: (can be overwritten by user preferences)
<div class="foswikiHelp"> %H% *NOTE:* Keyword ==$filename== gets expanded to filename; ==$fileurl== gets expanded to the urlencoded filename; ==$comment== to comment; ==\t== to tab (3 spaces for bullets).</div>
<div class="foswikiHelp"> %H% *NOTE:* Keyword ==$filename== gets expanded to filename; ==$fileurl== gets expanded to the urlencoded filename; ==$comment== to comment; ==\t== to tab (3 spaces for bullets). See %SYSTEMWEB%.FileAttachment for details.</div>
<!-- verbatim tag required to prevent error in Apache log; does not suppress Set -->
<verbatim class="tml">
* Set ATTACHEDFILELINKFORMAT = \n * [[%ATTACHURL%/$fileurl][$filename]]: $comment
* Set ATTACHEDFILELINKFORMAT = \n * [[$percntATTACHURL$percnt/$fileurl][$filename]]%IF{"'$comment'=''" else=": $comment"}%
</verbatim>

* Format of images when the *link* check box is checked: (can be overwritten by user preferences)
<div class="foswikiHelp"> %H% *NOTE:* Keyword ==$filename== gets expanded to filename; ==$fileurl== gets expanded to the urlencoded filename; ==$comment== to comment; ==$size== to ==width="..." height="..."== attribute of ==img== tag; ==\t== to tab and ==\n== to linefeed (3 spaces for bullets).</div>
<div class="foswikiHelp"> %H% *NOTE:* Keyword ==$filename== gets expanded to filename; ==$fileurl== gets expanded to the urlencoded filename; ==$comment== to comment; ==$size== to ==width="..." height="..."== attribute of ==img== tag; ==\t== to tab and ==\n== to linefeed (3 spaces for bullets). See %SYSTEMWEB%.FileAttachment for details.</div>
<verbatim class="tml">
* Set ATTACHEDIMAGEFORMAT = \n * $comment: <br />\n <img src="%ATTACHURLPATH%/$fileurl" alt="$filename" $size />
* Set ATTACHEDIMAGEFORMAT = \n%IF{"'$comment'=''" else=" * $comment: <br />\n"}% <img src="$percntATTACHURLPATH$percnt/$fileurl" alt="$filename" $size />
</verbatim>

---++ Platform Settings
Expand Down
7 changes: 4 additions & 3 deletions core/data/System/FileAttachment.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" comment="" date="1457496285" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" comment="" date="1489539478" format="1.1" version="1"}%
%META:TOPICPARENT{name="UserDocumentationCategory"}%
%STARTINCLUDE%
---+ File Attachments
Expand Down Expand Up @@ -90,6 +90,7 @@ Attachment names are stored directly in the server native file system, so filena
* Any standard [[FormatTokens][formatting tokens]]: =$n=, =$comma=, =$lt=, etc.
* Any standard [[VarGMTIME][time format specifiers]]: =$year=, =$hours=, etc.
* =$name=: (deprecated, should no longer be used)
* [[Macros][Standard variables]]: =%<nop>WIKIUSER%=, etc.

---++ Downloading files

Expand Down Expand Up @@ -262,5 +263,5 @@ Describe the file so other people know what it is.
---
*Related Topics:* UserDocumentationCategory

%META:FILEATTACHMENT{name="Sample.txt" attr="" comment="Just a sample" date="1457496285" size="30" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="Smile.gif" attr="" comment="Smiley face" date="1457496285" size="94" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="Sample.txt" attr="" comment="Just a sample" date="1489539478" size="30" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="Smile.gif" attr="" comment="Smiley face" date="1489539478" size="94" user="ProjectContributor" version="1"}%
8 changes: 4 additions & 4 deletions core/lib/Foswiki/Attach.pm
Original file line number Diff line number Diff line change
Expand Up @@ -363,10 +363,9 @@ Build a link to the attachment, suitable for insertion in the topic.
sub getAttachmentLink {
my ( $this, $topicObject, $attName ) = @_;

my $att = $topicObject->get( 'FILEATTACHMENT', $attName );
my $fileComment = $att->{comment};
my $fileTime = $att->{date} || 0;
$fileComment = $attName unless ($fileComment);
my $att = $topicObject->get( 'FILEATTACHMENT', $attName );
my $fileComment = defined $att->{comment} ? $att->{comment} : '';
my $fileTime = $att->{date} || 0;
my ($fileExt) = $attName =~ m/(?:.*\.)*([^.]*)/;
$fileExt ||= '';

Expand Down Expand Up @@ -429,6 +428,7 @@ sub getAttachmentLink {

require Foswiki::Time;
$fileLink = Foswiki::Time::formatTime( $fileTime, $fileLink );
$fileLink = Foswiki::Func::expandCommonVariables($fileLink);
$fileLink = Foswiki::expandStandardEscapes($fileLink);

return $fileLink;
Expand Down

0 comments on commit ec6610d

Please sign in to comment.