aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki/CGI.pm
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-08-17 05:34:59 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-08-17 05:34:59 +0000
commitce7596dad9c841fee92a84579be0261d3ef26407 (patch)
treeaf7e9bc1c5d54258cbc398998fb456e199ec4708 /IkiWiki/CGI.pm
parentceae681a438a044778df212642d5f174d8bbc182 (diff)
downloadikiwiki-ce7596dad9c841fee92a84579be0261d3ef26407.tar
ikiwiki-ce7596dad9c841fee92a84579be0261d3ef26407.tar.gz
* Applied Jeremie Koenig's pluggable editpage buttons patch:
- add a title to the editpage form; - pass a reference to the list of buttons to the formbuilder_setup hooks, so we can add ours; - relax asumption about the possible submit values (use "Save Page" explicitly); - de-hardcode the submit buttons from the editpage template (This was needed for compatability with a bug in CGI::FormBuilder 3.0401, but ikiwiki already needs a newer version.) * Pass buttons to all other formbuilder_setup hooks too.
Diffstat (limited to 'IkiWiki/CGI.pm')
-rw-r--r--IkiWiki/CGI.pm14
1 files changed, 9 insertions, 5 deletions
diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm
index 07319ad22..e8df1fe11 100644
--- a/IkiWiki/CGI.pm
+++ b/IkiWiki/CGI.pm
@@ -157,7 +157,8 @@ sub cgi_signin ($$) { #{{{
force => 1);
run_hooks(formbuilder_setup => sub {
- shift->(form => $form, cgi => $q, session => $session);
+ shift->(form => $form, cgi => $q, session => $session,
+ buttons => $buttons);
});
decode_form_utf8($form);
@@ -228,7 +229,8 @@ sub cgi_prefs ($$) { #{{{
my $buttons=["Save Preferences", "Logout", "Cancel"];
run_hooks(formbuilder_setup => sub {
- shift->(form => $form, cgi => $q, session => $session);
+ shift->(form => $form, cgi => $q, session => $session,
+ buttons => $buttons);
});
$form->field(name => "do", type => "hidden");
@@ -304,6 +306,7 @@ sub cgi_editpage ($$) { #{{{
eval q{use CGI::FormBuilder};
error($@) if $@;
my $form = CGI::FormBuilder->new(
+ title => "editpage",
fields => \@fields,
charset => "utf-8",
method => 'POST',
@@ -321,7 +324,8 @@ sub cgi_editpage ($$) { #{{{
);
run_hooks(formbuilder_setup => sub {
- shift->(form => $form, cgi => $q, session => $session);
+ shift->(form => $form, cgi => $q, session => $session,
+ buttons => \@buttons);
});
decode_form_utf8($form);
@@ -402,12 +406,12 @@ sub cgi_editpage ($$) { #{{{
preprocess($page, $page,
filter($page, $page, $form->field('editcontent')), 0, 1))));
}
- else {
+ elsif ($form->submitted eq "Save Page") {
$form->tmpl_param("page_preview", "");
}
$form->tmpl_param("page_conflict", "");
- if (! $form->submitted || $form->submitted eq "Preview" ||
+ if ($form->submitted ne "Save Page" ||
! $form->validate) {
if ($form->field("do") eq "create") {
my @page_locs;