#!/usr/local/bin/perl
# edit_ui.cgi
# Edit user interface options

require './webmin-lib.pl';
&header($text{'ui_title'}, "");
print "<hr>\n";

print $text{'ui_desc'},"<p>\n";
print "<form action=change_ui.cgi>\n";
print "<table border>\n";
print "<tr $tb> <td><b>$text{'ui_header'}</b></td> </tr>\n";
print "<tr $cb> <td><table>\n";

for($i=0; $i<@cs_names; $i++) {
	$cd = $cs_codes[$i];
	print "<tr> <td><b>$cs_names[$i]</b></td>\n";
	printf "<td><input type=radio name=${cd}_def value=1 %s> %s\n",
		defined($gconfig{$cd}) ? "" : "checked",
		$text{'ui_default'};
	printf "&nbsp;&nbsp;<input type=radio name=${cd}_def value=0 %s>\n",
		defined($gconfig{$cd}) ? "checked" : "";
	if ($gconfig{$cd} =~ /(..)(..)(..)/) {
		($r, $g, $b) = ($1, $2, $3);
		}
	else {
		$r = $g = $b = undef;
		}
	print "<font color=#ff0000>R</font>\n";
	print "<input name=${cd}_red size=3 value=\"$r\">\n";
	print "<font color=#00ff00>G</font>\n";
	print "<input name=${cd}_green size=3 value=\"$g\">\n";
	print "<font color=#0000ff>B</font>\n";
	print "<input name=${cd}_blue size=3 value=\"$b\">\n";
	print "</td> </tr>\n";
	}
print "<tr> <td><b>$text{'ui_texttitles'}</b></td>\n";
printf "<td><input type=radio name=texttitles value=1 %s> %s\n",
	$gconfig{'texttitles'} ? 'checked' : '', $text{'yes'};
printf "<input type=radio name=texttitles value=0 %s> %s</td> </tr>\n",
	$gconfig{'texttitles'} ? '' : 'checked', $text{'no'};

print "<tr> <td><b>$text{'ui_sysinfo'}</b></td>\n";
print "<td><select name=sysinfo>\n";
printf "<option value=0 %s> %s\n",
	$gconfig{'sysinfo'} == 0 ? 'selected' : '', $text{'ui_sysinfo0'};
printf "<option value=1 %s> %s\n",
	$gconfig{'sysinfo'} == 1 ? 'selected' : '', $text{'ui_sysinfo1'};
printf "<option value=4 %s> %s\n",
	$gconfig{'sysinfo'} == 4 ? 'selected' : '', $text{'ui_sysinfo4'};
printf "<option value=2 %s> %s\n",
	$gconfig{'sysinfo'} == 2 ? 'selected' : '', $text{'ui_sysinfo2'};
printf "<option value=3 %s> %s\n",
	$gconfig{'sysinfo'} == 3 ? 'selected' : '', $text{'ui_sysinfo3'};
print "</select></td> </tr>\n";

print "<tr> <td><b>$text{'ui_feedback'}</b></td>\n";
printf "<td><input type=radio name=feedback_def value=1 %s> %s\n",
	$gconfig{'feedback_to'} ? "" : "checked", $webmin_feedback_address;
printf "<input type=radio name=feedback_def value=0 %s>\n",
	$gconfig{'feedback_to'} ? "checked" : "";
printf "<input name=feedback size=20 value='%s'></td> </tr>\n",
	$gconfig{'feedback_to'};

print "<tr> <td><b>$text{'ui_feedbackmode'}</b></td>\n";
printf "<td><input type=radio name=nofeedbackcc value=0 %s> %s\n",
	$gconfig{'nofeedbackcc'} == 0 ? "checked" : "", $text{'yes'};
printf "<input type=radio name=nofeedbackcc value=1 %s> %s\n",
	$gconfig{'nofeedbackcc'} == 1 ? "checked" : "", $text{'ui_feednocc'};
printf "<input type=radio name=nofeedbackcc value=2 %s> %s</td> </tr>\n",
	$gconfig{'nofeedbackcc'} == 2 ? "checked" : "", $text{'no'};

print "</table></td></tr></table>\n";
print "<input type=submit value=\"$text{'save'}\"></form>\n";

print "<hr>\n";
&footer("", $text{'index_return'});

