Bug: Statistics page does not provide links to non-wikiword topics
Topics like "Laptop" turn up unlinked.
Test case
Create the page "Laptop". Access it enough times to get it on the list.
Environment
TWiki version: |
01Feb2003 |
TWiki plugins: |
Smilies, Table |
Server OS: |
Solaris 8 |
Web server: |
Apache 1.3.27 |
Perl version: |
5.6 |
Client OS: |
Mac OS X |
Web Browser: |
Mozilla 1.3b |
--
StefanLindmark - 24 Feb 2003
Follow up
Interesting - see
StatisticsDoesntFindAllContributors for a related issue.
--
RichardDonkin - 26 Feb 2003
bin/statistics
still contains the following:
my $topicRegex = qr/[^ ]+/; # Relaxed topic names - any non-space OK
# but won't be auto-linked in WebStatistics
which leads me to conclude that topic names are inserted into
WebStatistics topics as is. With the following change, all topics will be linked, no matter what format they are:
bin/statistics: line 525
from: $list[@list] = "$statValue $topicName";
to: $list[@list] = "$statValue [[$topicName]]";
--
StefanLindmark - 26 Feb 2003
Fix record
Misunderstood your original posting - need more coffee before replying, or more sleep!
Thanks for the patch, I really need to put that in - a recent PC re-imaging has somewhat disrupted my CVS environment for TWiki work. If you can do the
TWikiPatches stuff to make this page appear there, it would be easy to track this and make sure it goes in. A patch as per
PatchGuidelines would be great, although this one is so simple it's not really essential.
--
RichardDonkin - 28 Feb 2003
The fix was actually a little bit more complex since the contributor name was displayed with the Main web as
Main.TWikiGuest because of the
[[...]]
rule. The fix does account for that.
Note that there is a small issue with this fix: Topics that start with lowercase get turned into a initial capital letter, thus creating a non-existing link. E.g. topic
laptop
gets turned into
[[laptop]]
, which points to (probably) non-existing topic
Laptop
. This is a rare case, ignored for now.
Fix in
TWikiAlphaRelease and TWiki.org:
diff -c -r1.38 statistics
*** statistics 1 Feb 2003 08:29:42 -0000 1.38
--- statistics 6 Mar 2003 07:50:07 -0000
***************
*** 436,447 ****
my $statTopViews = "";
my $statTopContributors = "";
if( @topViews ) {
- printMsg( " - top view: $topViews[0]", $cgiQuery );
$statTopViews = join( "<br /> ", @topViews );
}
if( @topContribs ) {
- printMsg( " - top contributor: $topContribs[0]", $cgiQuery );
$statTopContributors = join( "<br /> ", @topContribs );
}
# Update the WebStatistics topic
--- 436,448 ----
my $statTopViews = "";
my $statTopContributors = "";
if( @topViews ) {
$statTopViews = join( "<br /> ", @topViews );
+ $topViews[0] =~ s/[\[\]]*//g;
+ printMsg( " - top view: $topViews[0]", $cgiQuery );
}
if( @topContribs ) {
$statTopContributors = join( "<br /> ", @topContribs );
+ printMsg( " - top contributor: $topContribs[0]", $cgiQuery );
}
# Update the WebStatistics topic
***************
*** 521,528 ****
while( ( $topicName, $statValue ) = each( %$webhashref ) ) {
# Right-align statistic value for sorting
$statValue = sprintf "%7d", $statValue;
! # Add new array item at end of array
! $list[@list] = "$statValue $topicName";
}
# DEBUG
--- 522,533 ----
while( ( $topicName, $statValue ) = each( %$webhashref ) ) {
# Right-align statistic value for sorting
$statValue = sprintf "%7d", $statValue;
! # Add new array item at end of array
! if( $topicName =~ /\./ ) {
! $list[@list] = "$statValue $topicName";
! } else {
! $list[@list] = "$statValue [[$topicName]]";
! }
}
# DEBUG
--
PeterThoeny - 06 Mar 2003