]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/CGI.pm
* Add templatefile hook.
[git.ikiwiki.info.git] / IkiWiki / CGI.pm
index b1caff96dfa4941065f5f9dd529e3df423e83b0d..9fc65e34a0930fa9c9b6d704a695e87ecb63950c 100644 (file)
@@ -137,6 +137,7 @@ sub cgi_signin ($$) { #{{{
        error($@) if $@;
        my $form = CGI::FormBuilder->new(
                title => "signin",
+               name => "signin",
                header => 1,
                charset => "utf-8",
                method => 'POST',
@@ -145,7 +146,7 @@ sub cgi_signin ($$) { #{{{
                params => $q,
                action => $config{cgiurl},
                header => 0,
-               template => scalar template_params("signin.tmpl"),
+               template => {type => 'div'},
                stylesheet => baseurl()."style.css",
        );
        my $buttons=["Login"];
@@ -206,6 +207,7 @@ sub cgi_prefs ($$) { #{{{
        error($@) if $@;
        my $form = CGI::FormBuilder->new(
                title => "preferences",
+               name => "preferences",
                header => 0,
                charset => "utf-8",
                method => 'POST',
@@ -216,7 +218,7 @@ sub cgi_prefs ($$) { #{{{
                javascript => 0,
                params => $q,
                action => $config{cgiurl},
-               template => scalar template_params("prefs.tmpl"),
+               template => {type => 'div'},
                stylesheet => baseurl()."style.css",
                fieldsets => [
                        [login => gettext("Login")],
@@ -314,8 +316,10 @@ sub cgi_editpage ($$) { #{{{
                javascript => 0,
                params => $q,
                action => $config{cgiurl},
+               header => 0,
                table => 0,
                template => scalar template_params("editpage.tmpl"),
+               wikiname => $config{wikiname},
        );
        
        run_hooks(formbuilder_setup => sub {
@@ -398,7 +402,7 @@ sub cgi_editpage ($$) { #{{{
                        htmlize($page, $type,
                        linkify($page, "",
                        preprocess($page, $page,
-                       filter($page, $form->field('editcontent')), 0, 1))));
+                       filter($page, $page, $form->field('editcontent')), 0, 1))));
        }
        else {
                $form->tmpl_param("page_preview", "");
@@ -469,6 +473,7 @@ sub cgi_editpage ($$) { #{{{
                        $form->field(name => "type", type => 'select',
                                options => \@page_types);
                        $form->title(sprintf(gettext("creating %s"), pagetitle($page)));
+                       
                }
                elsif ($form->field("do") eq "edit") {
                        check_canedit($page, $q, $session);
@@ -488,7 +493,8 @@ sub cgi_editpage ($$) { #{{{
                        $form->title(sprintf(gettext("editing %s"), pagetitle($page)));
                }
                
-               print $form->render(submit => \@buttons);
+               printheader($session);
+               print misctemplate($form->title, $form->render(submit => \@buttons));
        }
        else {
                # save page
@@ -501,7 +507,8 @@ sub cgi_editpage ($$) { #{{{
                        $form->field(name => "page", type => 'hidden');
                        $form->field(name => "type", type => 'hidden');
                        $form->title(sprintf(gettext("editing %s"), $page));
-                       print $form->render(submit => \@buttons);
+                       printheader($session);
+                       print misctemplate($form->title, $form->render(submit => \@buttons));
                        return;
                }
                elsif (-e "$config{srcdir}/$file" &&
@@ -516,7 +523,8 @@ sub cgi_editpage ($$) { #{{{
                                value => readfile("$config{srcdir}/$file").
                                         "\n\n\n".$form->field("editcontent"),
                                force => 1);
-                       print $form->render(submit => \@buttons);
+                       printheader($session);
+                       print misctemplate($form->title, $form->render(submit => \@buttons));
                        return;
                }
                
@@ -538,7 +546,8 @@ sub cgi_editpage ($$) { #{{{
                        $form->field(name => "page", type => 'hidden');
                        $form->field(name => "type", type => 'hidden');
                        $form->title(sprintf(gettext("editing %s"), $page));
-                       print $form->render(submit => \@buttons);
+                       printheader($session);
+                       print misctemplate($form->title, $form->render(submit => \@buttons));
                        return;
                }
                
@@ -582,7 +591,8 @@ sub cgi_editpage ($$) { #{{{
                        $form->field(name => "page", type => 'hidden');
                        $form->field(name => "type", type => 'hidden');
                        $form->title(sprintf(gettext("editing %s"), $page));
-                       print $form->render(submit => \@buttons);
+                       printheader($session);
+                       print misctemplate($form->title, $form->render(submit => \@buttons));
                        return;
                }
                else {