Index: edit =================================================================== RCS file: /cvsroot/twiki/twiki/bin/edit,v retrieving revision 1.74 diff -u -r1.74 edit --- edit 26 Feb 2004 08:26:14 -0000 1.74 +++ edit 9 Mar 2004 17:03:20 -0000 @@ -175,17 +175,7 @@ $formTemplate = $args{"name"}; } - # expand limited set of variables - # NOTE: Keep it in sync with the register script (FIXME: Put in function) - my $today = &TWiki::formatTime(time(), "\$day \$mon \$year", "gmtime"); - 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 + $text = TWiki::expandVariablesOnTopicCreation( $text ); } # parent setting Index: register =================================================================== RCS file: /cvsroot/twiki/twiki/bin/register,v retrieving revision 1.48 diff -u -r1.48 register --- register 26 Feb 2004 08:26:14 -0000 1.48 +++ register 9 Mar 2004 17:03:20 -0000 @@ -197,17 +197,7 @@ } $text = "$before$after"; - # expand limited set of variables - # NOTE: Keep it in sync with the edit script (FIXME: Put in function) - my $today = &TWiki::formatTime(time(), "\$day \$mon \$year", "gmtime"); - my $userName = $remoteUser || $wikiName; - $text =~ s/%DATE%/$today/go; - $text =~ s/%USERNAME%/$userName/go; # "jdoe" - $text =~ s/%WIKINAME%/$wikiName/go; # "JonDoe" - $text =~ s/%WIKIUSERNAME%/$webName.$wikiName/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 + TWiki::expandVariablesOnTopicCreation( $text ); $meta->put( "TOPICPARENT", ( "name" => $TWiki::wikiUsersTopicname ) ); &TWiki::Store::saveTopic( $webName, $wikiName, $text, $meta, "", 1 ); Index: TWiki.pm =================================================================== RCS file: /cvsroot/twiki/twiki/lib/TWiki.pm,v retrieving revision 1.302 diff -u -r1.302 TWiki.pm --- TWiki.pm 7 Mar 2004 11:05:40 -0000 1.302 +++ TWiki.pm 9 Mar 2004 17:05:53 -0000 @@ -2400,6 +2400,26 @@ # ========================= =pod +---++ sub expandVariablesOnTopicCreation ( $text ) +Expand limited set of variables with a topic during topic creation +=cut + +sub expandVariablesOnTopicCreation { + my ( $text ) = shift; + + my $today = formatTime(time(), "\$day \$mon \$year", "gmtime"); + my $wikiName = 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{(.*?)}%/&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 +} + +# ========================= +=pod ---++ sub handleWebAndTopicList ( $theAttr, $isWeb )