1#!/usr/local/bin/perl 2# list_pack.cgi 3# List all the files in some package 4 5require './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 13print &ui_subheading(&text('list_files', "<tt>$in{'package'}</tt>", 14 $s->{'desc'} ? $s->{'desc'} : $s->{'host'})); 15print "<table class='table table-striped table-hover table-condensed' width=100%>\n"; 16print "<thead><tr><th>$text{'list_path'}</th> ", 17 "<th>$text{'list_owner'}</th> ", 18 "<th>$text{'list_group'}</th> ", 19 "<th>$text{'list_type'}</th> ", 20 "<th>$text{'list_size'}</th> ", 21 "<th>$text{'list_status'}</th> </tr></thead><tbody>\n"; 22$n = &remote_foreign_call($s->{'host'}, "software", 23 "check_files", $in{'package'}); 24$files = &remote_eval($s->{'host'}, "software", "\\%files"); 25for($i=0; $i<$n; $i++) { 26 $sz = $files->{$i,'size'}; 27 $ty = $files->{$i,'type'}; 28 print "<tr>\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/</</g; 55 $err =~ s/>/>/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 } 62print "</tbody></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 67