Make charset default more sensible

https://sourceforge.net/tracker/?func=detail&atid=117457&aid=3380730&group_id=17457
This commit is contained in:
Jamie Cameron
2011-07-28 14:08:44 -07:00
parent 6b99ea5423
commit 23ebba1b79
4 changed files with 23 additions and 6 deletions

View File

@@ -227,6 +227,8 @@ else {
$text{'index_noperiod'})." ".$text{'index_mins'}.
"</td> </tr>\n";
}
$cs = !$in{'new'} ? $r->{'charset'} :
&get_charset() eq $default_charset ? undef : &get_charset();
print &ui_table_row(
&ui_oneradio("amode", 6, $text{'edit_amode6'}, $amode == 6),
&ui_textarea("reply", $filter->{'reply'}->{'autotext'}, 5, 60)."<br>".
@@ -241,8 +243,8 @@ print &ui_table_row(
"dend", "mend", "yend")." ".
&date_chooser_button("dend", "mend", "yend")."</td> </tr>\n".
"<tr> <td><b>$text{'index_charset'}</b></td> ".
"<td>".&ui_opt_textbox("charset", $r->{'charset'}, 20,
$text{'default'}." (iso-8859-1)")."</td> </tr>\n".
"<td>".&ui_opt_textbox("charset", $cs, 20,
$text{'default'}." ($default_charset)")."</td> </tr>\n".
"</table>",
undef, \@tds);

View File

@@ -25,13 +25,23 @@ print &ui_table_row($text{'auto_enabled'},
# Message
print &ui_table_row($text{'auto_reply'},
&ui_textarea("reply", $filter->{'reply'}->{'autotext'}, 5, 80,
&ui_textarea("reply",
$filter ? $filter->{'reply'}->{'autotext'} : "", 5, 80,
undef, $dis));
# Character set
$cs = $filter ? $filter->{'reply'}->{'charset'} :
&get_charset() eq $default_charset ? undef : &get_charset();
$csmode = $cs eq &get_charset() ? 2 :
$cs ? 0 : 1;
print &ui_table_row($text{'auto_charset'},
&ui_opt_textbox("charset", $filter->{'reply'}->{'charset'}, 20,
$text{'default'}." (iso-8859-1)"));
&ui_radio("charset_def", $csmode,
[ [ 1, $text{'default'}." ($default_charset)" ],
&get_charset() eq $default_charset ? ( ) :
( [ 2, $text{'auto_charsetdef'}.
" (".&get_charset().")" ] ),
[ 0, $text{'auto_charsetother'} ] ])." ".
&ui_textbox("charset", $csmode == 0 ? $cs : "", 20));
# Period
if (!$config{'reply_force'}) {

View File

@@ -105,6 +105,8 @@ auto_header=Automatic email reply options
auto_enabled=Automatic response enabled?
auto_reply=Reply message
auto_charset=Message character set
auto_charsetdef=From current language
auto_charsetother=Other character set
auto_period=Minimum interval between replies
auto_err=Failed to save automatic reply

View File

@@ -63,9 +63,12 @@ elsif ($in{'enabled'}) {
}
# Save character set
if ($in{'charset_def'}) {
if ($in{'charset_def'} == 1) {
delete($filter->{'reply'}->{'charset'});
}
elsif ($in{'charset_def'} == 2) {
$filter->{'reply'}->{'charset'} = &get_charset();
}
else {
$in{'charset'} =~ /^[a-z0-9\.\-\_]+$/i ||
error($text{'save_echarset'});