From: <Cra...@nt...> - 2005-07-30 17:10:25
|
Author: CrawfordCurrie Date: 2005-07-30 23:40:28 -0700 (Sat, 30 Jul 2005) New Revision: 5955 Modified: twiki/branches/DEVELOP/data/TWiki/TWikiLogos.txt twiki/branches/DEVELOP/lib/TWiki/Attach.pm Log: Item160: made it normalise the stored user to a web.wikiname Modified: twiki/branches/DEVELOP/data/TWiki/TWikiLogos.txt =================================================================== --- twiki/branches/DEVELOP/data/TWiki/TWikiLogos.txt 2005-07-31 04:20:54 UTC (rev 5954) +++ twiki/branches/DEVELOP/data/TWiki/TWikiLogos.txt 2005-07-31 06:40:28 UTC (rev 5955) @@ -31,3 +31,10 @@ <a href="%ATTACHURLPATH%/horzTWikiPowered.gif" alt="Powere"> %BR%open </a> + +%META:FILEATTACHMENT{name="smallLogo.gif" attrs="" comment="" date="3000000000" path="" user="TWikiContributor" version="1.1" size="1854"}% +%META:FILEATTACHMENT{name="vertTWiki.gif" attrs="" comment="" date="3000000000" path="" user="TWikiContributor" version="1.1" size="3884"}% +%META:FILEATTACHMENT{name="vertTWikiPowered.gif" attrs="" comment="" date="3000000000" path="" user="TWikiContributor" version="1.1" size="4051"}% +%META:FILEATTACHMENT{name="horzTWiki.gif" attrs="" comment="" date="3000000000" path="" user="TWikiContributor" version="1.1" size="3841"}% +%META:FILEATTACHMENT{name="horzTWikiPowered.gif" attrs="" comment="" date="3000000000" path="" user="TWikiContributor" version="1.1" size="2984"}% + Modified: twiki/branches/DEVELOP/lib/TWiki/Attach.pm =================================================================== --- twiki/branches/DEVELOP/lib/TWiki/Attach.pm 2005-07-31 04:20:54 UTC (rev 5954) +++ twiki/branches/DEVELOP/lib/TWiki/Attach.pm 2005-07-31 06:40:28 UTC (rev 5955) @@ -28,6 +28,13 @@ =cut +# SMELL: This is horrible. HORRIBLE!!! +# Duplicating meta-data (it should not be stored in the topic, it should be under the +# responsibility of the Store), having this as a singleton / package operating on otherwise +# typeless meta-data, the whole approach is NASTY. You can't even drop files in the +# attachments directory and expect TWiki to pick them up! Or expect TWiki to recover +# if you delete files from pub! HORRIBLE. + package TWiki::Attach; use strict; @@ -57,7 +64,7 @@ =pod ----++ ObjectMethod renderMetaData ( $web, $topic, $meta, $args, $isTopRev ) -> $text +---++ ObjectMethod renderMetaData( $web, $topic, $meta, $args, $isTopRev ) -> $text Generate a table of attachments suitable for the bottom of a topic view, using templates for the header, footer and each row. @@ -217,7 +224,7 @@ } elsif ( $attr eq 'SIZE' ) { my $attrSize = $info->{size}; - $attrSize = 100 if( $attrSize < 100 ); + $attrSize = 100 if( !$attrSize || $attrSize < 100 ); return sprintf( "%1.1f K", $attrSize / 1024 ); } elsif ( $attr eq 'COMMENT' ) { @@ -239,7 +246,9 @@ return TWiki::Time::formatTime( $info->{date} ); } elsif ( $attr eq 'USER' ) { - return $info->{user}; + my( $w, $t ) = $this->{session}->normalizeWebTopicName( + $TWiki::cfg{UsersWebName}, $info->{user} ); + return $w.'.'.$t; } else { return "\0A_$attr\0"; @@ -651,7 +660,7 @@ } $att->{date} = $date; my $u = $this->{session}->{users}->findUser( $att->{user} ); - $att->{user} = $u->login() if $u; + $att->{user} = $u->webDotWikiName() if $u; } } |