&ui_print_header("<tt>$in{'file'}</tt>", $text{'misc_title'}, "");
# Build list of timezones
-my %tzlist = ({});
-# This may possibly want to be a configuration option, however this is the
-# standard locaation almost certainly used by a particular PHP installation.
-open(TZTAB, "/usr/share/zoneinfo/zone.tab");
-while(<TZTAB>) {
- chomp;
- s/#.*$//;
- next if /^(\s)*$/;
- # File format is tab-separated with fields, in order:
- # Country code, Coordinates, Timezone name, Comments
- my($tz_cc, $tz_coord, $tz_tz, $tz_comm) = split(/\t/);
- # Stored as a hash for potential future-compatibility.
- $tzlist{$tz_tz} = {
- 'country' => $tz_cc,
- 'coords' => $tz_coord,
- 'comment' => $tz_comm
- };
+my %tzlist;
+&foreign_require("time");
+if (defined(&time::list_timezones)) {
+ foreach $t (&time::list_timezones()) {
+ $tzlist{$t->[0]} = { 'comment' => $t->[1] };
+ }
}
-close(TZTAB);
print &ui_form_start("save_misc.cgi", "post");
print &ui_hidden("file", $in{'file'}),"\n";
&onoff_radio("cgi.fix_pathinfo"));
# PHP Timezone Dropdown
-$tzlist{''}{'comment'} = "[ Default ]" if not exists $tzlist{''};
+$tzlist{''}{'comment'} = $text{'default'} if not exists $tzlist{''};
$curr_timezone = &find_value("date.timezone", $conf);
$tzlist{$curr_timezone}{'comment'} = "Custom timezone" if not exists $tzlist{$curr_timezone};
-# TODO: Figure out a good way to list the descriptions for each timezone.
print &ui_table_row(&hlink($text{'misc_timezone'}, "misc_timezone"),
-&ui_select("date.timezone", $curr_timezone, [sort keys %tzlist], 1, 0, 0, 0));
+ &ui_select("date.timezone", $curr_timezone,
+ [ map { $z = $tzlist{$_};
+ [ $_, $_.($z->{'comment'} ?
+ " ($z->{'comment'})" : "") ] }
+ (sort keys %tzlist) ], 1, 0, 0, 0), 3);
print &ui_table_end();
print &ui_form_end([ [ "save", $text{'save'} ] ]);