3 # Show details of a managed host, and all the modules on it
5 require './cluster-usermin-lib.pl';
7 &ui_print_header(undef, $text{'host_title'}, "");
9 @hosts = &list_usermin_hosts();
10 ($host) = grep { $_->{'id'} eq $in{'id'} } @hosts;
11 $server = &foreign_call("servers", "get_server", $in{'id'});
12 @modules = @{$host->{'modules'}};
13 @themes = @{$host->{'themes'}};
14 @users = @{$host->{'users'}};
15 @groups = @{$host->{'groups'}};
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>%s</td>\n",
26 $server->{'desc'} ? $server->{'desc'} : $server->{'host'};
29 print "<td>$text{'this_server'}</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(@modules);
44 print "<td><b>$text{'host_tcount'}</b></td>\n";
45 printf "<td>%d</td> </tr>\n", scalar(@themes);
47 print "<tr> <td><b>$text{'host_os'}</b></td>\n";
48 print "<td>$host->{'real_os_type'} $host->{'real_os_version'}</td>\n";
50 print "<td><b>$text{'host_version'}</b></td>\n";
51 printf "<td>%s</td> </tr>\n", $host->{'version'};
53 print "</table></td></tr></table>\n";
55 # Show delete and refresh buttons
56 print "<table width=100%><tr>\n";
57 print "<form action=delete_host.cgi>\n";
58 print "<input type=hidden name=id value=$in{'id'}>\n";
59 print "<td><input type=submit value='$text{'host_delete'}'></td>\n";
62 print "<form action=refresh.cgi>\n";
63 print "<input type=hidden name=id value=$in{'id'}>\n";
64 print "<td align=right><input type=submit value='$text{'host_refresh'}'></td>\n";
66 print "</tr></table>\n";
68 # Show table of modules and themes
69 print "<table border width=100%>\n";
70 print "<tr $tb> <td><b>$text{'host_header_m'}</b></td> </tr>\n";
71 print "<tr $cb> <td><table width=100%>\n";
74 foreach $m (sort { $a->{'desc'} cmp $b->{'desc'} } @modules) {
75 print "<tr>\n" if ($i%3 == 0);
76 print "<td width=33%><a href='edit_mod.cgi?mod=$m->{'dir'}&host=$in{'id'}'>",$m->{'desc'},"</td>\n";
77 print "</tr>\n" if ($i%3 == 2);
82 print "</table></td></tr>\n";
83 print "<tr $tb> <td><b>$text{'host_header_t'}</b></td> </tr>\n";
84 print "<tr $cb> <td><table width=100%>\n";
85 foreach $t (sort { $a->{'desc'} cmp $b->{'desc'} } @themes) {
86 print "<tr>\n" if ($i%3 == 0);
87 print "<td width=33%><a href='edit_mod.cgi?theme=$t->{'dir'}$in{'id'}'>",$t->{'desc'},"</td>\n";
88 print "</tr>\n" if ($i%3 == 2);
92 print "</table></td></tr></table><br>\n";
94 &ui_print_footer("", $text{'index_return'});