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...', waitMsg: 'Uploading and parsing calendar...',
url: 'plugins/calendarimporter/php/upload.php', url: 'plugins/calendarimporter/php/upload.php',
failure: function(file, action) { failure: function(file, action) {
Ext.getCmp('submitButton').disable(); this.submitButton.disable();
Ext.getCmp('submitAllButton').disable(); this.submitAllButton.disable();
Zarafa.common.dialogs.MessageBox.show({ Zarafa.common.dialogs.MessageBox.show({
title : _('Error'), title : _('Error'),
msg : _(action.result.error), msg : _(action.result.error),

View File

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

View File

@ -395,10 +395,6 @@ class CalendarModule extends Module
*/ */
private function importCalendar($actionType, $actionData) private function importCalendar($actionType, $actionData)
{ {
if ($this->DEBUG) {
error_log("PHP Timezone: " . $tz);
}
if (is_readable($actionData["ics_filepath"])) { 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! $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 { try {
$parser = new vcalendar([ $parser = new vcalendar([
"unique_id" => md5($actionData["ics_filepath"]), "unique_id" => md5($actionData["ics_filepath"]),
"filename" => $actionData["ics_filepath"] "directory" => dirname($actionData["ics_filepath"]),
"filename" => basename($actionData["ics_filepath"])
]); ]);
$parser->parse(); $parser->parse();
error_log(print_r($parser, true));
} catch (Exception $e) { } catch (Exception $e) {
$error = true; $error = true;
$error_msg = $e->getMessage(); $error_msg = $e->getMessage();
@ -602,7 +600,7 @@ class CalendarModule extends Module
$response['status'] = false; $response['status'] = false;
$response['message'] = $error_msg; $response['message'] = $error_msg;
} else { } else {
if (iterator_count($parser) == 0) { if (count($parser->components) == 0) {
$response['status'] = false; $response['status'] = false;
$response['message'] = "No event in ics file"; $response['message'] = "No event in ics file";
} else { } else {

View File

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