Handle hostnames with upper-case letters
[webmin.git] / webmin / edit_assignment.cgi
1 #!/usr/local/bin/perl
2
3 require './webmin-lib.pl';
4
5 @modules = grep { &check_os_support($_) &&
6                   !$_->{'hidden'} } &get_all_module_infos();
7 @modules = sort { $a->{'desc'} cmp $b->{'desc'} } @modules;
8 &read_file("$config_directory/webmin.catnames", \%catnames);
9
10 &ui_print_header(undef, $text{'assignment_title'}, undef);
11
12 print $text{'assignment_desc'},"<p>\n";
13
14 print &ui_form_start("save_assignment.cgi", "post");
15 @grid = ( );
16 foreach ( @modules ){
17     push(@grid, $_->{'desc'} || $_->{'dir'});
18     push(@grid, &cats($_->{'dir'}, $_->{'category'}));
19     }
20 print &ui_grid_table(\@grid, 4, 100, undef, undef, $text{'assignment_header'});
21 print &ui_form_end([ [ undef, $text{'assignment_ok'} ] ]);
22
23 &ui_print_footer("", $text{'index_return'});
24
25 sub cats {
26     my $cats;
27     my %cats;
28     foreach (keys %text) {
29         next unless /^category_/;
30         my $desc = $text{$_};
31         s/^category_//;
32         $cats{$_} = $desc;
33         }
34     foreach (keys %catnames) {
35         $cats{$_} = $catnames{$_};
36         }
37     return &ui_select($_[0], $_[1],
38                 [ map { [ $_, $cats{$_} ] }
39                       sort { $cats{$a} cmp $cats{$b} } keys %cats ]);
40 }