From 486585428130656f9227e80b5fdb3fe3e645b9ce Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 10 Nov 2009 19:37:27 +0000 Subject: [PATCH] Added aliases for Windows timezone to standard TZID's --- calendar/inc/class.calendar_timezones.inc.php | 6 + calendar/setup/setup.inc.php | 2 +- calendar/setup/tables_update.inc.php | 124 ++++++++++++++++++ 3 files changed, 131 insertions(+), 1 deletion(-) diff --git a/calendar/inc/class.calendar_timezones.inc.php b/calendar/inc/class.calendar_timezones.inc.php index a41a31b62a..f84938d74b 100644 --- a/calendar/inc/class.calendar_timezones.inc.php +++ b/calendar/inc/class.calendar_timezones.inc.php @@ -18,6 +18,12 @@ * This class serves two purposes: * - convert between TZID strings and nummeric tz_id's stored in database * - get iCal VTIMEZONE component for a TZID (data from Lighting extension) + * + * Recommendations about timezone handling in calendars: + * @link http://www.calconnect.org/publications/icalendartimezoneproblemsandrecommendationsv1.0.pdf + * + * Mapping Windows timezone to standard TZID's: + * @link http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/windows_tzid.html */ class calendar_timezones { diff --git a/calendar/setup/setup.inc.php b/calendar/setup/setup.inc.php index bca3601702..aecb8ce4a4 100755 --- a/calendar/setup/setup.inc.php +++ b/calendar/setup/setup.inc.php @@ -10,7 +10,7 @@ */ $setup_info['calendar']['name'] = 'calendar'; -$setup_info['calendar']['version'] = '1.7.005'; +$setup_info['calendar']['version'] = '1.7.006'; $setup_info['calendar']['app_order'] = 3; $setup_info['calendar']['enable'] = 1; $setup_info['calendar']['index'] = 'calendar.calendar_uiviews.index'; diff --git a/calendar/setup/tables_update.inc.php b/calendar/setup/tables_update.inc.php index c1f618aa78..b76095f7e5 100644 --- a/calendar/setup/tables_update.inc.php +++ b/calendar/setup/tables_update.inc.php @@ -1818,3 +1818,127 @@ function calendar_upgrade1_7_004() return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.005'; } +/** + * Adding Windows timezones as alias to standard TZID's + * + * @link http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/windows_tzid.html + * + * @return string + */ +function calendar_upgrade1_7_005() +{ + foreach(array( + 'AUS Central Standard Time' => 'Australia/Darwin', + 'AUS Eastern Standard Time' => 'Australia/Sydney', + 'Afghanistan Standard Time' => 'Asia/Kabul', + 'Alaskan Standard Time' => 'America/Anchorage', + 'Arab Standard Time' => 'Asia/Riyadh', + 'Arabian Standard Time' => 'Asia/Dubai', + 'Arabic Standard Time' => 'Asia/Baghdad', + 'Argentina Standard Time' => 'America/Argentina/Buenos_Aires', // was 'America/Buenos_Aires', + 'Armenian Standard Time' => 'Asia/Yerevan', + 'Atlantic Standard Time' => 'America/Halifax', + 'Azerbaijan Standard Time' => 'Asia/Baku', + 'Azores Standard Time' => 'Atlantic/Azores', + 'Canada Central Standard Time' => 'America/Regina', + 'Cape Verde Standard Time' => 'Atlantic/Cape_Verde', + 'Caucasus Standard Time' => 'Asia/Yerevan', + 'Cen. Australia Standard Time' => 'Australia/Adelaide', + 'Central America Standard Time' => 'America/Guatemala', + 'Central Asia Standard Time' => 'Asia/Dhaka', + 'Central Brazilian Standard Time' => 'America/Manaus', + 'Central Europe Standard Time' => 'Europe/Budapest', + 'Central European Standard Time' => 'Europe/Warsaw', + 'Central Pacific Standard Time' => 'Pacific/Guadalcanal', + 'Central Standard Time' => 'America/Chicago', + 'Central Standard Time (Mexico)' => 'America/Mexico_City', + 'China Standard Time' => 'Asia/Shanghai', + 'Dateline Standard Time' => 'Etc/GMT+12', + 'E. Africa Standard Time' => 'Africa/Nairobi', + 'E. Australia Standard Time' => 'Australia/Brisbane', + 'E. Europe Standard Time' => 'Europe/Minsk', + 'E. South America Standard Time' => 'America/Sao_Paulo', + 'Eastern Standard Time' => 'America/New_York', + 'Egypt Standard Time' => 'Africa/Cairo', + 'Ekaterinburg Standard Time' => 'Asia/Yekaterinburg', + 'FLE Standard Time' => 'Europe/Kiev', + 'Fiji Standard Time' => 'Pacific/Fiji', + 'GMT Standard Time' => 'Europe/London', + 'GTB Standard Time' => 'Europe/Istanbul', + 'Georgian Standard Time' => 'Etc/GMT-3', + 'Greenland Standard Time' => 'America/Godthab', + 'Greenwich Standard Time' => 'Atlantic/Reykjavik', // was 'Africa/Reykjavik', + 'Hawaiian Standard Time' => 'Pacific/Honolulu', + 'India Standard Time' => 'Asia/Calcutta', + 'Iran Standard Time' => 'Asia/Tehran', + 'Israel Standard Time' => 'Asia/Jerusalem', + 'Jordan Standard Time' => 'Asia/Amman', + 'Korea Standard Time' => 'Asia/Seoul', + 'Mauritius Standard Time' => 'Indian/Mauritius', + 'Mexico Standard Time' => 'America/Mexico_City', + 'Mexico Standard Time 2' => 'America/Chihuahua', + 'Mid-Atlantic Standard Time' => 'Atlantic/South_Georgia', + 'Middle East Standard Time' => 'Asia/Beirut', + 'Montevideo Standard Time' => 'America/Montevideo', + 'Morocco Standard Time' => 'Africa/Casablanca', + 'Mountain Standard Time' => 'America/Denver', + 'Mountain Standard Time (Mexico)' => 'America/Chihuahua', + 'Myanmar Standard Time' => 'Asia/Rangoon', + 'N. Central Asia Standard Time' => 'Asia/Novosibirsk', + 'Namibia Standard Time' => 'Africa/Windhoek', + 'Nepal Standard Time' => 'Asia/Katmandu', + 'New Zealand Standard Time' => 'Pacific/Auckland', + 'Newfoundland Standard Time' => 'America/St_Johns', + 'North Asia East Standard Time' => 'Asia/Irkutsk', + 'North Asia Standard Time' => 'Asia/Krasnoyarsk', + 'Pacific SA Standard Time' => 'America/Santiago', + 'Pacific Standard Time' => 'America/Los_Angeles', + 'Pacific Standard Time (Mexico)' => 'America/Tijuana', + 'Pakistan Standard Time' => 'Asia/Karachi', + 'Romance Standard Time' => 'Europe/Paris', + 'Russian Standard Time' => 'Europe/Moscow', + 'SA Eastern Standard Time' => 'Etc/GMT+3', + 'SA Pacific Standard Time' => 'America/Bogota', + 'SA Western Standard Time' => 'America/La_Paz', + 'SE Asia Standard Time' => 'Asia/Bangkok', + 'Samoa Standard Time' => 'Pacific/Apia', + 'Singapore Standard Time' => 'Asia/Singapore', + 'South Africa Standard Time' => 'Africa/Johannesburg', + 'Sri Lanka Standard Time' => 'Asia/Colombo', + 'Taipei Standard Time' => 'Asia/Taipei', + 'Tasmania Standard Time' => 'Australia/Hobart', + 'Tokyo Standard Time' => 'Asia/Tokyo', + 'Tonga Standard Time' => 'Pacific/Tongatapu', + 'US Eastern Standard Time' => 'Etc/GMT+5', + 'US Mountain Standard Time' => 'America/Phoenix', + 'Venezuela Standard Time' => 'America/Caracas', + 'Vladivostok Standard Time' => 'Asia/Vladivostok', + 'W. Australia Standard Time' => 'Australia/Perth', + 'W. Central Africa Standard Time' => 'Africa/Lagos', + 'W. Europe Standard Time' => 'Europe/Berlin', + 'West Asia Standard Time' => 'Asia/Tashkent', + 'West Pacific Standard Time' => 'Pacific/Port_Moresby', + 'Yakutsk Standard Time' => 'Asia/Yakutsk', + ) as $win_tz => $tzid) + { + if (!(calendar_timezones::tz2id($win_tz))) // not already defined + { + if (!($id = calendar_timezones::tz2id($tzid))) + { + error_log(__METHOD__."() Windows timezone: '$win_tz': TZID='$tzid' is NOT defined!"); + } + else + { + $GLOBALS['egw']->db->insert('egw_cal_timezones',array( + 'tz_alias' => $id, + 'tz_latitude' => null, + 'tz_longitude' => null, + 'tz_component' => null, + ),array( + 'tz_tzid' => $win_tz, + ),__LINE__,__FILE__,'calendar'); + } + } + } + return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.006'; +} \ No newline at end of file