diff --git a/js/dialogs/ImportPanel.js b/js/dialogs/ImportPanel.js index cf3a3cc..c12743a 100644 --- a/js/dialogs/ImportPanel.js +++ b/js/dialogs/ImportPanel.js @@ -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), diff --git a/php/download.php b/php/download.php index 215fddb..8f64548 100644 --- a/php/download.php +++ b/php/download.php @@ -21,6 +21,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ +namespace calendarimporter; + class DownloadHandler { /** diff --git a/php/module.calendar.php b/php/module.calendar.php index c490a5d..feab76a 100644 --- a/php/module.calendar.php +++ b/php/module.calendar.php @@ -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 { diff --git a/php/plugin.calendarimporter.php b/php/plugin.calendarimporter.php index 29168ef..27712cb 100644 --- a/php/plugin.calendarimporter.php +++ b/php/plugin.calendarimporter.php @@ -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; }