basic import working

This commit is contained in:
Christoph Haas 2016-06-25 15:17:19 +02:00
parent 746278f891
commit 557ea6b6da
2 changed files with 22 additions and 11 deletions

View File

@ -285,13 +285,13 @@ Zarafa.plugins.calendarimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
parsedData[i] = [
eventdata.events[i]["subject"],
new Date(parseInt(eventdata.events[i]["startdate"]) * 1000),
new Date(parseInt(eventdata.events[i]["enddate"]) * 1000),
new Date(parseInt(eventdata.events[i]["duedate"]) * 1000),
eventdata.events[i]["location"],
eventdata.events[i]["body"],
eventdata.events[i]["priority"],
eventdata.events[i]["label"],
eventdata.events[i]["busy"],
eventdata.events[i]["class"],
eventdata.events[i]["busystatus"],
eventdata.events[i]["private"],
eventdata.events[i]["organizer"],
eventdata.events[i]["alarms"],
eventdata.events[i]["timezone"],

View File

@ -406,14 +406,18 @@ class CalendarModule extends Module
$propValuesMAPI = array();
$properties = $GLOBALS['properties']->getAppointmentProperties();
error_log("properties: " . print_r($properties, true));
$count = 0;
// iterate through all events and import them :)
foreach ($events as $event) {
if (isset($event["startdate"]) && ($importall || in_array($event["internal_fields"]["event_uid"], $uids))) {
error_log("Importing: " . print_r($event, true));
// parse the arraykeys
// TODO: this is very slow...
foreach ($events as $key => $value) {
foreach ($event as $key => $value) {
if ($key !== "internal_fields") {
if(isset($properties[$key])) {
$propValuesMAPI[$properties[$key]] = $value;
@ -421,6 +425,11 @@ class CalendarModule extends Module
}
}
error_log("MAPI: " . print_r($propValuesMAPI, true));
$propValuesMAPI[$properties["commonstart"]] = $propValuesMAPI[$properties["startdate"]];
$propValuesMAPI[$properties["commonend"]] = $propValuesMAPI[$properties["duedate"]];
$propValuesMAPI[$properties["message_class"]] = "IPM.Appointment";
$propValuesMAPI[$properties["icon_index"]] = "1024";
$message = mapi_folder_createmessage($folder);
@ -429,7 +438,7 @@ class CalendarModule extends Module
mapi_setprops($message, $propValuesMAPI);
mapi_savechanges($message);
if ($this->DEBUG) {
error_log("New event added: \"" . $propValuesMAPI[$properties["startdate"]] . "\".\n");
error_log("New event added: \"" . $event["startdate"] . "\".\n");
}
$count++;
}
@ -663,21 +672,23 @@ class CalendarModule extends Module
$properties["internal_fields"]["event_uid"] = base64_encode($Index . $vEvent->UID);
$properties["startdate"] = (string)$vEvent->DTSTART->getDateTime()->getTimestamp();
$properties["enddate"] = (string)$vEvent->DTEND->getDateTime()->getTimestamp();
$properties["duedate"] = (string)$vEvent->DTEND->getDateTime()->getTimestamp();
$properties["location"] = (string)$vEvent->LOCATION;
$properties["subject"] = (string)$vEvent->SUMMARY;
$properties["body"] = (string)$vEvent->DESCRIPTION;
$properties["comment"] = (string)$vEvent->COMMENT;
$properties["timezone"] = (string)$vEvent->DTSTART["TZID"];
$properties["organizer"] = (string)$vEvent->ORGANIZER;
$properties["busy"] = (string)$vEvent->{'X-MICROSOFT-CDO-INTENDEDSTATUS'}; // X-MICROSOFT-CDO-BUSYSTATUS
$properties["busystatus"] = array_search((string)$vEvent->{'X-MICROSOFT-CDO-INTENDEDSTATUS'}, $this->busystates); // X-MICROSOFT-CDO-BUSYSTATUS
$properties["transp"] = (string)$vEvent->TRANSP;
//$properties["trigger"] = (string)$vEvent->COMMENT;
$properties["priority"] = (string)$vEvent->PRIORITY;
$properties["class"] = (string)$vEvent->CLASS;
//$properties["label"] = (string)$vEvent->COMMENT;
$properties["lastmodified"] = (string)$vEvent->{'LAST-MODIFIED'};
$properties["created"] = (string)$vEvent->CREATED;
$properties["private"] = ((string)$vEvent->CLASS) == "PRIVATE" ? true : false;
if(!empty((string)$vEvent->{'X-ZARAFA-LABEL'})) {
$properties["label"] = array_search((string)$vEvent->{'X-ZARAFA-LABEL'}, $this->labels);
}
$properties["last_modification_time"] = (string)$vEvent->{'LAST-MODIFIED'}->getDateTime()->getTimestamp();
$properties["creation_time"] = (string)$vEvent->CREATED->getDateTime()->getTimestamp();
$properties["rrule"] = (string)$vEvent->RRULE;
// Attendees