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

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


Author: sunnavy
Date: Tue Jun 24 16:18:05 2008
New Revision: 13571

Modified:
   rt/3.8/trunk/   (props changed)
   rt/3.8/trunk/share/html/Elements/SelectTimezone

Log:
 r13777 at sunnavys-mb:  sunnavy | 2008-06-25 03:49:47 +0800
 show timezone offset if people have DateTime


Modified: rt/3.8/trunk/share/html/Elements/SelectTimezone
==============================================================================
--- rt/3.8/trunk/share/html/Elements/SelectTimezone	(original)
+++ rt/3.8/trunk/share/html/Elements/SelectTimezone	Tue Jun 24 16:18:05 2008
@@ -47,8 +47,21 @@
 %# END BPS TAGGED BLOCK }}}
 <%ONCE>
 my $HAS_DATETIME_TZ = eval { require DateTime::TimeZone };
-my @names;
- at names = DateTime::TimeZone->all_names if $HAS_DATETIME_TZ;
+my $HAS_DATETIME = eval { require DateTime };
+
+my (@names, %label);
+if ( $HAS_DATETIME_TZ ) {
+    @names = DateTime::TimeZone->all_names;
+}
+
+if ( $HAS_DATETIME ) {
+    my $dt = DateTime->now;
+    for ( @names ) {
+        $dt->set_time_zone( $_ );
+        $label{$_} = $_ . ' ' . $dt->strftime('%z');
+    }
+}
+
 </%ONCE>
 % unless ( $HAS_DATETIME_TZ && @names ) {
 <input type="text" name="<% $Name %>" value="<% $Default %>" />
@@ -58,7 +71,8 @@
 <option value=""><&|/l&>System Default</&></option>
 % }
 % foreach my $tz (@names) {
-<option value="<% $tz %>" <% ($Default||'') eq $tz? 'selected="selected"' :'' |n %> ><% $tz %></option>
+<option value="<% $tz %>" <% ($Default||'') eq $tz? 'selected="selected"' :''
+ |n %> ><% $label{$tz} || $tz %></option>
 % }
 </select>
 % }


More information about the Rt-commit mailing list