[Rt-commit] rt branch 5.0/make-sysconfig-timezone-selectbox created. rt-5.0.2-279-gce45939aa6
BPS Git Server
git at git.bestpractical.com
Thu Jun 23 15:20:29 UTC 2022
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".
The branch, 5.0/make-sysconfig-timezone-selectbox has been created
at ce45939aa664b2581a3294226180e7ff40f32183 (commit)
- Log -----------------------------------------------------------------
commit ce45939aa664b2581a3294226180e7ff40f32183
Author: Brian Conry <bconry at bestpractical.com>
Date: Thu Jun 23 09:59:17 2022 -0500
Make the Timezone config option a Select widget
This change converts the Timezone option to a Select widget, from a text
box, on the System Configuration page. This restricts the admin to
choosing from known-valid options.
This is the same list that is built and presented in the User
Preferences.
Note that while this list does not usually include deprecated timezone
names, the current value of the configuration option is always added as
the first item in the list, even when it is deprecated.
diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index 89276eeba7..c39d011a1e 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -1952,7 +1952,19 @@ our %META;
Widget => '/Widgets/Form/String',
},
Timezone => {
- Widget => '/Widgets/Form/String',
+ Widget => '/Widgets/Form/Select',
+ WidgetArguments => {
+ Callback => sub { my $ret = { Values => [], ValuesLabel => {} };
+ my @names = ( RT->Config->Get('Timezone'), DateTime::TimeZone->all_names );
+ my $dt = DateTime->now;
+ foreach my $tzname ( @names ) {
+ push @{ $ret->{Values} }, $tzname;
+ $dt->set_time_zone( $tzname );
+ $ret->{ValuesLabel}{$tzname} = $tzname . ' ' . $dt->strftime('%z');
+ }
+ return $ret;
+ },
+ },
},
VERPPrefix => {
Widget => '/Widgets/Form/String',
-----------------------------------------------------------------------
hooks/post-receive
--
rt
More information about the rt-commit
mailing list