Handle hostnames with upper-case letters
[webmin.git] / nis / old_edit_switch.cgi
1 #!/usr/local/bin/perl
2 # edit_switch.cgi
3 # Display client service switches
4
5 require './nis-lib.pl';
6 &ui_print_header(undef, $text{'switch_title'}, "");
7 @switch = &get_nsswitch_conf();
8
9 print "<form action=save_switch.cgi method=post>\n";
10 print "<table border>\n";
11 print "<tr $tb> <td><b>$text{'switch_service'}</b></td> ",
12       "<td><b>$text{'switch_order'}</b></td> </tr>\n";
13
14 foreach $s (@switch) {
15         local @o = split(/\s+/, $s->{'order'});
16         $max = @o if (@o > $max);
17         }
18
19 foreach $s (@switch) {
20         local $sv = $s->{'service'};
21         print "<tr $cb>\n";
22         print "<td><b>",$text{"desc_$sv"} ? $text{"desc_$sv"} :
23                         $s->{'service'},"</b></td> <td>\n";
24         if ($s->{'order'} =~ /\[/) {
25                 print "<input name=order_$sv size=60 value='$s->{'order'}'>\n";
26                 }
27         else {
28                 local @o = split(/\s+/, $s->{'order'});
29                 local @sources = ("");
30                 if (defined(&switch_sources)) {
31                         push(@sources, &switch_sources());
32                         }
33                 else {
34                         push(@sources, split(/\s+/, $config{'sources'}));
35                         }
36                 print "<table width=100% cellpadding=0 cellspacing=0><tr>\n";
37                 for($i=1; $i<=$max+1; $i++) {
38                         print "<td><select name=order_${sv}_${i}>\n";
39                         foreach $sc (@sources) {
40                                 if ($sc =~ /(\S+)=(\S+)/ && $1 eq $sv) {
41                                         printf "<option value='%s' %s>%s\n",
42                                             $2,
43                                             $o[$i-1] eq $2 ? 'selected' : '',
44                                             $text{"order_$2"};
45                                         }
46                                 elsif ($sc !~ /=/) {
47                                         printf "<option value='%s' %s>%s\n",
48                                             $sc,
49                                             $o[$i-1] eq $sc ? 'selected' : '',
50                                             $text{"order_$sc"};
51                                         }
52                                 }
53                         print "</select></td>";
54                         }
55                 print "</tr></table>\n";
56                 }
57         push(@list, $sv);
58         print "</td> </tr>\n";
59         }
60 print "</table>\n";
61 printf "<input type=hidden name=list value='%s'>\n",
62         join(" ", @list);
63 print "<input type=submit value='$text{'save'}'></form>\n";
64
65 &ui_print_footer("", $text{'index_return'});
66