Handle hostnames with upper-case letters
[webmin.git] / zones / index.cgi
1 #!/usr/local/bin/perl
2 # Shows all zones, with links to add more
3
4 require './zones-lib.pl';
5 do 'forms-lib.pl';
6
7 $p = new Webmin::Page(undef, $module_info{'desc'}, "intro", 1, 1);
8 $zn = &get_current_zone();
9 if (!&has_command("zoneadm")) {
10         $p->set_errormsg(&text('index_ecmd', "<tt>zoneadm</tt>"));
11         }
12 elsif ($zn ne "global") {
13         $p->set_errormsg(&text('index_eglobal', "<tt>$zn</tt>"));
14         }
15 else {
16         # Create the table
17         &ReadParse();
18         @zones = sort { $a->{'name'} cmp $b->{'name'} } &list_zones();
19         $form = new Webmin::Form();
20         $form->set_input(\%in);
21         $p->add_form($form);
22         $table = new Webmin::Table([ $text{'list_name'},
23                           $text{'list_id'},
24                           $text{'list_path'},
25                           $text{'list_status'},
26                           $text{'list_actions'} ], "100%");
27         $form->add_section($table);
28         foreach $z (@zones) {
29                 local ($a, @actions);
30                 foreach $a (&zone_status_actions($z)) {
31                         push(@actions, new Webmin::TableAction("save_zone.cgi", $a->[1], [ [ "zone", $z->{'name'} ], [ $a->[0], 1 ], [ "list", 1 ] ]));
32                         }
33                 $table->add_row([
34                         "<a href='edit_zone.cgi?zone=$z->{'name'}'>$z->{'name'}</a>",
35                         $z->{'id'},
36                         $z->{'zonepath'},
37                         &nice_status($z->{'status'}),
38                         \@actions
39                         ]);
40                 }
41         $table->set_emptymsg($text{'index_none'});
42         $table->add_link("create_form.cgi", $text{'index_add'});
43         $p->add_footer("/", $text{'index'});
44         }
45 $p->print();
46