2 # Display a form for editing this module's configuration on multiple hosts
4 require './cluster-webmin-lib.pl';
5 require '../config-lib.pl';
8 # Work out which hosts were selected
9 @hosts = &list_webmin_hosts();
10 @servers = &list_servers();
12 local ($got) = grep { $_->{'dir'} eq $in{'mod'} } @{$h->{'modules'}};
15 $gothosts{$h->{'id'}} = 1;
18 @hosts = &create_on_parse(undef, \@gothosts, $in{'mod'}, 1);
19 @hosts = grep { $gothosts{$_->{'id'}} } @hosts;
20 @hosts || &error($text{'config_enone'});
21 %minfo = &get_module_info($in{'mod'});
22 %minfo || &error($text{'config_ethis'});
24 # Get the config on the first host, or the local host
25 ($getfrom) = grep { $_->{'id'} == 0 } @hosts;
26 $getfrom ||= $hosts[0];
27 ($serv) = grep { $_->{'id'} == $getfrom->{'id'} } @servers;
28 &remote_foreign_require($serv->{'host'}, "webmin", "webmin-lib.pl");
29 %fconfig = &remote_foreign_call($serv->{'host'}, "webmin", "foreign_config",
32 # Show the config editor
33 %descmap = map { $_->{'id'}, $_->{'desc'} || $_->{'host'} } @servers;
34 $ondesc = $in{'server'} == -1 ? $text{'config_all'} :
35 $in{'server'} == -3 ? $text{'config_have'} :
36 $in{'server'} =~ /^group_(.*)/ ? &text('config_group', "$1") :
37 &text('config_on', $descmap{$in{'server'}});
38 &ui_print_header($ondesc, $text{'config_title'}, "");
40 print &ui_form_start("save_config.cgi", "post");
41 print &ui_hidden("mod", $in{'mod'});
43 print &ui_hidden("_host", $h->{'id'});
45 print &ui_hidden("_getfrom", $getfrom->{'id'});
46 print &ui_table_start(&text('config_header', $minfo{'desc'}), "100%", 2);
48 $mdir = &module_root_directory($in{'mod'});
49 if (-r "$mdir/config_info.pl") {
50 # Module has a custom config editor
51 &foreign_require($in{'mod'}, "config_info.pl");
52 if (&foreign_defined($in{'mod'}, "config_form")) {
54 &foreign_call($in{'mod'}, "config_form", \%fconfig);
58 # Use config.info to create config inputs
59 &generate_config(\%fconfig, "$mdir/config.info", $in{'mod'});
61 print &ui_table_end();
62 print &ui_form_end([ [ "save", $text{'save'} ] ]);
64 &ui_print_footer("", $text{'index_return'});