remove: make it clearer that repeated page parameter is OK here
ikiwiki's web interface does not currently have UI for removing multiple pages simultaneously, but the remove plugin is robust against doing so. Use a clearer idiom to make that obvious.master
parent
d157a97452
commit
2486d83706
|
@ -196,7 +196,9 @@ sub formbuilder (@) {
|
||||||
my $session=$params{session};
|
my $session=$params{session};
|
||||||
|
|
||||||
if ($form->submitted eq "Remove" && $form->field("do") eq "edit") {
|
if ($form->submitted eq "Remove" && $form->field("do") eq "edit") {
|
||||||
removal_confirm($q, $session, 0, $form->field("page"));
|
# deliberately taking multiple values of page
|
||||||
|
my @pages = $form->field("page");
|
||||||
|
removal_confirm($q, $session, 0, @pages);
|
||||||
}
|
}
|
||||||
elsif ($form->submitted eq "Remove Attachments") {
|
elsif ($form->submitted eq "Remove Attachments") {
|
||||||
my @selected=map { Encode::decode_utf8($_) } $q->param("attachment_select");
|
my @selected=map { Encode::decode_utf8($_) } $q->param("attachment_select");
|
||||||
|
@ -216,14 +218,15 @@ sub sessioncgi ($$) {
|
||||||
my ($form, $buttons)=confirmation_form($q, $session);
|
my ($form, $buttons)=confirmation_form($q, $session);
|
||||||
IkiWiki::decode_form_utf8($form);
|
IkiWiki::decode_form_utf8($form);
|
||||||
|
|
||||||
|
# deliberately taking multiple values of page
|
||||||
|
my @pages = $form->field("page");
|
||||||
|
|
||||||
if ($form->submitted eq 'Cancel') {
|
if ($form->submitted eq 'Cancel') {
|
||||||
postremove($session);
|
postremove($session);
|
||||||
}
|
}
|
||||||
elsif ($form->submitted eq 'Remove' && $form->validate) {
|
elsif ($form->submitted eq 'Remove' && $form->validate) {
|
||||||
IkiWiki::checksessionexpiry($q, $session);
|
IkiWiki::checksessionexpiry($q, $session);
|
||||||
|
|
||||||
my @pages=$form->field("page");
|
|
||||||
|
|
||||||
# Validate removal by checking that the page exists,
|
# Validate removal by checking that the page exists,
|
||||||
# and that the user is allowed to edit(/remove) it.
|
# and that the user is allowed to edit(/remove) it.
|
||||||
my @files;
|
my @files;
|
||||||
|
@ -288,7 +291,7 @@ sub sessioncgi ($$) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
removal_confirm($q, $session, 0, $form->field("page"));
|
removal_confirm($q, $session, 0, @pages);
|
||||||
}
|
}
|
||||||
|
|
||||||
exit 0;
|
exit 0;
|
||||||
|
|
Loading…
Reference in New Issue