[Rt-commit] r13573 - in rt/3.8/trunk: .

sunnavy at bestpractical.com sunnavy at bestpractical.com
Tue Jun 24 16:18:55 EDT 2008


Author: sunnavy
Date: Tue Jun 24 16:18:54 2008
New Revision: 13573

Modified:
   rt/3.8/trunk/   (props changed)
   rt/3.8/trunk/lib/RT/Installer.pm

Log:
 r13779 at sunnavys-mb:  sunnavy | 2008-06-25 04:07:51 +0800
 show timezone offset if people have DateTime for installer


Modified: rt/3.8/trunk/lib/RT/Installer.pm
==============================================================================
--- rt/3.8/trunk/lib/RT/Installer.pm	(original)
+++ rt/3.8/trunk/lib/RT/Installer.pm	Tue Jun 24 16:18:54 2008
@@ -208,9 +208,22 @@
         Widget          => '/Widgets/Form/Select',
         WidgetArguments => {
             Description => 'Timezone',                              #loc
-            Values      => [ '', DateTime::TimeZone->all_names ],
-            ValuesLabel => {
-                '' => 'System Default',                             #loc
+            Callback    => sub {
+                my $ret;
+                $ret->{Values} = ['', DateTime::TimeZone->all_names];
+
+                my $has_datetime = eval { require DateTime };
+                if ( $has_datetime ) {
+                    my $dt = DateTime->now;
+                    for my $tz ( DateTime::TimeZone->all_names ) {
+                        $dt->set_time_zone( $tz );
+                        $ret->{ValuesLabel}{$tz} =
+                            $tz . ' ' . $dt->strftime('%z');
+                    }
+                }
+                $ret->{ValuesLabel}{''} = 'System Default'; #loc
+
+                return $ret;
             },
         },
     };


More information about the Rt-commit mailing list