Handle hostnames with upper-case letters
[webmin.git] / software / list_pack.cgi
1 #!/usr/local/bin/perl
2 # list_pack.cgi
3 # List all the files in some package
4
5 require './software-lib.pl';
6 &ReadParse();
7 &ui_print_header(undef, $text{'list_title'}, "", "list_pack");
8
9 print &ui_subheading(&text('list_files', "<tt>$in{'package'}</tt>"));
10 print &ui_columns_start([
11         $text{'list_path'},
12         $text{'list_owner'},
13         $text{'list_group'},
14         $text{'list_type'},
15         $text{'list_size'},
16         $text{'list_status'} ], 100);
17 $n = &check_files($in{'package'}, $in{'version'});
18 @tds = ( "valign=top", "valign=top", "valign=top",
19          "valign=top", "valign=top", "valign=top" );
20 for($i=0; $i<$n; $i++) {
21         $sz = $files{$i,'size'};
22         $ty = $files{$i,'type'};
23         local @cols;
24         $ls = "<a href=\"file_info.cgi?file=".&urlize($files{$i,'path'})."\">";
25         $le = "</a>";
26         if ($ty == 3 || $ty == 4) {
27                 # Hard or soft link
28                 push(@cols, $ls.&html_escape($files{$i,'path'}).
29                       " -> ".&html_escape($files{$i,'link'}).$le);
30                 push(@cols, "", "");
31                 }
32         else {
33                 $table = "<table width=100% cellpadding=0 ".
34                       "cellspacing=0><tr><td>$ls".
35                       &html_escape($files{$i,'path'}).
36                       "$le</td> <td align=right>\n";
37                 if ($ty == 0 || $ty == 5) {
38                         $table .= "<a href='view.cgi".
39                                 &html_escape($files{$i,'path'}).
40                                 "'>$text{'list_view'}</a>";
41                         }
42                 $table .= "</td></tr></table>";
43                 push(@cols, $table);
44                 push(@cols, &html_escape($files{$i,'user'}));
45                 push(@cols, &html_escape($files{$i,'group'}));
46                 }
47         push(@cols, $type_map[$ty]);
48         push(@cols, $ty != 0 ? "" : &nice_size($sz));
49         $err = $files{$i,'error'};
50         if ($err) {
51                 $err =~ s/</&lt;/g;
52                 $err =~ s/>/&gt;/g;
53                 $err =~ s/\n/<br>/g;
54                 push(@cols, "<font color=#ff0000>$err</font>");
55                 }
56         else {
57                 push(@cols, $text{'list_ok'});
58                 }
59         print &ui_columns_row(\@cols, \@tds);
60         }
61 print &ui_columns_end();
62
63 &ui_print_footer("edit_pack.cgi?package=".&urlize($in{'package'}).
64         "&version=".&urlize($in{'version'}), $text{'edit_return'},
65         "tree.cgi", $text{'index_treturn'});
66