From 941755e46661b65f29aeebcf38f8410f9c8cfc2e Mon Sep 17 00:00:00 2001 From: Peter Gammie Date: Wed, 29 Sep 2010 15:43:44 +1000 Subject: Get things right after moving to a branch. --- IkiWiki/Plugin/recentchanges.pm | 11 ++++++++++- templates/change.tmpl | 2 ++ templates/revert.tmpl | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/IkiWiki/Plugin/recentchanges.pm b/IkiWiki/Plugin/recentchanges.pm index 2a78566e1..79d175328 100644 --- a/IkiWiki/Plugin/recentchanges.pm +++ b/IkiWiki/Plugin/recentchanges.pm @@ -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 => "sessioncgi", id => "recentchanges", call => \&sessioncgi); # 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 => "rev", type => "hidden", value => $rev, force => 1); return $f, ["Revert", "Cancel"]; } @@ -110,6 +110,7 @@ sub sessioncgi ($$) { if($r) { die "FIXME revert '$rev' failed."; } else { + require IkiWiki::Render; 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->field(name => "rev", type => "hidden", value => $rev, force => 1); IkiWiki::showform($form, $buttons, $session, $q); exit 0; } @@ -180,6 +182,13 @@ sub store ($$$) { ]; 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) { diff --git a/templates/change.tmpl b/templates/change.tmpl index 671b9e483..148b4376e 100644 --- a/templates/change.tmpl +++ b/templates/change.tmpl @@ -28,6 +28,8 @@
Date:
+
+[[diff|wikiicons/revert.png]]
diff --git a/templates/revert.tmpl b/templates/revert.tmpl index 3cf069dca..03cd0838d 100644 --- a/templates/revert.tmpl +++ b/templates/revert.tmpl @@ -5,6 +5,7 @@
+
-- cgit v1.2.3