display parsed data to user

This commit is contained in:
Christoph Haas 2016-06-20 20:00:44 +02:00
parent 2606bf75b1
commit 988d2d7b9f
2 changed files with 31 additions and 10 deletions

View File

@ -278,19 +278,14 @@ Zarafa.plugins.calendarimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
reloadGridStore: function(eventdata) { reloadGridStore: function(eventdata) {
var parsedData = []; 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) { if(eventdata !== null) {
parsedData = new Array(eventdata.events.length); parsedData = new Array(eventdata.events.length);
var i = 0; var i = 0;
for(i = 0; i < eventdata.events.length; i++) { for(i = 0; i < eventdata.events.length; i++) {
parsedData[i] = [ parsedData[i] = [
eventdata.events[i]["subject"], eventdata.events[i]["subject"],
new Date(parseInt(eventdata.events[i]["startdate"]) * 1000 + local_tz_offset), new Date(parseInt(eventdata.events[i]["startdate"]) * 1000),
new Date(parseInt(eventdata.events[i]["enddate"]) * 1000 + local_tz_offset), new Date(parseInt(eventdata.events[i]["enddate"]) * 1000),
eventdata.events[i]["location"], eventdata.events[i]["location"],
eventdata.events[i]["body"], eventdata.events[i]["body"],
eventdata.events[i]["priority"], eventdata.events[i]["priority"],

View File

@ -607,8 +607,8 @@ class CalendarModule extends Module
$response['parsed_file'] = $actionData["ics_filepath"]; $response['parsed_file'] = $actionData["ics_filepath"];
$response['parsed'] = array( $response['parsed'] = array(
'events' => $this->parseCalendarToArray($parser), 'events' => $this->parseCalendarToArray($parser),
'timezone' => $parser->VTIMEZONE->TZID, 'timezone' => isset($parser->VTIMEZONE->TZID) ? (string)$parser->VTIMEZONE->TZID : (string)$parser->{'X-WR-TIMEZONE'},
'calendar' => $parser 'calendar' => (string)$parser->PRODID
); );
} }
} }
@ -656,9 +656,35 @@ class CalendarModule extends Module
//$properties["trigger"] = (string)$vEvent->COMMENT; //$properties["trigger"] = (string)$vEvent->COMMENT;
$properties["priority"] = (string)$vEvent->PRIORITY; $properties["priority"] = (string)$vEvent->PRIORITY;
$properties["class"] = (string)$vEvent->CLASS; $properties["class"] = (string)$vEvent->CLASS;
$properties["label"] = (string)$vEvent->COMMENT; //$properties["label"] = (string)$vEvent->COMMENT;
$properties["lastmodified"] = (string)$vEvent->{'LAST-MODIFIED'}; $properties["lastmodified"] = (string)$vEvent->{'LAST-MODIFIED'};
$properties["created"] = (string)$vEvent->CREATED; $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); array_push($events, $properties);
} }