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. --- templates/change.tmpl | 2 ++ 1 file changed, 2 insertions(+) (limited to 'templates/change.tmpl') 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]]
-- cgit v1.2.3 From 1620e2dc4f0a25620fe243d1556722e6b2d2618d Mon Sep 17 00:00:00 2001 From: Peter Gammie Date: Fri, 1 Oct 2010 14:53:00 +1000 Subject: Correct 'alt' text for the revert image. --- templates/change.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'templates/change.tmpl') diff --git a/templates/change.tmpl b/templates/change.tmpl index 148b4376e..9cf40777b 100644 --- a/templates/change.tmpl +++ b/templates/change.tmpl @@ -29,7 +29,7 @@
Date:

-[[diff|wikiicons/revert.png]] +[[revert|wikiicons/revert.png]]
-- cgit v1.2.3 From 7988a5aee3be9fe82da1d47d2a72c95eabc7bb6e Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 6 Oct 2010 14:55:08 -0400 Subject: revert html tweaking --- doc/style.css | 3 ++- templates/change.tmpl | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'templates/change.tmpl') diff --git a/doc/style.css b/doc/style.css index fa4b2a38a..aa27d8866 100644 --- a/doc/style.css +++ b/doc/style.css @@ -172,7 +172,8 @@ div.recentchanges { width: 35%; font-size: small; } -.recentchanges .pagelinks { +.recentchanges .pagelinks, +.recentchanges .revert { float: right; margin: 0; width: 60%; diff --git a/templates/change.tmpl b/templates/change.tmpl index 9cf40777b..4525402a7 100644 --- a/templates/change.tmpl +++ b/templates/change.tmpl @@ -10,10 +10,8 @@
Changed pages:
-[[diff|wikiicons/diff.png]] - - - +[[diff|wikiicons/diff.png]] +
Changed by:
@@ -29,8 +27,10 @@
Date:

-[[revert|wikiicons/revert.png]]
+ +[[revert|wikiicons/revert.png]] +
-- cgit v1.2.3 From 84111d96c461a5d31a615ebf64cae751e6fd9aef Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 8 Oct 2010 17:54:12 -0400 Subject: make revert hooks optional I removed the IkiWiki::rcs_ stubs for the revert hooks. Instead recentchanges tests to see if the hooks are available and calls them directly. --- IkiWiki.pm | 8 -------- IkiWiki/Plugin/recentchanges.pm | 9 ++++++--- doc/plugins/write.mdwn | 5 +++-- templates/change.tmpl | 2 ++ 4 files changed, 11 insertions(+), 13 deletions(-) (limited to 'templates/change.tmpl') diff --git a/IkiWiki.pm b/IkiWiki.pm index faf4af5c7..1f6d70ba3 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -1941,14 +1941,6 @@ sub rcs_receive () { $hooks{rcs}{rcs_receive}{call}->(); } -sub rcs_preprevert ($) { - $hooks{rcs}{rcs_preprevert}{call}->(@_); -} - -sub rcs_revert ($) { - $hooks{rcs}{rcs_revert}{call}->(@_); -} - sub add_depends ($$;$) { my $page=shift; my $pagespec=shift; diff --git a/IkiWiki/Plugin/recentchanges.pm b/IkiWiki/Plugin/recentchanges.pm index 44c981548..a6d7f9fce 100644 --- a/IkiWiki/Plugin/recentchanges.pm +++ b/IkiWiki/Plugin/recentchanges.pm @@ -93,7 +93,8 @@ sub sessioncgi ($$) { return unless $do eq 'revert' && $rev; - IkiWiki::rcs_preprevert(cgi => $q, session => $session, rev => $rev); + $IkiWiki::hooks{rcs}{rcs_preprevert}{call}->( + cgi => $q, session => $session, rev => $rev); my ($form, $buttons) = confirmation_form($q, $session); IkiWiki::decode_form_utf8($form); @@ -101,7 +102,7 @@ sub sessioncgi ($$) { if ($form->submitted eq 'Revert' && $form->validate) { IkiWiki::checksessionexpiry($q, $session, $q->param('sid')); IkiWiki::disable_commit_hook(); - my $r = IkiWiki::rcs_revert($rev); + my $r = $IkiWiki::hooks{rcs}{rcs_revert}{call}->($rev); if (! defined $r) { # success rcs_commit_staged( message => sprintf(gettext("This reverts commit %s"), $rev), @@ -186,7 +187,9 @@ sub store ($$$) { ]; push @{$change->{pages}}, { link => '...' } if $is_excess; - if (length $config{cgiurl}) { + if (length $config{cgiurl} && + exists $IkiWiki::hooks{rcs}{rcs_preprevert} && + exists $IkiWiki::hooks{rcs}{rcs_revert}) { $change->{reverturl} = IkiWiki::cgiurl( do => "revert", rev => $change->{rev} diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index dbbe83851..6b751f0cd 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -1154,8 +1154,6 @@ context, and the whole diff in scalar context. This is used to get the page creation time for a file from the RCS, by looking it up in the history. -It's ok if this is not implemented, and throws an error. - If the RCS cannot determine a ctime for the file, return 0. #### `rcs_getmtime($)` @@ -1210,6 +1208,9 @@ It should try to revert the specified rev, and leave the reversion staged so `rcs_commit_staged` will complete it. It should return undef on _success_ and an error message on failure. +This hook and `rcs_preprevert` are optional, if not implemented, no revert +web interface will be available. + ### PageSpec plugins It's also possible to write plugins that add new functions to diff --git a/templates/change.tmpl b/templates/change.tmpl index 4525402a7..60a9d94b5 100644 --- a/templates/change.tmpl +++ b/templates/change.tmpl @@ -28,9 +28,11 @@
+ [[revert|wikiicons/revert.png]] +
-- cgit v1.2.3