]> sipb.mit.edu Git - ikiwiki.git/commitdiff
* Change formbuilder hook to not be responsible for displaying a form,
authorJoey Hess <joey@kitenet.net>
Wed, 12 Dec 2007 08:01:15 +0000 (03:01 -0500)
committerJoey Hess <joey@kitenet.net>
Wed, 12 Dec 2007 08:15:30 +0000 (03:15 -0500)
  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!)

IkiWiki/CGI.pm
IkiWiki/Plugin/edittemplate.pm
IkiWiki/Plugin/passwordauth.pm
debian/changelog
doc/plugins/write.mdwn

index 75f096e137b99e4fccd39fc9c6d290bf9106a1e2..567fa85beaf2f185eaab65fbc81aac04985e7351 100644 (file)
@@ -33,10 +33,9 @@ sub showform ($$$$) { #{{{
                                buttons => $buttons);
                });
        }
-       else {
-               printheader($session);
-               print misctemplate($form->title, $form->render(submit => $buttons));
-       }
+
+       printheader($session);
+       print misctemplate($form->title, $form->render(submit => $buttons));
 }
 
 sub redirect ($$) { #{{{
index 20c948eb1af75d30b6913efafce70198b3b604b5..6689b9a5c405a57e7db202cb9f6f0a46ce11db29 100644 (file)
@@ -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};
        
index b61e6c86e1b118c5baeb852de95a187dc39de854..af16c27542257de13251adae31acdd6578d31b95 100644 (file)
@@ -211,9 +211,6 @@ sub formbuilder (@) { #{{{
                        }
                }
        }
-       
-       IkiWiki::printheader($session);
-       print IkiWiki::misctemplate($form->title, $form->render(submit => $buttons));
 } #}}}
 
 1
index 2118aeaa04f8c1eb5e2544ace0bbca0faa13a6aa..e4d4083a9defb63cbb5f3cee5396407599633b40 100644 (file)
@@ -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
 
index 1cb26a076045ee7b99ac45a16327f4f12143b141..b7c487ee223a3926c093ee77c49d854c35d7e2dc 100644 (file)
@@ -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