From 988d2d7b9f07144c26252a6ac637ee43f8ea6132 Mon Sep 17 00:00:00 2001 From: Christoph Haas Date: Mon, 20 Jun 2016 20:00:44 +0200 Subject: [PATCH] display parsed data to user --- js/dialogs/ImportPanel.js | 9 ++------- php/module.calendar.php | 32 +++++++++++++++++++++++++++++--- 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/js/dialogs/ImportPanel.js b/js/dialogs/ImportPanel.js index a317efc..c191a46 100644 --- a/js/dialogs/ImportPanel.js +++ b/js/dialogs/ImportPanel.js @@ -278,19 +278,14 @@ Zarafa.plugins.calendarimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, { reloadGridStore: function(eventdata) { var parsedData = []; - // this is done to get rid of the local browser timezone.... - // because all timezone specific stuff is done via php - var local_tz_offset = new Date().getTimezoneOffset() * 60000; // getTimezoneOffset returns minutes... we need milliseconds - - if(eventdata !== null) { parsedData = new Array(eventdata.events.length); var i = 0; for(i = 0; i < eventdata.events.length; i++) { parsedData[i] = [ eventdata.events[i]["subject"], - new Date(parseInt(eventdata.events[i]["startdate"]) * 1000 + local_tz_offset), - new Date(parseInt(eventdata.events[i]["enddate"]) * 1000 + local_tz_offset), + new Date(parseInt(eventdata.events[i]["startdate"]) * 1000), + new Date(parseInt(eventdata.events[i]["enddate"]) * 1000), eventdata.events[i]["location"], eventdata.events[i]["body"], eventdata.events[i]["priority"], diff --git a/php/module.calendar.php b/php/module.calendar.php index 040d447..fc2d3fd 100644 --- a/php/module.calendar.php +++ b/php/module.calendar.php @@ -607,8 +607,8 @@ class CalendarModule extends Module $response['parsed_file'] = $actionData["ics_filepath"]; $response['parsed'] = array( 'events' => $this->parseCalendarToArray($parser), - 'timezone' => $parser->VTIMEZONE->TZID, - 'calendar' => $parser + 'timezone' => isset($parser->VTIMEZONE->TZID) ? (string)$parser->VTIMEZONE->TZID : (string)$parser->{'X-WR-TIMEZONE'}, + 'calendar' => (string)$parser->PRODID ); } } @@ -656,9 +656,35 @@ class CalendarModule extends Module //$properties["trigger"] = (string)$vEvent->COMMENT; $properties["priority"] = (string)$vEvent->PRIORITY; $properties["class"] = (string)$vEvent->CLASS; - $properties["label"] = (string)$vEvent->COMMENT; + //$properties["label"] = (string)$vEvent->COMMENT; $properties["lastmodified"] = (string)$vEvent->{'LAST-MODIFIED'}; $properties["created"] = (string)$vEvent->CREATED; + $properties["rrule"] = (string)$vEvent->RRULE; + + // Attendees + $properties["attendees"] = array(); + if(isset($vEvent->ATTENDEE) && count($vEvent->ATTENDEE) > 0) { + foreach($vEvent->ATTENDEE as $attendee) { + $properties["attendees"][] = array( + "name" => (string)$attendee["CN"], + "mail" => (string)$attendee, + "status" => (string)$attendee["PARTSTAT"], + "role" => (string)$attendee["ROLE"] + ); + } + } + + // Alarms + $properties["alarms"] = array(); + if(isset($vEvent->VALARM) && count($vEvent->VALARM) > 0) { + foreach($vEvent->VALARM as $alarm) { + $properties["alarms"][] = array( + "description" => (string)$alarm->DESCRIPTION, + "trigger" => (string)$alarm->TRIGGER, + "type" => (string)$alarm->TRIGGER["VALUE"] + ); + } + } array_push($events, $properties); }