run_hooks(pagetemplate => sub {
shift->(page => "", destpage => "", template => $template);
});
+ templateactions($template, "");
$template->param(
dynamic => 1,
- have_actions => 0, # force off
title => $title,
wikiname => $config{wikiname},
content => $content,
html5 => $config{html5},
@_,
);
-
+
return $template->output;
}
+sub templateactions ($$) {
+ my $template=shift;
+ my $page=shift;
+
+ my $have_actions=0;
+ my @actions;
+ run_hooks(pageactions => sub {
+ push @actions, map { { action => $_ } }
+ grep { defined } shift->(page => $page);
+ });
+ $template->param(actions => \@actions);
+
+ if ($config{cgiurl} && exists $hooks{auth}) {
+ $template->param(prefsurl => cgiurl(do => "prefs"));
+ $have_actions=1;
+ }
+
+ if ($have_actions || @actions) {
+ $template->param(have_actions => 1);
+ }
+}
+
sub hook (@) {
my %param=@_;