3 # Display hosts on which webmin modules are being managed, a list of
4 # installed modules and a form for installing new ones
6 require './cluster-webmin-lib.pl';
7 &ui_print_header(undef, $text{'index_title'}, "", "intro", 1, 1);
9 # Display hosts on which modules will be installed
10 print &ui_subheading($text{'index_hosts'});
11 @servers = &list_servers();
12 @hosts = &list_webmin_hosts();
13 if ($config{'sort_mode'} == 1) {
14 @hosts = sort { my ($as) = grep { $_->{'id'} == $a->{'id'} } @servers;
15 my ($bs) = grep { $_->{'id'} == $b->{'id'} } @servers;
16 lc($as->{'host'}) cmp lc($bs->{'host'}) } @hosts;
18 elsif ($config{'sort_mode'} == 2) {
19 @hosts = sort { my ($as) = grep { $_->{'id'} == $a->{'id'} } @servers;
20 my ($bs) = grep { $_->{'id'} == $b->{'id'} } @servers;
21 lc(&server_name($as)) cmp lc(&server_name($bs)) }@hosts;
25 local ($s) = grep { $_->{'id'} == $h->{'id'} } @servers;
27 push(@titles, &server_name($s)."<br>".
28 &text('index_version', $h->{'version'}));
29 push(@links, "edit_host.cgi?id=$h->{'id'}");
30 push(@icons, "$gconfig{'webprefix'}/servers/images/$s->{'type'}.gif");
31 $gothost{$h->{'id'}}++;
34 if ($config{'table_mode'}) {
36 print &ui_columns_start([ $text{'index_thost'},
39 $text{'index_ttype'} ]);
41 local ($s) = grep { $_->{'id'} == $h->{'id'} } @servers;
43 local ($type) = grep { $_->[0] eq $s->{'type'} }
44 @servers::server_types;
45 print &ui_columns_row([
46 "<a href='edit_host.cgi?id=$h->{'id'}'>".
47 ($s->{'host'} || &get_system_hostname())."</a>",
53 print &ui_columns_end();
57 &icons_table(\@links, \@titles, \@icons);
62 print "<b>$text{'index_nohosts'}</b><p>\n";
65 # Build common selectors
66 @wgroups = &all_groups(\@hosts);
67 $modsel2 = $modsel = "<select name=mod>\n";
68 $modsel2 .= "<option value=''>$text{'index_gacl'}\n";
69 foreach $m (&all_modules(\@hosts)) {
70 $modsel .= "<option value=$m->{'dir'}>$m->{'desc'}\n";
71 $modsel2 .= "<option value=$m->{'dir'}>$m->{'desc'}\n";
73 $modsel .= "</select>\n";
74 $modsel2 .= "</select>\n";
75 $themesel = "<select name=theme>\n";
76 foreach $t (&all_themes(\@hosts)) {
77 $themesel .= "<option value=$t->{'dir'}>$t->{'desc'}\n";
79 $themesel .= "</select>\n";
80 $usersel = "<select name=user>\n";
81 foreach $u (&all_users(\@hosts)) {
82 $usersel .= "<option>$u->{'name'}\n";
84 $usersel .= "</select>\n";
85 $groupsel = "<select name=group>\n";
86 foreach $u (@wgroups) {
87 $groupsel .= "<option>$u->{'name'}\n";
89 $groupsel .= "</select>\n";
91 print "<table width=100%><tr>\n";
92 @addservers = grep { !$gothost{$_->{'id'}} } @servers;
94 print "<form action=add.cgi><td>\n";
95 print "<input type=submit name=add value='$text{'index_add'}'>\n";
96 print "<select name=server>\n";
97 foreach $s (@addservers) {
98 print "<option value=$s->{'id'}>",&server_name($s),"\n";
101 print "</td></form>\n";
104 else { print "<td></td>\n"; }
106 @groups = &servers::list_all_groups(\@servers);
108 print "<form action=add.cgi><td align=right>\n";
109 print "<input type=submit name=gadd value='$text{'index_gadd'}'>\n";
110 print "<select name=group>\n";
111 foreach $g (@groups) {
112 print "<option>$g->{'name'}\n";
115 print "</td></form>\n";
118 else { print "<td></td>\n"; }
119 print "</tr></table>\n";
122 # Display user search forms and new user buttons
124 print &ui_subheading($text{'index_users'});
125 print "<table width=100%>\n";
127 print "<tr><form action=edit_user.cgi><td>\n";
128 print "<input type=submit value='$text{'index_euser'}'>\n";
130 print "</td></form>\n";
133 print "<form action=edit_acl.cgi><td>\n";
134 print "<input type=submit value='$text{'index_euseracl'}'>\n";
136 print "$text{'index_inmod'}\n";
138 print "</td></form>\n";
141 print "<form action=user_form.cgi><td align=right>\n";
142 print "<input type=submit value='$text{'index_cuser'}'>\n";
143 print "</td></form></tr>\n";
147 print "<tr><form action=edit_group.cgi><td>\n";
148 print "<input type=submit value='$text{'index_egroup'}'>\n";
150 print "</td></form>\n";
153 print "<form action=edit_acl.cgi><td>\n";
154 print "<input type=submit value='$text{'index_egroupacl'}'>\n";
156 print "$text{'index_inmod'}\n";
158 print "</td></form>\n";
162 print "<tr> <td colspan=2></td>\n";
165 print "<form action=group_form.cgi><td align=right>\n";
166 print "<input type=submit value='$text{'index_cgroup'}'>\n";
167 print "</td></form></tr>\n";
170 print "<tr> <form action=refresh.cgi><td align=left colspan=2>\n";
171 print "<input type=submit value='$text{'index_refresh'}'>\n";
172 &create_on_input(undef, 1, 1);
173 print "</td></form>\n";
176 print "<form action=sync_form.cgi><td align=right>\n";
177 print "<input type=submit value='$text{'index_sync'}'>\n";
178 print "</td></form></tr>\n";
183 # Display modules lists and new module form
185 print &ui_subheading($text{'index_modules'});
186 print "<table width=100%><tr>\n";
187 print "<form action=edit_mod.cgi><td>\n";
188 print "<input type=submit value=\"$text{'index_edit'}\">\n";
192 print "<td align=right><input type=submit name=tedit value=\"$text{'index_tedit'}\">\n";
194 print "</td></form></tr></table><p>\n";
197 print "<form action=install.cgi method=post ",
198 "enctype=multipart/form-data>\n";
199 print "$text{'index_installmsg'}<p>\n";
200 print "<input type=radio name=source value=0 checked> $text{'index_local'}\n";
201 print "<input name=local size=50>\n";
202 print &file_chooser_button("local", 0, $formno); print "<br>\n";
203 print "<input type=radio name=source value=1> $text{'index_uploaded'}\n";
204 print "<input type=file name=upload size=20><br>\n";
205 print "<input type=radio name=source value=2> $text{'index_ftp'}\n";
206 print "<input name=url size=50><br>\n";
207 print " " x 5,"<input type=checkbox name=down value=1> ",
208 "$text{'index_down'}<p>\n";
210 print "<input type=radio name=grant value=0 checked> ",
211 "$text{'index_grant2'}\n";
212 print "<input name=grantto size=30 value='$base_remote_user'><br>\n";
213 print "<input type=radio name=grant value=1> ",
214 "$text{'index_grant1'}<br>\n";
216 print "<input type=checkbox name=nodeps value=1> ",
217 "$text{'index_nodeps'}<p>\n";
219 print "$text{'index_installon'}\n";
223 print "<input type=submit value=\"$text{'index_installok'}\">\n";
227 # Display upgrade form
228 &foreign_require("webmin", "webmin-lib.pl");
230 print &ui_subheading($text{'index_upgrade'});
231 print "$text{'index_updesc'}<p>\n";
233 # what kind of install is the local system?
234 $mode = &webmin::get_install_type();
236 print "<form action=upgrade.cgi method=post enctype=multipart/form-data>\n";
237 print "<input type=hidden name=mode value='$mode'>\n";
239 print "<input type=radio name=source value=0> $text{'index_local'}\n";
240 print "<input name=file size=40>\n";
241 print &file_chooser_button("file", 0, $formno),"<br>\n";
242 print "<input type=radio name=source value=1> $text{'index_uploaded'}\n";
243 print "<input name=upload type=file size=30><br>\n";
244 print "<input type=radio name=source value=5> $text{'index_ftp'}\n";
245 print "<input name=url size=40><br>\n";
246 if ($in{'mode'} eq 'rpm' || $mode eq 'deb' || !$in{'mode'}) {
247 print "<input type=radio name=source value=2 checked> $webmin::text{'upgrade_ftp'}<br>\n";
251 printf "<input type=checkbox name=sig value=1> %s<br>\n",
252 $webmin::text{'upgrade_sig'};
253 print "<input type=checkbox name=delete value=1> ",
254 "$webmin::text{'upgrade_delete'}<br>\n";
255 print "<input type=checkbox name=only value=1> ",
256 "$webmin::text{'upgrade_only'}<br>\n";
257 print "$text{'index_upgradeon'}\n";
259 print "<input type=submit value=\"$webmin::text{'upgrade_ok'}\">\n";
263 # Show form for installing updates
265 print &ui_subheading($text{'index_update'});
266 print "$text{'index_updatedesc'}<p>\n";
267 print "<form action=update.cgi>\n";
269 printf "<input type=radio name=source value=0 %s> %s<br>\n",
270 $webmin::config{'upsource'} ? "" : "checked",
271 $webmin::text{'update_webmin'};
272 printf "<input type=radio name=source value=1 %s> %s\n",
273 $webmin::config{'upsource'} ? "checked" : "",
274 $webmin::text{'update_other'};
275 printf "<input name=other size=30 value='%s'><p>\n",
276 $webmin::config{'upsource'};
278 printf "<input type=checkbox name=show value=1 %s> %s<br>\n",
279 $webmin::config{'upshow'} ? "checked" : "",
280 $webmin::text{'update_show'};
281 printf "<input type=checkbox name=missing value=1 %s> %s<br>\n",
282 $webmin::config{'upmissing'} ? "checked" : "",
283 $webmin::text{'update_missing'};
284 printf "<input type=checkbox name=third value=1 %s> %s<br>\n",
285 $webmin::config{'upthird'} ? "checked" : "",
286 $webmin::text{'update_third'};
288 print "$text{'index_updateon'}\n";
289 &create_on_input(undef, 1);
291 print "<input type=submit value=\"$webmin::text{'update_ok'}\">\n";
295 &ui_print_footer("/", $text{'index'});