Author: ralfbecker
Date: Tue Nov 10 16:08:35 2009
New Revision: 28286
URL: http://www.egroupware.org/viewvc/egroupware?rev=28286&view=rev Log:
"Using VTIMEZONE component from new calendar_timezones class (imported sqlite DB from Lighting) for exports and importing TZID from iCals.
Horde Code already uses VTIMEZONE component to return times in servertime, no need to change anything there."
if ($this->log) error_log(__FILE__.'('.__LINE__.'): '.__METHOD__.' '.array2string($event)."\n",3,$this->logfile);
- if (!$serverTZ
- && $event['recur_type'] != MCAL_RECUR_NONE
- && date('e', $event['start']) != 'UTC')
- {
- if ($event['recur_enddate'])
- {
- $startDST = date('I', $event['start']);
- $finalDST = date('I', $event['recur_enddate']);
- // Different DST or more than half a year?
- if ($startDST != $finalDST ||
- ($event['recur_enddate'] - $event['start']) > 15778800)
- {
- $utc = false;
- $serverTZ = true;
- }
- }
- else
- {
- $utc = false;
- $serverTZ = true;
- }
- if ($serverTZ)
- {
- // Add only one instance
- $serverTZ = $this->generate_vtimezone($event, $vcal);
- }
- }
-
+ // for palmos we have to use user-time and NO timezone
+ if (strpos($this->productName, 'palmos') !== false)
+ {
+ $tzid = null;
+ }
+ // check if tzid of event (not only recuring ones) is already added to export
+ elseif (($tzid = $event['tzid']) && $tzid != 'UTC' && !in_array($tzid,$vtimezones_added))
+ {
+ // check if we have vtimezone component data for tzid of event, if not default to user timezone (default to server tz)
+ if (!($vtimezone = calendar_timezones::tz2id($tzid,'component')))
+ {
+ error_log(__METHOD__."() unknown TZID='$tzid', defaulting to user timezone '".egw_time::$user_timezone->getName()."'!");
+ $vtimezone = calendar_timezones::tz2id($tzid=egw_time::$user_timezone->getName(),'component');
+ }
+ //error_log("in_array('$tzid',\$vtimezones_added)=".array2string(in_array($tzid,$vtimezones_added)).", component=$vtimezone");;
+ if (!in_array($tzid,$vtimezones_added))
+ {
+ // $vtimezone is a string with a single VTIMEZONE component, afaik Horde_iCalendar can not add it directly
+ // --> we have to parse it and let Horde_iCalendar add it again
+ $horde_vtimezone = Horde_iCalendar::newComponent('VTIMEZONE',$container=false);
+ $horde_vtimezone->parsevCalendar($vtimezone,'VTIMEZONE');
+ $vcal->addComponent($horde_vtimezone);
+ $vtimezones_added[] = $tzid;
+ }
+ }
if ($this->productManufacturer != 'file' && $this->uidExtension)
{
// Append UID to DESCRIPTION
@@ -347,15 +342,7 @@
break;
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________
eGroupWare-cvs mailing list
eGroupWare-cvs@... https://lists.sourceforge.net/lists/listinfo/egroupware-cvs