]> sipb.mit.edu Git - ikiwiki.git/commitdiff
Get things right after moving to a branch.
authorPeter Gammie <peteg42@gmail.com>
Wed, 29 Sep 2010 05:43:44 +0000 (15:43 +1000)
committerPeter Gammie <peteg42@gmail.com>
Wed, 29 Sep 2010 05:43:44 +0000 (15:43 +1000)
IkiWiki/Plugin/recentchanges.pm
templates/change.tmpl
templates/revert.tmpl

index 2a78566e146f2e4b0bc2f321bd1fb0392e126dd5..79d175328fbd775f696c0c2812e77924a335ae63 100644 (file)
@@ -13,6 +13,7 @@ sub import {
        hook(type => "refresh", id => "recentchanges", call => \&refresh);
        hook(type => "pagetemplate", id => "recentchanges", call => \&pagetemplate);
        hook(type => "htmlize", id => "_change", call => \&htmlize);
        hook(type => "refresh", id => "recentchanges", call => \&refresh);
        hook(type => "pagetemplate", id => "recentchanges", call => \&pagetemplate);
        hook(type => "htmlize", id => "_change", call => \&htmlize);
+       hook(type => "sessioncgi", id => "recentchanges", call => \&sessioncgi);
        # Load goto to fix up links from recentchanges
        IkiWiki::loadplugin("goto");
 }
        # Load goto to fix up links from recentchanges
        IkiWiki::loadplugin("goto");
 }
@@ -80,7 +81,6 @@ sub confirmation_form {
     $f->field(name => "sid", type => "hidden", value => $session->id,
               force => 1);
     $f->field(name => "do", type => "hidden", value => "revert", force => 1);
     $f->field(name => "sid", type => "hidden", value => $session->id,
               force => 1);
     $f->field(name => "do", type => "hidden", value => "revert", force => 1);
-    $f->field(name => "rev", type => "hidden", value => $rev, force => 1);
 
     return $f, ["Revert", "Cancel"];
 }
 
     return $f, ["Revert", "Cancel"];
 }
@@ -110,6 +110,7 @@ sub sessioncgi ($$) {
         if($r) {
             die "FIXME revert '$rev' failed.";
         } else {
         if($r) {
             die "FIXME revert '$rev' failed.";
         } else {
+            require IkiWiki::Render;
             IkiWiki::refresh();
             IkiWiki::saveindex();
             # FIXME indicate success.
             IkiWiki::refresh();
             IkiWiki::saveindex();
             # FIXME indicate success.
@@ -118,6 +119,7 @@ sub sessioncgi ($$) {
         $form->title(sprintf(gettext("confirm reversion of %s"), $rev));
         my $patch_contents = IkiWiki::rcs_showpatch($rev);
         $form->tmpl_param(patch_contents => encode_entities($patch_contents));
         $form->title(sprintf(gettext("confirm reversion of %s"), $rev));
         my $patch_contents = IkiWiki::rcs_showpatch($rev);
         $form->tmpl_param(patch_contents => encode_entities($patch_contents));
+        $form->field(name => "rev", type => "hidden", value => $rev, force => 1);
         IkiWiki::showform($form, $buttons, $session, $q);
         exit 0;
     }
         IkiWiki::showform($form, $buttons, $session, $q);
         exit 0;
     }
@@ -180,6 +182,13 @@ sub store ($$$) {
        ];
        push @{$change->{pages}}, { link => '...' } if $is_excess;
 
        ];
        push @{$change->{pages}}, { link => '...' } if $is_excess;
 
+        if (length $config{cgiurl}) {
+            $change->{reverturl} = IkiWiki::cgiurl(
+                  do => "revert",
+                  rev => $change->{rev}
+                );
+        }
+
        $change->{author}=$change->{user};
        my $oiduser=eval { IkiWiki::openiduser($change->{user}) };
        if (defined $oiduser) {
        $change->{author}=$change->{user};
        my $oiduser=eval { IkiWiki::openiduser($change->{user}) };
        if (defined $oiduser) {
index 671b9e48358445260ce6d0db200c0d5750625993..148b4376e28fcb6cf84ea6ec2bcee75ddc983db2 100644 (file)
@@ -28,6 +28,8 @@
 <span class="committype"><TMPL_VAR COMMITTYPE></span>
 <span class="desc"><br />Date:</span>
 <span class="changedate"><TMPL_VAR COMMITDATE></span>
 <span class="committype"><TMPL_VAR COMMITTYPE></span>
 <span class="desc"><br />Date:</span>
 <span class="changedate"><TMPL_VAR COMMITDATE></span>
+<span class="desc"><br /></span>
+<span class="revert"><a href="<TMPL_VAR REVERTURL>" rel="nofollow">[[diff|wikiicons/revert.png]]</a></span>
 </div>
 <div class="changelog">
 <TMPL_LOOP MESSAGE>
 </div>
 <div class="changelog">
 <TMPL_LOOP MESSAGE>
index 3cf069dcae4f74335269e34eb5d0265748b9489e..03cd0838db28917e799851e137c1ae7c803f9ceb 100644 (file)
@@ -5,6 +5,7 @@
 <div>
  <TMPL_VAR FIELD-DO>
  <TMPL_VAR FIELD-SID>
 <div>
  <TMPL_VAR FIELD-DO>
  <TMPL_VAR FIELD-SID>
+ <TMPL_VAR FIELD-REV>
 </div>
 <div class="revert buttons">
  <TMPL_VAR form-submit>
 </div>
 <div class="revert buttons">
  <TMPL_VAR form-submit>