use Encode;
sub import { #{{{
+ hook(type => "getsetup", id => "edittemplate",
+ call => \&getsetup);
hook(type => "needsbuild", id => "edittemplate",
call => \&needsbuild);
hook(type => "preprocess", id => "edittemplate",
call => \&formbuilder);
} #}}}
+sub getsetup () { #{{{
+ return
+ plugin => {
+ safe => 1,
+ rebuild => undef,
+ },
+} #}}}
+
sub needsbuild (@) { #{{{
my $needsbuild=shift;
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