archive_me1Add my vote for this tag create new tag
, view all tags

Implemented: New REVINFO revision variable for templates

The current %REVINFO% variable that is used in view.tmpl is already formatted in a way that is not always suitable. It renders the revision variables in a fixed string, such as: Revision: r1.41 - 22 Apr 2004 - 10:06 - ArthurClemens.

For template/skin authors it is useful to split up the variables in:

  • revision number
  • revision date
  • revision user/author

The additional variables in the template are:

  • %REVINFO{"$rev"}%, e.g. 1.41
  • %REVINFO{"$date"}%, e.g. 22 Apr 2004 - 10:06
  • %REVINFO{"$username"}%, e.g. aclemens
  • %REVINFO{"$wikiname"}%, e.g. ArthurClemens
  • %REVINFO{"$wikiusername"}%, e.g. Main.ArthurClemens
  • or any combination like %REVINFO{"Revision: r$rev - $date - $wikiusername"}%

In PatternSkin for instance, I use at the top of the page:

%REVINFO{"Last changed: $date by $wikiusername"}%

-- ArthurClemens - 22 Apr 2004
-- PeterThoeny - 25 Apr 2004
-- SvenDowideit - 01 Jun 2004


yes - damned fine idea - don't forget that the DATE var needs to be of the DISPLAYDATE sort, so that when the user asys to report in local time, it does. - and if the date can be set using the standard formatting method - even better smile

-- SvenDowideit - 22 Apr 2004

Looks good to me. Moving onto my merge queue. Sometime you're going to have to get on IRC or AIM or Jabber and rope me or Sven into helping you out with putting together patches. E-mail's fine too, but chat/IM is much more effective for troubleshooting.

-- WalterMundt - 25 Apr 2004

Yay! Thank you!

-- MattWilkie - 01 Jun 2004

Here's a doc, needs to be sorted into TWikiVariables but i can't save in there (Internal Server Error whenever I try to preview a change).


I added this to TWikiVariables, but I had to lose the table, as I get an InternalServerError whenever I try to preview the topic with the table in. If I change the table to a simple list, the server no longer crashes. I suspect the filenameToIcon function, but can't prove anything.

-- CrawfordCurrie - 28 Jun 2004

This is a tad broken - and the pattern skin usage that Arthur mentions above is part of the problem.

when you view an older revision you get told that it is the latest version (which is wrong), or the the pattern skin will tell you that the last change is the date from the old version.

I have commited a fix to SVN that will display REVINFO using the rev cgi-param.

Arthur - you will need to change it from Last Change to Edited On or something more generic (are you ok with this?

-- SvenDowideit - 07 Jul 2004

I made some enhancements, in SVN:

  • new rev="1.5" parameter to get info on a specific revision
  • new web and topic parameters

Docs in TWikiVariables are updated. I removed the documentation of the $comment since it is not set yet.

I got also the intenal server error when updating the topic. I could save after temporarily disabling the TablePlugin. This Plugin seems to eat more resources then SourceForge tolerates.

-- PeterThoeny - 12 Jul 2004

How do I get the linked wikiname? %REVINFO{"$username"}% only gives me the name, but not the link to the user's topic.

  • does %REVINFO{"$wikiusername"}% work?
  • Yes, this works. And when I wanted to update the info in TWikiVariables, I saw it is just there. In any case I've updated the table here too. -- AC

-- ArthurClemens - 25 Jul 2004

I found a bug with this feature: If TWiki is run from a shell script it fails since the cgi query is undefined. Fix is in SVN.

*** bu1/TWiki.pm        Wed Aug  4 12:37:38 2004
--- TWiki.pm    Tue Aug 17 00:01:43 2004
*** 2300,2311 ****
      my( $theWeb, $theTopic, $theArgs ) = @_;

-     my $cgiQuery = getCgiQuery();
      my $format = extractNameValuePair( $theArgs ) || extractNameValuePair( $theArgs, "format" )
                   || "r1.\$rev - \$date - \$wikiusername";
      my $web    = extractNameValuePair( $theArgs, "web" ) || $theWeb;
      my $topic  = extractNameValuePair( $theArgs, "topic" ) || $theTopic;
!     my $revnum = $cgiQuery->param('rev') || extractNameValuePair( $theArgs, "rev" ) || "";

      my( $date, $user, $rev, $comment ) = TWiki::Store::getRevisionInfo( $web, $topic, $revnum );
      my $wikiName     = userToWikiName( $user, 1 );
--- 2300,2313 ----
      my( $theWeb, $theTopic, $theArgs ) = @_;

      my $format = extractNameValuePair( $theArgs ) || extractNameValuePair( $theArgs, "format" )
                   || "r1.\$rev - \$date - \$wikiusername";
      my $web    = extractNameValuePair( $theArgs, "web" ) || $theWeb;
      my $topic  = extractNameValuePair( $theArgs, "topic" ) || $theTopic;
!     my $cgiQuery = getCgiQuery();
!     my $cgiRev = "";
!     $cgiRev = $cgiQuery->param('rev') if( $cgiQuery );
!     my $revnum = $cgiRev || extractNameValuePair( $theArgs, "rev" ) || "";

      my( $date, $user, $rev, $comment ) = TWiki::Store::getRevisionInfo( $web, $topic, $revnum );
      my $wikiName     = userToWikiName( $user, 1 );

-- PeterThoeny - 17 Aug 2004

The output of REVINFO has been changed but this topic was not updated. Apparently REVINFO{$date} now outputs the date without time, and REVINFO{$time} outputs date - time.

$time is not documented anywhere.

-- ArthurClemens - 15 Feb 2006

Edit | Attach | Watch | Print version | History: r24 < r23 < r22 < r21 < r20 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r24 - 2006-02-15 - ArthurClemens
  • 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.