X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/b01a2274c3f96541b8b48f9ebb883ee8b7451fa3..3dd98a3b3f66555ca3d83ec6940a9cd11cf8bec7:/IkiWiki.pm diff --git a/IkiWiki.pm b/IkiWiki.pm index d76b5edb4..a42f56bf0 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -1004,7 +1004,7 @@ sub displaytime ($;$$) { my $time=formattime($_[0], $_[1]); if ($config{html5}) { return ''; } else { @@ -1748,7 +1748,6 @@ sub misctemplate ($$;@) { $template->param( dynamic => 1, - have_actions => 0, # force off title => $title, wikiname => $config{wikiname}, content => $content, @@ -1757,9 +1756,33 @@ sub misctemplate ($$;@) { @_, ); + templateactions($template, ""); + 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=@_;