#!/usr/local/bin/perl # index.cgi # Display hosts on which software packages are being managed, a form for # finding existing packages and a form for installing more require './cluster-software-lib.pl'; &ui_print_header(undef, $text{'index_title'}, "", "intro", 1, 1); # Display hosts on which software will be installed print &ui_subheading($text{'index_hosts'}); @servers = &list_servers(); @hosts = &list_software_hosts(); if ($config{'sort_mode'} == 1) { @hosts = sort { my ($as) = grep { $_->{'id'} == $a->{'id'} } @servers; my ($bs) = grep { $_->{'id'} == $b->{'id'} } @servers; lc($as->{'host'}) cmp lc($bs->{'host'}) } @hosts; } elsif ($config{'sort_mode'} == 2) { @hosts = sort { my ($as) = grep { $_->{'id'} == $a->{'id'} } @servers; my ($bs) = grep { $_->{'id'} == $b->{'id'} } @servers; lc(&server_name($as)) cmp lc(&server_name($bs)) }@hosts; } $formno = 0; foreach $h (@hosts) { local ($s) = grep { $_->{'id'} == $h->{'id'} } @servers; next if (!$s); local $count = @{$h->{'packages'}}; push(@titles, ($s->{'desc'} ? $s->{'desc'} : $s->{'realhost'} ? "$s->{'realhost'}:$s->{'port'}" : "$s->{'host'}:$s->{'port'}")."
". &text('index_count', $count)); push(@links, "edit_host.cgi?id=$h->{'id'}"); push(@icons, "$gconfig{'webprefix'}/servers/images/$s->{'type'}.gif"); push(@installed, $count); $gothost{$h->{'id'}}++; } if (@links) { if ($config{'table_mode'}) { # Show as table print &ui_columns_start([ $text{'index_thost'}, $text{'index_tdesc'}, $text{'index_tcount'}, $text{'index_ttype'} ]); foreach $h (@hosts) { local ($s) = grep { $_->{'id'} == $h->{'id'} } @servers; next if (!$s); local ($type) = grep { $_->[0] eq $s->{'type'} } @servers::server_types; print &ui_columns_row([ "". ($s->{'host'} || &get_system_hostname())."", $s->{'desc'}, scalar(@{$h->{'packages'}}), $type->[1], ]); } print &ui_columns_end(); } else { # Show as icons &icons_table(\@links, \@titles, \@icons); } } else { print "$text{'index_nohosts'}

\n"; } $formno++; # Show form for adding a server print "\n"; @addservers = grep { !$gothost{$_->{'id'}} } @servers; if (@addservers && $access{'add'}) { print "\n"; print "\n"; print "\n"; } # Show button for compare form if (@hosts) { print "\n"; print "\n"; print "\n"; } # Show form for adding a group of servers @groups = &servers::list_all_groups(\@servers); if (@groups && $access{'add'}) { print "\n"; print "\n"; print "\n"; } print "
\n"; print "\n"; print "
\n"; print "\n"; print "
\n"; print "\n"; print "
\n"; if (@hosts) { # Display search form print &ui_hr(); print &ui_subheading($text{'index_installed'}); print "\n"; print "
\n"; $formno += 2; print "
\n"; print "\n"; print "\n"; print "
\n"; print "\n"; &create_on_input(undef, 1, 1); print "
\n"; # Display cross-cluster install form print &ui_hr(); print &ui_subheading($text{'index_install'}); print "$text{'index_installmsg'}

\n"; $upid = time().$$; print &ui_form_start("install_pack.cgi?id=$upid", "form-data", undef, &read_parse_mime_javascript($upid, [ "upload" ])),"\n"; @opts = ( ); push(@opts, [ 0, $text{'index_local'}, &ui_textbox("local", undef, 50)."\n". &file_chooser_button("local", 0, 2) ]); push(@opts, [ 1, $text{'index_uploaded'}, &ui_upload("upload", 50) ]); push(@opts, [ 2, $text{'index_ftp'}, &ui_textbox("url", undef, 50)."
\n". &ui_checkbox("down", 1, $text{'index_down'}, 0) ]); if ($software::has_update_system) { push(@opts, [ 3, $software::text{$software::update_system.'_input'}, &ui_textbox("update", undef, 30)."\n". &software::update_system_button("update", $software::text{$software::update_system.'_find'}) ]); } print &ui_radio_table("source", 0, \@opts); print &ui_submit($text{'index_installok'}),"\n"; print &ui_form_end(); } &ui_print_footer("/", $text{'index'});