]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki.pm
(no commit message)
[ikiwiki.git] / IkiWiki.pm
index 46c29abe38a045b813a8a32a632c3f97c729faa8..0f28801a60a354cf38b1b8f271133fb22acc60a0 100644 (file)
@@ -12,9 +12,9 @@ use open qw{:utf8 :std};
 
 use vars qw{%config %links %oldlinks %pagemtime %pagectime %pagecase
        %pagestate %wikistate %renderedfiles %oldrenderedfiles
-       %pagesources %destsources %depends %depends_simple @mass_depends 
-       %hooks %forcerebuild %loaded_plugins %typedlinks %oldtypedlinks
-       %autofiles};
+       %pagesources %delpagesources %destsources %depends %depends_simple
+       @mass_depends %hooks %forcerebuild %loaded_plugins %typedlinks
+       %oldtypedlinks %autofiles};
 
 use Exporter q{import};
 our @EXPORT = qw(hook debug error htmlpage template template_depends
@@ -1745,6 +1745,7 @@ sub misctemplate ($$;@) {
        run_hooks(pagetemplate => sub {
                shift->(page => "", destpage => "", template => $template);
        });
+       templateactions($template, "");
 
        $template->param(
                dynamic => 1,
@@ -1756,17 +1757,29 @@ sub misctemplate ($$;@) {
                @_,
        );
        
+       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 => "");
+                       grep { defined } shift->(page => $page);
        });
        $template->param(actions => \@actions);
-       if (@actions) {
-               $template->param(have_actions => 1);
+
+       if ($config{cgiurl} && exists $hooks{auth}) {
+               $template->param(prefsurl => cgiurl(do => "prefs"));
+               $have_actions=1;
        }
 
-       return $template->output;
+       if ($have_actions || @actions) {
+               $template->param(have_actions => 1);
+       }
 }
 
 sub hook (@) {