mirror of
https://github.com/webmin/webmin.git
synced 2026-02-03 06:03:28 +00:00
Allow editing of multiple configs
This commit is contained in:
@@ -19,3 +19,5 @@ Added fields for setting the index and control files locations.
|
||||
Added fields to the SSL page for an optional CA certificate file and private key password.
|
||||
---- Changes since 1.530 ----
|
||||
Added support for Dovecot 2.0, which renames many configuration directives and splits up the config using include files.
|
||||
---- Changes since 1.550 ----
|
||||
The Edit Config Files page can now be used to edit any of the Dovecot configuration files, for the case where there are many included configs.
|
||||
|
||||
@@ -3,12 +3,26 @@
|
||||
|
||||
require './dovecot-lib.pl';
|
||||
&ui_print_header(undef, $text{'manual_title'}, "");
|
||||
&ReadParse();
|
||||
$file = $in{'file'} || $config{'dovecot_config'};
|
||||
$conf = &get_config();
|
||||
@files = &unique(map { $_->{'file'} } @$conf);
|
||||
&indexof($file, @files) >= 0 || &error($text{'manual_efile'});
|
||||
|
||||
# Show the file selector
|
||||
print &ui_form_start("edit_manual.cgi");
|
||||
print "<b>$text{'manual_editsel'}</b>\n";
|
||||
print &ui_select("file", $file, \@files),"\n";
|
||||
print &ui_submit($text{'manual_ok'});
|
||||
print &ui_form_end();
|
||||
|
||||
# Show the file contents
|
||||
print &text('manual_desc', "<tt>$config{'dovecot_config'}</tt>"),"<p>\n";
|
||||
print &ui_form_start("save_manual.cgi", "form-data");
|
||||
$data = &read_file_contents($config{'dovecot_config'});
|
||||
print &ui_textarea("data", $data, 20, 80),"\n";
|
||||
print &ui_hidden("file", $file);
|
||||
print &ui_table_start(undef, undef, 2);
|
||||
$data = &read_file_contents($file);
|
||||
print &ui_table_row(undef, ui_textarea("data", $data, 20, 80), 2);
|
||||
print &ui_table_end();
|
||||
print &ui_form_end([ [ "save", $text{'save'} ] ]);
|
||||
|
||||
&ui_print_footer("", $text{'index_return'});
|
||||
|
||||
@@ -188,8 +188,11 @@ log_bootup=Enabled Dovecot at boot time
|
||||
log_bootdown=Disabled Dovecot at boot time
|
||||
log_manual=Manually edited config file $1
|
||||
|
||||
manual_title=Edit Config File
|
||||
manual_desc=Editing Dovecot configuration file $1 ..
|
||||
manual_title=Edit Config Files
|
||||
manual_editsel=Edit Dovecot configuration file
|
||||
manual_err=Failed to save config file
|
||||
manual_edata=Nothing entered!
|
||||
manual_efile=Selected configuration file is not valid
|
||||
manual_ok=Edit
|
||||
|
||||
__norefs=1
|
||||
|
||||
@@ -4,14 +4,17 @@
|
||||
require './dovecot-lib.pl';
|
||||
&ReadParseMime();
|
||||
&error_setup($text{'manual_err'});
|
||||
$conf = &get_config();
|
||||
@files = &unique(map { $_->{'file'} } @$conf);
|
||||
&indexof($in{'file'}, @files) >= 0 || &error($text{'manual_efile'});
|
||||
|
||||
$in{'data'} =~ s/\r//g;
|
||||
$in{'data'} =~ /\S/ || &error($text{'manual_edata'});
|
||||
|
||||
&open_lock_tempfile(DATA, ">$config{'dovecot_config'}");
|
||||
&open_lock_tempfile(DATA, ">$in{'file'}");
|
||||
&print_tempfile(DATA, $in{'data'});
|
||||
&close_tempfile(DATA);
|
||||
|
||||
&webmin_log("manual", undef, $config{'dovecot_config'});
|
||||
&webmin_log("manual", undef, $in{'file'});
|
||||
&redirect("");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user