]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
po: test formbuilder_setup hook to warn about new master page's language
authorintrigeri <intrigeri@boum.org>
Fri, 2 Jan 2009 11:15:21 +0000 (12:15 +0100)
committerintrigeri <intrigeri@boum.org>
Fri, 2 Jan 2009 11:15:21 +0000 (12:15 +0100)
Signed-off-by: intrigeri <intrigeri@boum.org>
IkiWiki/Plugin/po.pm

index 48c3c37e6182c486a9da959301de25829a1d4f2d..2f43c498347e9bb4b763caebff30e3a6713a6444 100644 (file)
@@ -43,6 +43,7 @@ sub import {
        hook(type => "canremove", id => "po", call => \&canremove);
        hook(type => "canrename", id => "po", call => \&canrename);
        hook(type => "editcontent", id => "po", call => \&editcontent);
+       hook(type => "formbuilder_setup", id => "po", call => \&formbuilder_setup);
 
        $origsubs{'bestlink'}=\&IkiWiki::bestlink;
        inject(name => "IkiWiki::bestlink", call => \&mybestlink);
@@ -439,6 +440,20 @@ sub editcontent () {
        return $params{content};
 }
 
+sub formbuilder_setup (@) {
+       my %params=@_;
+       my $form=$params{form};
+       my $q=$params{cgi};
+
+       return unless (defined $form->field("do") && $form->field("do") eq "create");
+
+       $form->tmpl_param(
+               message => sprintf(
+                               gettext('**WARNING: this page must be written in %s**'),
+                               $config{po_master_language}{name})
+       );
+}
+
 
 # ,----
 # | Injected functions