From 3b47dae9ca03b31cf5915c0d12215883fe2c32c1 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 2 Oct 2008 12:53:53 -0400 Subject: [PATCH] remove, rename: Allow acting on attachments as a page is being created. --- IkiWiki/Plugin/remove.pm | 10 ++++++---- IkiWiki/Plugin/rename.pm | 10 ++++++---- debian/changelog | 1 + 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/IkiWiki/Plugin/remove.pm b/IkiWiki/Plugin/remove.pm index c8d76368e..cf95026c8 100644 --- a/IkiWiki/Plugin/remove.pm +++ b/IkiWiki/Plugin/remove.pm @@ -61,9 +61,10 @@ 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")) { # Removal button for the page, and also for attachments. - push @{$params{buttons}}, "Remove"; + push @{$params{buttons}}, "Remove" if $form->field("do") eq "edit"; $form->tmpl_param("field-remove" => ''); } } #}}} @@ -135,11 +136,12 @@ sub formbuilder (@) { #{{{ my %params=@_; my $form=$params{form}; - 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")) { my $q=$params{cgi}; my $session=$params{session}; - if ($form->submitted eq "Remove") { + if ($form->submitted eq "Remove" && $form->field("do") eq "edit") { removal_confirm($q, $session, 0, $form->field("page")); } elsif ($form->submitted eq "Remove Attachments") { diff --git a/IkiWiki/Plugin/rename.pm b/IkiWiki/Plugin/rename.pm index 6c131487a..7e55e271c 100644 --- a/IkiWiki/Plugin/rename.pm +++ b/IkiWiki/Plugin/rename.pm @@ -210,11 +210,12 @@ sub formbuilder (@) { #{{{ my %params=@_; my $form=$params{form}; - 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")) { my $q=$params{cgi}; my $session=$params{session}; - if ($form->submitted eq "Rename") { + if ($form->submitted eq "Rename" && $form->field("do") eq "edit") { rename_start($q, $session, 0, $form->field("page")); } elsif ($form->submitted eq "Rename Attachment") { @@ -237,9 +238,10 @@ 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")) { # Rename button for the page, and also for attachments. - push @{$params{buttons}}, "Rename"; + push @{$params{buttons}}, "Rename" if $form->field("do") eq "edit"; $form->tmpl_param("field-rename" => ''); if (defined $renamesummary) { diff --git a/debian/changelog b/debian/changelog index b54fce784..0f3530cb2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -35,6 +35,7 @@ ikiwiki (2.66) UNRELEASED; urgency=low * inline: Fix handling of rootpage that doesn't exist. * attachment: Support adding attachments to pages even as they are being created. + * remove, rename: Allow acting on attachments as a page is being created. -- Joey Hess Thu, 25 Sep 2008 13:45:55 -0400 -- 2.39.5