Fix to drop obsolete code introduced from nested eval tests

This commit is contained in:
iliajie
2023-02-05 20:24:40 +02:00
parent b6422024a6
commit 1ff8d1cc5d
3 changed files with 24 additions and 31 deletions

View File

@@ -59,34 +59,31 @@ if ($access{'lang'}) {
# Old datetime format or a new locale
if ($access{'locale'}) {
my $locale;
eval "use DateTime; use DateTime::Locale; use DateTime::TimeZone;";
&foreign_require('webmin');
if (!$@) {
$locale++;
my $locales = &list_locales();
my %localesrev = reverse %{$locales};
my $locale = $locale_auto || $gconfig{'locale'} || &get_default_system_locale();
print &ui_table_row($text{'index_locale'},
&ui_radio("locale_def", defined($user->{'locale'}) ? 0 : 1,
[ [ 1, &text('index_localeglobal2', $locales->{$locale}, $locale)."<br>" ],
[ 0, $text{'index_localeset'} ] ])." ".
&ui_select("locale", $user->{'locale'},
[ map { [ $localesrev{$_}, $_ ] } sort values %{$locales} ] ),
undef, [ "valign=top","valign=top" ]);
}
if (!$locale) {
my %wtext = &load_language('webmin');
print &ui_table_row($text{'index_locale2'},
&ui_radio("dateformat_def", defined($user->{'dateformat'}) ? 0 : 1,
[ [ 1, &text('index_dateformatglobal2', $gconfig{'dateformat'} || "dd/mon/yyyy")."<br>" ],
[ 0, $text{'index_dateformatset'} ] ])." ".
&ui_select("dateformat", $user->{'dateformat'} || "dd/mon/yyyy",
[ map { [ $_, $wtext{'lang_dateformat_'.$_} ] }
@webmin::webmin_date_formats ] ),
undef, [ "valign=top","valign=top" ]);
}
my $locales = &list_locales();
my %localesrev = reverse %{$locales};
my $locale = $locale_auto || $gconfig{'locale'} || &get_default_system_locale();
print &ui_table_row($text{'index_locale'},
&ui_radio("locale_def", defined($user->{'locale'}) ? 0 : 1,
[ [ 1, &text('index_localeglobal2', $locales->{$locale}, $locale)."<br>" ],
[ 0, $text{'index_localeset'} ] ])." ".
&ui_select("locale", $user->{'locale'},
[ map { [ $localesrev{$_}, $_ ] } sort values %{$locales} ] ),
undef, [ "valign=top","valign=top" ]);
}
else {
my %wtext = &load_language('webmin');
print &ui_table_row($text{'index_locale2'},
&ui_radio("dateformat_def", defined($user->{'dateformat'}) ? 0 : 1,
[ [ 1, &text('index_dateformatglobal2', $gconfig{'dateformat'} || "dd/mon/yyyy")."<br>" ],
[ 0, $text{'index_dateformatset'} ] ])." ".
&ui_select("dateformat", $user->{'dateformat'} || "dd/mon/yyyy",
[ map { [ $_, $wtext{'lang_dateformat_'.$_} ] }
@webmin::webmin_date_formats ] ),
undef, [ "valign=top","valign=top" ]);
}
}
if ($access{'theme'}) {

View File

@@ -20,10 +20,8 @@ print &ui_table_row($text{'lang_lang'},
&list_languages() ]));
# Old datetime format or a new locale
my $locale;
eval "use DateTime; use DateTime::Locale; use DateTime::TimeZone;";
if (!$@) {
$locale++;
my $locales = &list_locales();
my %localesrev = reverse %{$locales};
my $locale_auto = &parse_accepted_language(\%uconfig);
@@ -33,7 +31,7 @@ if (!$@) {
&ui_hidden("dateformat", $uconfig{'dateformat'}));
}
if (!$locale) {
else {
print &ui_table_row($text{'lang_dateformat'},
&ui_select("dateformat", $uconfig{'dateformat'} || "dd/mon/yyyy",
[ map { [ $_, $text{'lang_dateformat_'.$_} ] }

View File

@@ -21,10 +21,8 @@ print &ui_table_row($text{'lang_lang'},
&ui_checkbox("langauto", 1, $text{'langauto_include'}, $clangauto));
# Old datetime format or a new locale
my $locale;
eval "use DateTime; use DateTime::Locale; use DateTime::TimeZone;";
if (!$@) {
$locale++;
my $locales = &list_locales();
my %localesrev = reverse %{$locales};
my $locale_auto = &parse_accepted_language();
@@ -34,7 +32,7 @@ if (!$@) {
&ui_hidden("dateformat", $gconfig{'dateformat'}),
undef, [ "valign=middle","valign=middle" ]);
}
if (!$locale) {
else {
print &ui_table_row($text{'lang_dateformat'},
&ui_select("dateformat", $gconfig{'dateformat'} || "dd/mon/yyyy",
[ map { [ $_, $text{'lang_dateformat_'.$_} ] }