]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/lockedit.pm
* Change formbuilder hook to not be responsible for displaying a form,
[git.ikiwiki.info.git] / IkiWiki / Plugin / lockedit.pm
index 2b72fabe539e18f14e181cddc5bcdf3ccb060874..a829df1cfba6bf29ce266461c2a8cfde4ffc8be7 100644 (file)
@@ -3,7 +3,7 @@ package IkiWiki::Plugin::lockedit;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 
 sub import { #{{{
        hook(type => "canedit", id => "lockedit", call => \&canedit);
 
 sub import { #{{{
        hook(type => "canedit", id => "lockedit", call => \&canedit);
@@ -20,9 +20,10 @@ sub canedit ($$) { #{{{
        return undef if defined $user && IkiWiki::is_admin($user);
 
        foreach my $admin (@{$config{adminuser}}) {
        return undef if defined $user && IkiWiki::is_admin($user);
 
        foreach my $admin (@{$config{adminuser}}) {
-               if (pagespec_match($page, IkiWiki::userinfo_get($admin, "locked_pages"), "")) {
+               if (pagespec_match($page, IkiWiki::userinfo_get($admin, "locked_pages"))) {
+                       IkiWiki::needsignin($cgi, $session) unless defined $user;
                        return sprintf(gettext("%s is locked by %s and cannot be edited"),
                        return sprintf(gettext("%s is locked by %s and cannot be edited"),
-                               htmllink("", "", $page, 1),
+                               htmllink("", "", $page, noimageinline => 1),
                                IkiWiki::userlink($admin));
                }
        }
                                IkiWiki::userlink($admin));
                }
        }
@@ -40,7 +41,8 @@ sub formbuilder_setup (@) { #{{{
 
        if ($form->title eq "preferences") {
                $form->field(name => "locked_pages", size => 50,
 
        if ($form->title eq "preferences") {
                $form->field(name => "locked_pages", size => 50,
-                       comment => "(".htmllink("", "", "PageSpec", 1).")");
+                       fieldset => "admin",
+                       comment => "(".htmllink("", "", "ikiwiki/PageSpec", noimageinline => 1).")");
                if (! IkiWiki::is_admin($user_name)) {
                        $form->field(name => "locked_pages", type => "hidden");
                }
                if (! IkiWiki::is_admin($user_name)) {
                        $form->field(name => "locked_pages", type => "hidden");
                }