]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/CGI.pm
web commit by AlexandreDupas: Added my self
[git.ikiwiki.info.git] / IkiWiki / CGI.pm
index 75f096e137b99e4fccd39fc9c6d290bf9106a1e2..c2dacf78d46253a74015cd67155bbb33fc34ad70 100644 (file)
@@ -33,10 +33,9 @@ sub showform ($$$$) { #{{{
                                buttons => $buttons);
                });
        }
                                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 ($$) { #{{{
 }
 
 sub redirect ($$) { #{{{
@@ -311,9 +310,6 @@ sub cgi_editpage ($$) { #{{{
                fields => \@fields,
                charset => "utf-8",
                method => 'POST',
                fields => \@fields,
                charset => "utf-8",
                method => 'POST',
-               validate => {
-                       editcontent => '/.+/',
-               },
                required => [qw{editcontent}],
                javascript => 0,
                params => $q,
                required => [qw{editcontent}],
                javascript => 0,
                params => $q,
@@ -357,6 +353,7 @@ sub cgi_editpage ($$) { #{{{
                        $form->field(name => "rcsinfo",
                                value => rcs_prepedit($file), force => 1);
                }
                        $form->field(name => "rcsinfo",
                                value => rcs_prepedit($file), force => 1);
                }
+               $form->field(name => "editcontent", validate => '/.*/');
        }
        else {
                $type=$form->param('type');
        }
        else {
                $type=$form->param('type');
@@ -372,6 +369,7 @@ sub cgi_editpage ($$) { #{{{
                if (! $form->submitted) {
                        $form->field(name => "rcsinfo", value => "", force => 1);
                }
                if (! $form->submitted) {
                        $form->field(name => "rcsinfo", value => "", force => 1);
                }
+               $form->field(name => "editcontent", validate => '/.+/');
        }
 
        $form->field(name => "do", type => 'hidden');
        }
 
        $form->field(name => "do", type => 'hidden');
@@ -553,6 +551,7 @@ sub cgi_editpage ($$) { #{{{
                });
                $content=~s/\r\n/\n/g;
                $content=~s/\r/\n/g;
                });
                $content=~s/\r\n/\n/g;
                $content=~s/\r/\n/g;
+               $content.="\n" if $content !~ /\n$/;
 
                $config{cgi}=0; # avoid cgi error message
                eval { writefile($file, $config{srcdir}, $content) };
 
                $config{cgi}=0; # avoid cgi error message
                eval { writefile($file, $config{srcdir}, $content) };