--- Render.pm 2006-02-07 09:08:45.000000000 -0600 +++ Render.pm 2006-02-10 22:33:04.000000000 -0600 @@ -536,12 +536,41 @@ my @attrs; my $href = $this->{session}->getScriptUrl( 0, 'view', $web, $topic ); - if( $anchor ) { - $anchor = $this->makeAnchorName( $anchor ); - push( @attrs, class => 'twikiAnchorLink', href => $href.'#'.$anchor ); + # 2006/02/10 - WikiName highlighting patch + my $session = $this->{session}; + my $usersWeb = $TWiki::cfg{UsersWebName}; + # FIXME - This is almost certainly not the most efficient way to get this info! + # Make a list of potentially valid usernames + # This logic is copied from TWiki::Search - get some likely topics from the Users web + my @topicList = $session->{store}->getTopicNames( $usersWeb ); + # Anything starting with Web, User, or TWiki probably isn't someone's name, and will + # reduce the number of files searched for preferences + @topicList = grep( !/^(?:Web|User|TWiki).+/, @topicList ); + my $found = 0; + map { if( $topic =~ m/^$_$/ ){ $found = 1 } } @topicList; + my $color = ''; + if( $found ) { + # FIXME move color pref key (NAMEBACKGROUND) to ... somewhere else? + # Maybe the TWiki config file? + $color = $session->{prefs}->getTopicPreferencesValue( + 'NAMEBACKGROUND', + $usersWeb, + $topic + ); + } + if( $color ) { + push( @attrs, class => "twikiNameLink", href => $href ); + # Because this varies (maybe 100x) over a page, adding a class won't work here :/ + push( @attrs, style => "background-color: $color;" ); } else { - push( @attrs, class => 'twikiLink', href => $href ); + if( $anchor ) { + $anchor = $this->makeAnchorName( $anchor ); + push( @attrs, class => "twikiAnchorLink", href => $href.'#'.$anchor ); + } else { + push( @attrs, class => "twikiLink", href => $href ); + } } + # end 2006/02/10 - WikiName highlighting patch my $tooltip = $this->_linkToolTipInfo( $web, $topic ); push( @attrs, title => $tooltip ) if( $tooltip );