new ics lib

This commit is contained in:
Christoph Haas 2016-06-20 18:02:57 +02:00
parent f97daa514b
commit 2c18071de4
4 changed files with 9 additions and 9 deletions

View File

@ -507,8 +507,8 @@ Zarafa.plugins.calendarimporter.dialogs.ImportPanel = Ext.extend(Ext.Panel, {
waitMsg: 'Uploading and parsing calendar...',
url: 'plugins/calendarimporter/php/upload.php',
failure: function(file, action) {
Ext.getCmp('submitButton').disable();
Ext.getCmp('submitAllButton').disable();
this.submitButton.disable();
this.submitAllButton.disable();
Zarafa.common.dialogs.MessageBox.show({
title : _('Error'),
msg : _(action.result.error),

View File

@ -21,6 +21,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
namespace calendarimporter;
class DownloadHandler
{
/**

View File

@ -395,10 +395,6 @@ class CalendarModule extends Module
*/
private function importCalendar($actionType, $actionData)
{
if ($this->DEBUG) {
error_log("PHP Timezone: " . $tz);
}
if (is_readable($actionData["ics_filepath"])) {
$ical = new ICal($actionData["ics_filepath"], $GLOBALS["settings"]->get("zarafa/v1/plugins/calendarimporter/default_timezone"), $actionData["timezone"], $actionData["ignore_dst"]); // Parse it!
@ -591,9 +587,11 @@ class CalendarModule extends Module
try {
$parser = new vcalendar([
"unique_id" => md5($actionData["ics_filepath"]),
"filename" => $actionData["ics_filepath"]
"directory" => dirname($actionData["ics_filepath"]),
"filename" => basename($actionData["ics_filepath"])
]);
$parser->parse();
error_log(print_r($parser, true));
} catch (Exception $e) {
$error = true;
$error_msg = $e->getMessage();
@ -602,7 +600,7 @@ class CalendarModule extends Module
$response['status'] = false;
$response['message'] = $error_msg;
} else {
if (iterator_count($parser) == 0) {
if (count($parser->components) == 0) {
$response['status'] = false;
$response['message'] = "No event in ics file";
} else {

View File

@ -62,7 +62,7 @@ class Plugincalendarimporter extends Plugin
break;
case 'server.index.load.custom':
if ($data['name'] == 'download_ics') {
DownloadHandler::doDownload();
calendarimporter\DownloadHandler::doDownload();
}
break;
}