forked from webmin/webmin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConfirmPage.pm
47 lines (42 loc) · 1.14 KB
/
ConfirmPage.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package WebminUI::ConfirmPage;
use WebminUI::Page;
use WebminCore;
@ISA = ( "WebminUI::Page" );
=head2 new WebminUI::ConfirmPage(subheading, title, message, cgi, &in, [ok-message],
[cancel-message], [help-name])
Create a new page object that asks if the user is sure if he wants to
do something or not.
=cut
sub new
{
if (defined(&WebminUI::Theme::ConfirmPage::new)) {
return new WebminUI::Theme::ConfirmPage(@_[1..$#_]);
}
my ($self, $subheading, $title, $message, $cgi, $in, $ok, $cancel, $help) = @_;
$self = new WebminUI::Page($subheading, $title, $help);
$self->{'in'} = $in;
$self->add_message($message);
my $form = new WebminUI::Form($cgi, "get");
$form->set_input($in);
$self->add_form($form);
foreach my $i (keys %$in) {
foreach my $v (split(/\0/, $in->{$i})) {
$form->add_hidden($i, $v);
}
}
$form->add_button(new WebminUI::Submit($ok || "OK", "ui_confirm"));
$form->add_button(new WebminUI::Submit($cancel || $text{'cancel'}, "ui_cancel"));
bless($self);
return $self;
}
sub get_confirm
{
my ($self) = @_;
return $self->{'in'}->{'ui_confirm'} ? 1 : 0;
}
sub get_cancel
{
my ($self) = @_;
return $self->{'in'}->{'ui_cancel'} ? 1 : 0;
}
1;