#!/usr/local/bin/perl # edit_pack.cgi # Display details of a package require './cluster-software-lib.pl'; &ReadParse(); &ui_print_header(undef, $text{'edit_title'}, "", "edit_pack"); # Find all hosts with the package @hosts = &list_software_hosts(); @servers = &list_servers(); foreach $h (@hosts) { foreach $p (@{$h->{'packages'}}) { if ($p->{'name'} eq $in{'package'}) { local ($s) = grep { $_->{'id'} == $h->{'id'} } @servers; push(@got, $s); $version{$s} = $p->{'version'}; $pkg = $p if (!$pkg); $checkon = $s if (!$s->{'id'}); } } } # Get the details from this host, or the first in the list $checkon = $got[0] if (!$checkon); &remote_foreign_require($checkon->{'host'}, "software", "software-lib.pl"); @pinfo = &remote_foreign_call($checkon->{'host'}, "software", "package_info", $in{'package'}); # Show package details print "\n"; print "\n"; print "
",&text('edit_details', $checkon->{'desc'} ? $checkon->{'desc'} : "$checkon->{'host'}"),"
\n"; # Description, if we have one if ($pinfo[2]) { print "\n"; print "\n"; } print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
$text{'edit_desc'}
",
	      &html_escape(&entities_to_ascii($pinfo[2])),
	      "
$text{'edit_pack'} $pinfo[0]$text{'edit_class'} ", $pinfo[1] ? $pinfo[1] : $text{'edit_none'},"
$text{'edit_ver'} $pinfo[4]$text{'edit_vend'} $pinfo[5]
$text{'edit_arch'} $pinfo[3]$text{'edit_inst'} $pinfo[6]

\n"; print "\n"; # Show button to list files, if possible if (!$pinfo[8]) { print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } # Show button to un-install, if possible if (!$pinfo[7]) { print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } print "
\n"; print "
\n"; print "\n"; print "

\n"; # Show hosts with the package print &ui_hr(); print &ui_subheading($text{'edit_hosts'}); @icons = map { "/servers/images/$_->{'type'}.gif" } @got; @links = map { "edit_host.cgi?id=$_->{'id'}" } @got; @titles = map { ($_->{'desc'} ? $_->{'desc'} : $_->{'realhost'} ? "$_->{'realhost'}:$_->{'port'}" : "$_->{'host'}:$_->{'port'}"). ($version{$_} ? "
$text{'edit_ver'} $version{$_}" : "") } @got; &icons_table(\@links, \@titles, \@icons); &remote_finished(); if ($in{'search'}) { &ui_print_footer("search.cgi?search=$in{'search'}", $text{'search_return'}); } else { &ui_print_footer("", $text{'index_return'}); }