calendarimporter 2.0.2:
- fixed crash when public store does not exist - check if temporary directory is writeable - disabled display_error with ini_set - fixed exporter: now really exporting the chosen calendar - improved parser (timezone detection)
This commit is contained in:
parent
55b6e41277
commit
b2be7585d5
@ -2,6 +2,8 @@ calendarimporter 2.0.2:
|
|||||||
- fixed crash when public store does not exist
|
- fixed crash when public store does not exist
|
||||||
- check if temporary directory is writeable
|
- check if temporary directory is writeable
|
||||||
- disabled display_error with ini_set
|
- disabled display_error with ini_set
|
||||||
|
- fixed exporter: now really exporting the chosen calendar
|
||||||
|
- improved parser (timezone detection)
|
||||||
|
|
||||||
calendarimporter 2.0.1:
|
calendarimporter 2.0.1:
|
||||||
- removed debug line "utc = true;"
|
- removed debug line "utc = true;"
|
||||||
|
@ -505,7 +505,7 @@ Zarafa.plugins.calendarimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
|
|||||||
if(typeof response.parsed.calendar["X-WR-TIMEZONE"] !== "undefined") {;
|
if(typeof response.parsed.calendar["X-WR-TIMEZONE"] !== "undefined") {;
|
||||||
this.timezone = response.parsed.calendar["X-WR-TIMEZONE"];
|
this.timezone = response.parsed.calendar["X-WR-TIMEZONE"];
|
||||||
this.timezoneselector.setValue(Zarafa.plugins.calendarimporter.data.Timezones.unMap(this.timezone));
|
this.timezoneselector.setValue(Zarafa.plugins.calendarimporter.data.Timezones.unMap(this.timezone));
|
||||||
}
|
}
|
||||||
this.reloadGridStore(response.parsed);
|
this.reloadGridStore(response.parsed);
|
||||||
} else {
|
} else {
|
||||||
Ext.getCmp('submitButton').disable();
|
Ext.getCmp('submitButton').disable();
|
||||||
@ -599,17 +599,28 @@ Zarafa.plugins.calendarimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
|
|||||||
var calexist = true;
|
var calexist = true;
|
||||||
var calendarFolder = container.getHierarchyStore().getDefaultFolder('calendar');
|
var calendarFolder = container.getHierarchyStore().getDefaultFolder('calendar');
|
||||||
var pubStore = container.getHierarchyStore().getPublicStore();
|
var pubStore = container.getHierarchyStore().getPublicStore();
|
||||||
var pubFolder = pubStore.getDefaultFolder("publicfolders");
|
var pubSubFolders = [];
|
||||||
var pubSubFolders = pubFolder.getChildren();
|
if(typeof pubStore !== "undefined") {
|
||||||
|
try {
|
||||||
|
var pubFolder = pubStore.getDefaultFolder("publicfolders");
|
||||||
|
var pubSubFolders = pubFolder.getChildren();
|
||||||
|
} catch (e) {
|
||||||
|
console.log("Error opening the shared folder...");
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(calValue != "calendar") {
|
if(calValue != "calendar") {
|
||||||
var subFolders = calendarFolder.getChildren();
|
var subFolders = calendarFolder.getChildren();
|
||||||
var i = 0;
|
var i = 0;
|
||||||
|
|
||||||
|
/* add public folders if any exist */
|
||||||
for(i = 0; i < pubSubFolders.length; i++) {
|
for(i = 0; i < pubSubFolders.length; i++) {
|
||||||
if(pubSubFolders[i].isContainerClass("IPF.Appointment")){
|
if(pubSubFolders[i].isContainerClass("IPF.Appointment")){
|
||||||
subFolders.push(pubSubFolders[i]);
|
subFolders.push(pubSubFolders[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i=0;i<subFolders.length;i++) {
|
for(i=0;i<subFolders.length;i++) {
|
||||||
// loo up right folder
|
// loo up right folder
|
||||||
// TODO: improve!!
|
// TODO: improve!!
|
||||||
@ -713,11 +724,56 @@ Zarafa.plugins.calendarimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
|
|||||||
|
|
||||||
var i = 0;
|
var i = 0;
|
||||||
|
|
||||||
|
//receive existing calendar store
|
||||||
|
var calValue = this.calendarselector.value;
|
||||||
|
var calendarFolder = container.getHierarchyStore().getDefaultFolder('calendar');
|
||||||
|
var pubStore = container.getHierarchyStore().getPublicStore();
|
||||||
|
var pubSubFolders = [];
|
||||||
|
if(typeof pubStore !== "undefined") {
|
||||||
|
try {
|
||||||
|
var pubFolder = pubStore.getDefaultFolder("publicfolders");
|
||||||
|
var pubSubFolders = pubFolder.getChildren();
|
||||||
|
} catch (e) {
|
||||||
|
console.log("Error opening the shared folder...");
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(calValue != "calendar") {
|
||||||
|
var subFolders = calendarFolder.getChildren();
|
||||||
|
var i = 0;
|
||||||
|
|
||||||
|
/* add public folders if any exist */
|
||||||
|
for(i = 0; i < pubSubFolders.length; i++) {
|
||||||
|
if(pubSubFolders[i].isContainerClass("IPF.Appointment")){
|
||||||
|
subFolders.push(pubSubFolders[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i=0;i<subFolders.length;i++) {
|
||||||
|
// loo up right folder
|
||||||
|
// TODO: improve!!
|
||||||
|
if(subFolders[i].getDisplayName() == calValue) {
|
||||||
|
calendarFolder = subFolders[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(calendarFolder.isDefaultFolder()) {
|
||||||
|
Zarafa.common.dialogs.MessageBox.show({
|
||||||
|
title : _('Error'),
|
||||||
|
msg : _('Selected calendar does not exist!'),
|
||||||
|
icon : Zarafa.common.dialogs.MessageBox.ERROR,
|
||||||
|
buttons : Zarafa.common.dialogs.MessageBox.OK
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for(i = 0; i < requests; i++) {
|
for(i = 0; i < requests; i++) {
|
||||||
var responseHandler = new Zarafa.plugins.calendarimporter.data.ResponseHandler({
|
var responseHandler = new Zarafa.plugins.calendarimporter.data.ResponseHandler({
|
||||||
successCallback: this.storeResult.createDelegate(this)
|
successCallback: this.storeResult.createDelegate(this)
|
||||||
});
|
});
|
||||||
this.requestNext(responseHandler, response.page.rowcount *(i+1), response.page.rowcount);
|
this.requestNext(calendarFolder, responseHandler, response.page.rowcount *(i+1), response.page.rowcount);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -754,12 +810,12 @@ Zarafa.plugins.calendarimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* build a new event request for the listmodule
|
* build a new event request for the listmodule
|
||||||
|
* @param {Object} calendarFolder the calendarFolder to export
|
||||||
* @param {Object} responseHandler (should be storeResult)
|
* @param {Object} responseHandler (should be storeResult)
|
||||||
* @param {int} start
|
* @param {int} start
|
||||||
* @param {int} limit
|
* @param {int} limit
|
||||||
*/
|
*/
|
||||||
requestNext: function(responseHandler, start, limit) {
|
requestNext: function(calendarFolder, responseHandler, start, limit) {
|
||||||
var calendarFolder = container.getHierarchyStore().getDefaultFolder('calendar');
|
|
||||||
|
|
||||||
container.getRequest().singleRequest(
|
container.getRequest().singleRequest(
|
||||||
'appointmentlistmodule',
|
'appointmentlistmodule',
|
||||||
|
@ -188,8 +188,8 @@ class ICal {
|
|||||||
//$keyword = $keyword[0]; // remove additional content like VALUE=DATE
|
//$keyword = $keyword[0]; // remove additional content like VALUE=DATE
|
||||||
//}
|
//}
|
||||||
|
|
||||||
if (stristr($keyword, "TIMEZONE") && !$this->timezone_set) { // check if timezone already set...
|
if ((stristr($keyword, "TIMEZONE") || stristr($keyword, "TZID")) && !$this->timezone_set) { // check if timezone already set...
|
||||||
$this->default_timezone = $value; // store the calendertimezone
|
$this->default_timezone = $this->trimTimeZone($value); // store the calendertimezone
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($component) {
|
switch ($component) {
|
||||||
@ -238,6 +238,24 @@ class ICal {
|
|||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Trim a Timezone String
|
||||||
|
*
|
||||||
|
* @param {string} $timezone timezone string which should be trimmed
|
||||||
|
* @return {string} trimmed value
|
||||||
|
*/
|
||||||
|
private function trimTimeZone($timezone) {
|
||||||
|
if(preg_match('~([?<=/]*)([^/]*[/|-][^/]*$)~', $timezone, $matches)) { // detects tzurls in tzids
|
||||||
|
if ($matches[2] != "") {
|
||||||
|
return $matches[2]; // 2 = extracted timezone
|
||||||
|
} else {
|
||||||
|
return $timezone;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $timezone;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a key-value pair of a string.
|
* Get a key-value pair of a string.
|
||||||
*
|
*
|
||||||
@ -277,6 +295,7 @@ class ICal {
|
|||||||
if($pos !== false && $propvalue != false) {
|
if($pos !== false && $propvalue != false) {
|
||||||
$timezone = str_replace('"', '', $propvalue);
|
$timezone = str_replace('"', '', $propvalue);
|
||||||
$timezone = str_replace('\'', '', $timezone);
|
$timezone = str_replace('\'', '', $timezone);
|
||||||
|
$timezone = $this->trimTimeZone($timezone);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -414,6 +433,15 @@ class ICal {
|
|||||||
$array = $this->cal;
|
$array = $this->cal;
|
||||||
return $array['VCALENDAR'];
|
return $array['VCALENDAR'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the default or set timezone
|
||||||
|
*
|
||||||
|
* @return {string}
|
||||||
|
*/
|
||||||
|
public function timezone() {
|
||||||
|
return $this->default_timezone;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a boolean value whether thr current calendar has events or not
|
* Returns a boolean value whether thr current calendar has events or not
|
||||||
|
@ -413,6 +413,7 @@ class CalendarModule extends Module {
|
|||||||
$response['status'] = true;
|
$response['status'] = true;
|
||||||
$response['parsed_file']= $actionData["ics_filepath"];
|
$response['parsed_file']= $actionData["ics_filepath"];
|
||||||
$response['parsed'] = array (
|
$response['parsed'] = array (
|
||||||
|
'timezone' => $ical->timezone(),
|
||||||
'calendar' => $ical->calendar(),
|
'calendar' => $ical->calendar(),
|
||||||
'events' => $ical->events()
|
'events' => $ical->events()
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user