[Rt-commit] rt branch 5.0/make-sysconfig-timezone-selectbox created. rt-5.0.2-279-g233574b08b

BPS Git Server git at git.bestpractical.com
Thu Jun 23 15:54:40 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  233574b08bbdd4eab36cf80380c5258cf653ec8b (commit)

- Log -----------------------------------------------------------------
commit 233574b08bbdd4eab36cf80380c5258cf653ec8b
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 and the file-only
    value of the option (if different from the current value) are both
    added at the top of the list, even when they are 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