New timezone management for importer (now working as expected ;) )
Dynamic timezone-change preview =) TODO: - complete timezone mapping list! - check exporter timezone management
This commit is contained in:
parent
7d42712f43
commit
fb426098d6
@ -1,3 +1,12 @@
|
||||
/**
|
||||
* ResponseHandler
|
||||
*
|
||||
* This class handles all responses from the php backend
|
||||
*
|
||||
* @author Christoph Haas <mail@h44z.net>
|
||||
* @modified 29.12.2012
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
Ext.namespace('Zarafa.plugins.calendarimporter.data');
|
||||
|
||||
/**
|
||||
|
@ -1,84 +1,164 @@
|
||||
/**
|
||||
* Timezone class
|
||||
*
|
||||
* This class can handle all our timezone operations and conversions.
|
||||
*
|
||||
* @author Christoph Haas <mail@h44z.net>
|
||||
* @modified 29.12.2012
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
Ext.namespace("Zarafa.plugins.calendarimporter.data");
|
||||
|
||||
Zarafa.plugins.calendarimporter.data.Timezones = Ext.extend(Object, {
|
||||
|
||||
store : [
|
||||
['Pacific/Midway','(UTC -11:00) Midway, Niue, Pago Pago'],
|
||||
['America/Adak','(UTC -10:00) Adak'],
|
||||
['Pacific/Fakaofo','(UTC -10:00) Fakaofo, Honolulu, Johnston, Rarotonga, Tahiti'],
|
||||
['Pacific/Marquesas','(UTC -10:30) Marquesas'],
|
||||
['America/Anchorage','(UTC -09:00) Anchorage, Juneau, Nome, Sitka, Yakutat'],
|
||||
['Pacific/Gambier','(UTC -09:00) Gambier'],
|
||||
['America/Dawson','(UTC -08:00) Dawson, Los Angeles, Tijuana, Vancouver, Whitehorse'],
|
||||
['America/Santa_Isabel','(UTC -08:00) Santa Isabel'],
|
||||
['America/Metlakatla','(UTC -08:00) Metlakatla, Pitcairn'],
|
||||
['America/Dawson_Creek','(UTC -07:00) Dawson Creek, Hermosillo, Phoenix'],
|
||||
['America/Chihuahua','(UTC -07:00) Chihuahua, Mazatlan'],
|
||||
['America/Boise','(UTC -07:00) Boise, Cambridge Bay, Denver, Edmonton, Inuvik, Ojinaga, Shiprock, Yellowknife'],
|
||||
['America/Chicago','(UTC -06:00) Beulah, Center, Chicago, Knox, Matamoros, Menominee, New Salem, Rainy River, Rankin Inlet, Resolute, Tell City, Winnipeg'],
|
||||
['America/Belize','(UTC -06:00) Belize, Costa Rica, El Salvador, Galapagos, Guatemala, Managua, Regina, Swift Current, Tegucigalpa'],
|
||||
['Pacific/Easter','(UTC -06:00) Easter'],
|
||||
['America/Bahia_Banderas','(UTC -06:00) Bahia Banderas, Cancun, Merida, Mexico City, Monterrey'],
|
||||
['America/Detroit','(UTC -05:00) Detroit, Grand Turk, Indianapolis, Iqaluit, Louisville, Marengo, Monticello, Montreal, Nassau, New York, Nipigon, Pangnirtung, Petersburg, Thunder Bay, Toronto, Vevay, Vincennes, Winamac'],
|
||||
['America/Atikokan','(UTC -05:00) Atikokan, Bogota, Cayman, Guayaquil, Jamaica, Lima, Panama, Port-au-Prince'],
|
||||
['America/Havana','(UTC -05:00) Havana'],
|
||||
['America/Caracas','(UTC -05:30) Caracas'],
|
||||
['America/Glace_Bay','(UTC -04:00) Bermuda, Glace Bay, Goose Bay, Halifax, Moncton, Thule'],
|
||||
['Atlantic/Stanley','(UTC -04:00) Stanley'],
|
||||
['America/Santiago','(UTC -04:00) Palmer, Santiago'],
|
||||
['America/Anguilla','(UTC -04:00) Anguilla, Antigua, Aruba, Barbados, Blanc-Sablon, Boa Vista, Curacao, Dominica, Eirunepe, Grenada, Guadeloupe, Guyana, Kralendijk, La Paz, Lower Princes, Manaus, Marigot, Martinique, Montserrat, Port of Spain, Porto Velho, Puerto Rico, Rio Branco, Santo Domingo, St Barthelemy, St Kitts, St Lucia, St Thomas, St Vincent, Tortola'],
|
||||
['America/Campo_Grande','(UTC -04:00) Campo Grande, Cuiaba'],
|
||||
['America/Asuncion','(UTC -04:00) Asuncion'],
|
||||
['America/St_Johns','(UTC -04:30) St Johns'],
|
||||
['America/Sao_Paulo','(UTC -03:00) Sao Paulo'],
|
||||
['America/Araguaina','(UTC -03:00) Araguaina, Bahia, Belem, Buenos Aires, Catamarca, Cayenne, Cordoba, Fortaleza, Jujuy, La Rioja, Maceio, Mendoza, Paramaribo, Recife, Rio Gallegos, Rothera, Salta, San Juan, Santarem, Tucuman, Ushuaia'],
|
||||
['America/Montevideo','(UTC -03:00) Montevideo'],
|
||||
['America/Godthab','(UTC -03:00) Godthab'],
|
||||
['America/Argentina/San_Luis','(UTC -03:00) San Luis'],
|
||||
['America/Miquelon','(UTC -03:00) Miquelon'],
|
||||
['America/Noronha','(UTC -02:00) Noronha, South Georgia'],
|
||||
['Atlantic/Cape_Verde','(UTC -01:00) Cape Verde'],
|
||||
['America/Scoresbysund','(UTC -01:00) Azores, Scoresbysund'],
|
||||
['Atlantic/Canary','(UTC) Canary, Dublin, Faroe, Guernsey, Isle of Man, Jersey, Lisbon, London, Madeira'],
|
||||
['Africa/Abidjan','(UTC) Abidjan, Accra, Bamako, Banjul, Bissau, Casablanca, Conakry, Dakar, Danmarkshavn, El Aaiun, Freetown, Lome, Monrovia, Nouakchott, Ouagadougou, Reykjavik, Sao Tome, St Helena'],
|
||||
['Africa/Algiers','(UTC +01:00) Algiers, Bangui, Brazzaville, Douala, Kinshasa, Lagos, Libreville, Luanda, Malabo, Ndjamena, Niamey, Porto-Novo, Tunis'],
|
||||
['Africa/Ceuta','(UTC +01:00) Amsterdam, Andorra, Belgrade, Berlin, Bratislava, Brussels, Budapest, Ceuta, Copenhagen, Gibraltar, Ljubljana, Longyearbyen, Luxembourg, Madrid, Malta, Monaco, Oslo, Paris, Podgorica, Prague, Rome, San Marino, Sarajevo, Skopje, Stockholm, Tirane, Vaduz, Vatican, Vienna, Warsaw, Zagreb, Zurich'],
|
||||
['Africa/Windhoek','(UTC +01:00) Windhoek'],
|
||||
['Asia/Damascus','(UTC +02:00) Damascus'],
|
||||
['Asia/Beirut','(UTC +02:00) Beirut'],
|
||||
['Asia/Jerusalem','(UTC +02:00) Jerusalem'],
|
||||
['Asia/Nicosia','(UTC +02:00) Athens, Bucharest, Chisinau, Helsinki, Istanbul, Mariehamn, Nicosia, Riga, Sofia, Tallinn, Vilnius'],
|
||||
['Africa/Blantyre','(UTC +02:00) Blantyre, Bujumbura, Cairo, Gaborone, Gaza, Harare, Hebron, Johannesburg, Kigali, Lubumbashi, Lusaka, Maputo, Maseru, Mbabane, Tripoli'],
|
||||
['Asia/Amman','(UTC +02:00) Amman'],
|
||||
['Africa/Addis_Ababa','(UTC +03:00) Addis Ababa, Aden, Antananarivo, Asmara, Baghdad, Bahrain, Comoro, Dar es Salaam, Djibouti, Juba, Kaliningrad, Kampala, Khartoum, Kiev, Kuwait, Mayotte, Minsk, Mogadishu, Nairobi, Qatar, Riyadh, Simferopol, Syowa, Uzhgorod, Zaporozhye'],
|
||||
['Asia/Tehran','(UTC +03:30) Tehran'],
|
||||
['Asia/Yerevan','(UTC +04:00) Yerevan'],
|
||||
['Asia/Dubai','(UTC +04:00) Dubai, Mahe, Mauritius, Moscow, Muscat, Reunion, Samara, Tbilisi, Volgograd'],
|
||||
['Asia/Baku','(UTC +04:00) Baku'],
|
||||
['Asia/Kabul','(UTC +04:30) Kabul'],
|
||||
['Antarctica/Mawson','(UTC +05:00) Aqtau, Aqtobe, Ashgabat, Dushanbe, Karachi, Kerguelen, Maldives, Mawson, Oral, Samarkand, Tashkent'],
|
||||
['Asia/Colombo','(UTC +05:30) Colombo, Kolkata'],
|
||||
['Asia/Kathmandu','(UTC +05:45) Kathmandu'],
|
||||
['Antarctica/Vostok','(UTC +06:00) Almaty, Bishkek, Chagos, Dhaka, Qyzylorda, Thimphu, Vostok, Yekaterinburg'],
|
||||
['Asia/Rangoon','(UTC +06:30) Cocos, Rangoon'],
|
||||
['Antarctica/Davis','(UTC +07:00) Bangkok, Christmas, Davis, Ho Chi Minh, Hovd, Jakarta, Novokuznetsk, Novosibirsk, Omsk, Phnom Penh, Pontianak, Vientiane'],
|
||||
['Antarctica/Casey','(UTC +08:00) Brunei, Casey, Choibalsan, Chongqing, Harbin, Hong Kong, Kashgar, Krasnoyarsk, Kuala Lumpur, Kuching, Macau, Makassar, Manila, Perth, Shanghai, Singapore, Taipei, Ulaanbaatar, Urumqi'],
|
||||
['Australia/Eucla','(UTC +08:45) Eucla'],
|
||||
['Asia/Dili','(UTC +09:00) Dili, Irkutsk, Jayapura, Palau, Pyongyang, Seoul, Tokyo'],
|
||||
['Australia/Adelaide','(UTC +09:30) Adelaide, Broken Hill'],
|
||||
['Australia/Darwin','(UTC +09:30) Darwin'],
|
||||
['Antarctica/DumontDUrville','(UTC +10:00) Brisbane, Chuuk, DumontDUrville, Guam, Lindeman, Port Moresby, Saipan, Yakutsk'],
|
||||
['Australia/Currie','(UTC +10:00) Currie, Hobart, Melbourne, Sydney'],
|
||||
['Australia/Lord_Howe','(UTC +10:30) Lord Howe'],
|
||||
['Antarctica/Macquarie','(UTC +11:00) Efate, Guadalcanal, Kosrae, Macquarie, Noumea, Pohnpei, Sakhalin, Vladivostok'],
|
||||
['Pacific/Norfolk','(UTC +11:30) Norfolk'],
|
||||
['Antarctica/McMurdo','(UTC +12:00) Auckland, McMurdo, South Pole'],
|
||||
['Asia/Anadyr','(UTC +12:00) Anadyr, Fiji, Funafuti, Kamchatka, Kwajalein, Magadan, Majuro, Nauru, Tarawa, Wake, Wallis'],
|
||||
['Pacific/Chatham','(UTC +12:45) Chatham'],
|
||||
['Pacific/Enderbury','(UTC +13:00) Enderbury, Tongatapu'],
|
||||
['Pacific/Apia','(UTC +13:00) Apia'],
|
||||
['Pacific/Kiritimati','(UTC +14:00) Kiritimati']
|
||||
]
|
||||
['Pacific/Midway','(UTC -11:00) Midway, Niue, Pago Pago', -660],
|
||||
['America/Adak','(UTC -10:00) Adak', -600],
|
||||
['Pacific/Fakaofo','(UTC -10:00) Fakaofo, Honolulu, Johnston, Rarotonga, Tahiti', -600],
|
||||
['Pacific/Marquesas','(UTC -10:30) Marquesas', -630],
|
||||
['America/Anchorage','(UTC -09:00) Anchorage, Juneau, Nome, Sitka, Yakutat', -540],
|
||||
['Pacific/Gambier','(UTC -09:00) Gambier', -540],
|
||||
['America/Dawson','(UTC -08:00) Dawson, Los Angeles, Tijuana, Vancouver, Whitehorse', -480],
|
||||
['America/Santa_Isabel','(UTC -08:00) Santa Isabel', -480],
|
||||
['America/Metlakatla','(UTC -08:00) Metlakatla, Pitcairn', -480],
|
||||
['America/Dawson_Creek','(UTC -07:00) Dawson Creek, Hermosillo, Phoenix', -420],
|
||||
['America/Chihuahua','(UTC -07:00) Chihuahua, Mazatlan', -420],
|
||||
['America/Boise','(UTC -07:00) Boise, Cambridge Bay, Denver, Edmonton, Inuvik, Ojinaga, Shiprock, Yellowknife', -420],
|
||||
['America/Chicago','(UTC -06:00) Beulah, Center, Chicago, Knox, Matamoros, Menominee, New Salem, Rainy River, Rankin Inlet, Resolute, Tell City, Winnipeg', -360],
|
||||
['America/Belize','(UTC -06:00) Belize, Costa Rica, El Salvador, Galapagos, Guatemala, Managua, Regina, Swift Current, Tegucigalpa', -360],
|
||||
['Pacific/Easter','(UTC -06:00) Easter', -360],
|
||||
['America/Bahia_Banderas','(UTC -06:00) Bahia Banderas, Cancun, Merida, Mexico City, Monterrey', -360],
|
||||
['America/Detroit','(UTC -05:00) Detroit, Grand Turk, Indianapolis, Iqaluit, Louisville, Marengo, Monticello, Montreal, Nassau, New York, Nipigon, Pangnirtung, Petersburg, Thunder Bay, Toronto, Vevay, Vincennes, Winamac', -300],
|
||||
['America/Atikokan','(UTC -05:00) Atikokan, Bogota, Cayman, Guayaquil, Jamaica, Lima, Panama, Port-au-Prince', -300],
|
||||
['America/Havana','(UTC -05:00) Havana', -300],
|
||||
['America/Caracas','(UTC -05:30) Caracas', -330],
|
||||
['America/Glace_Bay','(UTC -04:00) Bermuda, Glace Bay, Goose Bay, Halifax, Moncton, Thule', -240],
|
||||
['Atlantic/Stanley','(UTC -04:00) Stanley', -240],
|
||||
['America/Santiago','(UTC -04:00) Palmer, Santiago', -240],
|
||||
['America/Anguilla','(UTC -04:00) Anguilla, Antigua, Aruba, Barbados, Blanc-Sablon, Boa Vista, Curacao, Dominica, Eirunepe, Grenada, Guadeloupe, Guyana, Kralendijk, La Paz, Lower Princes, Manaus, Marigot, Martinique, Montserrat, Port of Spain, Porto Velho, Puerto Rico, Rio Branco, Santo Domingo, St Barthelemy, St Kitts, St Lucia, St Thomas, St Vincent, Tortola', -240],
|
||||
['America/Campo_Grande','(UTC -04:00) Campo Grande, Cuiaba', -240],
|
||||
['America/Asuncion','(UTC -04:00) Asuncion', -240],
|
||||
['America/St_Johns','(UTC -04:30) St Johns', -270],
|
||||
['America/Sao_Paulo','(UTC -03:00) Sao Paulo', -180],
|
||||
['America/Araguaina','(UTC -03:00) Araguaina, Bahia, Belem, Buenos Aires, Catamarca, Cayenne, Cordoba, Fortaleza, Jujuy, La Rioja, Maceio, Mendoza, Paramaribo, Recife, Rio Gallegos, Rothera, Salta, San Juan, Santarem, Tucuman, Ushuaia', -180],
|
||||
['America/Montevideo','(UTC -03:00) Montevideo', -180],
|
||||
['America/Godthab','(UTC -03:00) Godthab', -180],
|
||||
['America/Argentina/San_Luis','(UTC -03:00) San Luis', -180],
|
||||
['America/Miquelon','(UTC -03:00) Miquelon', -180],
|
||||
['America/Noronha','(UTC -02:00) Noronha, South Georgia', -120],
|
||||
['Atlantic/Cape_Verde','(UTC -01:00) Cape Verde', -60],
|
||||
['America/Scoresbysund','(UTC -01:00) Azores, Scoresbysund', -60],
|
||||
['Atlantic/Canary','(UTC) Canary, Dublin, Faroe, Guernsey, Isle of Man, Jersey, Lisbon, London, Madeira', 0],
|
||||
['Africa/Abidjan','(UTC) Abidjan, Accra, Bamako, Banjul, Bissau, Casablanca, Conakry, Dakar, Danmarkshavn, El Aaiun, Freetown, Lome, Monrovia, Nouakchott, Ouagadougou, Reykjavik, Sao Tome, St Helena', 0],
|
||||
['Africa/Algiers','(UTC +01:00) Algiers, Bangui, Brazzaville, Douala, Kinshasa, Lagos, Libreville, Luanda, Malabo, Ndjamena, Niamey, Porto-Novo, Tunis', 60],
|
||||
['Africa/Ceuta','(UTC +01:00) Amsterdam, Andorra, Belgrade, Berlin, Bratislava, Brussels, Budapest, Ceuta, Copenhagen, Gibraltar, Ljubljana, Longyearbyen, Luxembourg, Madrid, Malta, Monaco, Oslo, Paris, Podgorica, Prague, Rome, San Marino, Sarajevo, Skopje, Stockholm, Tirane, Vaduz, Vatican, Vienna, Warsaw, Zagreb, Zurich', 60],
|
||||
['Africa/Windhoek','(UTC +01:00) Windhoek', 60],
|
||||
['Asia/Damascus','(UTC +02:00) Damascus', 120],
|
||||
['Asia/Beirut','(UTC +02:00) Beirut', 120],
|
||||
['Asia/Jerusalem','(UTC +02:00) Jerusalem', 120],
|
||||
['Asia/Nicosia','(UTC +02:00) Athens, Bucharest, Chisinau, Helsinki, Istanbul, Mariehamn, Nicosia, Riga, Sofia, Tallinn, Vilnius', 120],
|
||||
['Africa/Blantyre','(UTC +02:00) Blantyre, Bujumbura, Cairo, Gaborone, Gaza, Harare, Hebron, Johannesburg, Kigali, Lubumbashi, Lusaka, Maputo, Maseru, Mbabane, Tripoli', 120],
|
||||
['Asia/Amman','(UTC +02:00) Amman', 120],
|
||||
['Africa/Addis_Ababa','(UTC +03:00) Addis Ababa, Aden, Antananarivo, Asmara, Baghdad, Bahrain, Comoro, Dar es Salaam, Djibouti, Juba, Kaliningrad, Kampala, Khartoum, Kiev, Kuwait, Mayotte, Minsk, Mogadishu, Nairobi, Qatar, Riyadh, Simferopol, Syowa, Uzhgorod, Zaporozhye', 180],
|
||||
['Asia/Tehran','(UTC +03:30) Tehran', 210],
|
||||
['Asia/Yerevan','(UTC +04:00) Yerevan', 240],
|
||||
['Asia/Dubai','(UTC +04:00) Dubai, Mahe, Mauritius, Moscow, Muscat, Reunion, Samara, Tbilisi, Volgograd', 240],
|
||||
['Asia/Baku','(UTC +04:00) Baku', 240],
|
||||
['Asia/Kabul','(UTC +04:30) Kabul', 270],
|
||||
['Antarctica/Mawson','(UTC +05:00) Aqtau, Aqtobe, Ashgabat, Dushanbe, Karachi, Kerguelen, Maldives, Mawson, Oral, Samarkand, Tashkent', 300],
|
||||
['Asia/Colombo','(UTC +05:30) Colombo, Kolkata', 330],
|
||||
['Asia/Kathmandu','(UTC +05:45) Kathmandu', 345],
|
||||
['Antarctica/Vostok','(UTC +06:00) Almaty, Bishkek, Chagos, Dhaka, Qyzylorda, Thimphu, Vostok, Yekaterinburg', 360],
|
||||
['Asia/Rangoon','(UTC +06:30) Cocos, Rangoon', 390],
|
||||
['Antarctica/Davis','(UTC +07:00) Bangkok, Christmas, Davis, Ho Chi Minh, Hovd, Jakarta, Novokuznetsk, Novosibirsk, Omsk, Phnom Penh, Pontianak, Vientiane', 420],
|
||||
['Antarctica/Casey','(UTC +08:00) Brunei, Casey, Choibalsan, Chongqing, Harbin, Hong Kong, Kashgar, Krasnoyarsk, Kuala Lumpur, Kuching, Macau, Makassar, Manila, Perth, Shanghai, Singapore, Taipei, Ulaanbaatar, Urumqi', 480],
|
||||
['Australia/Eucla','(UTC +08:45) Eucla', 525],
|
||||
['Asia/Dili','(UTC +09:00) Dili, Irkutsk, Jayapura, Palau, Pyongyang, Seoul, Tokyo', 540],
|
||||
['Australia/Adelaide','(UTC +09:30) Adelaide, Broken Hill', 570],
|
||||
['Australia/Darwin','(UTC +09:30) Darwin', 570],
|
||||
['Antarctica/DumontDUrville','(UTC +10:00) Brisbane, Chuuk, DumontDUrville, Guam, Lindeman, Port Moresby, Saipan, Yakutsk', 600],
|
||||
['Australia/Currie','(UTC +10:00) Currie, Hobart, Melbourne, Sydney', 600],
|
||||
['Australia/Lord_Howe','(UTC +10:30) Lord Howe', 630],
|
||||
['Antarctica/Macquarie','(UTC +11:00) Efate, Guadalcanal, Kosrae, Macquarie, Noumea, Pohnpei, Sakhalin, Vladivostok', 660],
|
||||
['Pacific/Norfolk','(UTC +11:30) Norfolk', 690],
|
||||
['Antarctica/McMurdo','(UTC +12:00) Auckland, McMurdo, South Pole', 720],
|
||||
['Asia/Anadyr','(UTC +12:00) Anadyr, Fiji, Funafuti, Kamchatka, Kwajalein, Magadan, Majuro, Nauru, Tarawa, Wake, Wallis', 720],
|
||||
['Pacific/Chatham','(UTC +12:45) Chatham', 765],
|
||||
['Pacific/Enderbury','(UTC +13:00) Enderbury, Tongatapu', 780],
|
||||
['Pacific/Apia','(UTC +13:00) Apia', 780],
|
||||
['Pacific/Kiritimati','(UTC +14:00) Kiritimati', 840]
|
||||
],
|
||||
|
||||
/* map all citys to the above timezones */
|
||||
map : {
|
||||
/* Pacific */
|
||||
'Pacific/Midway' : 'Pacific/Midway',
|
||||
'Pacific/Niue' : 'Pacific/Midway',
|
||||
'Pacific/Pago_Pago' : 'Pacific/Midway',
|
||||
'Pacific/Fakaofo' : 'Pacific/Fakaofo',
|
||||
'Pacific/Honolulu' : 'Pacific/Fakaofo',
|
||||
'Pacific/Johnston' : 'Pacific/Fakaofo',
|
||||
'Pacific/Rarotonga' : 'Pacific/Fakaofo',
|
||||
'Pacific/Tahiti' : 'Pacific/Fakaofo',
|
||||
'Pacific/Marquesas' : 'Pacific/Marquesas',
|
||||
'Pacific/Gambier' : 'Pacific/Gambier',
|
||||
'Pacific/Easter' : 'Pacific/Easter',
|
||||
'Pacific/Norfolk' : 'Pacific/Norfolk',
|
||||
'Pacific/Chatham' : 'Pacific/Chatham',
|
||||
'Pacific/Enderbury' : 'Pacific/Enderbury',
|
||||
'Pacific/Tongatapu' : 'Pacific/Enderbury',
|
||||
'Pacific/Apia' : 'Pacific/Apia',
|
||||
'Pacific/Kiritimati' : 'Pacific/Kiritimati',
|
||||
/* America */
|
||||
'America/Adak' : 'America/Adak',
|
||||
'America/Anchorage' : 'America/Anchorage',
|
||||
'America/Juneau' : 'America/Anchorage',
|
||||
'America/Nome' : 'America/Anchorage',
|
||||
'America/Sitka' : 'America/Anchorage',
|
||||
'America/Yakutat' : 'America/Anchorage',
|
||||
'America/Dawson' : 'America/Dawson',
|
||||
'America/Los_Angeles' : 'America/Dawson',
|
||||
'America/Tijuana' : 'America/Dawson',
|
||||
'America/Vancouver' : 'America/Dawson',
|
||||
'America/Whitehorse' : 'America/Dawson',
|
||||
'America/Santa_Isabel' : 'America/Santa_Isabel',
|
||||
'America/Metlakatla' : 'America/Metlakatla',
|
||||
'America/Dawson_Creek' : 'America/Dawson_Creek',
|
||||
'America/Hermosillo' : 'America/Dawson_Creek',
|
||||
'America/Phoenix' : 'America/Dawson_Creek',
|
||||
'America/Chihuahua' : 'America/Chihuahua',
|
||||
'America/Mazatlan' : 'America/Chihuahua'
|
||||
/* Europe */
|
||||
/* Africa */
|
||||
/* Australia */
|
||||
/* Atlantic */
|
||||
/* Antarctica */
|
||||
/* Artic */
|
||||
/*
|
||||
/* Asia */
|
||||
/* Indian */
|
||||
/* Others */
|
||||
|
||||
},
|
||||
|
||||
/* return unmapped timezone... */
|
||||
unMap: function(timezone) {
|
||||
return this.map[timezone] !== undefined ? this.map[timezone] : timezone;
|
||||
},
|
||||
|
||||
getOffset: function(timezone) {
|
||||
/* find timezone, this needs to be optimized ;) */
|
||||
timezone = this.unMap(timezone);
|
||||
|
||||
for(i = 0; i < this.store.length; i++) {
|
||||
if(this.store[i][0] == timezone) {
|
||||
return (this.store[i][2] * 60000);
|
||||
}
|
||||
}
|
||||
|
||||
return 0; // no offset found...
|
||||
}
|
||||
});
|
||||
|
||||
Zarafa.plugins.calendarimporter.data.Timezones = new Zarafa.plugins.calendarimporter.data.Timezones();
|
@ -1,3 +1,12 @@
|
||||
/**
|
||||
* ImportContentPanel
|
||||
*
|
||||
* Container for the importpanel.
|
||||
*
|
||||
* @author Christoph Haas <mail@h44z.net>
|
||||
* @modified 29.12.2012
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
Ext.namespace("Zarafa.plugins.calendarimporter.dialogs");
|
||||
|
||||
/**
|
||||
|
@ -1,3 +1,12 @@
|
||||
/**
|
||||
* ImportPanel
|
||||
*
|
||||
* The main Panel of the calendarimporter plugin.
|
||||
*
|
||||
* @author Christoph Haas <mail@h44z.net>
|
||||
* @modified 29.12.2012
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
Ext.namespace("Zarafa.plugins.calendarimporter.dialogs");
|
||||
|
||||
/**
|
||||
@ -79,13 +88,26 @@ Zarafa.plugins.calendarimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
|
||||
* @private
|
||||
*/
|
||||
createGrid : function(eventdata) {
|
||||
|
||||
/* remove the grid if it already exists because of an old calendar file */
|
||||
this.remove("eventgrid");
|
||||
|
||||
var parsedData = [];
|
||||
var local_tz_offset = new Date().getTimezoneOffset() * 60000; // getTimezoneOffset returns minutes... we need milliseconds
|
||||
var tz_offset = local_tz_offset;
|
||||
|
||||
if(this.timezone != null) {
|
||||
tz_offset = Zarafa.plugins.calendarimporter.data.Timezones.getOffset(this.timezone);
|
||||
}
|
||||
|
||||
if(eventdata !== null) {
|
||||
var parsedData = new Array(eventdata.events.length);
|
||||
|
||||
for(var i=0; i < eventdata.events.length; i++) {
|
||||
parsedData[i] = new Array(eventdata.events[i]["SUMMARY"], new Date(parseInt(eventdata.events[i]["DTSTART"])), new Date(parseInt(eventdata.events[i]["DTEND"])), eventdata.events[i]["LOCATION"], eventdata.events[i]["DESCRIPTION"]);
|
||||
parsedData[i] = new Array(eventdata.events[i]["SUMMARY"], new Date(parseInt(eventdata.events[i]["DTSTART"]) + local_tz_offset - tz_offset), new Date(parseInt(eventdata.events[i]["DTEND"]) + local_tz_offset - tz_offset), eventdata.events[i]["LOCATION"], eventdata.events[i]["DESCRIPTION"]);
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
// create the data store
|
||||
@ -117,8 +139,8 @@ Zarafa.plugins.calendarimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
|
||||
},
|
||||
columns: [
|
||||
{id: 'Summary', header: 'Title', width: 300, sortable: true, dataIndex: 'title'},
|
||||
{header: 'Start', width: 150, sortable: true, dataIndex: 'start'},
|
||||
{header: 'End', width: 150, sortable: true, dataIndex: 'end'},
|
||||
{header: 'Start', width: 150, sortable: true, dataIndex: 'start', renderer : Zarafa.common.ui.grid.Renderers.datetime},
|
||||
{header: 'End', width: 150, sortable: true, dataIndex: 'end', renderer : Zarafa.common.ui.grid.Renderers.datetime},
|
||||
{header: 'Location', width: 150, sortable: true, dataIndex: 'location'},
|
||||
{header: 'Description', width: 150, sortable: true, dataIndex: 'description'}
|
||||
]
|
||||
@ -292,10 +314,12 @@ Zarafa.plugins.calendarimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
|
||||
* @param {Number} index
|
||||
*/
|
||||
onTimezoneSelected : function(combo, record, index) {
|
||||
// record.data.field1 == timezone
|
||||
//this.remove("eventgrid");
|
||||
this.timezone = record.data.field1;
|
||||
//this.insert(this.items.length,this.createGrid(this.parsedresult));
|
||||
this.timezone = record.data.field1;
|
||||
|
||||
if(this.parsedresult != null) {
|
||||
this.add(this.createGrid(this.parsedresult));
|
||||
this.doLayout();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@ -328,10 +352,11 @@ Zarafa.plugins.calendarimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
|
||||
|
||||
if(this.timezone == null) {;
|
||||
this.timezone = action.result.response.calendar["X-WR-TIMEZONE"];
|
||||
this.timezoneselector.setValue(Zarafa.plugins.calendarimporter.data.Timezones.unMap(this.timezone));
|
||||
} else {
|
||||
this.timezone = this.timezoneselector.value;
|
||||
}
|
||||
this.insert(this.items.length,this.createGrid(action.result.response));
|
||||
this.add(this.createGrid(action.result.response));
|
||||
this.doLayout();
|
||||
},
|
||||
scope : this
|
||||
@ -417,7 +442,7 @@ Zarafa.plugins.calendarimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
|
||||
icon : Ext.MessageBox.ERROR,
|
||||
buttons : Ext.MessageBox.OK
|
||||
});
|
||||
} else {
|
||||
} else {
|
||||
var calendarFolder = container.getHierarchyStore().getDefaultFolder('calendar');
|
||||
if(calValue != "calendar") {
|
||||
var subFolders = calendarFolder.getChildren();
|
||||
@ -456,7 +481,7 @@ Zarafa.plugins.calendarimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
|
||||
|
||||
var updateTimer = function() {
|
||||
for(var i = 1; i < 101; i++){
|
||||
setTimeout(updateProgressBar(i), 20*i);
|
||||
setTimeout(updateProgressBar(i), 20*i);
|
||||
}
|
||||
};
|
||||
|
||||
@ -474,7 +499,7 @@ Zarafa.plugins.calendarimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
|
||||
groupDir: "ASC",
|
||||
restriction: {
|
||||
startdate: 0,
|
||||
duedate: 2145826800 // 2037... highest unix timestamp
|
||||
duedate: 2145826800 // 2037... nearly highest unix timestamp
|
||||
},
|
||||
sort: [{
|
||||
"field": "startdate",
|
||||
@ -526,7 +551,7 @@ Zarafa.plugins.calendarimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
|
||||
downLoadICS : function(response)
|
||||
{
|
||||
Zarafa.common.dialogs.MessageBox.hide();
|
||||
if(response.status === true) {
|
||||
if(response.status === true) {
|
||||
// needs to be window.open, document.location.href kills the extjs response handler...
|
||||
window.open('plugins/calendarimporter/php/download.php?fileid='+response.fileid+'&basedir='+response.basedir+'&secid='+response.secid+'&realname='+response.realname,"Download");
|
||||
} else {
|
||||
|
@ -1,3 +1,13 @@
|
||||
/**
|
||||
* Calendarimporter
|
||||
*
|
||||
* Main entry point for the plugin
|
||||
*
|
||||
* @author Christoph Haas <mail@h44z.net>
|
||||
* @modified 29.12.2012
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
Ext.namespace("Zarafa.plugins.calendarimporter"); // Assign the right namespace
|
||||
|
||||
Zarafa.plugins.calendarimporter.ImportPlugin = Ext.extend(Zarafa.core.Plugin, { // create new import plugin
|
||||
|
@ -4,11 +4,11 @@ VERSION:2.0
|
||||
CALSCALE:GREGORIAN
|
||||
METHOD:PUBLISH
|
||||
X-WR-CALNAME:Testkalender
|
||||
X-WR-TIMEZONE:Europe/Berlin
|
||||
X-WR-TIMEZONE:America/Detroit
|
||||
X-WR-CALDESC:Nur zum testen vom Google Kalender
|
||||
BEGIN:VEVENT
|
||||
DTSTART;TZID="W. Europe":20121227T100000
|
||||
DTEND;TZID="W. Europe":20121227T110000Z
|
||||
DTSTART;TZID="America/Detroit":20121227T100000
|
||||
DTEND;TZID="America/Detroit":20121227T110000
|
||||
DTSTAMP:20110121T195741Z
|
||||
UID:1koigufm110c5hnq6ln57murd4@google.com
|
||||
CREATED:20110119T142901Z
|
||||
|
@ -61,47 +61,46 @@ class ICal {
|
||||
foreach ($lines as $line) {
|
||||
$line = trim($line);
|
||||
$add = $this->keyValueFromString($line);
|
||||
error_log("line: " . $line);
|
||||
if ($add === false) {
|
||||
$this->addCalendarComponentWithKeyAndValue($type, false, $line);
|
||||
continue;
|
||||
}
|
||||
|
||||
list($keyword, $value) = $add;
|
||||
list($keyword, $props, $value) = $add;
|
||||
|
||||
switch ($line) {
|
||||
// http://www.kanzaki.com/docs/ical/vtodo.html
|
||||
case "BEGIN:VTODO":
|
||||
$this->todo_count++;
|
||||
$type = "VTODO";
|
||||
break;
|
||||
// http://www.kanzaki.com/docs/ical/vtodo.html
|
||||
case "BEGIN:VTODO":
|
||||
$this->todo_count++;
|
||||
$type = "VTODO";
|
||||
break;
|
||||
|
||||
// http://www.kanzaki.com/docs/ical/vevent.html
|
||||
case "BEGIN:VEVENT":
|
||||
//echo "vevent gematcht";
|
||||
$this->event_count++;
|
||||
$type = "VEVENT";
|
||||
break;
|
||||
// http://www.kanzaki.com/docs/ical/vevent.html
|
||||
case "BEGIN:VEVENT":
|
||||
//echo "vevent gematcht";
|
||||
$this->event_count++;
|
||||
$type = "VEVENT";
|
||||
break;
|
||||
|
||||
//all other special strings
|
||||
case "BEGIN:VCALENDAR":
|
||||
case "BEGIN:DAYLIGHT":
|
||||
// http://www.kanzaki.com/docs/ical/vtimezone.html
|
||||
case "BEGIN:VTIMEZONE":
|
||||
case "BEGIN:STANDARD":
|
||||
$type = $value;
|
||||
break;
|
||||
case "END:VTODO": // end special text - goto VCALENDAR key
|
||||
case "END:VEVENT":
|
||||
case "END:VCALENDAR":
|
||||
case "END:DAYLIGHT":
|
||||
case "END:VTIMEZONE":
|
||||
case "END:STANDARD":
|
||||
$type = "VCALENDAR";
|
||||
break;
|
||||
default:
|
||||
$this->addCalendarComponentWithKeyAndValue($type, $keyword, $value);
|
||||
break;
|
||||
//all other special strings
|
||||
case "BEGIN:VCALENDAR":
|
||||
case "BEGIN:DAYLIGHT":
|
||||
// http://www.kanzaki.com/docs/ical/vtimezone.html
|
||||
case "BEGIN:VTIMEZONE":
|
||||
case "BEGIN:STANDARD":
|
||||
$type = $value;
|
||||
break;
|
||||
case "END:VTODO": // end special text - goto VCALENDAR key
|
||||
case "END:VEVENT":
|
||||
case "END:VCALENDAR":
|
||||
case "END:DAYLIGHT":
|
||||
case "END:VTIMEZONE":
|
||||
case "END:STANDARD":
|
||||
$type = "VCALENDAR";
|
||||
break;
|
||||
default:
|
||||
$this->addCalendarComponentWithKeyAndValue($type, $keyword, $value, $props);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $this->cal;
|
||||
@ -117,14 +116,14 @@ class ICal {
|
||||
*
|
||||
* @return {None}
|
||||
*/
|
||||
public function addCalendarComponentWithKeyAndValue($component, $keyword, $value) {
|
||||
if ($keyword == false) {
|
||||
public function addCalendarComponentWithKeyAndValue($component, $keyword, $value, $props = false) {
|
||||
if ($keyword == false) { // multiline value
|
||||
$keyword = $this->last_keyword;
|
||||
|
||||
switch ($component) {
|
||||
case 'VEVENT':
|
||||
if (stristr($keyword, "DTSTART") or stristr($keyword, "DTEND")) {
|
||||
$ts = $this->iCalDateToUnixTimestamp($value);
|
||||
$ts = $this->iCalDateToUnixTimestamp($value, $props);
|
||||
$value = $ts * 1000;
|
||||
}
|
||||
$value = str_replace("\\n", "\n", $value);
|
||||
@ -138,10 +137,11 @@ class ICal {
|
||||
}
|
||||
}
|
||||
|
||||
/* This should not be neccesary anymore*/
|
||||
//always strip additional content....
|
||||
//if (stristr($keyword, "DTSTART") or stristr($keyword, "DTEND")) {
|
||||
$keyword = explode(";", $keyword);
|
||||
$keyword = $keyword[0]; // remove additional content like VALUE=DATE
|
||||
//$keyword = explode(";", $keyword);
|
||||
//$keyword = $keyword[0]; // remove additional content like VALUE=DATE
|
||||
//}
|
||||
|
||||
if (stristr($keyword, "TIMEZONE")) {
|
||||
@ -155,7 +155,7 @@ class ICal {
|
||||
break;
|
||||
case "VEVENT":
|
||||
if (stristr($keyword, "DTSTART") or stristr($keyword, "DTEND")) {
|
||||
$ts = $this->iCalDateToUnixTimestamp($value);
|
||||
$ts = $this->iCalDateToUnixTimestamp($value, $props);
|
||||
$value = $ts * 1000;
|
||||
}
|
||||
$value = str_replace("\\n", "\n", $value);
|
||||
@ -173,17 +173,16 @@ class ICal {
|
||||
*
|
||||
* @param {string} $text which is like "VCALENDAR:Begin" or "LOCATION:"
|
||||
*
|
||||
* @return {array} array("VCALENDAR", "Begin")
|
||||
* @return {array} array("VCALENDAR", "Begin", "Optional Props")
|
||||
*/
|
||||
public function keyValueFromString($text) {
|
||||
preg_match("/(^[^a-z:]+[;a-zA-Z=\/\"\']*)[:]([\w\W]*)/", $text, $matches);
|
||||
preg_match("/(^[^a-z:;]+)[;a-zA-Z]*[=]*([a-zA-Z\/\"\'\.\s]*)[:]([\w\W]*)/", $text, $matches);
|
||||
|
||||
error_log("macthes: " . count($matches). " " . $text);
|
||||
if (count($matches) == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$matches = array_splice($matches, 1, 2);
|
||||
$matches = array_splice($matches, 1, 3);
|
||||
return $matches;
|
||||
}
|
||||
|
||||
@ -195,8 +194,13 @@ class ICal {
|
||||
*
|
||||
* @return {int}
|
||||
*/
|
||||
public function iCalDateToUnixTimestamp($icalDate) {
|
||||
public function iCalDateToUnixTimestamp($icalDate, $timezone) {
|
||||
|
||||
if($timezone) {
|
||||
$timezone = str_replace('"', '', $timezone);
|
||||
$timezone = str_replace('\'', '', $timezone);
|
||||
}
|
||||
|
||||
/* timestring format */
|
||||
$utc = strpos("zZ",substr($icalDate, -1)) === false ? false : true;
|
||||
|
||||
@ -228,16 +232,21 @@ class ICal {
|
||||
(int)$date[1]);
|
||||
|
||||
|
||||
if($utc) {
|
||||
$utcdate = new DateTime();
|
||||
$utcdate->setTimestamp($timestamp);
|
||||
$utcdate->setTimezone(new DateTimeZone($this->default_timezone));
|
||||
$utcoffset = $utcdate->getOffset();
|
||||
if(!$utc) {
|
||||
$tz = $this->default_timezone;
|
||||
if($timezone) {
|
||||
$tz = $timezone;
|
||||
}
|
||||
|
||||
$this_tz = new DateTimeZone($tz);
|
||||
$tz_now = new DateTime("now", $this_tz);
|
||||
$tz_offset = $this_tz->getOffset($tz_now);
|
||||
$timestamp_utc = $timestamp + $tz_offset;
|
||||
} else {
|
||||
$utcoffset = 0;
|
||||
$timestamp_utc = $timestamp;
|
||||
}
|
||||
|
||||
return ($timestamp + $utcoffset);
|
||||
return ($timestamp_utc);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -20,19 +20,13 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* This module integrates Owncloud into attachment part of emails
|
||||
* @class OwncloudModule
|
||||
* @extends Module
|
||||
*/
|
||||
|
||||
include_once('mapi/class.recurrence.php');
|
||||
include_once('plugins/calendarimporter/php/ical/class.icalcreator.php');
|
||||
|
||||
class CalendarexporterModule extends Module {
|
||||
|
||||
private $DEBUG = true; // enable error_log debugging
|
||||
private $DEBUG = false; // enable error_log debugging
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
|
Loading…
Reference in New Issue
Block a user