]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/edittemplate.pm
filecheck: Fixed two bits broken in move from attachment.
[git.ikiwiki.info.git] / IkiWiki / Plugin / edittemplate.pm
index d1716a31564031813e7d9f273ab7ff3ca02f3f5c..98308de135ba42c6efc5d574b261d51cc5f18e29 100644 (file)
@@ -8,6 +8,8 @@ use HTML::Template;
 use Encode;
 
 sub import { #{{{
 use Encode;
 
 sub import { #{{{
+       hook(type => "getsetup", id => "edittemplate",
+               call => \&getsetup);
        hook(type => "needsbuild", id => "edittemplate",
                call => \&needsbuild);
        hook(type => "preprocess", id => "edittemplate",
        hook(type => "needsbuild", id => "edittemplate",
                call => \&needsbuild);
        hook(type => "preprocess", id => "edittemplate",
@@ -16,6 +18,14 @@ sub import { #{{{
                call => \&formbuilder);
 } #}}}
 
                call => \&formbuilder);
 } #}}}
 
+sub getsetup () { #{{{
+       return
+               plugin => {
+                       safe => 1,
+                       rebuild => undef,
+               },
+} #}}}
+
 sub needsbuild (@) { #{{{
        my $needsbuild=shift;
 
 sub needsbuild (@) { #{{{
        my $needsbuild=shift;
 
@@ -54,7 +64,9 @@ sub formbuilder (@) { #{{{
        my %params=@_;
        my $form=$params{form};
 
        my %params=@_;
        my $form=$params{form};
 
-       return if $form->field("do") ne "create";
+       return if $form->field("do") ne "create" ||
+               length $form->field("editcontent");
+       
        my $page=$form->field("page");
        
        # The tricky bit here is that $page is probably just the base
        my $page=$form->field("page");
        
        # The tricky bit here is that $page is probably just the base