Compare commits
9 Commits
php54compa
...
master
Author | SHA1 | Date | |
---|---|---|---|
6af790cb44 | |||
a9e0b1feb6 | |||
f89f96dc59 | |||
bbdfff4e32 | |||
38baffbff8 | |||
55bdf0a8d8 | |||
611b5162cc | |||
4e9a05987e | |||
9cb9978adc |
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
.idea/
|
||||
.vs/
|
||||
|
21
.gitlab-ci.yml
Normal file
21
.gitlab-ci.yml
Normal file
@ -0,0 +1,21 @@
|
||||
# This file is only necessary for the gitlab to github sync and does not belong to the webapp plugin code.
|
||||
|
||||
#before_script:
|
||||
# - ssh-keyscan -t rsa,dsa,ecdsa github.com > /etc/ssh/ssh_known_hosts
|
||||
stages:
|
||||
- mirror
|
||||
|
||||
variables:
|
||||
MIRROR_REPOSITORY: "git@github.com:h44z/kopano_webapp_calendarimporter.git"
|
||||
|
||||
mirror-github:
|
||||
stage: mirror
|
||||
cache: {}
|
||||
script:
|
||||
# Do a mirror clone of the repository
|
||||
- git clone --mirror $CI_REPOSITORY_URL
|
||||
# Mirror push it to the destination
|
||||
- cd $CI_PROJECT_NAME.git
|
||||
- git push --mirror $MIRROR_REPOSITORY
|
||||
# Cleanup
|
||||
- cd ..; rm -rf $CI_PROJECT_NAME.git
|
BIN
DIST/calendarimporter_2.2.2.zip
Normal file
BIN
DIST/calendarimporter_2.2.2.zip
Normal file
Binary file not shown.
BIN
DIST/calendarimporter_2.2.3.zip
Normal file
BIN
DIST/calendarimporter_2.2.3.zip
Normal file
Binary file not shown.
BIN
DIST/calendarimporter_backend_2.2.2.zip
Normal file
BIN
DIST/calendarimporter_backend_2.2.2.zip
Normal file
Binary file not shown.
BIN
DIST/calendarimporter_backend_2.2.3.zip
Normal file
BIN
DIST/calendarimporter_backend_2.2.3.zip
Normal file
Binary file not shown.
165
LICENSE
Normal file
165
LICENSE
Normal file
@ -0,0 +1,165 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
120
README.md
120
README.md
@ -1,20 +1,124 @@
|
||||
CALENDAR IMPORTER AND EXPORTER:
|
||||
===
|
||||
|
||||
Building the calendar importer plugin for Zarafa WebApp:
|
||||
## Building the calendar importer plugin from source:
|
||||
|
||||
### Dependencies
|
||||
- Kopano WebApp Source Code (https://stash.kopano.io/projects/KW/repos/kopano-webapp/browse)
|
||||
- PHP >= 5 (7 or higher recommended)
|
||||
- composer (https://getcomposer.org/)
|
||||
- JDK 1.8 (http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)
|
||||
- ant (http://ant.apache.org/)
|
||||
|
||||
Add JAVA_HOME (e.g. C:\Program Files\Java\jdk1.8.0_161) to your path. Also add Ant, Composer, PHP and Java to the global PATH variable!
|
||||
|
||||
### Compiling the plugin
|
||||
Unzip (or use git clone) the sourcecode of Kopano WebApp to a new directory. In this README we call the source folder of WebApp "kopano-webapp-source".
|
||||
|
||||
Then generate the WebApp build utils:
|
||||
```
|
||||
cd /zarafa/webapp/
|
||||
cd kopano-webapp-source
|
||||
ant tools
|
||||
cd /zarafa/webapp/plugins/
|
||||
```
|
||||
|
||||
Next clone the plugin to the WebApp plugin directory:
|
||||
```
|
||||
cd kopano-webapp-source\plugins
|
||||
git clone https://git.sprinternet.at/zarafa_webapp/calendarimporter.git
|
||||
cd calendarimporter
|
||||
```
|
||||
|
||||
Now lets build the plugin:
|
||||
```
|
||||
cd kopano-webapp-source\plugins\calendarimporter\php
|
||||
composer install
|
||||
cd kopano-webapp-source\plugins\calendarimporter
|
||||
ant deploy
|
||||
```
|
||||
|
||||
### Usage
|
||||
Rightclick a calendarfolder or calendar entry to export it as iCal.
|
||||
The compiled plugin is saved to `kopano-webapp-source\deploy\plugins\calendarimporter`.
|
||||
|
||||
Rightclick a calendarfolder to import a iCal file.
|
||||
## Installing the plugin
|
||||
|
||||
Rightclick a iCal attachment to import it.
|
||||
### From compiled source
|
||||
Copy the whole folder "calendarimporter" to your production WebApp (`kopano-webapp-production\plugins\calendarimporter`)
|
||||
|
||||
For example:
|
||||
```
|
||||
cp -r kopano-webapp-source\deploy\plugins\calendarimporter kopano-webapp-production\plugins\
|
||||
```
|
||||
|
||||
## Installing the sync backend
|
||||
|
||||
### From source
|
||||
Copy the whole folder "kopano-webapp-source\plugins\calendarimporter\backend" to a destination of cour choice.
|
||||
|
||||
For example:
|
||||
```
|
||||
cp -r kopano-webapp-source\plugins\calendarimporter\backend /opt/ical-sync/backend
|
||||
```
|
||||
|
||||
### From precompiled download
|
||||
Download the newest backend release from https://git.sprinternet.at/zarafa_webapp/calendarimporter/tree/master/DIST.
|
||||
|
||||
Unzip the downloaded file and copy the backend folder to a destination of cour choice.
|
||||
|
||||
For example:
|
||||
```
|
||||
cp -r Downloads\calendarimporter_backend /opt/ical-sync/backend
|
||||
```
|
||||
|
||||
## WebApp Plugin Configuration
|
||||
Edit the config.php file in the plugin root path to fit your needs.
|
||||
|
||||
Available configuration values:
|
||||
|
||||
| Configuration Value | Type | Default | Desctription |
|
||||
| ------------- |:-------------:| ----- | ----- |
|
||||
| PLUGIN_CALENDARIMPORTER_USER_DEFAULT_ENABLE | boolean | false | Set to true to enable the plugin for all users |
|
||||
| PLUGIN_CALENDARIMPORTER_USER_DEFAULT_ENABLE_SYNC | string | true | Set to true to enable the sync feature for all users |
|
||||
| PLUGIN_CALENDARIMPORTER_DEFAULT | string | "Kalender" | Default calendar folder name (might be "Calendar" on english installations) |
|
||||
| PLUGIN_CALENDARIMPORTER_DEFAULT_TIMEZONE | string | "Europe/Vienna" | The local Timezone |
|
||||
| PLUGIN_CALENDARIMPORTER_TMP_UPLOAD | string | "/var/lib/kopano-webapp/tmp/" | Temporary path to store uploaded iCal files |
|
||||
|
||||
## Sync Backend Configuration
|
||||
First you have to create a new Kopano user with admin rights.
|
||||
For example:
|
||||
```
|
||||
kopano-admin -c adminuser -e admin@domain.com -f "Calendar Sync Admin" -p topsecretpw -a 1
|
||||
```
|
||||
Then edit the config.php file of the sync backend to fit your needs.
|
||||
|
||||
Available configuration values:
|
||||
|
||||
| Configuration Value | Type | Default | Desctription |
|
||||
| ------------- |:-------------:| ----- | ----- |
|
||||
| $ADMINUSERNAME | string | "adminuser" | The newly created Kopano admin user |
|
||||
| $ADMINPASSWORD | string | "topsecretpw" | The password of the admin user |
|
||||
| $SERVER | string | "http://localhost:236/kopano" | Kopano Socket or HTTP(S) connection string |
|
||||
| $CALDAVURL | string | "http://localhost:8080/ical/" | Kopano CalDAV URL |
|
||||
| $TEMPDIR | string | "/tmp/" | Temporary path to store synchronised iCal files (must be writeable by the user executing the sync script) |
|
||||
|
||||
Next set up a cronjob to allow periodic syncing of ical items.
|
||||
|
||||
For example: (`/etc/crontab`):
|
||||
```
|
||||
# sync ics calendars every minute (interval can be changed by the user)
|
||||
* * * * * icssync /opt/ical-sync/backend/sync.php > /var/log/icssync.log 2>&1
|
||||
```
|
||||
|
||||
If you get an error, make sure that the mapi module is loaded for php-cli. Therefore create or modify: `/etc/php7/cli/conf.d/50-mapi.ini`
|
||||
```
|
||||
extension=mapi.so
|
||||
```
|
||||
|
||||
Do no run the sync script as root! Create a user without admin rights (`adduser icssync`), and change permissions of the tmp folder accordingly.
|
||||
|
||||
## Usage
|
||||
|
||||
The plugin add context menu entries to calendar folders.
|
||||
|
||||
![Plugin Context Menus](https://git.sprinternet.at/zarafa_webapp/calendarimporter/raw/master/usage.png "Kopano Webapp Context Menu")
|
||||
|
||||
If syncing is enabled, the calendar section in the WebApp settings gets extended with a synchronisation overview. There you can add new iCal URLs for syncing.
|
||||
|
||||
![Plugin Settings Menus](https://git.sprinternet.at/zarafa_webapp/calendarimporter/raw/master/usage_sync.png "Kopano Webapp Settings Menu")
|
@ -1,14 +1,54 @@
|
||||
Backend setup:
|
||||
# Backend setup:
|
||||
|
||||
1. Create a Admin User in Zarafa:
|
||||
zarafa-admin -c adminuser -e admin@domain.com -f "Calendar Sync Admin" -p topsecretpw -a 1
|
||||
## Installing the sync backend
|
||||
|
||||
2. Edit the config.php to fit your needs.
|
||||
### From source
|
||||
Copy the whole folder "kopano-webapp-source\plugins\calendarimporter\backend" to a destination of cour choice.
|
||||
|
||||
3. Setup cron to run your script every 10 minutes (or whatever...)
|
||||
For example:
|
||||
```
|
||||
cp -r kopano-webapp-source\plugins\calendarimporter\backend /opt/ical-sync/backend
|
||||
```
|
||||
|
||||
4. If you get an error, make sure that the mapi module is loaded for php-cli:
|
||||
* Add: /etc/php5/cli/conf.d/50-mapi.ini
|
||||
* Content: extension=mapi.so
|
||||
### From precompiled download
|
||||
Download the newest backend release from https://git.sprinternet.at/zarafa_webapp/calendarimporter/tree/master/DIST.
|
||||
|
||||
Never run the backend script as root!
|
||||
Unzip the downloaded file and copy the backend folder to a destination of cour choice.
|
||||
|
||||
For example:
|
||||
```
|
||||
cp -r Downloads\calendarimporter_backend /opt/ical-sync/backend
|
||||
```
|
||||
|
||||
## Sync Backend Configuration
|
||||
First you have to create a new Kopano user with admin rights.
|
||||
For example:
|
||||
```
|
||||
kopano-admin -c adminuser -e admin@domain.com -f "Calendar Sync Admin" -p topsecretpw -a 1
|
||||
```
|
||||
Then edit the config.php file of the sync backend to fit your needs.
|
||||
|
||||
Available configuration values:
|
||||
|
||||
| Configuration Value | Type | Default | Desctription |
|
||||
| ------------- |:-------------:| ----- | ----- |
|
||||
| $ADMINUSERNAME | string | "adminuser" | The newly created Kopano admin user |
|
||||
| $ADMINPASSWORD | string | "topsecretpw" | The password of the admin user |
|
||||
| $SERVER | string | "http://localhost:236/kopano" | Kopano Socket or HTTP(S) connection string |
|
||||
| $CALDAVURL | string | "http://localhost:8080/ical/" | Kopano CalDAV URL |
|
||||
| $TEMPDIR | string | "/tmp/" | Temporary path to store synchronised iCal files (must be writeable by the user executing the sync script) |
|
||||
|
||||
Next set up a cronjob to allow periodic syncing of ical items.
|
||||
|
||||
For example: (`/etc/crontab`):
|
||||
```
|
||||
# sync ics calendars every minute (interval can be changed by the user)
|
||||
* * * * * icssync /opt/ical-sync/backend/sync.php > /var/log/icssync.log 2>&1
|
||||
```
|
||||
|
||||
If you get an error, make sure that the mapi module is loaded for php-cli. Therefore create or modify: `/etc/php7/cli/conf.d/50-mapi.ini`
|
||||
```
|
||||
extension=mapi.so
|
||||
```
|
||||
|
||||
Do no run the sync script as root! Create a user without admin rights (`adduser icssync`), and change permissions of the tmp folder accordingly.
|
@ -1,8 +1,7 @@
|
||||
<?php
|
||||
// config options
|
||||
$ADMINUSERNAME = "admin";
|
||||
$ADMINPASSWORD = "admin";
|
||||
$SERVER = "file:///var/run/zarafa";
|
||||
$CALDAVURL = "http://localhost:8080/ical/";
|
||||
$TEMPDIR = "/tmp/";
|
||||
?>
|
||||
$ADMINUSERNAME = "admin"; // Kopano administrative user
|
||||
$ADMINPASSWORD = "admin"; // Kopano administrative user password
|
||||
$SERVER = "http://localhost:236/kopano"; // Kopano socket or http(s) connection
|
||||
$CALDAVURL = "http://localhost:8080/ical/"; // Caldav URL
|
||||
$TEMPDIR = "/tmp/"; // Temporary directory for storing downloaded ics files
|
||||
|
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
/**
|
||||
* functions.php, zarafa calender to ics im/exporter backend
|
||||
* functions.php, Kopano calender to ics im/exporter backend
|
||||
*
|
||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
||||
* Copyright (C) 2012-2016 Christoph Haas
|
||||
* Copyright (C) 2012-2018 Christoph Haas
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@ -18,10 +18,16 @@
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
/* gets the data from a URL */
|
||||
/**
|
||||
* gets the data from a URL
|
||||
*
|
||||
* @param $url
|
||||
* @param null $username
|
||||
* @param null $password
|
||||
* @return mixed|null
|
||||
*/
|
||||
function curl_get_data($url, $username = NULL, $password = NULL) {
|
||||
$ch = curl_init();
|
||||
$timeout = 5;
|
||||
@ -44,7 +50,12 @@ function curl_get_data($url, $username = NULL, $password = NULL) {
|
||||
return $data;
|
||||
}
|
||||
|
||||
/* gets all zarafa users */
|
||||
/**
|
||||
* gets all zarafa users
|
||||
*
|
||||
* @param $userStore
|
||||
* @return null|void
|
||||
*/
|
||||
function get_user_ics_list($userStore) {
|
||||
// get settings
|
||||
// first check if property exist and we can open that using mapi_openproperty
|
||||
@ -89,7 +100,13 @@ function get_user_ics_list($userStore) {
|
||||
}
|
||||
}
|
||||
|
||||
/* updates the webapp settings */
|
||||
/**
|
||||
* updates the webapp settings
|
||||
*
|
||||
* @param $userStore
|
||||
* @param $icsentry
|
||||
* @return bool|void
|
||||
*/
|
||||
function update_last_sync_date($userStore, $icsentry) {
|
||||
// get settings
|
||||
// first check if property exist and we can open that using mapi_openproperty
|
||||
@ -134,7 +151,17 @@ function update_last_sync_date($userStore, $icsentry) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* upload a file */
|
||||
/**
|
||||
* upload a file
|
||||
*
|
||||
* @param $filename
|
||||
* @param $caldavurl
|
||||
* @param $username
|
||||
* @param $calendarname
|
||||
* @param null $authuser
|
||||
* @param null $authpass
|
||||
* @return int
|
||||
*/
|
||||
function upload_ics_to_caldav($filename, $caldavurl, $username, $calendarname, $authuser = NULL, $authpass = NULL) {
|
||||
$url = $caldavurl . $username . "/" . rawurlencode($calendarname) . "/";
|
||||
$post = array('file'=>'@'.$filename);
|
||||
@ -162,4 +189,3 @@ function upload_ics_to_caldav($filename, $caldavurl, $username, $calendarname, $
|
||||
|
||||
return $http_status;
|
||||
}
|
||||
?>
|
@ -1,10 +1,10 @@
|
||||
#!/usr/bin/php
|
||||
<?php
|
||||
/**
|
||||
* sync.php, zarafa calender to ics im/exporter backend
|
||||
* sync.php, Kopano calender to ics im/exporter backend
|
||||
*
|
||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
||||
* Copyright (C) 2012-2016 Christoph Haas
|
||||
* Copyright (C) 2012-2018 Christoph Haas
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@ -26,17 +26,17 @@ if(php_sapi_name() !== 'cli') {
|
||||
}
|
||||
|
||||
/**
|
||||
* Make sure that the zarafa mapi extension is enabled in cli mode:
|
||||
* Make sure that the kopano mapi extension is enabled in cli mode:
|
||||
* Add: /etc/php5/cli/conf.d/50-mapi.ini
|
||||
* Content: extension=mapi.so
|
||||
*/
|
||||
|
||||
// MAPI includes
|
||||
include('/usr/share/php/mapi/mapi.util.php');
|
||||
include('/usr/share/php/mapi/mapidefs.php');
|
||||
include('/usr/share/php/mapi/mapicode.php');
|
||||
include('/usr/share/php/mapi/mapitags.php');
|
||||
include('/usr/share/php/mapi/mapiguid.php');
|
||||
include('mapi/mapi.util.php');
|
||||
include('mapi/mapidefs.php');
|
||||
include('mapi/mapicode.php');
|
||||
include('mapi/mapitags.php');
|
||||
include('mapi/mapiguid.php');
|
||||
include('config.php');
|
||||
include('functions.php');
|
||||
|
||||
@ -134,7 +134,7 @@ foreach($userList as $userName => $userData) {
|
||||
echo "Import completed: $result\n";
|
||||
$result = update_last_sync_date($userStore, $syncItemName);
|
||||
$res = $result ? "true":"false";
|
||||
echo "Updated Zarafa settings: " . $res . "\n";
|
||||
echo "Updated Kopano settings: " . $res . "\n";
|
||||
} else {
|
||||
echo "Uploading failed: " . $result . "\n";
|
||||
}
|
||||
@ -147,4 +147,3 @@ foreach($userList as $userName => $userData) {
|
||||
|
||||
echo "###Done sync for user: " . $userName . "\n\n";
|
||||
}
|
||||
?>
|
@ -1,3 +1,10 @@
|
||||
v2.2.3: 14.06.2018
|
||||
- Fixed JS error, thanks to hartois
|
||||
- Fixed manifest.xml structure (validation now succeeds)
|
||||
|
||||
calendarimporter 2.2.2:
|
||||
- updated documentation
|
||||
|
||||
calendarimporter 2.2.1:
|
||||
- finally supporting Kopano Webapp 3.1.x
|
||||
- translation to german added
|
||||
|
20
js/ABOUT.js
20
js/ABOUT.js
@ -2,7 +2,7 @@
|
||||
* ABOUT.js, Kopano calender to ics im/exporter
|
||||
*
|
||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
||||
* Copyright (C) 2012-2016 Christoph Haas
|
||||
* Copyright (C) 2012-2018 Christoph Haas
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@ -29,7 +29,7 @@ Ext.namespace('Zarafa.plugins.calendarimporter');
|
||||
* The copyright string holding the copyright notice for the Zarafa calendarimporter Plugin.
|
||||
*/
|
||||
Zarafa.plugins.calendarimporter.ABOUT = ""
|
||||
+ "<p>Copyright (C) 2012-2016 Christoph Haas <christoph.h@sprinternet.at></p>"
|
||||
+ "<p>Copyright (C) 2012-2018 Christoph Haas <christoph.h@sprinternet.at></p>"
|
||||
|
||||
+ "<p>This program is free software; you can redistribute it and/or "
|
||||
+ "modify it under the terms of the GNU Lesser General Public "
|
||||
@ -49,18 +49,8 @@ Zarafa.plugins.calendarimporter.ABOUT = ""
|
||||
|
||||
+ "<p>The calendarimporter plugin contains the following third-party components:</p>"
|
||||
|
||||
+ "<h1>iCalcreator v2.16.12</h1>"
|
||||
+ "<h1>sabre-io/vobject v4.1</h1>"
|
||||
|
||||
+ "<p>Copyright 2007-2013 Kjell-Inge Gustafsson kigkonsult</p>"
|
||||
+ "<p>Copyright (C) 2011-2016 fruux GmbH (https://fruux.com/)</p>"
|
||||
|
||||
+ "<p>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.</p>"
|
||||
|
||||
+ "<p>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.</p>"
|
||||
|
||||
+ "<h1>Ics-parser</h1>"
|
||||
|
||||
+ "<p>Copyright 2002-2007 Martin Thoma <info@martin-thoma.de></p>"
|
||||
|
||||
+ "<p>Licensed under the MIT License.</p>"
|
||||
|
||||
+ "<p>Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.</p>";
|
||||
+ "<p>Licensed under the BSD 3-Clause \"New\" or \"Revised\" License</p>";
|
@ -2,7 +2,7 @@
|
||||
* Actions.js zarafa calender to ics im/exporter
|
||||
*
|
||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
||||
* Copyright (C) 2012-2016 Christoph Haas
|
||||
* Copyright (C) 2012-2018 Christoph Haas
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@ -128,7 +128,7 @@ Zarafa.plugins.calendarimporter.data.Actions = {
|
||||
var inbox = container.getHierarchyStore().getDefaultStore();
|
||||
var pub = container.getHierarchyStore().getPublicStore();
|
||||
|
||||
if (!Ext.isEmpty(inbox.subStores) && inbox.subStores.folders.totalLength > 0) {
|
||||
if (!Ext.isEmpty(inbox) && !Ext.isEmpty(inbox.subStores)) {
|
||||
for (var i = 0; i < inbox.subStores.folders.totalLength; i++) {
|
||||
var folder = inbox.subStores.folders.getAt(i);
|
||||
if (!Ext.isEmpty(folder) && folder.get("container_class") == "IPF.Appointment") {
|
||||
@ -149,7 +149,7 @@ Zarafa.plugins.calendarimporter.data.Actions = {
|
||||
}
|
||||
}
|
||||
|
||||
if (!Ext.isEmpty(pub.subStores) && pub.subStores.folders.totalLength > 0) {
|
||||
if (!Ext.isEmpty(pub) && !Ext.isEmpty(pub.subStores)) {
|
||||
for (var j = 0; j < pub.subStores.folders.totalLength; j++) {
|
||||
var folder = pub.subStores.folders.getAt(j);
|
||||
if (!Ext.isEmpty(folder) && folder.get("container_class") == "IPF.Appointment") {
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ResponseHandler.js, Kopano calender to ics im/exporter
|
||||
*
|
||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
||||
* Copyright (C) 2012-2016 Christoph Haas
|
||||
* Copyright (C) 2012-2018 Christoph Haas
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -2,7 +2,7 @@
|
||||
* timezones.js, Kopano calender to ics im/exporter
|
||||
*
|
||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
||||
* Copyright (C) 2012-2016 Christoph Haas
|
||||
* Copyright (C) 2012-2018 Christoph Haas
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ImportContentPanel.js, Kopano calender to ics im/exporter
|
||||
*
|
||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
||||
* Copyright (C) 2012-2016 Christoph Haas
|
||||
* Copyright (C) 2012-2018 Christoph Haas
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ImportPanel.js, Kopano calender to ics im/exporter
|
||||
*
|
||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
||||
* Copyright (C) 2012-2016 Christoph Haas
|
||||
* Copyright (C) 2012-2018 Christoph Haas
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -2,7 +2,7 @@
|
||||
* plugin.calendarimporter.js, Kopano calender to ics im/exporter
|
||||
*
|
||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
||||
* Copyright (C) 2012-2016 Christoph Haas
|
||||
* Copyright (C) 2012-2018 Christoph Haas
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -2,7 +2,7 @@
|
||||
* SettingsCalSyncWidget.js, Kopano calender to ics im/exporter
|
||||
*
|
||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
||||
* Copyright (C) 2012-2016 Christoph Haas
|
||||
* Copyright (C) 2012-2018 Christoph Haas
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -2,7 +2,7 @@
|
||||
* SettingsWidget.js, Kopano calender to ics im/exporter
|
||||
*
|
||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
||||
* Copyright (C) 2012-2016 Christoph Haas
|
||||
* Copyright (C) 2012-2018 Christoph Haas
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -2,7 +2,7 @@
|
||||
* CalSyncEditContentPanel.js, Kopano calender to ics im/exporter
|
||||
*
|
||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
||||
* Copyright (C) 2012-2016 Christoph Haas
|
||||
* Copyright (C) 2012-2018 Christoph Haas
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -2,7 +2,7 @@
|
||||
* CalSyncEditPanel.js, Kopano calender to ics im/exporter
|
||||
*
|
||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
||||
* Copyright (C) 2012-2016 Christoph Haas
|
||||
* Copyright (C) 2012-2018 Christoph Haas
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -2,7 +2,7 @@
|
||||
* CalSyncGrid.js, Kopano calender to ics im/exporter
|
||||
*
|
||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
||||
* Copyright (C) 2012-2016 Christoph Haas
|
||||
* Copyright (C) 2012-2018 Christoph Haas
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -2,7 +2,7 @@
|
||||
* CalSyncPanel.js, Kopano calender to ics im/exporter
|
||||
*
|
||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
||||
* Copyright (C) 2012-2016 Christoph Haas
|
||||
* Copyright (C) 2012-2018 Christoph Haas
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ContectMenu.js, Kopano calender to ics im/exporter
|
||||
*
|
||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
||||
* Copyright (C) 2012-2016 Christoph Haas
|
||||
* Copyright (C) 2012-2018 Christoph Haas
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
10
manifest.xml
10
manifest.xml
@ -2,19 +2,19 @@
|
||||
<!DOCTYPE plugin SYSTEM "manifest.dtd">
|
||||
<plugin version="2">
|
||||
<info>
|
||||
<version>2.2.1</version>
|
||||
<version>2.2.3</version>
|
||||
<name>calendarimporter</name>
|
||||
<title>ICS Calendar Importer/Exporter</title>
|
||||
<author>Christoph Haas</author>
|
||||
<authorURL>http://www.sprinternet.at</authorURL>
|
||||
<description>Import or Export a ICS file to/from the Kopano calendar</description>
|
||||
<description>Import or export a ICS file to/from the Kopano calendar</description>
|
||||
</info>
|
||||
<translations>
|
||||
<translationsdir>languages</translationsdir>
|
||||
</translations>
|
||||
<config>
|
||||
<configfile>config.php</configfile>
|
||||
</config>
|
||||
<translations>
|
||||
<translationsdir>languages</translationsdir>
|
||||
</translations>
|
||||
<components>
|
||||
<component>
|
||||
<files>
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"require": {
|
||||
"sabre/vobject": "3.5.3"
|
||||
"sabre/vobject": "4.1"
|
||||
}
|
||||
}
|
@ -3,7 +3,7 @@
|
||||
* download.php, Kopano calendar to ics im/exporter
|
||||
*
|
||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
||||
* Copyright (C) 2012-2016 Christoph Haas
|
||||
* Copyright (C) 2012-2018 Christoph Haas
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -3,7 +3,7 @@
|
||||
* helper.php, Kopano calender to ics im/exporter
|
||||
*
|
||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
||||
* Copyright (C) 2012-2016 Christoph Haas
|
||||
* Copyright (C) 2012-2018 Christoph Haas
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -3,7 +3,7 @@
|
||||
* module.calendar.php, Kopano calender to ics im/exporter
|
||||
*
|
||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
||||
* Copyright (C) 2012-2016 Christoph Haas
|
||||
* Copyright (C) 2012-2018 Christoph Haas
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@ -287,9 +287,8 @@ class CalendarModule extends Module
|
||||
]);
|
||||
|
||||
// Add organizer
|
||||
$organizer = $this->getProp($messageProps, "sender_email_address");
|
||||
if(!empty($organizer)) {
|
||||
$vEvent->add('ORGANIZER', 'mailto:' . $organizer);
|
||||
if(!empty( $this->getProp($messageProps, "sender_email_address"))) {
|
||||
$vEvent->add('ORGANIZER', 'mailto:' . $this->getProp($messageProps, "sender_email_address"));
|
||||
$vEvent->ORGANIZER['CN'] = $this->getProp($messageProps, "sender_name");
|
||||
}
|
||||
|
||||
@ -303,8 +302,7 @@ class CalendarModule extends Module
|
||||
}
|
||||
|
||||
// Add alarms
|
||||
$reminder = $this->getProp($messageProps, "reminder");
|
||||
if (!empty($reminder) && $this->getProp($messageProps, "reminder") == 1) {
|
||||
if (!empty($this->getProp($messageProps, "reminder")) && $this->getProp($messageProps, "reminder") == 1) {
|
||||
$vAlarm = $vEvent->add('VALARM', [
|
||||
'ACTION' => 'DISPLAY',
|
||||
'DESCRIPTION' => $this->getProp($messageProps, "subject") // reuse the event summary
|
||||
@ -321,8 +319,7 @@ class CalendarModule extends Module
|
||||
}
|
||||
|
||||
// Add location
|
||||
$location = $this->getProp($messageProps, "location");
|
||||
if (!empty($location)) {
|
||||
if (!empty($this->getProp($messageProps, "location"))) {
|
||||
$vEvent->add('LOCATION', $this->getProp($messageProps, "location"));
|
||||
}
|
||||
|
||||
@ -333,11 +330,10 @@ class CalendarModule extends Module
|
||||
}
|
||||
|
||||
// Add categories
|
||||
$categories = $this->getProp($messageProps, "categories");
|
||||
if (!empty($categories)) {
|
||||
$categoryArray = array_map('trim', explode(';', trim($categories, " ;")));
|
||||
if (!empty($this->getProp($messageProps, "categories"))) {
|
||||
$categories = array_map('trim', explode(';', trim($this->getProp($messageProps, "categories"), " ;")));
|
||||
|
||||
$vEvent->add('CATEGORIES', $categoryArray);
|
||||
$vEvent->add('CATEGORIES', $categories);
|
||||
}
|
||||
}
|
||||
|
||||
@ -693,16 +689,12 @@ class CalendarModule extends Module
|
||||
$properties["comment"] = (string)$vEvent->COMMENT;
|
||||
$properties["timezone"] = (string)$vEvent->DTSTART["TZID"];
|
||||
$properties["organizer"] = (string)$vEvent->ORGANIZER;
|
||||
|
||||
$fbType = (string)$vEvent->FBTYPE;
|
||||
$msIntendedStatus = (string)$vEvent->{'X-MICROSOFT-CDO-INTENDEDSTATUS'};
|
||||
$msBusyStatus = (string)$vEvent->{'X-MICROSOFT-CDO-BUSYSTATUS'};
|
||||
if(!empty($fbType)) {
|
||||
$properties["busystatus"] = array_search($fbType, $this->freeBusyStates);
|
||||
} else if(!empty($msIntendedStatus)) {
|
||||
$properties["busystatus"] = array_search($msIntendedStatus, $this->busyStates);
|
||||
} else if(!empty($msBusyStatus)) {
|
||||
$properties["busystatus"] = array_search($msBusyStatus, $this->busyStates);
|
||||
if(!empty((string)$vEvent->FBTYPE)) {
|
||||
$properties["busystatus"] = array_search((string)$vEvent->FBTYPE, $this->freeBusyStates);
|
||||
} else if(!empty((string)$vEvent->{'X-MICROSOFT-CDO-INTENDEDSTATUS'})) {
|
||||
$properties["busystatus"] = array_search((string)$vEvent->{'X-MICROSOFT-CDO-INTENDEDSTATUS'}, $this->busyStates);
|
||||
} else if(!empty((string)$vEvent->{'X-MICROSOFT-CDO-BUSYSTATUS'})) {
|
||||
$properties["busystatus"] = array_search((string)$vEvent->{'X-MICROSOFT-CDO-BUSYSTATUS'}, $this->busyStates);
|
||||
} else {
|
||||
$properties["busystatus"] = array_search("BUSY", $this->busyStates);
|
||||
}
|
||||
@ -710,18 +702,15 @@ class CalendarModule extends Module
|
||||
//$properties["trigger"] = (string)$vEvent->COMMENT;
|
||||
$properties["priority"] = (string)$vEvent->PRIORITY;
|
||||
$properties["private"] = ((string)$vEvent->CLASS) == "PRIVATE" ? true : false;
|
||||
$zLabel = (string)$vEvent->{'X-ZARAFA-LABEL'};
|
||||
if (!empty($zLabel)) {
|
||||
$properties["label"] = array_search($zLabel, $this->labels);
|
||||
if (!empty((string)$vEvent->{'X-ZARAFA-LABEL'})) {
|
||||
$properties["label"] = array_search((string)$vEvent->{'X-ZARAFA-LABEL'}, $this->labels);
|
||||
}
|
||||
$lastModified = (string)$vEvent->{'LAST-MODIFIED'};
|
||||
if (!empty($lastModified)) {
|
||||
if (!empty((string)$vEvent->{'LAST-MODIFIED'})) {
|
||||
$properties["last_modification_time"] = (string)$vEvent->{'LAST-MODIFIED'}->getDateTime()->getTimestamp();
|
||||
} else {
|
||||
$properties["last_modification_time"] = time();
|
||||
}
|
||||
$created = (string)$vEvent->CREATED;
|
||||
if (!empty($created)) {
|
||||
if (!empty((string)$vEvent->CREATED)) {
|
||||
$properties["creation_time"] = (string)$vEvent->CREATED->getDateTime()->getTimestamp();
|
||||
} else {
|
||||
$properties["creation_time"] = time();
|
||||
|
@ -3,7 +3,7 @@
|
||||
* plugin.calendarimporter.php, Kopano calender to ics im/exporter
|
||||
*
|
||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
||||
* Copyright (C) 2012-2016 Christoph Haas
|
||||
* Copyright (C) 2012-2018 Christoph Haas
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -3,7 +3,7 @@
|
||||
* upload.php, Kopano calender to ics im/exporter
|
||||
*
|
||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
||||
* Copyright (C) 2012-2016 Christoph Haas
|
||||
* Copyright (C) 2012-2018 Christoph Haas
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
BIN
usage_sync.png
Normal file
BIN
usage_sync.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 64 KiB |
Loading…
Reference in New Issue
Block a user