3 # Display client service switches
5 require './nis-lib.pl';
6 &ui_print_header(undef, $text{'switch_title'}, "");
7 @switch = &get_nsswitch_conf();
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";
14 foreach $s (@switch) {
15 local @o = split(/\s+/, $s->{'order'});
16 $max = @o if (@o > $max);
19 foreach $s (@switch) {
20 local $sv = $s->{'service'};
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";
28 local @o = split(/\s+/, $s->{'order'});
29 local @sources = ("");
30 if (defined(&switch_sources)) {
31 push(@sources, &switch_sources());
34 push(@sources, split(/\s+/, $config{'sources'}));
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",
43 $o[$i-1] eq $2 ? 'selected' : '',
47 printf "<option value='%s' %s>%s\n",
49 $o[$i-1] eq $sc ? 'selected' : '',
53 print "</select></td>";
55 print "</tr></table>\n";
58 print "</td> </tr>\n";
61 printf "<input type=hidden name=list value='%s'>\n",
63 print "<input type=submit value='$text{'save'}'></form>\n";
65 &ui_print_footer("", $text{'index_return'});