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