basic import working
This commit is contained in:
parent
746278f891
commit
557ea6b6da
@ -285,13 +285,13 @@ Zarafa.plugins.calendarimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
|
|||||||
parsedData[i] = [
|
parsedData[i] = [
|
||||||
eventdata.events[i]["subject"],
|
eventdata.events[i]["subject"],
|
||||||
new Date(parseInt(eventdata.events[i]["startdate"]) * 1000),
|
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]["location"],
|
||||||
eventdata.events[i]["body"],
|
eventdata.events[i]["body"],
|
||||||
eventdata.events[i]["priority"],
|
eventdata.events[i]["priority"],
|
||||||
eventdata.events[i]["label"],
|
eventdata.events[i]["label"],
|
||||||
eventdata.events[i]["busy"],
|
eventdata.events[i]["busystatus"],
|
||||||
eventdata.events[i]["class"],
|
eventdata.events[i]["private"],
|
||||||
eventdata.events[i]["organizer"],
|
eventdata.events[i]["organizer"],
|
||||||
eventdata.events[i]["alarms"],
|
eventdata.events[i]["alarms"],
|
||||||
eventdata.events[i]["timezone"],
|
eventdata.events[i]["timezone"],
|
||||||
|
@ -406,14 +406,18 @@ class CalendarModule extends Module
|
|||||||
|
|
||||||
$propValuesMAPI = array();
|
$propValuesMAPI = array();
|
||||||
$properties = $GLOBALS['properties']->getAppointmentProperties();
|
$properties = $GLOBALS['properties']->getAppointmentProperties();
|
||||||
|
error_log("properties: " . print_r($properties, true));
|
||||||
$count = 0;
|
$count = 0;
|
||||||
|
|
||||||
// iterate through all events and import them :)
|
// iterate through all events and import them :)
|
||||||
foreach ($events as $event) {
|
foreach ($events as $event) {
|
||||||
if (isset($event["startdate"]) && ($importall || in_array($event["internal_fields"]["event_uid"], $uids))) {
|
if (isset($event["startdate"]) && ($importall || in_array($event["internal_fields"]["event_uid"], $uids))) {
|
||||||
|
|
||||||
|
error_log("Importing: " . print_r($event, true));
|
||||||
|
|
||||||
// parse the arraykeys
|
// parse the arraykeys
|
||||||
// TODO: this is very slow...
|
// TODO: this is very slow...
|
||||||
foreach ($events as $key => $value) {
|
foreach ($event as $key => $value) {
|
||||||
if ($key !== "internal_fields") {
|
if ($key !== "internal_fields") {
|
||||||
if(isset($properties[$key])) {
|
if(isset($properties[$key])) {
|
||||||
$propValuesMAPI[$properties[$key]] = $value;
|
$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["message_class"]] = "IPM.Appointment";
|
||||||
$propValuesMAPI[$properties["icon_index"]] = "1024";
|
$propValuesMAPI[$properties["icon_index"]] = "1024";
|
||||||
$message = mapi_folder_createmessage($folder);
|
$message = mapi_folder_createmessage($folder);
|
||||||
@ -429,7 +438,7 @@ class CalendarModule extends Module
|
|||||||
mapi_setprops($message, $propValuesMAPI);
|
mapi_setprops($message, $propValuesMAPI);
|
||||||
mapi_savechanges($message);
|
mapi_savechanges($message);
|
||||||
if ($this->DEBUG) {
|
if ($this->DEBUG) {
|
||||||
error_log("New event added: \"" . $propValuesMAPI[$properties["startdate"]] . "\".\n");
|
error_log("New event added: \"" . $event["startdate"] . "\".\n");
|
||||||
}
|
}
|
||||||
$count++;
|
$count++;
|
||||||
}
|
}
|
||||||
@ -663,21 +672,23 @@ class CalendarModule extends Module
|
|||||||
$properties["internal_fields"]["event_uid"] = base64_encode($Index . $vEvent->UID);
|
$properties["internal_fields"]["event_uid"] = base64_encode($Index . $vEvent->UID);
|
||||||
|
|
||||||
$properties["startdate"] = (string)$vEvent->DTSTART->getDateTime()->getTimestamp();
|
$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["location"] = (string)$vEvent->LOCATION;
|
||||||
$properties["subject"] = (string)$vEvent->SUMMARY;
|
$properties["subject"] = (string)$vEvent->SUMMARY;
|
||||||
$properties["body"] = (string)$vEvent->DESCRIPTION;
|
$properties["body"] = (string)$vEvent->DESCRIPTION;
|
||||||
$properties["comment"] = (string)$vEvent->COMMENT;
|
$properties["comment"] = (string)$vEvent->COMMENT;
|
||||||
$properties["timezone"] = (string)$vEvent->DTSTART["TZID"];
|
$properties["timezone"] = (string)$vEvent->DTSTART["TZID"];
|
||||||
$properties["organizer"] = (string)$vEvent->ORGANIZER;
|
$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["transp"] = (string)$vEvent->TRANSP;
|
||||||
//$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["private"] = ((string)$vEvent->CLASS) == "PRIVATE" ? true : false;
|
||||||
//$properties["label"] = (string)$vEvent->COMMENT;
|
if(!empty((string)$vEvent->{'X-ZARAFA-LABEL'})) {
|
||||||
$properties["lastmodified"] = (string)$vEvent->{'LAST-MODIFIED'};
|
$properties["label"] = array_search((string)$vEvent->{'X-ZARAFA-LABEL'}, $this->labels);
|
||||||
$properties["created"] = (string)$vEvent->CREATED;
|
}
|
||||||
|
$properties["last_modification_time"] = (string)$vEvent->{'LAST-MODIFIED'}->getDateTime()->getTimestamp();
|
||||||
|
$properties["creation_time"] = (string)$vEvent->CREATED->getDateTime()->getTimestamp();
|
||||||
$properties["rrule"] = (string)$vEvent->RRULE;
|
$properties["rrule"] = (string)$vEvent->RRULE;
|
||||||
|
|
||||||
// Attendees
|
// Attendees
|
||||||
|
Loading…
Reference in New Issue
Block a user