mirror of
https://github.com/webmin/webmin.git
synced 2026-02-03 14:13:29 +00:00
ui-lib conversion
This commit is contained in:
@@ -12,18 +12,12 @@ if ($in{'manual'}) {
|
||||
# Display manual edit form
|
||||
&ui_print_header(undef, $text{'feature_manual'}, "");
|
||||
|
||||
print "<form action=manual_features.cgi method=post ",
|
||||
"enctype=multipart/form-data>\n";
|
||||
print &ui_form_start("manual_features.cgi", "form-data");
|
||||
print &text('feature_mdesc', "<tt>$config{'sendmail_mc'}</tt>"),
|
||||
"<br>\n";
|
||||
print "<textarea name=data rows=20 cols=80>";
|
||||
open(FEAT, $config{'sendmail_mc'});
|
||||
while(<FEAT>) {
|
||||
print &html_escape($_);
|
||||
}
|
||||
close(FEAT);
|
||||
print "</textarea><br>\n";
|
||||
print "<input type=submit value='$text{'save'}'></form>\n";
|
||||
print &ui_textarea("data", &read_file_contents($config{'sendmail_mc'}),
|
||||
20, 80);
|
||||
print &ui_form_end([ [ undef, $text{'save'} ] ]);
|
||||
|
||||
&ui_print_footer("list_features.cgi", $text{'features_return'});
|
||||
exit;
|
||||
@@ -38,103 +32,71 @@ else {
|
||||
$feature = $features[$in{'idx'}];
|
||||
}
|
||||
|
||||
print "<form action=save_feature.cgi>\n";
|
||||
print "<input type=hidden name=new value='$in{'new'}'>\n";
|
||||
print "<input type=hidden name=idx value='$in{'idx'}'>\n";
|
||||
print "<input type=hidden name=type value='$feature->{'type'}'>\n";
|
||||
|
||||
print "<table border width=100%>\n";
|
||||
print "<tr $tb> <td><b>$text{'feature_header'}</b></td> </tr>\n";
|
||||
print "<tr $cb> <td><table>\n";
|
||||
print &ui_form_start("save_feature.cgi", "post");
|
||||
print &ui_hidden("new", $in{'new'});
|
||||
print &ui_hidden("idx", $in{'idx'});
|
||||
print &ui_hidden("type", $feature->{'type'});
|
||||
print &ui_table_start($text{'feature_header'}, "width=100%", 2);
|
||||
|
||||
# Current value
|
||||
if (!$in{'new'} && $feature->{'type'}) {
|
||||
print "<tr> <td><b>$text{'feature_old'}</b></td>\n";
|
||||
print "<td><tt>$feature->{'text'}</tt></td> </tr>\n";
|
||||
print &ui_table_row($text{'feature_old'},
|
||||
"<tt>".&html_escape($feature->{'text'})."</tt>");
|
||||
}
|
||||
|
||||
if ($feature->{'type'} == 0) {
|
||||
# Unsupported text line
|
||||
print "<tr> <td><b>$text{'feature_text'}</b></td>\n";
|
||||
printf "<td><input name=text size=80 value='%s'></td> </tr>\n",
|
||||
&html_escape($feature->{'text'});
|
||||
print &ui_table_row($text{'feature_text'},
|
||||
&ui_textbox("text", $feature->{'text'}, 80));
|
||||
}
|
||||
elsif ($feature->{'type'} == 1) {
|
||||
# A FEATURE() definition
|
||||
print "<tr> <td><b>$text{'feature_feat'}</b></td>\n";
|
||||
print "<td><select name=name>\n";
|
||||
foreach $f (&list_feature_types()) {
|
||||
printf "<option value=%s %s>%s</option>\n",
|
||||
$f->[0], $feature->{'name'} eq $f->[0] ? 'selected' : '',
|
||||
$f->[1];
|
||||
}
|
||||
print "</select></td> </tr>\n";
|
||||
print &ui_table_row($text{'feature_feat'},
|
||||
&ui_select("name", $feature->{'name'},
|
||||
[ &list_feature_types() ]));
|
||||
|
||||
print "<tr> <td valign=top><b>$text{'feature_values'}</b></td> <td>\n";
|
||||
local @v = @{$feature->{'values'}};
|
||||
@v = ( "" ) if (!@v);
|
||||
local @vals;
|
||||
for($i=0; $i<=@v; $i++) {
|
||||
print "<input name=value_$i size=50 value='$v[$i]'><br>\n";
|
||||
push(@vals, &ui_textbox("value_$i", $v[$i], 50));
|
||||
}
|
||||
print "</td> </tr>\n";
|
||||
print &ui_table_row($text{'feature_values'},
|
||||
join("<br>\n", @vals));
|
||||
}
|
||||
elsif ($feature->{'type'} == 2 || $feature->{'type'} == 3) {
|
||||
# A define() or undefine()
|
||||
print "<tr> <td><b>$text{'feature_def'}</b></td>\n";
|
||||
print "<td><select name=name>\n";
|
||||
foreach $d (&list_define_types()) {
|
||||
printf "<option value=%s %s>%s</option>\n",
|
||||
$d->[0], $d->[0] eq $feature->{'name'} ? "selected" : "",
|
||||
$d->[1];
|
||||
$found++ if ($d->[0] eq $feature->{'name'});
|
||||
}
|
||||
print "<option value=$feature->{'name'} selected>$feature->{'name'}</option>\n"
|
||||
if (!$found && !$in{'new'});
|
||||
print "</select>\n";
|
||||
print &ui_table_row($text{'feature_def'},
|
||||
&ui_select("name", $feature->{'name'},
|
||||
[ &list_define_types() ], 1, 0, 1));
|
||||
|
||||
print "<tr> <td valign=top><b>$text{'feature_defval'}</b></td>\n";
|
||||
print "<td valign=top>\n";
|
||||
printf "<input type=radio name=undef value=0 %s> %s\n",
|
||||
$feature->{'type'} == 2 ? "checked" : "", $text{'feature_defmode1'};
|
||||
printf "<input name=value size=50 value='%s'><br>\n",
|
||||
$feature->{'value'};
|
||||
printf "<input type=radio name=undef value=1 %s> %s\n",
|
||||
$feature->{'type'} == 3 ? "checked" : "", $text{'feature_defmode0'};
|
||||
print "</td> </tr>\n";
|
||||
print &ui_table_row($text{'feature_defval'},
|
||||
&ui_radio("undef", $feature->{'type'} == 2 ? 0 : 1,
|
||||
[ [ 0, $text{'feature_defmode1'}." ".
|
||||
&ui_textbox("value", $feature->{'value'}, 50) ],
|
||||
[ 1, $text{'feature_defmode0'} ] ]));
|
||||
}
|
||||
elsif ($feature->{'type'} == 4) {
|
||||
# A MAILER() definition
|
||||
print "<tr> <td><b>$text{'feature_mailer'}</b></td>\n";
|
||||
print "<td><select name=mailer>\n";
|
||||
foreach $m (&list_mailer_types()) {
|
||||
printf "<option value=%s %s>%s</option>\n",
|
||||
$m->[0], $feature->{'mailer'} eq $m->[0] ? 'selected' : '',
|
||||
$m->[1];
|
||||
}
|
||||
print "</select></td> </tr>\n";
|
||||
print &ui_table_row($text{'feature_mailer'},
|
||||
&ui_select("mailer", $feature->{'mailer'},
|
||||
[ &list_mailer_types() ]));
|
||||
}
|
||||
elsif ($feature->{'type'} == 5) {
|
||||
# An OSTYPE() definition
|
||||
print "<tr> <td><b>$text{'feature_ostype'}</b></td>\n";
|
||||
print "<td><select name=ostype>\n";
|
||||
foreach $m (&list_ostype_types()) {
|
||||
printf "<option value=%s %s>%s</option>\n",
|
||||
$m->[0], $feature->{'ostype'} eq $m->[0] ? 'selected' : '',
|
||||
$m->[1];
|
||||
}
|
||||
print "</select></td> </tr>\n";
|
||||
print &ui_table_row($text{'feature_ostype'},
|
||||
&ui_select("ostype", $feature->{'ostype'},
|
||||
[ &list_ostype_types() ]));
|
||||
}
|
||||
|
||||
print "</table></td></tr></table>\n";
|
||||
print "<table width=100%><tr>\n";
|
||||
print &ui_table_end();
|
||||
if ($in{'new'}) {
|
||||
print "<td><input type=submit value='$text{'create'}'></td>\n";
|
||||
print &ui_form_end([ [ undef, $text{'create'} ] ]);
|
||||
}
|
||||
else {
|
||||
print "<td><input type=submit value='$text{'save'}'></td>\n";
|
||||
print "<td align=right><input type=submit name=delete ",
|
||||
"value='$text{'delete'}'></td>\n";
|
||||
print &ui_form_end([ [ undef, $text{'save'} ],
|
||||
[ 'delete', $text{'delete'} ] ]);
|
||||
}
|
||||
print "</tr></table></form>\n";
|
||||
|
||||
&ui_print_footer("list_features.cgi", $text{'features_return'});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user