2 # Shows hosts on which Usermin is installed
4 require './cluster-usermin-lib.pl';
5 &ui_print_header(undef, $text{'index_title'}, "", "intro", 1, 1);
7 # Display hosts on which modules will be installed
8 print &ui_subheading($text{'index_hosts'});
9 @servers = &list_servers();
10 @hosts = &list_usermin_hosts();
11 if ($config{'sort_mode'} == 1) {
12 @hosts = sort { my ($as) = grep { $_->{'id'} == $a->{'id'} } @servers;
13 my ($bs) = grep { $_->{'id'} == $b->{'id'} } @servers;
14 lc($as->{'host'}) cmp lc($bs->{'host'}) } @hosts;
16 elsif ($config{'sort_mode'} == 2) {
17 @hosts = sort { my ($as) = grep { $_->{'id'} == $a->{'id'} } @servers;
18 my ($bs) = grep { $_->{'id'} == $b->{'id'} } @servers;
19 lc(&server_name($as)) cmp lc(&server_name($bs)) }@hosts;
23 local ($s) = grep { $_->{'id'} == $h->{'id'} } @servers;
25 push(@titles, &server_name($s)."<br>".
26 &text('index_version', $h->{'version'}));
27 push(@links, "edit_host.cgi?id=$h->{'id'}");
28 push(@icons, "$gconfig{'webprefix'}/servers/images/$s->{'type'}.gif");
29 $gothost{$h->{'id'}}++;
32 if ($config{'table_mode'}) {
34 print &ui_columns_start([ $text{'index_thost'},
37 $text{'index_ttype'} ]);
39 local ($s) = grep { $_->{'id'} == $h->{'id'} } @servers;
41 local ($type) = grep { $_->[0] eq $s->{'type'} }
42 @servers::server_types;
43 print &ui_columns_row([
44 "<a href='edit_host.cgi?id=$h->{'id'}'>".
45 ($s->{'host'} || &get_system_hostname())."</a>",
51 print &ui_columns_end();
55 &icons_table(\@links, \@titles, \@icons);
59 print "<b>$text{'index_nohosts'}</b><p>\n";
62 # Build common selectors
63 @wgroups = &all_groups(\@hosts);
64 $modsel2 = $modsel = "<select name=mod>\n";
65 $modsel2 .= "<option value=''>$text{'index_gacl'}\n";
66 foreach $m (&all_modules(\@hosts)) {
67 $modsel .= "<option value=$m->{'dir'}>$m->{'desc'}\n";
68 $modsel2 .= "<option value=$m->{'dir'}>$m->{'desc'}\n";
70 $modsel .= "</select>\n";
71 $modsel2 .= "</select>\n";
72 $themesel = "<select name=theme>\n";
73 foreach $t (&all_themes(\@hosts)) {
74 $themesel .= "<option value=$t->{'dir'}>$t->{'desc'}\n";
76 $themesel .= "</select>\n";
78 # Show button for adding server
79 print "<table width=100%><tr>\n";
80 @addservers = grep { !$gothost{$_->{'id'}} } @servers;
82 print "<form action=add.cgi><td>\n";
83 print "<input type=submit name=add value='$text{'index_add'}'>\n";
84 print "<select name=server>\n";
85 foreach $s (@addservers) {
86 print "<option value=$s->{'id'}>",&server_name($s),"\n";
89 print "</td></form>\n";
92 else { print "<td></td>\n"; }
94 # Show button for adding server group
95 @groups = &servers::list_all_groups(\@servers);
97 print "<form action=add.cgi><td align=right>\n";
98 print "<input type=submit name=gadd value='$text{'index_gadd'}'>\n";
99 print "<select name=group>\n";
100 foreach $g (@groups) {
101 print "<option>$g->{'name'}\n";
104 print "</td></form>\n";
107 else { print "<td></td>\n"; }
108 print "</tr></table>\n";
111 # Display modules lists and new module form
113 print &ui_subheading($text{'index_modules'});
114 print "<table width=100%><tr>\n";
115 print "<form action=edit_mod.cgi><td>\n";
116 print "<input type=submit value=\"$text{'index_edit'}\">\n";
120 print "<td align=right><input type=submit name=tedit value=\"$text{'index_tedit'}\">\n";
122 print "</td></form></tr>\n";
125 print "<tr> <form action=refresh.cgi><td align=left colspan=2>\n";
126 print "<input type=submit value='$text{'index_refresh'}'>\n";
127 &create_on_input(undef, 1, 1);
128 print "</td></form>\n";
130 print "</table><p>\n";
132 print "<form action=install.cgi method=post ",
133 "enctype=multipart/form-data>\n";
134 print "$text{'index_installmsg'}<p>\n";
135 print "<input type=radio name=source value=0 checked> $text{'index_local'}\n";
136 print "<input name=local size=50>\n";
137 print &file_chooser_button("local", 0, $formno); print "<br>\n";
138 print "<input type=radio name=source value=1> $text{'index_uploaded'}\n";
139 print "<input type=file name=upload size=20><br>\n";
140 print "<input type=radio name=source value=2> $text{'index_ftp'}\n";
141 print "<input name=url size=50><br>\n";
142 print " " x 5,"<input type=checkbox name=down value=1> ",
143 "$text{'index_down'}<p>\n";
145 print "<input type=checkbox name=nodeps value=1> ",
146 "$text{'index_nodeps'}<br>\n";
148 print "$text{'index_installon'}\n";
152 print "<input type=submit value=\"$text{'index_installok'}\">\n";
156 # Display upgrade form
157 &foreign_require("webmin", "webmin-lib.pl");
159 print &ui_subheading($text{'index_upgrade'});
160 print "$text{'index_updesc'}<p>\n";
162 # what kind of install is the local system?
163 $mode = &usermin::get_install_type();
165 print "<form action=upgrade.cgi method=post enctype=multipart/form-data>\n";
166 print "<input type=hidden name=mode value='$mode'>\n";
168 print "<input type=radio name=source value=0> $text{'index_local'}\n";
169 print "<input name=file size=40>\n";
170 print &file_chooser_button("file", 0, $formno),"<br>\n";
171 print "<input type=radio name=source value=1> $text{'index_uploaded'}\n";
172 print "<input name=upload type=file size=30><br>\n";
173 print "<input type=radio name=source value=5> $text{'index_ftp'}\n";
174 print "<input name=url size=40><br>\n";
175 if ($in{'mode'} eq 'rpm' || !$in{'mode'}) {
176 print "<input type=radio name=source value=2 checked> $webmin::text{'upgrade_ftp'}<br>\n";
180 print "<input type=checkbox name=delete value=1> ",
181 "$webmin::text{'upgrade_delete'}<br>\n";
182 print "$text{'index_upgradeon'}\n";
184 print "<input type=submit value=\"$usermin::text{'upgrade_ok'}\">\n";
189 &ui_print_footer("/", $text{'index'});