Handle hostnames with upper-case letters
[webmin.git] / dovecot / index.cgi
1 #!/usr/local/bin/perl
2 # Show the dovecot config menu
3
4 require './dovecot-lib.pl';
5 $ver = &get_dovecot_version();
6 &ui_print_header(undef, $module_info{'desc'}, "", undef, 1, 1, 0,
7                  &help_search_link("dovecot", "man", "doc", "google"),
8                  undef, undef,
9                  $ver ? &text('index_version', $ver) : undef);
10
11 # Make sure dovecot is installed
12 if (!&has_command($config{'dovecot'})) {
13         print &ui_config_link('index_ecmd',
14                         [ "<tt>$config{'dovecot'}</tt>", undef ]),"<p>\n";
15
16         &foreign_require("software", "software-lib.pl");
17         $lnk = &software::missing_install_link(
18                         "dovecot", $text{'index_dovecot'},
19                         "../$module_name/", $module_info{'desc'});
20         print $lnk,"<p>\n" if ($lnk);
21
22         &ui_print_footer("/", $text{'index'});
23         exit;
24         }
25
26 # Check for config file
27 if (!&get_config_file()) {
28         print &ui_config_link('index_econf',
29                 [ "<tt>$config{'dovecot_config'}</tt>", undef ]),"<p>\n";
30         &ui_print_footer("/", $text{'index'});
31         exit;
32         }
33
34 # Show icons for option categories
35 @pages = ( "net", "login", "mail", "ssl", "manual" );
36 @titles = map { $text{$_."_title"} } @pages;
37 @icons = map { "images/".$_.".gif" } @pages;
38 @links = map { "edit_".$_.".cgi" } @pages;
39 &icons_table(\@links, \@titles, \@icons, scalar(@titles));
40
41 # Show start/stop and atboot buttons
42 print &ui_hr();
43 print &ui_buttons_start();
44
45 if (&is_dovecot_running()) {
46         print &ui_buttons_row("apply.cgi", $text{'index_apply'},
47                               $text{'index_applydesc'});
48         print &ui_buttons_row("stop.cgi", $text{'index_stop'},
49                               $text{'index_stopdesc'});
50         }
51 else {
52         print &ui_buttons_row("start.cgi", $text{'index_start'},
53                               $text{'index_startdesc'});
54         }
55
56 if ($config{'init_script'}) {
57         &foreign_require("init", "init-lib.pl");
58         $atboot = &init::action_status($config{'init_script'});
59         print &ui_buttons_row("bootup.cgi", $text{'index_boot'},
60                               $text{'index_bootdesc'}, undef,
61                               &ui_radio("boot", $atboot == 2 ? 1 : 0,
62                                         [ [ 1, $text{'yes'} ],
63                                           [ 0, $text{'no'} ] ]));
64         }
65
66 print &ui_buttons_end();
67
68 &ui_print_footer("/", $text{'index'});
69