3 # Show details of a managed host, and all the packages on it
5 require './cluster-software-lib.pl';
6 &foreign_require("servers", "servers-lib.pl");
8 &header($text{'host_title'}, "");
11 @hosts = &list_software_hosts();
12 ($host) = grep { $_->{'id'} eq $in{'id'} } @hosts;
13 $server = &foreign_call("servers", "get_server", $in{'id'});
14 @packages = @{$host->{'packages'}};
17 print "<form action=delete_host.cgi>\n";
18 print "<input type=hidden name=id value=$in{'id'}>\n";
19 print "<table border width=100%>\n";
20 print "<tr $tb> <td><b>$text{'host_header'}</b></td> </tr>\n";
21 print "<tr $cb> <td><table width=100%>\n";
23 print "<tr> <td><b>$text{'host_name'}</b></td>\n";
24 if ($server->{'id'}) {
25 printf "<td><a href='/servers/link.cgi/%s/'>%s</a></td>\n",
26 $server->{'id'}, $server->{'desc'} ? "$server->{'desc'} ($server->{'host'}:$server->{'port'})" : "$server->{'host'}:$server->{'port'}";
29 print "<td><a href=/>$text{'this_server'}</a></td>\n";
32 if ($server->{'id'}) {
33 print "<td><b>$text{'host_type'}</b></td> <td>\n";
34 foreach $t (@servers::server_types) {
35 print $t->[1] if ($t->[0] eq $server->{'type'});
41 print "<tr> <td><b>$text{'host_count'}</b></td>\n";
42 printf "<td>%d</td>\n", scalar(@packages);
44 print "<td><b>$text{'host_os'}</b></td>\n";
45 print "<td>$host->{'real_os_type'} $host->{'real_os_version'}</td> </tr>\n";
47 print "</table></td></tr></table>\n";
48 print "<input type=submit value='$text{'host_delete'}'></form>\n";
50 # Show tree of packages
52 foreach $c (sort { $a cmp $b } &unique(map { $_->{'class'} } @packages)) {
55 $p = join('/', @w[0..$#w-1]);
56 if (!defined($heir{$p})) {
57 $pp = join('/', @w[0..$#w-2]);
64 # get the current open list
65 open(HEIROPEN, "$module_config_directory/heiropen.$in{'id'}");
73 # traverse the heirarchy
76 print "<h3>$text{'host_installed'}</h3>\n";
77 print "<table width=100%>\n";
81 print "<a href='closeall.cgi?id=$in{'id'}'>$text{'host_close'}</a> $spacer\n";
82 print "<a href='openall.cgi?id=$in{'id'}'>$text{'host_open'}</a><p>\n";
86 &footer("", $text{'index_return'});
91 print "<tr> <td>", $spacer x $_[1];
93 print "<a name=\"$_[0]\"></a>\n";
94 $act = $heiropen{$_[0]} ? "close" : "open";
95 print "<a href=\"$act.cgi?id=$in{'id'}&what=",&urlize($_[0]),"\">";
97 print "<img border=0 src=images/$act.gif></a> $1</td>\n",
99 else { print "<img src=images/close.gif> <i>$text{'host_all'}</i></td>\n"; }
100 print "<td><br></td> </tr>\n";
101 if ($heiropen{$_[0]}) {
102 # print sub-folders followed by packages
103 foreach $i (@packages) {
104 if ($i->{'class'} eq $_[0]) {
105 print "<tr> <td>", $spacer x ($_[1]+1);
106 print "<img border=0 src=images/pack.gif></a> \n";
107 print "<a href=\"edit_pack.cgi?package=",
108 &urlize($i->{'name'}),"\">$i->{'name'}</a></td>\n";
109 print "<td>$i->{'desc'}</td>\n";
113 foreach $s (&unique(split(/\0+/, $heir{$_[0]}))) {
114 &traverse($s, $_[1]+1);