diff options
author | Joey Hess <joey@kodama.kitenet.net> | 2008-10-02 12:48:06 -0400 |
---|---|---|
committer | Joey Hess <joey@kodama.kitenet.net> | 2008-10-02 12:48:06 -0400 |
commit | c9459523813052ee187bdad1c8594ae114bece62 (patch) | |
tree | 602f82a24bd0d91d1fd4940814cacf83c1727cfb /IkiWiki | |
parent | e0fd02acf1d40d8f049a7f470e07eebad28cab3d (diff) |
attachment: Support adding attachments to pages even as they are being created.
Diffstat (limited to 'IkiWiki')
-rw-r--r-- | IkiWiki/Plugin/attachment.pm | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/IkiWiki/Plugin/attachment.pm b/IkiWiki/Plugin/attachment.pm index 837992841..2d1fe51cf 100644 --- a/IkiWiki/Plugin/attachment.pm +++ b/IkiWiki/Plugin/attachment.pm @@ -94,7 +94,8 @@ sub formbuilder_setup (@) { #{{{ my $form=$params{form}; my $q=$params{cgi}; - if (defined $form->field("do") && $form->field("do") eq "edit") { + if (defined $form->field("do") && ($form->field("do") eq "edit" || + $form->field("do") eq "create")) { # Add attachment field, set type to multipart. $form->enctype(&CGI::MULTIPART); $form->field(name => 'attachment', type => 'file'); @@ -158,7 +159,7 @@ sub formbuilder (@) { #{{{ my $form=$params{form}; my $q=$params{cgi}; - return if ! defined $form->field("do") || $form->field("do") ne "edit"; + return if ! defined $form->field("do") || ($form->field("do") ne "edit" && $form->field("do") ne "create") ; my $filename=$q->param('attachment'); if (defined $filename && length $filename && |