diff options
-rw-r--r-- | Zotlabs/Module/Cdav.php | 12 | ||||
-rw-r--r-- | Zotlabs/Module/Channel_calendar.php | 20 | ||||
-rw-r--r-- | include/event.php | 4 | ||||
-rw-r--r-- | include/features.php | 5 | ||||
-rw-r--r-- | view/tpl/cdav_calendar.tpl | 4 |
5 files changed, 27 insertions, 18 deletions
diff --git a/Zotlabs/Module/Cdav.php b/Zotlabs/Module/Cdav.php index 08d27c850..de639e281 100644 --- a/Zotlabs/Module/Cdav.php +++ b/Zotlabs/Module/Cdav.php @@ -1144,16 +1144,24 @@ class Cdav extends Controller { $dtend = (string)$vevent->DTEND; $description = (string)$vevent->DESCRIPTION; $location = (string)$vevent->LOCATION; - $timezone = (string)$vevent->DTSTART['TZID']; + $timezone_str = (string)$vevent->DTSTART['TZID']; $rw = ((cdav_perms($id[0],$calendars,true)) ? true : false); $editable = $rw ? true : false; $recurrent = ((isset($vevent->{'RECURRENCE-ID'})) ? true : false); if($recurrent) { $editable = false; - $timezone = $recurrent_timezone; + $timezone_str = $recurrent_timezone; } + // Try to get an usable olson format timezone + $timezone_obj = \Sabre\VObject\TimeZoneUtil::getTimeZone($timezone_str, $vcalendar); + $timezone = $timezone_obj->getName(); + + // If we got nothing fallback to UTC + if(! $timezone) + $timezone = 'UTC'; + $allDay = (((string)$vevent->DTSTART['VALUE'] == 'DATE') ? true : false); $events[] = [ diff --git a/Zotlabs/Module/Channel_calendar.php b/Zotlabs/Module/Channel_calendar.php index 96d32039e..44fe261e8 100644 --- a/Zotlabs/Module/Channel_calendar.php +++ b/Zotlabs/Module/Channel_calendar.php @@ -345,8 +345,9 @@ class Channel_calendar extends \Zotlabs\Web\Controller { if(! $tz) $tz = 'UTC'; - if($rr['etype'] === 'birthday') - $rr['adjust'] = intval(feature_enabled(local_channel(), 'smart_birthdays')); + if($rr['etype'] === 'birthday') { + $rr['adjust'] = 1; //intval(feature_enabled(local_channel(), 'smart_birthdays')); + } $start = (($rr['adjust']) ? datetime_convert($tz, date_default_timezone_get(), $rr['dtstart'], 'c') : datetime_convert('UTC', 'UTC', $rr['dtstart'], 'c')); if ($rr['nofinish']){ @@ -356,7 +357,6 @@ class Channel_calendar extends \Zotlabs\Web\Controller { // give a fake end to birthdays so they get crammed into a // single day on the calendar - if($rr['etype'] === 'birthday') $end = null; } @@ -374,13 +374,13 @@ class Channel_calendar extends \Zotlabs\Web\Controller { } } - $allDay = false; + //$allDay = false; // allDay event rules - if(!strpos($start, 'T') && !strpos($end, 'T')) - $allDay = true; - if(strpos($start, 'T00:00:00') && strpos($end, 'T00:00:00')) - $allDay = true; + //if(!strpos($start, 'T') && !strpos($end, 'T')) + // $allDay = true; + //if(strpos($start, 'T00:00:00') && strpos($end, 'T00:00:00')) + // $allDay = true; $edit = ((local_channel() && $rr['author_xchan'] == get_observer_hash()) ? array(z_root().'/events/'.$rr['event_hash'].'?expandform=1',t('Edit event'),'','') : false); @@ -395,10 +395,10 @@ class Channel_calendar extends \Zotlabs\Web\Controller { 'start'=> $start, 'end' => $end, 'drop' => $drop, - 'allDay' => $allDay, + 'allDay' => (($rr['adjust']) ? 0 : 1), 'title' => htmlentities($rr['summary'], ENT_COMPAT, 'UTF-8', false), 'editable' => $edit ? true : false, - 'item'=>$rr, + 'item' => $rr, 'plink' => [$rr['plink'], t('Link to source')], 'description' => htmlentities($rr['description'], ENT_COMPAT, 'UTF-8', false), 'location' => htmlentities($rr['location'], ENT_COMPAT, 'UTF-8', false), diff --git a/include/event.php b/include/event.php index 9bae69f5c..eb8731f46 100644 --- a/include/event.php +++ b/include/event.php @@ -83,11 +83,11 @@ function format_event_obj($jobject) { '$title' => zidify_links(smilies(bbcode($object['title']))), '$dtstart_label' => t('Starts:'), '$dtstart_title' => datetime_convert($tz, date_default_timezone_get(), $object['dtstart'], (($object['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' )), - '$dtstart_dt' => (($object['adjust']) ? day_translate(datetime_convert($tz, date_default_timezone_get(), $object['dtstart'] , $bd_format )) : day_translate(datetime_convert('UTC', date_default_timezone_get(), $object['dtstart'] , $bd_format))), + '$dtstart_dt' => (($object['adjust']) ? day_translate(datetime_convert($tz, date_default_timezone_get(), $object['dtstart'] , $bd_format )) : day_translate(datetime_convert('UTC', 'UTC', $object['dtstart'] , $bd_format))), '$finish' => (($object['nofinish']) ? false : true), '$dtend_label' => t('Finishes:'), '$dtend_title' => datetime_convert($tz, date_default_timezone_get(), $object['dtend'], (($object['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' )), - '$dtend_dt' => (($object['adjust']) ? day_translate(datetime_convert($tz, date_default_timezone_get(), $object['dtend'] , $bd_format )) : day_translate(datetime_convert('UTC', date_default_timezone_get(), $object['dtend'] , $bd_format ))) + '$dtend_dt' => (($object['adjust']) ? day_translate(datetime_convert($tz, date_default_timezone_get(), $object['dtend'] , $bd_format )) : day_translate(datetime_convert('UTC', 'UTC', $object['dtend'] , $bd_format ))) )); $event['content'] = replace_macros(get_markup_template('event_item_content.tpl'),array( diff --git a/include/features.php b/include/features.php index a44b424a6..5841395c5 100644 --- a/include/features.php +++ b/include/features.php @@ -96,14 +96,15 @@ function get_features($filtered = true, $level = (-1)) { false, get_config('feature_lock','event_tz_select'), ], - +/* [ 'smart_birthdays', t('Smart Birthdays'), t('Make birthday events timezone aware in case your friends are scattered across the planet.'), - true, + false, get_config('feature_lock','smart_birthdays'), ] +*/ ], diff --git a/view/tpl/cdav_calendar.tpl b/view/tpl/cdav_calendar.tpl index da4a6d156..083c7cea3 100644 --- a/view/tpl/cdav_calendar.tpl +++ b/view/tpl/cdav_calendar.tpl @@ -207,7 +207,7 @@ $(document).ready(function() { 'timezone_select': event.extendedProps.timezone, 'dtstart': dtstart.toUTCString(), 'dtend': dtend.toUTCString(), - 'adjust': event.extendedProps.item.adjust, + 'adjust': event.allDay ? 0 : 1, 'categories': event.extendedProps.categories, 'desc': event.extendedProps.description, 'location': event.extendedProps.location, @@ -256,7 +256,7 @@ $(document).ready(function() { 'timezone_select': event.extendedProps.timezone, 'dtstart': dtstart.toUTCString(), 'dtend': dtend.toUTCString(), - 'adjust': event.extendedProps.item.adjust, + 'adjust': event.allDay ? 0 : 1, 'categories': event.extendedProps.categories, 'desc': event.extendedProps.description, 'location': event.extendedProps.location, |