r10 - 19 Dec 2006 - 20:55:13 - ArthurClemensYou are here: TWiki >  Support Web > HowToGetIfCurrentRevisionIsLast
Tags:
search 1 Add my vote for this tag, , create new tag

Question

Hi everyone. I need to know if current document revision is final and to change topic title accordingly.

I can get current revision by %REVINFO{"$rev"}%.

But how can I get last revision number of the topic? So than I can add to topic title something

like that:

%IF{'%REVINFO{"$rev"} %<$finalRev' then='<strong>Obsolete revision</strong>'}

So the question is how to get $finalRev.

Environment

TWiki version: TWikiRelease04x00x02
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS:  
Web server:  
Perl version:  
Client OS:  
Web Browser:  
Categories:  
-- EugenePanaitov - 12 Jun 2006

Answer

ALERT! If you answer a question - or have a question you asked answered by someone - please remember to edit the page and set the status to answered. The status is in a drop-down list below the edit box.

Possibly include it in from a (html comment) section containing just REVINFO in the "final revision" of the topic?

-- SteffenPoulsen - 16 Jun 2006

How can it be done? How can I distinguish is this topic revision last in history? Is there any way to access history except REVINFO?

-- EugenePanaitov - 25 Jun 2006

A simple search actually seems to go the way for newest revision:

%IF{'%REVINFO{"$rev"}%<%SEARCH{ "%TOPIC%" topic="%TOPIC%" scope="topic" nosearch="on" nototal="on" format="$rev" }%' then='%RED% *THIS VERSION HAS BEEN OBSOLETED* %ENDCOLOR%'}%

Warning goes here in obsoleted revision:

Visit http://twiki.org/cgi-bin/view/Support/HowToGetIfCurrentRevisionIsLast?rev=6 to see the warning show up.

-- SteffenPoulsen - 27 Jun 2006

Hello, I modified this code to

%IF{'%REVINFO{"$rev"}%<%SEARCH{ "%BASETOPIC%" topic="%BASETOPIC%" scope="topic" nosearch="on" nototal="on" format="$rev" }%' then='<center>%RED% *OBSOLETE REVISION - FOR REFERENCE ONLY* %ENDCOLOR%</center>' else='Any another text here. Revision details: %REVINFO{"r$rev - $date - $time - $wikiusername" topic="%BASEWEB%.%BASETOPIC%"}%'}%

and include this topic in the most of the other topics in the Web, generally it is work well, but I get two problems:

1) I noticed strange bug - Sometimes, If topic had attachments/images It said [code], what revision always obsoleted. I can not get any more precised dependencies.
2) If topic is non-WikiWord this code generate errors;

Example (this shows at point of including):

IF{ "26<" else="Any another text here. Revision details: r3 - 16 Jun 2006 - 14:31:14 - YuryK? " then="

OBSOLETE REVISION - FOR REFERENCE ONLY
" }: Missing operand before <

Can anybody help me to fix these problems?

-- YuryKocharyan - 10 Jul 2006

I found answer on first question, should be

%REVINFO{"$rev" topic="%BASEWEB%.%BASETOPIC%"}
not as described above.

And I make more detailed research on second item.

-- YuryKocharyan - 13 Jul 2006

Surround the search with <noautolink></noautolink> tags:

<noautolink>
%IF{'%REVINFO{"$rev"}%<%SEARCH{ "%BASETOPIC%" topic="%BASETOPIC%" scope="topic" nosearch="on" nototal="on" format="$rev" }%' then='<center>%RED% *OBSOLETE REVISION - FOR REFERENCE ONLY* %ENDCOLOR%</center>' else='Any another text here. Revision details: %REVINFO{"r$rev - $date - $time - $wikiusername" topic="%BASEWEB%.%BASETOPIC%"}%'}%
</noautolink>

generates: Any another text here. Revision details: r10 - 19 Dec 2006 - 20:55:13 - Main.ArthurClemens

-- ArthurClemens - 19 Dec 2006

 
Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r10 < r9 < r8 < r7 < r6 | More topic actions
 
Powered by TWiki
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback SourceForge.net Logo