$template->param(
dynamic => 1,
- have_actions => 0, # force off
title => $title,
wikiname => $config{wikiname},
content => $content,
html5 => $config{html5},
@_,
);
+
+ my @actions;
+ run_hooks(pageactions => sub {
+ push @actions, map { { action => $_ } }
+ grep { defined } shift->(page => "");
+ });
+ $template->param(actions => \@actions);
+ if (@actions) {
+ $template->param(have_actions => 1);
+ }
return $template->output;
}
hook(type => "getsetup", id => "recentchanges", call => \&getsetup);
hook(type => "checkconfig", id => "recentchanges", call => \&checkconfig);
hook(type => "refresh", id => "recentchanges", call => \&refresh);
+ hook(type => "pageactions", id => "recentchanges", call => \&pageactions);
hook(type => "pagetemplate", id => "recentchanges", call => \&pagetemplate);
hook(type => "htmlize", id => "_change", call => \&htmlize);
# Load goto to fix up links from recentchanges
}
# Enable the recentchanges link on wiki pages.
+sub pageactions (@) {
+ my %params=@_;
+ my $page=$params{page};
+
+ if (defined $config{recentchangespage} && $config{rcs} &&
+ $page ne $config{recentchangespage}) {
+ return htmllink($page, $page, $config{recentchangespage},
+ gettext("RecentChanges"));
+ }
+}
+
+# Backwards compatability for templates still using
+# RECENTCHANGESURL.
sub pagetemplate (@) {
my %params=@_;
my $template=$params{template};
my $page=$params{page};
if (defined $config{recentchangespage} && $config{rcs} &&
- $page ne $config{recentchangespage} &&
- $template->query(name => "recentchangesurl")) {
+ $template->query(name => "recentchangesurl") &&
+ $page ne $config{recentchangespage}) {
$template->param(recentchangesurl => urlto($config{recentchangespage}, $page));
$template->param(have_actions => 1);
}