Handle hostnames with upper-case letters
[webmin.git] / sarg / index.cgi
1 #!/usr/local/bin/perl
2 # Show icons for sarg option categories
3
4 require './sarg-lib.pl';
5
6 if (!-r $config{'sarg_conf'}) {
7         &ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1);
8         &ui_print_endpage(
9                 &ui_config_link('index_econf',
10                         [ "<tt>$config{'sarg_conf'}</tt>", undef ]));
11         }
12 if (!&has_command($config{'sarg'})) {
13         &ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1);
14         &ui_print_endpage(
15                 &ui_config_link('index_ecmd',
16                         [ "<tt>$config{'sarg'}</tt>", undef ]));
17         }
18
19 # Get the version
20 $out = `$config{'sarg'} -v 2>&1 </dev/null`;
21 if ($out =~ /sarg-([0-9\.]+)\s/ || $out =~ /Version:\s*([0-9\.]+)/i) {
22         $sarg_version = $1;
23         }
24 else {
25         &ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1);
26         &ui_print_endpage(
27                 &text('index_eversion',
28                       "<tt>$config{'sarg'}</tt>", "<pre>$out</pre>"));
29         }
30
31 # Show icons for options
32 &ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1, 0,
33                  &help_search_link("sarg", "man", "doc", "google"),
34                  undef, undef,
35                  &text('index_version', $sarg_version));
36 @pages = ( "log", "report", "style", "sched" );
37 @links = map { "edit_${_}.cgi" } @pages;
38 @titles = map { $text{"${_}_title"} } @pages;
39 @icons = map { "images/${_}.gif" } @pages;
40 &icons_table(\@links, \@titles, \@icons);
41
42 # Show buttons for generating report now and for viewing
43 $conf = &get_config();
44 $odir = &find_value("output_dir", $conf);
45 $odir ||= &find_value("output_dir", $conf, 1);
46 $sfile = &find_value("access_log", $conf);
47 if ($sfile || $odir && -d $odir) {
48         print &ui_hr();
49         print &ui_buttons_start();
50         }
51 if ($sfile) {
52         print &ui_buttons_row("generate.cgi", $text{'index_generate'},
53                               &text('index_generatedesc', "<tt>$odir</tt>").
54                               "<br><b>$text{'index_clear'}</b> ".
55                               &gen_clear_input().
56                               "<br><b>$text{'index_range'}</b> ".
57                               &gen_range_input());
58         print "<tr> <td><p></td> </tr>\n";
59         }
60 if ($odir && -d $odir) {
61         print &ui_buttons_row(-r "$odir/index.html" ? "view.cgi/index.html"
62                                                     : "view.cgi/",
63                               $text{'index_view'},
64                               &text('index_viewdesc', "<tt>$odir</tt>"));
65         }
66 if ($sfile || $odir && -r "$odir/index.html") {
67         print &ui_buttons_end();
68         }
69
70 &ui_print_footer("/", $text{'index'});