mmm, not quite. This shifts all events that are not in the current timezone off by one hour -- so if it's july (during daylight saving time) and you're looking back at what happened in january (during which we observed standard time), or vice versa, events look fine in your current month but they are off by an hour during the months where the other tz was observed.
I have a fix, it's not pretty but it works better. I even try to determine whether DST is not observed where you are (or at least, where the server is, which is usually a good indication).
1. fix toGMT
2. fix getEvents (in database.php)Code:function toGMT($time) { $gmt_offset = date('Z'); // current gmt offset may not match event's gmt offset // adjust accordingly if (date('I') && !date('I',$time)) { $gmt_offset -= 3600; } else if (!date('I') && date('I',$time)) { $gmt_offset += 3600; } return date('Y-m-d H:i:s',$time - $gmt_offset); }
Code:public function getEvents($start, $end) { if (!empty($this->rcmail->user->ID)) { /* This was completely wrong -- the question is whether to adjust the EVENT's time for DST. Whether we are CURRENTLY observing DST is not really the issue. The question is (A) does the user observe DST? and if so, (B) does THIS EVENT fall on the calendar during DST or STD time? */ if ($this->rcmail->config->get('timezone') === "auto") { $auto = TRUE; $tz = isset($_SESSION['timezone']) ? $_SESSION['timezone'] : date('Z')/3600; } else { $auto = FALSE; $tz = $this->rcmail->config->get('timezone'); if($this->rcmail->config->get('dst_active')) { $dst_active = TRUE; $tz++; } } if (date('I') || (!$auto && $dst_active)) { $tz_std = $tz - 1; $tz_dst = $tz; } else { $tz_std = $tz; $tz_dst = $tz + 1; } // Server does not observe DST? Then most likely the user doesn't either. if (($auto || !$dst_active) && !date('I',mktime(0,0,0,7,1,2010))) { // no DST adjustment $tz_std = $tz; $tz_dst = $tz; } $result = $this->rcmail->db->query( "SELECT * FROM events WHERE user_id=?", $this->rcmail->user->ID ); $events = array(); while ($result && ($event = $this->rcmail->db->fetch_assoc($result))) { $event['start'] = strtotime($event['start']); $event['end'] = strtotime($event['end']); // is/was the EVENT during daylight saving time? if (date('I',$event['start'] + $tz * 3600)) { $event['start'] += $tz_dst * 3600; $event['end'] += $tz_dst * 3600; } else { $event['start'] += $tz_std * 3600; $event['end'] += $tz_std * 3600; } $events[]=array( 'id' => $event['event_id'], 'start' => date('c', $event['start']), 'end' => date('c', $event['end']), 'title' => $event['summary'], 'description' => $event['description'], 'className' => $event['category'], 'allDay'=> ($event['all_day'] == 1)?true:false, ); } return json_encode($events); } }
Last edited by Blueyed1; 05-05-2010 at 06:37 PM. Reason: pictures missing
Assuming the database is setup correctly you would need to edit the sql querys that are going to the database that are in the main plugin file.
Well, my knowledge to postgresSQL DB and configuration in general, is limited to following a step by step guide.
It would be a nice feature if calendar plugin could be made so it'l run on postgresSQL, the same way as mySQL, and with a brief guide to installation.
/Blueyed1
This thread has been splitted to:
#1-jQuery Weekcalendar plugin (deprecated)
http://www.roundcubeforum.net/7-thir...eprecated.html
#2-jQuery Fullcalendar plugin (developed by Lazlo and forked by rosali)
http://www.roundcubeforum.net/7-thir...ed-rosali.html
Posts regarding these two plugin versions has been moved to appriate thread.
Posts remaining here refer to Lazlo's Github version (RoundCube Calendar).
Last edited by rosali; 05-31-2010 at 04:01 PM.
Regards,
Rosali
__________________
MyRoundcube Project http://myroundcube.googlecode.com
MyRoundcube Online Demo - Free Email Address http://mail4us.net
MyRoundcube Plugins Generic Installation Guide http://mail4us.net/myroundcube/index.php
Mailing List http://mail4us.net/?_action=plugin.nabble
@ all subscribers: Don't miss to subscribe to new threads!
Regards,
Rosali
__________________
MyRoundcube Project http://myroundcube.googlecode.com
MyRoundcube Online Demo - Free Email Address http://mail4us.net
MyRoundcube Plugins Generic Installation Guide http://mail4us.net/myroundcube/index.php
Mailing List http://mail4us.net/?_action=plugin.nabble
How do I change the hours to AM and PM 12 hour blocks instead of the 24:00 clock
you can do it i calendar settings: change time format....
How do I add and create new categories in the calendar
There are currently 1 users browsing this thread. (0 members and 1 guests)