X-Git-Url: http://git.tremily.us/?p=ikiwiki.git;a=blobdiff_plain;f=IkiWiki.pm;h=699ad13dac4183e5d3135e62d6956e6f40c8a731;hp=33e4e1d1f3f40326228f1d11167c0726e4e13531;hb=c8b34aa31c7d146adf4210c6171dfea2988a7688;hpb=bc0aa4d40e10238f6b83e285869caab3dfeca395 diff --git a/IkiWiki.pm b/IkiWiki.pm index 33e4e1d1f..699ad13da 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -1745,10 +1745,10 @@ sub misctemplate ($$;@) { 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, @@ -1756,10 +1756,32 @@ sub misctemplate ($$;@) { 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=@_;