Handle hostnames with upper-case letters
[webmin.git] / cfengine / edit_push.cgi
1 #!/usr/local/bin/perl
2 # edit_push.cgi
3 # Display a list of hosts to which configurations are copied
4
5 require './cfengine-lib.pl';
6 &ui_print_header(undef, $text{'push_title'}, "", "push");
7
8 if (!&has_command($config{'cfrun'})) {
9         print &text('push_ecmd', "<tt>$config{'cfrun'}</tt>",
10                   "$gconfig{'webprefix'}/config.cgi?$module_name"),"<p>\n";
11         &ui_print_footer("/", $text{'index'});
12         exit;
13         }
14
15 ($hosts, $opts) = &get_cfrun_hosts();
16 print "<form action=save_push.cgi>\n";
17 print "<table border width=100%>\n";
18 print "<tr $tb> <td><b>$text{'push_header'}</b></td> </tr>\n";
19 print "<tr $cb> <td><table width=100%>\n";
20
21 print "<tr> <td><b>$text{'push_domain'}</b></td>\n";
22 printf "<td><input name=domain size=30 value='%s'></td> </tr>\n",
23         $opts->{'domain'};
24
25 print "<tr> <td><b>$text{'push_users'}</b></td>\n";
26 printf "<td><input name=access size=50 value='%s'> %s</td> </tr>\n",
27         join(" ", split(/,/, $opts->{'access'})),
28         &user_chooser_button("access", 1);
29
30 print "</table><table border>\n";
31 print "<tr> <td><b>$text{'push_host'}</b></td> ",
32       "<td><b>$text{'push_opts'}</b></td> </tr>\n";
33 $i = 0;
34 foreach $h (@$hosts, [ ], [ ]) {
35         print "<tr>\n";
36         printf "<td><input name=host_$i size=30 value='%s'></td>\n", $h->[0];
37         printf "<td><input name=opts_$i size=30 value='%s'></td>\n", $h->[1];
38         print "</tr>\n";
39         $i++;
40         }
41 print "</table></td></tr></table>\n";
42 print "<input type=submit value='$text{'save'}'></form>\n";
43
44 if (@$hosts) {
45         print &ui_hr();
46         print "<form action=push.cgi>\n";
47         print "<table width=100%><tr>\n";
48         print "<td><input type=submit value='$text{'push_push'}'></td>\n";
49         print "<td>",&text('push_pushdesc',
50                            "<tt>$config{'cfrun'}</tt>"),"</td>\n";
51         print "</tr></table></form>\n";
52         }
53
54 &ui_print_footer("", $text{'index_return'});
55