Tags:
create new tag
, view all tags

Implemented: Expand USERNAME and WIKINAME in Template Topics

ExpandVariablesInEditTemplateTopic and ExpandVariablesInNewUserTemplate is done for a few variables only. The variables %USERNAME% and %WIKINAME% are new as of today, they complement the existing %WIKIUSERNAME% expansion.

This fixes the problem of unexpanded %WIKINAME% variable when submitting a new Plugin at Plugins.PluginPackageHowTo (the edit template topic has signature TWiki:Main/%WIKINAME%)

Change is in TWikiAlphaRelease and at TWiki.org. Change:

RCS file: /cvsroot/twiki/twiki/bin/edit,v
retrieving revision 1.67
diff -c -r1.67 edit
*** edit        4 Jun 2003 21:00:50 -0000       1.67
--- edit        18 Oct 2003 22:09:17 -0000
***************
*** 157,166 ****
              $formTemplate = $args{"name"};
          }

!         # expand limited set of variables (keep it in sync with the register script)
          my $today = &TWiki::getGmDate();
          $text =~ s/%DATE%/$today/go;
!         $text =~ s/%WIKIUSERNAME%/$wikiUserName/go;
          $text =~ s/%URLPARAM{(.*?)}%/TWiki::handleUrlParam($1)/geo;  # expand URL parameters
          $text =~ s/%NOP{.*?}%//gos;  # Remove filler: Use it to remove access control at time of
          $text =~ s/%NOP%//go;        # topic instantiation or to prevent search from hitting a template
--- 157,170 ----
              $formTemplate = $args{"name"};
          }

!         # expand limited set of variables
!         # NOTE: Keep it in sync with the register script (FIXME: Put in function)
          my $today = &TWiki::getGmDate();
+         my $wikiName = TWiki::userToWikiName( $userName, 1 );
          $text =~ s/%DATE%/$today/go;
!         $text =~ s/%USERNAME%/$userName/go;          # "jdoe"
!         $text =~ s/%WIKINAME%/$wikiName/go;          # "JonDoe"
!         $text =~ s/%WIKIUSERNAME%/$wikiUserName/go;  # "Main.JonDoe"
          $text =~ s/%URLPARAM{(.*?)}%/TWiki::handleUrlParam($1)/geo;  # expand URL parameters
          $text =~ s/%NOP{.*?}%//gos;  # Remove filler: Use it to remove access control at time of
          $text =~ s/%NOP%//go;        # topic instantiation or to prevent search from hitting a template

-- PeterThoeny - 18 Oct 2003

TWikiTemplates docs are now updated

-- PeterThoeny - 25 Apr 2004

Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 2004-04-25 - 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.