3 # Display details of a package
5 require './cluster-software-lib.pl';
7 &ui_print_header(undef, $text{'edit_title'}, "", "edit_pack");
9 # Find all hosts with the package
10 @hosts = &list_software_hosts();
11 @servers = &list_servers();
13 foreach $p (@{$h->{'packages'}}) {
14 if ($p->{'name'} eq $in{'package'}) {
15 local ($s) = grep { $_->{'id'} == $h->{'id'} } @servers;
17 $version{$s} = $p->{'version'};
19 $checkon = $s if (!$s->{'id'});
24 # Get the details from this host, or the first in the list
25 $checkon = $got[0] if (!$checkon);
26 &remote_foreign_require($checkon->{'host'}, "software", "software-lib.pl");
27 @pinfo = &remote_foreign_call($checkon->{'host'}, "software", "package_info",
30 # Show package details
31 print "<table border width=100%>\n";
32 print "<tr $tb> <td><b>",&text('edit_details', $checkon->{'desc'} ?
33 $checkon->{'desc'} : "<tt>$checkon->{'host'}</tt>"),"</b></td> </tr>\n";
34 print "<tr $cb> <td><table width=100%>\n";
36 # Description, if we have one
38 print "<tr> <td valign=top width=20%><b>$text{'edit_desc'}</b></td>\n";
39 print "<td colspan=3><pre>",
40 &html_escape(&entities_to_ascii($pinfo[2])),
41 "</pre></td> </tr>\n";
44 print "<tr> <td width=20%><b>$text{'edit_pack'}</b></td> <td>$pinfo[0]</td>\n";
45 print "<td width=20%><b>$text{'edit_class'}</b></td> <td>",
46 $pinfo[1] ? $pinfo[1] : $text{'edit_none'},"</td> </tr>\n";
48 print "<tr> <td width=20%><b>$text{'edit_ver'}</b></td> <td>$pinfo[4]</td>\n";
49 print "<td width=20%><b>$text{'edit_vend'}</b></td> <td>$pinfo[5]</td> </tr>\n";
51 print "<tr> <td width=20%><b>$text{'edit_arch'}</b></td> <td>$pinfo[3]</td>\n";
52 print "<td width=20%><b>$text{'edit_inst'}</b></td> <td>$pinfo[6]</td> </tr>\n";
53 print "</table></td></tr></table><p>\n";
55 print "<table width=100%> <tr>\n";
57 # Show button to list files, if possible
59 print "<form action=list_pack.cgi>\n";
60 print "<input type=hidden name=package value=\"$pinfo[0]\">\n";
61 print "<input type=hidden name=search value=\"$in{'search'}\">\n";
62 print "<td align=left><input type=submit value=\"$text{'edit_list'}\">\n";
63 print "<select name=server>\n";
65 print "<option value='$s->{'id'}'>",
66 $s->{'desc'} || $s->{'realhost'} || $s->{'host'};
68 print "</select></td>\n";
72 # Show button to un-install, if possible
74 print "<form action=delete_pack.cgi>\n";
75 print "<input type=hidden name=package value=\"$pinfo[0]\">\n";
76 print "<input type=hidden name=search value=\"$in{'search'}\">\n";
77 print "<td align=right>\n";
78 print "<input type=submit value=\"$text{'edit_uninst'}\">\n";
79 print "<select name=server>\n";
80 print "<option value=-1>$text{'edit_all'}\n";
82 print "<option value='$s->{'id'}'>",
83 $s->{'desc'} || $s->{'realhost'} || $s->{'host'};
85 print "</select></td>\n";
89 print "</tr> </table><p>\n";
91 # Show hosts with the package
93 print &ui_subheading($text{'edit_hosts'});
94 @icons = map { "/servers/images/$_->{'type'}.gif" } @got;
95 @links = map { "edit_host.cgi?id=$_->{'id'}" } @got;
96 @titles = map { ($_->{'desc'} ? $_->{'desc'} :
97 $_->{'realhost'} ? "$_->{'realhost'}:$_->{'port'}" :
98 "$_->{'host'}:$_->{'port'}").
99 ($version{$_} ? "<br>$text{'edit_ver'} $version{$_}" : "") } @got;
100 &icons_table(\@links, \@titles, \@icons);
104 &ui_print_footer("search.cgi?search=$in{'search'}", $text{'search_return'});
107 &ui_print_footer("", $text{'index_return'});