From 76c2f9192aff370161622642a49da1cfd60d9c2f Mon Sep 17 00:00:00 2001 From: Christoph Haas Date: Wed, 5 Dec 2012 21:31:10 +0000 Subject: [PATCH] calendarimporter: added exportfeature - not finished yet TODO: ical creater backend, download --- config.php | 2 + js/data/ResponseHandler.js | 36 ++++++++++++ js/dialogs/ImportContentPanel.js | 7 ++- js/dialogs/ImportPanel.js | 89 ++++++++++++++++++++++++++++-- js/plugin.calendarimporter.js | 12 ++-- manifest.xml | 10 ++-- php/module.calendarexporter.php | 94 ++++++++++++++++++++++++++++++++ php/plugin.calendarimporter.php | 3 +- 8 files changed, 237 insertions(+), 16 deletions(-) create mode 100644 js/data/ResponseHandler.js create mode 100644 php/module.calendarexporter.php diff --git a/config.php b/config.php index 4cd6fbd..de30025 100644 --- a/config.php +++ b/config.php @@ -1,6 +1,8 @@ - 1.0 + 1.1 calendarimporter - ICS Calendar Importer + ICS Calendar Importer/Exporter Christoph Haas http://www.sprinternet.at Import a ICS file to the zarafa calendar @@ -17,19 +17,21 @@ php/plugin.calendarimporter.php + php/module.calendarexporter.php js/plugin.calendarimporter.js + js/data/ResponseHandler.js js/dialogs/ImportContentPanel.js js/dialogs/ImportPanel.js js/plugin.calendarimporter.js + js/data/ResponseHandler.js js/dialogs/ImportContentPanel.js js/dialogs/ImportPanel.js - resources/css/calendarimporter.css - + resources/css/calendarimporter.css resources/css/calendarimporter.css diff --git a/php/module.calendarexporter.php b/php/module.calendarexporter.php new file mode 100644 index 0000000..04af4a7 --- /dev/null +++ b/php/module.calendarexporter.php @@ -0,0 +1,94 @@ + + * Copyright (C) 2012 Christoph Haas + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +/** + * This module integrates Owncloud into attachment part of emails + * @class OwncloudModule + * @extends Module + */ +class CalendarexporterModule extends Module { + + private $DEBUG = true; // enable error_log debugging + + /** + * @constructor + * @param $id + * @param $data + */ + public function __construct($id, $data) { + parent::Module($id, $data); + } + + /** + * Executes all the actions in the $data variable. + * Exception part is used for authentication errors also + * @return boolean true on success or false on failure. + */ + public function execute() { + $result = false; + + foreach($this->data as $actionType => $actionData) { + if(isset($actionType)) { + try { + if($this->DEBUG) { + error_log("exec: " . $actionType); + } + switch($actionType) { + case "export": + $result = $this->exportCalendar($actionType, $actionData); + break; + default: + $this->handleUnknownActionType($actionType); + } + + } catch (MAPIException $e) { + if($this->DEBUG) { + error_log("mapi exception: " . $e->getMessage()); + } + } catch (Exception $e) { + if($this->DEBUG) { + error_log("exception: " . $e->getMessage()); + } + } + } + } + + return $result; + } + + private function exportCalendar($actionType, $actionData) { + /* look up functionality in class.appointmentlistmodule.php (webapp/server/modules)*/ + + $response['status'] = true; + $response['entries'] = "1002"; // number of entries that will be exported + $this->addActionData($actionType, $response); + $GLOBALS["bus"]->addData($this->getResponseData()); + + if($this->DEBUG) { + error_log("export done, bus data written!"); + } + + } +}; + +?> diff --git a/php/plugin.calendarimporter.php b/php/plugin.calendarimporter.php index f9b2b18..6dd4c37 100644 --- a/php/plugin.calendarimporter.php +++ b/php/plugin.calendarimporter.php @@ -47,7 +47,8 @@ class Plugincalendarimporter extends Plugin { 'plugins' => Array( 'calendarimporter' => Array( 'enable' => PLUGIN_CALENDARIMPORTER_USER_DEFAULT_ENABLE, - 'default_calendar' => PLUGIN_CALENDARIMPORTER_DEFAULT // currently not used, maybe in next release + 'enable_export' => PLUGIN_CALENDARIMPORTER_USER_DEFAULT_ENABLE_EXPORT, + 'default_calendar' => PLUGIN_CALENDARIMPORTER_DEFAULT // currently not used, maybe in next release ) ) )