forked from webmin/webmin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
edit_manual.cgi
executable file
·35 lines (30 loc) · 1.01 KB
/
edit_manual.cgi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/local/bin/perl
# Show a form to edit a config file
use strict;
use warnings;
require './iscsi-tgtd-lib.pl';
our (%text, %config, %in);
&ReadParse();
my $file = $in{'file'} || $config{'config_file'};
&ui_print_header(undef, $text{'manual_title'}, "");
# Config file selector
my $conf = &get_tgtd_config();
my @files = &unique($config{'config_file'},
(map { $_->{'file'} } @$conf));
print &ui_form_start("edit_manual.cgi");
print "<b>$text{'manual_file'}</b> ",
&ui_select("file", $file, \@files),"\n",
&ui_submit($text{'manual_ok'}),"<br>\n";
print &ui_form_end();
print &ui_hr();
# File editor
print "<b>",&text('manual_desc', "<tt>$file</tt>"),"</b><p>\n";
print &ui_form_start("save_manual.cgi", "form-data");
print &ui_hidden("file", $file);
print &ui_table_start(undef, undef, 2);
print &ui_table_row(undef,
&ui_textarea("data", &read_file_contents($file),
20, 80));
print &ui_table_end();
print &ui_form_end([ [ undef, $text{'save'} ] ]);
&ui_print_footer("", $text{'index_return'});