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

require './usermin-lib.pl';
$access{'ui'} || &error($text{'acl_ecannot'});
&header($text{'ui_title'}, "");
print "<hr>\n";

&get_usermin_config(\%uconfig);
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";

print "<tr> <td><b>$text{'ui_texttitles'}</b></td>\n";
printf "<td><input type=radio name=texttitles value=1 %s> %s\n",
	$uconfig{'texttitles'} ? 'checked' : '', $text{'yes'};
printf "<input type=radio name=texttitles value=0 %s> %s</td> </tr>\n",
	$uconfig{'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",
	$uconfig{'sysinfo'} == 0 ? 'selected' : '', $text{'ui_sysinfo0'};
printf "<option value=1 %s> %s\n",
	$uconfig{'sysinfo'} == 1 ? 'selected' : '', $text{'ui_sysinfo1'};
printf "<option value=2 %s> %s\n",
	$uconfig{'sysinfo'} == 2 ? 'selected' : '', $text{'ui_sysinfo2'};
printf "<option value=3 %s> %s\n",
	$uconfig{'sysinfo'} == 3 ? 'selected' : '', $text{'ui_sysinfo3'};
print "</select></td> </tr>\n";

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

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

print "<tr> <td><b>$text{'ui_gotomodule'}</b></td>\n";
print "<td><select name=gotomodule>\n";
printf "<option value='' %s>%s\n",
	$uconfig{'gotomodule'} ? "" : "selected", $text{'ui_gotonone'};
foreach $m (&list_modules()) {
	printf "<option value=%s %s>%s\n",
		$m->{'dir'}, $uconfig{'gotomodule'} eq $m->{'dir'} ?
				'selected' : '', $m->{'desc'};
	}
print "</select></td> </tr>\n";

print "<tr> <td><b>$text{'ui_feedbackmode'}</b></td>\n";
printf "<td><input type=radio name=feedback_def value=1 %s> %s\n",
	$uconfig{'feedback'} ? "" : "checked", $text{'no'};
printf "<input type=radio name=feedback_def value=0 %s> %s\n",
	$uconfig{'feedback'} ? "checked" : "", $text{'ui_feedbackyes'};
printf "<input name=feedback size=30 value='%s'></td> </tr>\n",
	$uconfig{'feedback'};

print "<tr> <td><b>$text{'ui_feedbackmail'}</b></td>\n";
printf "<td nowrap><input type=radio name=feedbackmail_def value=1 %s> %s\n",
	$uconfig{'feedbackmail'} ? "" : "checked",
	$text{'ui_feedbackmail1'};
printf "<input type=radio name=feedbackmail_def value=0 %s> %s\n",
	$uconfig{'feedbackmail'} ? "checked" : "",
	$text{'ui_feedbackmail0'};
printf "<input name=feedbackmail size=30 value='%s'></td> </tr>\n",
	$uconfig{'feedbackmail'};

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

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

