* Change formbuilder hook to not be responsible for displaying a form,
so that more than one plugin can use this hook. I believe this is a safe change, since only passwordauth uses this hook. (If some other plugin already used it, it would have broken passwordauth!)master
parent
c46b17983d
commit
4745391360
|
@ -33,10 +33,9 @@ sub showform ($$$$) { #{{{
|
|||
buttons => $buttons);
|
||||
});
|
||||
}
|
||||
else {
|
||||
|
||||
printheader($session);
|
||||
print misctemplate($form->title, $form->render(submit => $buttons));
|
||||
}
|
||||
}
|
||||
|
||||
sub redirect ($$) { #{{{
|
||||
|
|
|
@ -12,8 +12,8 @@ sub import { #{{{
|
|||
call => \&needsbuild);
|
||||
hook(type => "preprocess", id => "edittemplate",
|
||||
call => \&preprocess);
|
||||
hook(type => "formbuilder_setup", id => "edittemplate",
|
||||
call => \&formbuilder_setup);
|
||||
hook(type => "formbuilder", id => "edittemplate",
|
||||
call => \&formbuilder);
|
||||
} #}}}
|
||||
|
||||
sub needsbuild (@) { #{{{
|
||||
|
@ -49,7 +49,7 @@ sub preprocess (@) { #{{{
|
|||
$params{template}, $params{match});
|
||||
} # }}}
|
||||
|
||||
sub formbuilder_setup (@) { #{{{
|
||||
sub formbuilder (@) { #{{{
|
||||
my %params=@_;
|
||||
my $form=$params{form};
|
||||
|
||||
|
|
|
@ -211,9 +211,6 @@ sub formbuilder (@) { #{{{
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
IkiWiki::printheader($session);
|
||||
print IkiWiki::misctemplate($form->title, $form->render(submit => $buttons));
|
||||
} #}}}
|
||||
|
||||
1
|
||||
|
|
|
@ -20,6 +20,10 @@ ikiwiki (2.16) UNRELEASED; urgency=low
|
|||
* Fix file pruning code to work if ikiwiki is run with "." as the srcdir.
|
||||
* Add an edittemplate plugin, allowing registering template pages, that
|
||||
provide default content for new pages created using the web frontend.
|
||||
* Change formbuilder hook to not be responsible for displaying a form,
|
||||
so that more than one plugin can use this hook.
|
||||
I believe this is a safe change, since only passwordauth uses this hook.
|
||||
(If some other plugin already used it, it would have broken passwordauth!)
|
||||
|
||||
-- Joey Hess <joeyh@debian.org> Mon, 03 Dec 2007 14:47:36 -0500
|
||||
|
||||
|
|
|
@ -279,10 +279,8 @@ it's a form that it needs to modify, will call various methods to
|
|||
add/remove/change fields, tweak the validation code for the fields, etc. It
|
||||
will not validate or display the form.
|
||||
|
||||
Form validation and display can be overridden by the formbuilder hook.
|
||||
By default, ikiwiki will do a basic validation and display of the form,
|
||||
but if this hook is registered, it will stop that and let the hook take
|
||||
over.
|
||||
Just before a form is displayed to the user, the `formbuilder` hook is
|
||||
called. It can be used to validate the form, but should not display it.
|
||||
|
||||
### savestate
|
||||
|
||||
|
|
Loading…
Reference in New Issue