• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item5543: Allow easier restoring of previous version from raw view

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Engine view template Enhancement New TWIki:Main.SvenDowideit n/a  

Edit Form Data

Reported By:
Applies To:
Current State:
Waiting For:
Target Release:
Released In:


Allow easier restoring of previous versions from raw

If you want to restore a previous version you end up having the raw view. Something like ?raw=on&rev=4

It would be quiet nice to have at least a message telling you what to do. Or even better something like this:

<CarloSchulz> something like: to restore this version do blah
<SvenDowideit> so you are going to assume that any time someone hits raw, they are contemplating a restore?
<SvenDowideit> god dammit! you made me think of a better idea
<SvenDowideit> ok, in view.tmpl, there is a line
<CarloSchulz> most of the times at least
<SvenDowideit> %TMPL:DEF{"content"}%
<SvenDowideit> that contains %TEXT
<SvenDowideit> iirc %TEXT is replaced by textarea ...
<SvenDowideit> what you could easily do
<SvenDowideit> you _could_ add a TMPL:DEF{raw_content} deinition
<SvenDowideit> that wrappes the TEXT bit
<SvenDowideit> with a html form
<SvenDowideit> with a button that says 'restore previous version'
<SvenDowideit> which does a POST
<OliverKrueger> cool idea. :)
<CarloSchulz> sounds good
<SvenDowideit> and wa-la, all this stupid shit goes away, because twiki finally does somethign useful
<CarloSchulz> I want to restore raw=on&rev=2
<SvenDowideit> where rev 2 < maxrev
<SvenDowideit> and where allow CHANGE == true
<SvenDowideit> so now we have 3 conditions
<SvenDowideit> ok, make me a bug :}
<CarloSchulz> ok, will do so

-- TWiki:Main/CarloSchulz - 15 Apr 2008

and I started with


%TMPL:DEF{"formstart"}%<div class="twikiFormHolder twistyMakeHidden" id="formHolder">
<form name="main" action="%SCRIPTURLPATH{"save"}%/%WEB%/%TOPIC%" method="post">%TMPL:END%
</form></div><!-- /twikiFormHolder-->%TMPL:END%
%TMPL:DEF{"formparameters:edit"}%<input type="hidden" name="originalrev" value="%ORIGINALREV%" />
<input type="hidden" name="skin" value="%<nop>URLPARAM{"skin"}%" />
<input type="hidden" name="cover" value="%<nop>URLPARAM{"cover"}%" />
<input type="hidden" name="redirectto" value="%REDIRECTTO%" />
<input type="hidden" name="formtemplate" value="%FORMTEMPLATE%" />
<input type="hidden" name="templatetopic" value="%TEMPLATETOPIC%" />
<input type="hidden" name="settingstopic" value="%SETTINGSTOPIC%" />
<input type="hidden" name="topicparent" value="%TOPICPARENT%" />
<input type="hidden" name="newtopic" value="%NEWTOPIC%" />
<input type="hidden" name="forcenewrevision" value="%<nop>URLPARAM{"forcenewrevision"}%" />
<input type="hidden" name="rev" value="%<nop>URLPARAM{"rev"}%" />
<input type="hidden" name="cmd" value="%CMD%" />
<input type="hidden" name="nowysiwyg" value="%<nop>URLPARAM{"nowysiwyg"}%" />%TMPL:END%

%IF{"$rev = info.version" then="same" else="different"}%
<input type='submit' class='twikiSubmit' name='action_save' value='Restore this version' id='save' />

%TMPL:DEF{"content"}%%TMPL:P{context="view_raw" then="rawcontent" else="viewcontent"}%%TMPL:END%

but got stuck on the IF - as i can't think of a way to get the topics' max rev - info.version == the $rev URLPARAM

-- TWiki:Main.SvenDowideit - 15 Apr 2008

oh, plus i added some extra context code in UI/View.pm

Index: lib/TWiki/UI/View.pm
--- lib/TWiki/UI/View.pm   (revision 198)
+++ lib/TWiki/UI/View.pm   (working copy)
@@ -157,6 +157,8 @@
         if( $raw eq 'debug' || $raw eq 'all' ) {
             $text = $store->getDebugText( $meta, $text );
+        $session->enterContext( 'view_raw' );
+        $session->enterContext( 'view_raw_'.$raw );
     if( $TWiki::cfg{Log}{view} ) {

-- TWiki:Main.SvenDowideit

Some background info....

I found it handy to spot the latest contributors of a topic at a glance and without the need to load an extra page.

Therefore I installed TWiki:Plugins.ContributorsPlugin and modified the ouptut of the plugin so that it presents a link to the view and to the raw view of each topics revision. The result is the following table at the bottom of each page:


Now, imagine you click on restore rev 3. How cool would it be to have a button in raw=on&rev=3 saying "restore"


Although the standard pattern skin has not such a table, such a way of restoring from raw would be extremely usefull for pattern as well.

-- TWiki:Main.CarloSchulz - 15 Apr 2008

ah, ok, so really what you could do is change the restore link in ContributorsPlugin to goto Edit or Diff (Diff may well be the easier place) rather than raw mode, and have that contain the restore button.

I'll play with that option, as the raw view one is turning out to need more code changes than I have time for (but that I need to collate for twiki 5).

-- TWiki:Main.SvenDowideit - 16 Apr 2008

Don't forget that we added a Restore feature in "More topic actions" recently.

And please make enhancements to the UI as a feature request and not hidden in a bug item that few of us may ever see.

-- TWiki:Main.KennethLavrsen - 16 Apr 2008

The reason for doing things this way is that you don't need the more screen. Imho more is something that scares newbie users away the first time they see it. Another advantage is that you can see what you want to restore at the beginng of the cycle not at the end.

-- TWiki:Main.CarloSchulz - 16 Apr 2008

ok, I tried the restore function on more and it's not satisfying to me. It's not intuitive and theres not guidance after you clicked restore. It's better then what we had before but still too geeky.

-- TWiki:Main.CarloSchulz - 16 Apr 2008

Please create a proposal in Codev with the interaction design you have in mind.

-- TWiki:Main.ArthurClemens - 16 Apr 2008

ok, convinced. will do so....

-- TWiki:Main.CarloSchulz - 16 Apr 2008

Summary Allow easier restoring of previous version from raw view
ReportedBy TWiki:Main.CarloSchulz
Codebase ~twiki4
SVN Range TWiki-5.0.0, Tue, 15 Apr 2008, build 16676
AppliesTo Engine
Component view template
Priority Enhancement
CurrentState New
WaitingFor TWIki:Main.SvenDowideit

TargetRelease n/a

Topic attachments
I Attachment History Action Size Date Who Comment
PNGpng restore.png r1 manage 17.9 K 2008-04-15 - 13:11 UnknownUser  
PNGpng revision_table.png r1 manage 23.6 K 2008-04-15 - 12:47 UnknownUser  
Edit | Attach | Watch | Print version | History: r8 < r7 < r6 < r5 < r4 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r8 - 2008-04-16 - CarloSchulz
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2023 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback