create new tag
, view all tags

Implemented: NewTopicLinkSymbol


there is a new variable that can be set in TWikiPreferences and WebPreferences

  • Style of a non existing topic: ( default ? )
      * Set NEWTOPICLINKSYMBOL = <sup><img src="%PUBURL%/TWiki/TWikiPreferences/new.gif" border="0" width="8" height="8"></sup>

The span containing the TopicName and the Symbol has the CssClassname of TWikiNewLink

I was aligning the style of FindElsewherePlugin with TWikiDotPm.

This patch allows you to specify the style of the "?" in TWikiPreferences as NEWTOPICLINKSTYLE

*** lib/TWiki.pm.old    Wed Oct 29 18:22:03 2003
--- lib/TWiki.pm        Wed Oct 29 18:49:37 2003
*** 78,84 ****
  use vars qw(
        @isoMonth @weekDay
        $TranslationToken %mon2num $isList @listTypes @listElements
!         $newTopicFontColor $newTopicBgColor $noAutoLink $linkProtocolPattern
          $headerPatternDa $headerPatternSp $headerPatternHt $headerPatternNoTOC
          $debugUserTime $debugSystemTime
          $viewableAttachmentCount $noviewableAttachmentCount
--- 78,85 ----
  use vars qw(
        @isoMonth @weekDay
        $TranslationToken %mon2num $isList @listTypes @listElements
!         $newTopicFontColor $newTopicBgColor $newTopicLinkStyle
!         $noAutoLink $linkProtocolPattern
          $headerPatternDa $headerPatternSp $headerPatternHt $headerPatternNoTOC
          $debugUserTime $debugSystemTime
          $viewableAttachmentCount $noviewableAttachmentCount
*** 377,382 ****
--- 378,384 ----
      # PTh: Moved from internalLink to initialize ('cause of performance)
      $newTopicBgColor   = TWiki::Prefs::getPreferencesValue("NEWTOPICBGCOLOR")   || "#FFFFCE";
      $newTopicFontColor = TWiki::Prefs::getPreferencesValue("NEWTOPICFONTCOLOR") || "#0000FF";
+     $newTopicLinkStyle = TWiki::Prefs::getPreferencesValue("NEWTOPICLINKSTYLE") || "<sup>?</sup>";
      # Prevent autolink of WikiWords
      $noAutoLink        = TWiki::Prefs::getPreferencesValue("NOAUTOLINK") || 0;

*** 2403,2409 ****
          $text .= "<span style='background : $newTopicBgColor;'>"
  #              .  "<a href=\"$scriptUrlPath/edit$scriptSuffix/$theWeb/$theTopic?topicparent=$webName.$topicName\">.</a>"
                .  "<font color=\"$newTopicFontColor\">$theLinkText</font></span>"
!               .  "<a href=\"$scriptUrlPath/oops$scriptSuffix/$webName/$singularForm?template=oopscreate&param1=$singularForm&param2=none\">?</a>";
          return $text;
      } else {
          $text .= $theLinkText;
--- 2405,2411 ----
          $text .= "<span style='background : $newTopicBgColor;'>"
  #              .  "<a href=\"$scriptUrlPath/edit$scriptSuffix/$theWeb/$theTopic?topicparent=$webName.$topicName\">.</a>"
                .  "<font color=\"$newTopicFontColor\">$theLinkText</font></span>"
!               .  "<a href=\"$scriptUrlPath/oops$scriptSuffix/$webName/$singularForm?template=oopscreate&param1=$singularForm&param2=none\">$newTopicLinkStyle</a>";
          return $text;
      } else {
          $text .= $theLinkText;

-- MartinCleaver - 30 Oct 2003

This small enhancement can go into the core.

I was confused when I read the topic title. My first thought on 'link style' was a CSS style for the links. Can we use a not confusing variable name? "NEWTOPICLINKTEXT" or "NEWTOPICLINKLABEL" comes to mind. Opinions?

-- PeterThoeny - 30 Oct 2003

Free to relabel it, I was originally thinking of doing a CSS style but couldn't be bothered to work out how to implement it.

I also added this to my setup:

   * Style of a non existing topic: ( default =?= )
      * Set NEWTOPICLINKSTYLE = <sup><img src="/pub/TWiki/TWikiPreferences/new.gif" border="0" width="8" height="8"></sup>

Here is the image new.gif - it's a derivative of new.gif supplied with KoalaSkin

And there is a demo on http://testwiki.mrjc.com/twiki/bin/view/HtmlAreaTest/WebHome - note it is the same image as the New icon (top right). Arthur should be proud.

-- MartinCleaver - 30 Oct 2003

Does this only change the question mark? E.g. could I change the background colour of the word preceding it? Make it bold or italic? Pink?

-- MattWilkie - 18 Dec 2003

Hi Matt,

Martin's patch just changes the question mark IIRC. The following patch makes things (signficantly) more customisable, and little different overhead from InterWiki:

--- system/lib/TWiki.pm   2003/10/26 21:54:12   1.9
+++ system/lib/TWiki.pm   2003/10/30 22:50:32   1.11
@@ -87,6 +87,7 @@
         $cgiQuery @publicWebList
         $formatVersion $OS $script
+        $deadLinkFormat

@@ -416,6 +417,9 @@
     # PTh: Moved from internalLink to initialize ('cause of performance)
     $newTopicBgColor   = TWiki::Prefs::getPreferencesValue("NEWTOPICBGCOLOR")   || "#FFFFCE";
     $newTopicFontColor = TWiki::Prefs::getPreferencesValue("NEWTOPICFONTCOLOR") || "#0000FF";
+    $deadLinkFormat    = TWiki::Prefs::getPreferencesValue("UNDEFINEDLINKFORMAT") || <<THIS;
+<span style='background : $newTopicBgColor;'><font color=\"$newTopicFontColor\">\$linktext</font></span><a href=\"$scriptUrlPath/edit$scriptSuffix/\$web/\$topic?topicparent=\$parentweb.\$parenttopic\">?</a>
     # Prevent autolink of WikiWords
     $noAutoLink        = TWiki::Prefs::getPreferencesValue("NOAUTOLINK") || 0;

@@ -2972,11 +2979,25 @@
     } elsif( $doLink ) {
-        $text .= "<span style='background : $newTopicBgColor;'>"
-              .  "<font color=\"$newTopicFontColor\">$theLinkText</font></span>"
-              .  "<a href=\"$scriptUrlPath/edit$scriptSuffix/$theWeb/$theTopic?topicparent=$webName.$topicName\">?</a>";
-        return $text;
+           my $tempLink = $deadLinkFormat;
+           $tempLink =~ s/\$web/$theWeb/;
+           $tempLink =~ s/\$topic/$theTopic/;
+           $tempLink =~ s/\$parentweb/$webName/;
+           $tempLink =~ s/\$parenttopic/$topicName/;
+           $tempLink =~ s/\$linktext/$theLinkText/;
+           $text .= $tempLink;
+           return $text;
     } else {
         $text .= $theLinkText;
         return $text;

Been in use for weeks, many users like it. Offered in case it's viewed as suitable. I've not tested this patch against an unmodified twiki.pm file so a little work at integrating might be needed. (line offsets might well be wrong) If you need more docs let me know - the patch above is hopefully clear enough.

-- MS - 18 Dec 2003

Bump feature topic marked as scheduled for CairoRelease with 0% SpecProgress

-- SamHasler - 20 Apr 2004

I have a concern about going to the extent of setting the entire layout of a deadLink, and it is mostly that this means that we should also have similar settings for liveLinks, and for all the rest of the markup rendering. This is my excuse for implementing only MartinC's version, but with the addition of css Tags.

-- SvenDowideit - 27 Jun 2004

Does the css tag include the topic name or is it just around the symbol? (

&lt;span class="TWikiNewLink"&gt;?&lt;/span&gt;
&lt;span class="TWikiNewLink"&gt;UnCreatedTopic?&lt;/span&gt;

I ask because for me the ideal not-exist marker is to have no symbol at all, and to mark the word differently instead: UnCreatedTopic.

<span style="border-bottom: thin dashed orange;" 
  title="follow link to create this topic, which doesn't exist yet">
  <span style="display:none">%NEWTOPICLINKSYMBOL%</span>

(replace the inline styles with class names of course; the display:none is so that non-css browsers get the question mark, or whatever the symbol is).

-- MattWilkie - 27 Jun 2004

the class is around the entire topicname and new link symbol. so what you have as your eg works, but you then don't get anything to click on to create the new topic (or do you ?) (which is the big advantage of MS's approach)

-- SvenDowideit - 27 Jun 2004

I would prefer not to have default colors. Because the default colors in RenderDotPm are set as css style: style='background : $newTopicBgColor;' , it makes it impossible to override with a style sheet (this can be done with other colors in TWiki that are defined as <font>). For instance if I want to have a transparent background it can't be done.
Besides, the colors are already defined in TWikiPreferences, so it seems it is not so important to provide extra defaults.

-- ArthurClemens - 26 Jul 2004

A simple way to allow CSS to override the variable settings is to make the background color a font attribute instead of a local style:

$text .= "&lt;span class=\"twikiNewLink\"&gt;"
              .  "&lt;font color=\"$newTopicFontColor\" bgcolor=\"$newTopicBgColor\"&gt;$theLinkText&lt;/font&gt;"
              .  "&lt;a href=\"$dispScriptUrlPath/edit$scriptSuffix/$theWeb/$theTopic?topicparent=$TWiki::webName.$TWiki::topicName\"&gt;$newLinkSymbol&lt;/a&gt;"
           .  "&lt;/span&gt;";

I don't think there are any side effects to this small change. So unless there are objections, I will make the change to Render.pm.

  • Update: I made a mistake. Now I don't know how it can be done.

Secondly, I would also prefer to have the whole word as a link.

-- ArthurClemens - 30 Jul 2004

If it can't override the font setting in css could it override a style/css setting? i.e.

$text .= "<span class='twikiNewLinkText' style='background : $newTopicBgColor;'>"
           .  "<font color='$newTopicFontColor'>$theLinkText</font>"
      .  "<span>"
      .  "<span class='twikiNewLink' style='background : $newTopicLinkBgColor;'>"
           .  "<a href=\"$dispScriptUrlPath/edit$scriptSuffix/$theWeb/$theTopic?topicparent=$TWiki::webName.$TWiki::topicName\">$newLinkSymbol</a>"
      .  "</span>";

For flexability there are two spans with separate classes and default background colours. I'll see if I can test this.

-- SamHasler - 30 Jul 2004

I'm a bit confused. This says scheduled for Cairo, but it doesn't appear to be in Dakar. Dakar appears to have something similar: NEWTOPICLINKSYMBOL, but not NEWTOPICLINKSTYLE. Did this somehow get transmogrified to NEWTOPICLINKSYMBOL? If so, perhaps the topic should be renamed, or some text put up at the top...

-- DougClaar - 08 Aug 2006

Both Cairo and TWiki 4 handle these new link related variables: NEWTOPICBGCOLOR, NEWTOPICFONTCOLOR NEWTOPICLINKSYMBOL. The top of this topic is correct, the patch is not correct.

-- PeterThoeny - 08 Aug 2006

Topic attachments
I Attachment History Action Size Date Who Comment
GIFgif new.gif r1 manage 0.8 K 2003-10-30 - 03:38 MartinCleaver  
Edit | Attach | Watch | Print version | History: r19 < r18 < r17 < r16 < r15 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r19 - 2006-08-08 - PeterThoeny
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2015 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.