• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

from TWiki:Codev.PreventLinkToOneself

Index: lib/TWiki/Render.pm
===================================================================
--- lib/TWiki/Render.pm (revision 11831)
+++ lib/TWiki/Render.pm (working copy)
@@ -549,13 +549,21 @@
 sub _renderExistingWikiWord {
     my ($this, $web, $topic, $text, $anchor) = @_;
 
+    my $currentWebHome = '';
+    $currentWebHome = 'twikiCurrentWebHomeLink ' if (($web eq $this->{session}->{webName}) &&
+                                      ($topic eq $TWiki::cfg{HomeTopicName} ));
+
+    my $currentTopic = '';
+    $currentTopic = 'twikiCurrentTopicLink ' if (($web eq $this->{session}->{webName}) &&
+                                       ($topic eq $this->{session}->{topicName}));
+
     my @attrs;
     my $href = $this->{session}->getScriptUrl( 0, 'view', $web, $topic );
     if( $anchor ) {
         $anchor = $this->makeAnchorName( $anchor );
-        push( @attrs, class => 'twikiAnchorLink', href => $href.'#'.$anchor );
+        push( @attrs, class => $currentTopic.$currentWebHome.'twikiAnchorLink', href => $href.'#'.$anchor );
     } else {
-        push( @attrs, class => 'twikiLink', href => $href );
+        push( @attrs, class => $currentTopic.$currentWebHome.'twikiLink', href => $href );
     }
     my $tooltip = $this->_linkToolTipInfo( $web, $topic );
     push( @attrs, title => $tooltip ) if( $tooltip );
Index: data/TWiki/TWikiCss.txt
===================================================================
--- data/TWiki/TWikiCss.txt     (revision 11831)
+++ data/TWiki/TWikiCss.txt     (working copy)
@@ -31,6 +31,8 @@
 |.twikiLink  |Render.pm  |
 |.twikiNewLink  |Render.pm  |
 |.twikiAnchorLink  |Render.pm  |
+|.twikiCurrentWebHomeLink  |Render.pm  |
+|.twikiCurrentTopicLink  |Render.pm  |
 |.twikiEmulatedLink  |Preview.pm  |
 |.twikiWebIndent  |TWiki.pm  |

4.1.0 released

KJL

ItemTemplate
Summary Css based solution to prevent links to oneself
ReportedBy TWiki:Main.SvenDowideit
Codebase ~twiki4
SVN Range TWiki-4.1, Sun, 22 Oct 2006, build 11793
AppliesTo Engine
Component

Priority Normal
CurrentState Closed
WaitingFor

Checkins 11835 11948 11949
TargetRelease minor
ReleasedIn 4.1.0
Edit | Attach | Watch | Print version | History: r11 < r10 < r9 < r8 < r7 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r11 - 2007-01-23 - CrawfordCurrie
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback