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