Compare commits
9 Commits
php54compa
...
v2.2.3
Author | SHA1 | Date | |
---|---|---|---|
6af790cb44 | |||
a9e0b1feb6 | |||
f89f96dc59 | |||
bbdfff4e32 | |||
38baffbff8 | |||
55bdf0a8d8 | |||
611b5162cc | |||
4e9a05987e | |||
9cb9978adc |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
|||||||
.idea/
|
.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:
|
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
|
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
|
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
|
ant deploy
|
||||||
```
|
```
|
||||||
|
|
||||||
### Usage
|
The compiled plugin is saved to `kopano-webapp-source\deploy\plugins\calendarimporter`.
|
||||||
Rightclick a calendarfolder or calendar entry to export it as iCal.
|
|
||||||
|
|
||||||
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.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|

|
@@ -1,14 +1,54 @@
|
|||||||
Backend setup:
|
# Backend setup:
|
||||||
|
|
||||||
1. Create a Admin User in Zarafa:
|
## Installing the sync backend
|
||||||
zarafa-admin -c adminuser -e admin@domain.com -f "Calendar Sync Admin" -p topsecretpw -a 1
|
|
||||||
|
### From source
|
||||||
2. Edit the config.php to fit your needs.
|
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:
|
||||||
|
```
|
||||||
4. If you get an error, make sure that the mapi module is loaded for php-cli:
|
cp -r kopano-webapp-source\plugins\calendarimporter\backend /opt/ical-sync/backend
|
||||||
* Add: /etc/php5/cli/conf.d/50-mapi.ini
|
```
|
||||||
* Content: extension=mapi.so
|
|
||||||
|
### From precompiled download
|
||||||
Never run the backend script as root!
|
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
|
||||||
|
```
|
||||||
|
|
||||||
|
## 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 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// config options
|
||||||
|
$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,165 +1,191 @@
|
|||||||
<?php
|
<?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>
|
* 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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* License as published by the Free Software Foundation; either
|
* License as published by the Free Software Foundation; either
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* License along with this library; if not, write to the Free Software
|
* License along with this library; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*
|
*/
|
||||||
*/
|
|
||||||
|
/**
|
||||||
/* gets the data from a URL */
|
* gets the data from a URL
|
||||||
function curl_get_data($url, $username = NULL, $password = NULL) {
|
*
|
||||||
$ch = curl_init();
|
* @param $url
|
||||||
$timeout = 5;
|
* @param null $username
|
||||||
|
* @param null $password
|
||||||
curl_setopt($ch, CURLOPT_URL, $url);
|
* @return mixed|null
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
*/
|
||||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
|
function curl_get_data($url, $username = NULL, $password = NULL) {
|
||||||
|
$ch = curl_init();
|
||||||
if($username != NULL && $password != NULL) {
|
$timeout = 5;
|
||||||
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
|
|
||||||
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
|
curl_setopt($ch, CURLOPT_URL, $url);
|
||||||
}
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
|
||||||
$data = curl_exec($ch);
|
|
||||||
$http_status = intval(curl_getinfo($ch, CURLINFO_HTTP_CODE));
|
if($username != NULL && $password != NULL) {
|
||||||
curl_close($ch);
|
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
|
||||||
|
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
|
||||||
if($http_status > 210 || $http_status < 200)
|
}
|
||||||
return NULL;
|
|
||||||
return $data;
|
$data = curl_exec($ch);
|
||||||
}
|
$http_status = intval(curl_getinfo($ch, CURLINFO_HTTP_CODE));
|
||||||
|
curl_close($ch);
|
||||||
/* gets all zarafa users */
|
|
||||||
function get_user_ics_list($userStore) {
|
if($http_status > 210 || $http_status < 200)
|
||||||
// get settings
|
return NULL;
|
||||||
// first check if property exist and we can open that using mapi_openproperty
|
return $data;
|
||||||
$storeProps = mapi_getprops($userStore, array(PR_EC_WEBACCESS_SETTINGS_JSON));
|
}
|
||||||
|
|
||||||
// Check if property exists, if it doesn not exist then we can continue with empty set of settings
|
/**
|
||||||
if (isset($storeProps[PR_EC_WEBACCESS_SETTINGS_JSON]) || propIsError(PR_EC_WEBACCESS_SETTINGS_JSON, $storeProps) == MAPI_E_NOT_ENOUGH_MEMORY) {
|
* gets all zarafa users
|
||||||
// read the settings property
|
*
|
||||||
$stream = mapi_openproperty($userStore, PR_EC_WEBACCESS_SETTINGS_JSON, IID_IStream, 0, 0);
|
* @param $userStore
|
||||||
if ($stream == false) {
|
* @return null|void
|
||||||
echo "Error opening settings property\n";
|
*/
|
||||||
}
|
function get_user_ics_list($userStore) {
|
||||||
|
// get settings
|
||||||
$settings_string = "";
|
// first check if property exist and we can open that using mapi_openproperty
|
||||||
$stat = mapi_stream_stat($stream);
|
$storeProps = mapi_getprops($userStore, array(PR_EC_WEBACCESS_SETTINGS_JSON));
|
||||||
mapi_stream_seek($stream, 0, STREAM_SEEK_SET);
|
|
||||||
for ($i = 0; $i < $stat['cb']; $i += 1024) {
|
// Check if property exists, if it doesn not exist then we can continue with empty set of settings
|
||||||
$settings_string .= mapi_stream_read($stream, 1024);
|
if (isset($storeProps[PR_EC_WEBACCESS_SETTINGS_JSON]) || propIsError(PR_EC_WEBACCESS_SETTINGS_JSON, $storeProps) == MAPI_E_NOT_ENOUGH_MEMORY) {
|
||||||
}
|
// read the settings property
|
||||||
|
$stream = mapi_openproperty($userStore, PR_EC_WEBACCESS_SETTINGS_JSON, IID_IStream, 0, 0);
|
||||||
if(empty($settings_string)) {
|
if ($stream == false) {
|
||||||
// property exists but without any content so ignore it and continue with
|
echo "Error opening settings property\n";
|
||||||
// empty set of settings
|
}
|
||||||
return;
|
|
||||||
}
|
$settings_string = "";
|
||||||
|
$stat = mapi_stream_stat($stream);
|
||||||
$settings = json_decode($settings_string, true);
|
mapi_stream_seek($stream, 0, STREAM_SEEK_SET);
|
||||||
if (empty($settings) || empty($settings['settings'])) {
|
for ($i = 0; $i < $stat['cb']; $i += 1024) {
|
||||||
echo "Error retrieving existing settings\n";
|
$settings_string .= mapi_stream_read($stream, 1024);
|
||||||
}
|
}
|
||||||
|
|
||||||
$calcontext = $settings["settings"]["zarafa"]["v1"]["contexts"]["calendar"];
|
if(empty($settings_string)) {
|
||||||
if(isset($calcontext["icssync"])) {
|
// property exists but without any content so ignore it and continue with
|
||||||
foreach($calcontext["icssync"] as $syncitem) {
|
// empty set of settings
|
||||||
echo "Found sync url: " . $syncitem["icsurl"] . " for calendar: " . $syncitem["calendar"] . "\n";
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $calcontext["icssync"];
|
$settings = json_decode($settings_string, true);
|
||||||
}
|
if (empty($settings) || empty($settings['settings'])) {
|
||||||
|
echo "Error retrieving existing settings\n";
|
||||||
return NULL;
|
}
|
||||||
}
|
|
||||||
}
|
$calcontext = $settings["settings"]["zarafa"]["v1"]["contexts"]["calendar"];
|
||||||
|
if(isset($calcontext["icssync"])) {
|
||||||
/* updates the webapp settings */
|
foreach($calcontext["icssync"] as $syncitem) {
|
||||||
function update_last_sync_date($userStore, $icsentry) {
|
echo "Found sync url: " . $syncitem["icsurl"] . " for calendar: " . $syncitem["calendar"] . "\n";
|
||||||
// get settings
|
}
|
||||||
// first check if property exist and we can open that using mapi_openproperty
|
|
||||||
$storeProps = mapi_getprops($userStore, array(PR_EC_WEBACCESS_SETTINGS_JSON));
|
return $calcontext["icssync"];
|
||||||
|
}
|
||||||
// Check if property exists, if it doesn not exist then we can continue with empty set of settings
|
|
||||||
if (isset($storeProps[PR_EC_WEBACCESS_SETTINGS_JSON]) || propIsError(PR_EC_WEBACCESS_SETTINGS_JSON, $storeProps) == MAPI_E_NOT_ENOUGH_MEMORY) {
|
return NULL;
|
||||||
// read the settings property
|
}
|
||||||
$stream = mapi_openpropertytostream($userStore, PR_EC_WEBACCESS_SETTINGS_JSON, MAPI_MODIFY);
|
}
|
||||||
if ($stream == false) {
|
|
||||||
echo "Error opening settings property\n";
|
/**
|
||||||
}
|
* updates the webapp settings
|
||||||
|
*
|
||||||
$settings_string = "";
|
* @param $userStore
|
||||||
$stat = mapi_stream_stat($stream);
|
* @param $icsentry
|
||||||
mapi_stream_seek($stream, 0, STREAM_SEEK_SET);
|
* @return bool|void
|
||||||
for ($i = 0; $i < $stat['cb']; $i += 1024) {
|
*/
|
||||||
$settings_string .= mapi_stream_read($stream, 1024);
|
function update_last_sync_date($userStore, $icsentry) {
|
||||||
}
|
// get settings
|
||||||
|
// first check if property exist and we can open that using mapi_openproperty
|
||||||
if(empty($settings_string)) {
|
$storeProps = mapi_getprops($userStore, array(PR_EC_WEBACCESS_SETTINGS_JSON));
|
||||||
// property exists but without any content so ignore it and continue with
|
|
||||||
// empty set of settings
|
// Check if property exists, if it doesn not exist then we can continue with empty set of settings
|
||||||
return;
|
if (isset($storeProps[PR_EC_WEBACCESS_SETTINGS_JSON]) || propIsError(PR_EC_WEBACCESS_SETTINGS_JSON, $storeProps) == MAPI_E_NOT_ENOUGH_MEMORY) {
|
||||||
}
|
// read the settings property
|
||||||
|
$stream = mapi_openpropertytostream($userStore, PR_EC_WEBACCESS_SETTINGS_JSON, MAPI_MODIFY);
|
||||||
$settings = json_decode($settings_string, true);
|
if ($stream == false) {
|
||||||
if (empty($settings) || empty($settings['settings'])) {
|
echo "Error opening settings property\n";
|
||||||
echo "Error retrieving existing settings\n";
|
}
|
||||||
}
|
|
||||||
|
$settings_string = "";
|
||||||
$settings["settings"]["zarafa"]["v1"]["contexts"]["calendar"]["icssync"][$icsentry]["lastsync"] = date('Y-m-d H:i:s');
|
$stat = mapi_stream_stat($stream);
|
||||||
|
mapi_stream_seek($stream, 0, STREAM_SEEK_SET);
|
||||||
$newsettings = json_encode($settings);
|
for ($i = 0; $i < $stat['cb']; $i += 1024) {
|
||||||
mapi_stream_setsize($stream, strlen($newsettings));
|
$settings_string .= mapi_stream_read($stream, 1024);
|
||||||
mapi_stream_seek($stream, 0, STREAM_SEEK_SET);
|
}
|
||||||
mapi_stream_write($stream, $newsettings);
|
|
||||||
$res = mapi_stream_commit ($stream);
|
if(empty($settings_string)) {
|
||||||
return $res;
|
// property exists but without any content so ignore it and continue with
|
||||||
}
|
// empty set of settings
|
||||||
|
return;
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
|
$settings = json_decode($settings_string, true);
|
||||||
/* upload a file */
|
if (empty($settings) || empty($settings['settings'])) {
|
||||||
function upload_ics_to_caldav($filename, $caldavurl, $username, $calendarname, $authuser = NULL, $authpass = NULL) {
|
echo "Error retrieving existing settings\n";
|
||||||
$url = $caldavurl . $username . "/" . rawurlencode($calendarname) . "/";
|
}
|
||||||
$post = array('file'=>'@'.$filename);
|
|
||||||
$ch = curl_init();
|
$settings["settings"]["zarafa"]["v1"]["contexts"]["calendar"]["icssync"][$icsentry]["lastsync"] = date('Y-m-d H:i:s');
|
||||||
|
|
||||||
curl_setopt($ch, CURLOPT_URL,$url);
|
$newsettings = json_encode($settings);
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
mapi_stream_setsize($stream, strlen($newsettings));
|
||||||
|
mapi_stream_seek($stream, 0, STREAM_SEEK_SET);
|
||||||
$fp = fopen($filename, 'r');
|
mapi_stream_write($stream, $newsettings);
|
||||||
curl_setopt($ch, CURLOPT_PUT, true);
|
$res = mapi_stream_commit ($stream);
|
||||||
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
|
return $res;
|
||||||
curl_setopt($ch, CURLOPT_INFILE, $fp);
|
}
|
||||||
curl_setopt($ch, CURLOPT_INFILESIZE, filesize ($filename));
|
|
||||||
|
return false;
|
||||||
if($authuser != NULL && $authpass != NULL) {
|
}
|
||||||
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
|
|
||||||
curl_setopt($ch, CURLOPT_USERPWD, "$authuser:$authpass");
|
/**
|
||||||
}
|
* upload a file
|
||||||
|
*
|
||||||
$result=curl_exec($ch);
|
* @param $filename
|
||||||
$http_status = intval(curl_getinfo($ch, CURLINFO_HTTP_CODE));
|
* @param $caldavurl
|
||||||
curl_close($ch);
|
* @param $username
|
||||||
|
* @param $calendarname
|
||||||
echo "uploading file to: " . $url . " (" . $http_status . ")\n";
|
* @param null $authuser
|
||||||
|
* @param null $authpass
|
||||||
return $http_status;
|
* @return int
|
||||||
}
|
*/
|
||||||
?>
|
function upload_ics_to_caldav($filename, $caldavurl, $username, $calendarname, $authuser = NULL, $authpass = NULL) {
|
||||||
|
$url = $caldavurl . $username . "/" . rawurlencode($calendarname) . "/";
|
||||||
|
$post = array('file'=>'@'.$filename);
|
||||||
|
$ch = curl_init();
|
||||||
|
|
||||||
|
curl_setopt($ch, CURLOPT_URL,$url);
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
|
||||||
|
$fp = fopen($filename, 'r');
|
||||||
|
curl_setopt($ch, CURLOPT_PUT, true);
|
||||||
|
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
|
||||||
|
curl_setopt($ch, CURLOPT_INFILE, $fp);
|
||||||
|
curl_setopt($ch, CURLOPT_INFILESIZE, filesize ($filename));
|
||||||
|
|
||||||
|
if($authuser != NULL && $authpass != NULL) {
|
||||||
|
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
|
||||||
|
curl_setopt($ch, CURLOPT_USERPWD, "$authuser:$authpass");
|
||||||
|
}
|
||||||
|
|
||||||
|
$result=curl_exec($ch);
|
||||||
|
$http_status = intval(curl_getinfo($ch, CURLINFO_HTTP_CODE));
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
echo "uploading file to: " . $url . " (" . $http_status . ")\n";
|
||||||
|
|
||||||
|
return $http_status;
|
||||||
|
}
|
299
backend/sync.php
299
backend/sync.php
@@ -1,150 +1,149 @@
|
|||||||
#!/usr/bin/php
|
#!/usr/bin/php
|
||||||
<?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>
|
* 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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* License as published by the Free Software Foundation; either
|
* License as published by the Free Software Foundation; either
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* License along with this library; if not, write to the Free Software
|
* License along with this library; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if(php_sapi_name() !== 'cli') {
|
if(php_sapi_name() !== 'cli') {
|
||||||
die("Script must be run from commandline!");
|
die("Script must be run from commandline!");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
* Add: /etc/php5/cli/conf.d/50-mapi.ini
|
||||||
* Content: extension=mapi.so
|
* Content: extension=mapi.so
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// MAPI includes
|
// MAPI includes
|
||||||
include('/usr/share/php/mapi/mapi.util.php');
|
include('mapi/mapi.util.php');
|
||||||
include('/usr/share/php/mapi/mapidefs.php');
|
include('mapi/mapidefs.php');
|
||||||
include('/usr/share/php/mapi/mapicode.php');
|
include('mapi/mapicode.php');
|
||||||
include('/usr/share/php/mapi/mapitags.php');
|
include('mapi/mapitags.php');
|
||||||
include('/usr/share/php/mapi/mapiguid.php');
|
include('mapi/mapiguid.php');
|
||||||
include('config.php');
|
include('config.php');
|
||||||
include('functions.php');
|
include('functions.php');
|
||||||
|
|
||||||
// log in to zarafa
|
// log in to zarafa
|
||||||
$session = mapi_logon_zarafa($ADMINUSERNAME, $ADMINPASSWORD, $SERVER);
|
$session = mapi_logon_zarafa($ADMINUSERNAME, $ADMINPASSWORD, $SERVER);
|
||||||
if($session === FALSE) {
|
if($session === FALSE) {
|
||||||
exit("Logon failed with error " .mapi_last_hresult() . "\n");
|
exit("Logon failed with error " .mapi_last_hresult() . "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// load all stores for the admin user
|
// load all stores for the admin user
|
||||||
$storeTable = mapi_getmsgstorestable($session);
|
$storeTable = mapi_getmsgstorestable($session);
|
||||||
if($storeTable === FALSE) {
|
if($storeTable === FALSE) {
|
||||||
exit("Storetable could not be opened. Error " .mapi_last_hresult() . "\n");
|
exit("Storetable could not be opened. Error " .mapi_last_hresult() . "\n");
|
||||||
}
|
}
|
||||||
$storesList = mapi_table_queryallrows($storeTable, array(PR_ENTRYID, PR_DEFAULT_STORE));
|
$storesList = mapi_table_queryallrows($storeTable, array(PR_ENTRYID, PR_DEFAULT_STORE));
|
||||||
|
|
||||||
// get admin users default store
|
// get admin users default store
|
||||||
foreach ($storesList as $row) {
|
foreach ($storesList as $row) {
|
||||||
if($row[PR_DEFAULT_STORE]) {
|
if($row[PR_DEFAULT_STORE]) {
|
||||||
$storeEntryid = $row[PR_ENTRYID];
|
$storeEntryid = $row[PR_ENTRYID];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!$storeEntryid) {
|
if(!$storeEntryid) {
|
||||||
exit("Can't find default store\n");
|
exit("Can't find default store\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// open default store
|
// open default store
|
||||||
$store = mapi_openmsgstore($session, $storeEntryid);
|
$store = mapi_openmsgstore($session, $storeEntryid);
|
||||||
if(!$store) {
|
if(!$store) {
|
||||||
exit("Unable to open system store\n");
|
exit("Unable to open system store\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// get a userlist
|
// get a userlist
|
||||||
$userList = array();
|
$userList = array();
|
||||||
// for multi company setup
|
// for multi company setup
|
||||||
$companyList = mapi_zarafa_getcompanylist($store);
|
$companyList = mapi_zarafa_getcompanylist($store);
|
||||||
if(mapi_last_hresult() == NOERROR && is_array($companyList)) {
|
if(mapi_last_hresult() == NOERROR && is_array($companyList)) {
|
||||||
// multi company setup, get all users from all companies
|
// multi company setup, get all users from all companies
|
||||||
foreach($companyList as $companyName => $companyData) {
|
foreach($companyList as $companyName => $companyData) {
|
||||||
$userList = array_merge($userList, mapi_zarafa_getuserlist($store, $companyData["companyid"]));
|
$userList = array_merge($userList, mapi_zarafa_getuserlist($store, $companyData["companyid"]));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// single company setup, get list of all zarafa users
|
// single company setup, get list of all zarafa users
|
||||||
$userList = mapi_zarafa_getuserlist($store);
|
$userList = mapi_zarafa_getuserlist($store);
|
||||||
}
|
}
|
||||||
if(count($userList) <= 0) {
|
if(count($userList) <= 0) {
|
||||||
exit("Unable to get user list\n");
|
exit("Unable to get user list\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// loop over all users
|
// loop over all users
|
||||||
foreach($userList as $userName => $userData) {
|
foreach($userList as $userName => $userData) {
|
||||||
// check for valid users
|
// check for valid users
|
||||||
if($userName == "SYSTEM" ||$userName == $ADMINUSERNAME) {
|
if($userName == "SYSTEM" ||$userName == $ADMINUSERNAME) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "###Getting sync settings for user: " . $userName . "\n";
|
echo "###Getting sync settings for user: " . $userName . "\n";
|
||||||
|
|
||||||
$userEntryId = mapi_msgstore_createentryid($store, $userName);
|
$userEntryId = mapi_msgstore_createentryid($store, $userName);
|
||||||
$userStore = mapi_openmsgstore($session, $userEntryId);
|
$userStore = mapi_openmsgstore($session, $userEntryId);
|
||||||
if(!$userStore) {
|
if(!$userStore) {
|
||||||
echo "Can't open user store\n";
|
echo "Can't open user store\n";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$syncItems = get_user_ics_list($userStore);
|
$syncItems = get_user_ics_list($userStore);
|
||||||
|
|
||||||
if($syncItems != NULL && count($syncItems) > 0) {
|
if($syncItems != NULL && count($syncItems) > 0) {
|
||||||
foreach($syncItems as $syncItemName => $syncItem) {
|
foreach($syncItems as $syncItemName => $syncItem) {
|
||||||
//check update intervall
|
//check update intervall
|
||||||
$lastUpdate = strtotime($syncItem["lastsync"]);
|
$lastUpdate = strtotime($syncItem["lastsync"]);
|
||||||
$updateIntervall = intval($syncItem["intervall"]) * 60; // we need seconds
|
$updateIntervall = intval($syncItem["intervall"]) * 60; // we need seconds
|
||||||
$currenttime = time();
|
$currenttime = time();
|
||||||
|
|
||||||
if(($lastUpdate + $updateIntervall) <= $currenttime) {
|
if(($lastUpdate + $updateIntervall) <= $currenttime) {
|
||||||
echo "Update intervall OK ($currenttime): " . ($lastUpdate + $updateIntervall) . "\n";
|
echo "Update intervall OK ($currenttime): " . ($lastUpdate + $updateIntervall) . "\n";
|
||||||
|
|
||||||
$tmpFilename = $TEMPDIR . uniqid($userName . $syncItem["calendar"], true) . ".ics";
|
$tmpFilename = $TEMPDIR . uniqid($userName . $syncItem["calendar"], true) . ".ics";
|
||||||
|
|
||||||
$user = NULL;
|
$user = NULL;
|
||||||
$pass= NULL;
|
$pass= NULL;
|
||||||
|
|
||||||
if($syncItem["user"] != NULL && !empty($syncItem["user"]))
|
if($syncItem["user"] != NULL && !empty($syncItem["user"]))
|
||||||
$user = $syncItem["user"];
|
$user = $syncItem["user"];
|
||||||
if($syncItem["pass"] != NULL && !empty($syncItem["pass"]))
|
if($syncItem["pass"] != NULL && !empty($syncItem["pass"]))
|
||||||
$pass= base64_decode($syncItem["pass"]);
|
$pass= base64_decode($syncItem["pass"]);
|
||||||
|
|
||||||
$icsData = curl_get_data($syncItem["icsurl"], $user, $pass);
|
$icsData = curl_get_data($syncItem["icsurl"], $user, $pass);
|
||||||
|
|
||||||
if($icsData != NULL) {
|
if($icsData != NULL) {
|
||||||
file_put_contents($tmpFilename, $icsData);
|
file_put_contents($tmpFilename, $icsData);
|
||||||
echo "Got valid data for " . $syncItem["icsurl"] . " stored in " . $tmpFilename . "\n";
|
echo "Got valid data for " . $syncItem["icsurl"] . " stored in " . $tmpFilename . "\n";
|
||||||
$result = upload_ics_to_caldav($tmpFilename, $CALDAVURL, $userName, $syncItem["calendarname"], $ADMINUSERNAME, $ADMINPASSWORD);
|
$result = upload_ics_to_caldav($tmpFilename, $CALDAVURL, $userName, $syncItem["calendarname"], $ADMINUSERNAME, $ADMINPASSWORD);
|
||||||
if(intval($result) == 200) {
|
if(intval($result) == 200) {
|
||||||
echo "Import completed: $result\n";
|
echo "Import completed: $result\n";
|
||||||
$result = update_last_sync_date($userStore, $syncItemName);
|
$result = update_last_sync_date($userStore, $syncItemName);
|
||||||
$res = $result ? "true":"false";
|
$res = $result ? "true":"false";
|
||||||
echo "Updated Zarafa settings: " . $res . "\n";
|
echo "Updated Kopano settings: " . $res . "\n";
|
||||||
} else {
|
} else {
|
||||||
echo "Uploading failed: " . $result . "\n";
|
echo "Uploading failed: " . $result . "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
echo "Update intervall STOP ($currenttime): " . ($lastUpdate + $updateIntervall) . "\n";
|
echo "Update intervall STOP ($currenttime): " . ($lastUpdate + $updateIntervall) . "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "###Done sync for user: " . $userName . "\n\n";
|
echo "###Done sync for user: " . $userName . "\n\n";
|
||||||
}
|
}
|
||||||
?>
|
|
133
changelog.txt
133
changelog.txt
@@ -1,64 +1,71 @@
|
|||||||
calendarimporter 2.2.1:
|
v2.2.3: 14.06.2018
|
||||||
- finally supporting Kopano Webapp 3.1.x
|
- Fixed JS error, thanks to hartois
|
||||||
- translation to german added
|
- Fixed manifest.xml structure (validation now succeeds)
|
||||||
|
|
||||||
calendarimporter 2.2.0:
|
calendarimporter 2.2.2:
|
||||||
- support for Kopano Webapp 3.1.1
|
- updated documentation
|
||||||
- Code rework
|
|
||||||
- Calendar export improved
|
calendarimporter 2.2.1:
|
||||||
- Calendar import improved
|
- finally supporting Kopano Webapp 3.1.x
|
||||||
- GUI improvements
|
- translation to german added
|
||||||
|
|
||||||
calendarimporter 2.1.0:
|
calendarimporter 2.2.0:
|
||||||
- ics sync is now implemented
|
- support for Kopano Webapp 3.1.1
|
||||||
|
- Code rework
|
||||||
calendarimporter 2.0.5:
|
- Calendar export improved
|
||||||
- added settings widget
|
- Calendar import improved
|
||||||
- compatible with webapp 1.5 and 1.6
|
- GUI improvements
|
||||||
|
|
||||||
calendarimporter 2.0.4:
|
calendarimporter 2.1.0:
|
||||||
- added compatible with webapp 1.4
|
- ics sync is now implemented
|
||||||
- added gui for sync - sync algorithms not jet implemented
|
|
||||||
|
calendarimporter 2.0.5:
|
||||||
calendarimporter 2.0.3:
|
- added settings widget
|
||||||
- fixed all day events
|
- compatible with webapp 1.5 and 1.6
|
||||||
|
|
||||||
calendarimporter 2.0.2:
|
calendarimporter 2.0.4:
|
||||||
- fixed crash when public store does not exist
|
- added compatible with webapp 1.4
|
||||||
- check if temporary directory is writeable
|
- added gui for sync - sync algorithms not jet implemented
|
||||||
- disabled display_error with ini_set
|
|
||||||
- fixed exporter: now really exporting the chosen calendar
|
calendarimporter 2.0.3:
|
||||||
- improved parser (timezone detection)
|
- fixed all day events
|
||||||
|
|
||||||
calendarimporter 2.0.1:
|
calendarimporter 2.0.2:
|
||||||
- removed debug line "utc = true;"
|
- fixed crash when public store does not exist
|
||||||
- Fixed problems with colons in value fields (improved regex)
|
- check if temporary directory is writeable
|
||||||
- minor fixes/improvements
|
- disabled display_error with ini_set
|
||||||
|
- fixed exporter: now really exporting the chosen calendar
|
||||||
calendarimporter 2.0:
|
- improved parser (timezone detection)
|
||||||
- updated iCalcreator to 2.16.12
|
|
||||||
- fixed exporter problem: now you can export more than 50 events
|
calendarimporter 2.0.1:
|
||||||
- fixed button visibility for attachment importing
|
- removed debug line "utc = true;"
|
||||||
- minor fixes/improvements
|
- Fixed problems with colons in value fields (improved regex)
|
||||||
|
- minor fixes/improvements
|
||||||
calendarimporter 2.0b:
|
|
||||||
- Completely rewritten timezone management
|
calendarimporter 2.0:
|
||||||
- Import of iCal attachments possible
|
- updated iCalcreator to 2.16.12
|
||||||
- webapp 1.3 about page added
|
- fixed exporter problem: now you can export more than 50 events
|
||||||
- bugfixes
|
- fixed button visibility for attachment importing
|
||||||
|
- minor fixes/improvements
|
||||||
calendarimporter 1.2:
|
|
||||||
- New timezone management
|
calendarimporter 2.0b:
|
||||||
- more imported fields (Busystatus, importance, label, class, organizer, reminder)
|
- Completely rewritten timezone management
|
||||||
- smaller improvements
|
- Import of iCal attachments possible
|
||||||
- deploy/build script
|
- webapp 1.3 about page added
|
||||||
- support for shared/public folders
|
- bugfixes
|
||||||
|
|
||||||
calendarimporter 1.1 final:
|
calendarimporter 1.2:
|
||||||
- ics exporter
|
- New timezone management
|
||||||
- improved ics fileparser
|
- more imported fields (Busystatus, importance, label, class, organizer, reminder)
|
||||||
- fixed ExtJS Problem in chrome
|
- smaller improvements
|
||||||
|
- deploy/build script
|
||||||
KNOWN PROBLEMS:
|
- support for shared/public folders
|
||||||
- attachments in events are ignored
|
|
||||||
|
calendarimporter 1.1 final:
|
||||||
|
- ics exporter
|
||||||
|
- improved ics fileparser
|
||||||
|
- fixed ExtJS Problem in chrome
|
||||||
|
|
||||||
|
KNOWN PROBLEMS:
|
||||||
|
- attachments in events are ignored
|
||||||
- recurrent events are not handled properly (im/export)
|
- recurrent events are not handled properly (im/export)
|
122
js/ABOUT.js
122
js/ABOUT.js
@@ -1,66 +1,56 @@
|
|||||||
/**
|
/**
|
||||||
* ABOUT.js, Kopano calender to ics im/exporter
|
* ABOUT.js, Kopano calender to ics im/exporter
|
||||||
*
|
*
|
||||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
* 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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* License as published by the Free Software Foundation; either
|
* License as published by the Free Software Foundation; either
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* License along with this library; if not, write to the Free Software
|
* License along with this library; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Ext.namespace('Zarafa.plugins.calendarimporter');
|
Ext.namespace('Zarafa.plugins.calendarimporter');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Zarafa.plugins.calendarimporter.ABOUT
|
* @class Zarafa.plugins.calendarimporter.ABOUT
|
||||||
* @extends String
|
* @extends String
|
||||||
*
|
*
|
||||||
* The copyright string holding the copyright notice for the Zarafa calendarimporter Plugin.
|
* The copyright string holding the copyright notice for the Zarafa calendarimporter Plugin.
|
||||||
*/
|
*/
|
||||||
Zarafa.plugins.calendarimporter.ABOUT = ""
|
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 "
|
+ "<p>This program is free software; you can redistribute it and/or "
|
||||||
+ "modify it under the terms of the GNU Lesser General Public "
|
+ "modify it under the terms of the GNU Lesser General Public "
|
||||||
+ "License as published by the Free Software Foundation; either "
|
+ "License as published by the Free Software Foundation; either "
|
||||||
+ "version 2.1 of the License, or (at your option) any later version.</p>"
|
+ "version 2.1 of the License, or (at your option) any later version.</p>"
|
||||||
|
|
||||||
+ "<p>This program is distributed in the hope that it will be useful, "
|
+ "<p>This program is distributed in the hope that it will be useful, "
|
||||||
+ "but WITHOUT ANY WARRANTY; without even the implied warranty of "
|
+ "but WITHOUT ANY WARRANTY; without even the implied warranty of "
|
||||||
+ "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU "
|
+ "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU "
|
||||||
+ "Lesser General Public License for more details.</p>"
|
+ "Lesser General Public License for more details.</p>"
|
||||||
|
|
||||||
+ "<p>You should have received a copy of the GNU Lesser General Public "
|
+ "<p>You should have received a copy of the GNU Lesser General Public "
|
||||||
+ "License along with this program; if not, write to the Free Software "
|
+ "License along with this program; if not, write to the Free Software "
|
||||||
+ "Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</p>"
|
+ "Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</p>"
|
||||||
|
|
||||||
+ "<hr />"
|
+ "<hr />"
|
||||||
|
|
||||||
+ "<p>The calendarimporter plugin contains the following third-party components:</p>"
|
+ "<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>Licensed under the BSD 3-Clause \"New\" or \"Revised\" License</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>";
|
|
@@ -2,7 +2,7 @@
|
|||||||
* Actions.js zarafa calender to ics im/exporter
|
* Actions.js zarafa calender to ics im/exporter
|
||||||
*
|
*
|
||||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
* 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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* 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 inbox = container.getHierarchyStore().getDefaultStore();
|
||||||
var pub = container.getHierarchyStore().getPublicStore();
|
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++) {
|
for (var i = 0; i < inbox.subStores.folders.totalLength; i++) {
|
||||||
var folder = inbox.subStores.folders.getAt(i);
|
var folder = inbox.subStores.folders.getAt(i);
|
||||||
if (!Ext.isEmpty(folder) && folder.get("container_class") == "IPF.Appointment") {
|
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++) {
|
for (var j = 0; j < pub.subStores.folders.totalLength; j++) {
|
||||||
var folder = pub.subStores.folders.getAt(j);
|
var folder = pub.subStores.folders.getAt(j);
|
||||||
if (!Ext.isEmpty(folder) && folder.get("container_class") == "IPF.Appointment") {
|
if (!Ext.isEmpty(folder) && folder.get("container_class") == "IPF.Appointment") {
|
||||||
|
@@ -1,85 +1,85 @@
|
|||||||
/**
|
/**
|
||||||
* ResponseHandler.js, Kopano calender to ics im/exporter
|
* ResponseHandler.js, Kopano calender to ics im/exporter
|
||||||
*
|
*
|
||||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
* 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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* License as published by the Free Software Foundation; either
|
* License as published by the Free Software Foundation; either
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* License along with this library; if not, write to the Free Software
|
* License along with this library; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ResponseHandler
|
* ResponseHandler
|
||||||
*
|
*
|
||||||
* This class handles all responses from the php backend
|
* This class handles all responses from the php backend
|
||||||
*/
|
*/
|
||||||
Ext.namespace('Zarafa.plugins.calendarimporter.data');
|
Ext.namespace('Zarafa.plugins.calendarimporter.data');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Zarafa.plugins.calendarimporter.data.ResponseHandler
|
* @class Zarafa.plugins.calendarimporter.data.ResponseHandler
|
||||||
* @extends Zarafa.plugins.calendarimporter.data.AbstractResponseHandler
|
* @extends Zarafa.plugins.calendarimporter.data.AbstractResponseHandler
|
||||||
*
|
*
|
||||||
* Calendar specific response handler.
|
* Calendar specific response handler.
|
||||||
*/
|
*/
|
||||||
Zarafa.plugins.calendarimporter.data.ResponseHandler = Ext.extend(Zarafa.core.data.AbstractResponseHandler, {
|
Zarafa.plugins.calendarimporter.data.ResponseHandler = Ext.extend(Zarafa.core.data.AbstractResponseHandler, {
|
||||||
/**
|
/**
|
||||||
* @cfg {Function} successCallback The function which
|
* @cfg {Function} successCallback The function which
|
||||||
* will be called after success request.
|
* will be called after success request.
|
||||||
*/
|
*/
|
||||||
successCallback: null,
|
successCallback: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call the successCallback callback function.
|
* Call the successCallback callback function.
|
||||||
* @param {Object} response Object contained the response data.
|
* @param {Object} response Object contained the response data.
|
||||||
*/
|
*/
|
||||||
doExport: function (response) {
|
doExport: function (response) {
|
||||||
this.successCallback(response);
|
this.successCallback(response);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call the successCallback callback function.
|
* Call the successCallback callback function.
|
||||||
* @param {Object} response Object contained the response data.
|
* @param {Object} response Object contained the response data.
|
||||||
*/
|
*/
|
||||||
doLoad: function (response) {
|
doLoad: function (response) {
|
||||||
this.successCallback(response);
|
this.successCallback(response);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call the successCallback callback function.
|
* Call the successCallback callback function.
|
||||||
* @param {Object} response Object contained the response data.
|
* @param {Object} response Object contained the response data.
|
||||||
*/
|
*/
|
||||||
doImport: function (response) {
|
doImport: function (response) {
|
||||||
this.successCallback(response);
|
this.successCallback(response);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call the successCallback callback function.
|
* Call the successCallback callback function.
|
||||||
* @param {Object} response Object contained the response data.
|
* @param {Object} response Object contained the response data.
|
||||||
*/
|
*/
|
||||||
doImportattachment: function (response) {
|
doImportattachment: function (response) {
|
||||||
this.successCallback(response);
|
this.successCallback(response);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* In case exception happened on server, server will return
|
* In case exception happened on server, server will return
|
||||||
* exception response with the code of exception.
|
* exception response with the code of exception.
|
||||||
* @param {Object} response Object contained the response data.
|
* @param {Object} response Object contained the response data.
|
||||||
*/
|
*/
|
||||||
doError: function (response) {
|
doError: function (response) {
|
||||||
alert("error response code: " + response.error.info.code);
|
alert("error response code: " + response.error.info.code);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Ext.reg('calendarimporter.calendarresponsehandler', Zarafa.plugins.calendarimporter.data.ResponseHandler);
|
Ext.reg('calendarimporter.calendarresponsehandler', Zarafa.plugins.calendarimporter.data.ResponseHandler);
|
1532
js/data/timezones.js
1532
js/data/timezones.js
File diff suppressed because it is too large
Load Diff
@@ -1,66 +1,66 @@
|
|||||||
/**
|
/**
|
||||||
* ImportContentPanel.js, Kopano calender to ics im/exporter
|
* ImportContentPanel.js, Kopano calender to ics im/exporter
|
||||||
*
|
*
|
||||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
* 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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* License as published by the Free Software Foundation; either
|
* License as published by the Free Software Foundation; either
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* License along with this library; if not, write to the Free Software
|
* License along with this library; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ImportContentPanel
|
* ImportContentPanel
|
||||||
*
|
*
|
||||||
* Container for the importpanel.
|
* Container for the importpanel.
|
||||||
*/
|
*/
|
||||||
Ext.namespace("Zarafa.plugins.calendarimporter.dialogs");
|
Ext.namespace("Zarafa.plugins.calendarimporter.dialogs");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Zarafa.plugins.calendarimporter.dialogs.ImportContentPanel
|
* @class Zarafa.plugins.calendarimporter.dialogs.ImportContentPanel
|
||||||
* @extends Zarafa.core.ui.ContentPanel
|
* @extends Zarafa.core.ui.ContentPanel
|
||||||
*
|
*
|
||||||
* The content panel which shows the hierarchy tree of Owncloud account files.
|
* The content panel which shows the hierarchy tree of Owncloud account files.
|
||||||
* @xtype calendarimportercontentpanel
|
* @xtype calendarimportercontentpanel
|
||||||
*/
|
*/
|
||||||
Zarafa.plugins.calendarimporter.dialogs.ImportContentPanel = Ext.extend(Zarafa.core.ui.ContentPanel, {
|
Zarafa.plugins.calendarimporter.dialogs.ImportContentPanel = Ext.extend(Zarafa.core.ui.ContentPanel, {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param config Configuration structure
|
* @param config Configuration structure
|
||||||
*/
|
*/
|
||||||
constructor: function (config) {
|
constructor: function (config) {
|
||||||
config = config || {};
|
config = config || {};
|
||||||
Ext.applyIf(config, {
|
Ext.applyIf(config, {
|
||||||
layout: 'fit',
|
layout: 'fit',
|
||||||
title: dgettext('plugin_calendarimporter', 'Import Calendar File'),
|
title: dgettext('plugin_calendarimporter', 'Import Calendar File'),
|
||||||
closeOnSave: true,
|
closeOnSave: true,
|
||||||
width: 800,
|
width: 800,
|
||||||
height: 700,
|
height: 700,
|
||||||
//Add panel
|
//Add panel
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
xtype: 'calendarimporter.importpanel',
|
xtype: 'calendarimporter.importpanel',
|
||||||
filename: config.filename,
|
filename: config.filename,
|
||||||
folder: config.folder
|
folder: config.folder
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
Zarafa.plugins.calendarimporter.dialogs.ImportContentPanel.superclass.constructor.call(this, config);
|
Zarafa.plugins.calendarimporter.dialogs.ImportContentPanel.superclass.constructor.call(this, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Ext.reg('calendarimporter.contentpanel', Zarafa.plugins.calendarimporter.dialogs.ImportContentPanel);
|
Ext.reg('calendarimporter.contentpanel', Zarafa.plugins.calendarimporter.dialogs.ImportContentPanel);
|
@@ -2,7 +2,7 @@
|
|||||||
* ImportPanel.js, Kopano calender to ics im/exporter
|
* ImportPanel.js, Kopano calender to ics im/exporter
|
||||||
*
|
*
|
||||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
* 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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
92
js/external/Ext.util.base64.js
vendored
92
js/external/Ext.util.base64.js
vendored
@@ -1,47 +1,47 @@
|
|||||||
Ext.util.base64 = {
|
Ext.util.base64 = {
|
||||||
base64s : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
|
base64s : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
|
||||||
|
|
||||||
encode: function(decStr){
|
encode: function(decStr){
|
||||||
if (typeof btoa === 'function') {
|
if (typeof btoa === 'function') {
|
||||||
return btoa(decStr);
|
return btoa(decStr);
|
||||||
}
|
}
|
||||||
var base64s = this.base64s;
|
var base64s = this.base64s;
|
||||||
var bits;
|
var bits;
|
||||||
var dual;
|
var dual;
|
||||||
var i = 0;
|
var i = 0;
|
||||||
var encOut = "";
|
var encOut = "";
|
||||||
while(decStr.length >= i + 3){
|
while(decStr.length >= i + 3){
|
||||||
bits = (decStr.charCodeAt(i++) & 0xff) <<16 | (decStr.charCodeAt(i++) & 0xff) <<8 | decStr.charCodeAt(i++) & 0xff;
|
bits = (decStr.charCodeAt(i++) & 0xff) <<16 | (decStr.charCodeAt(i++) & 0xff) <<8 | decStr.charCodeAt(i++) & 0xff;
|
||||||
encOut += base64s.charAt((bits & 0x00fc0000) >>18) + base64s.charAt((bits & 0x0003f000) >>12) + base64s.charAt((bits & 0x00000fc0) >> 6) + base64s.charAt((bits & 0x0000003f));
|
encOut += base64s.charAt((bits & 0x00fc0000) >>18) + base64s.charAt((bits & 0x0003f000) >>12) + base64s.charAt((bits & 0x00000fc0) >> 6) + base64s.charAt((bits & 0x0000003f));
|
||||||
}
|
}
|
||||||
if(decStr.length -i > 0 && decStr.length -i < 3){
|
if(decStr.length -i > 0 && decStr.length -i < 3){
|
||||||
dual = Boolean(decStr.length -i -1);
|
dual = Boolean(decStr.length -i -1);
|
||||||
bits = ((decStr.charCodeAt(i++) & 0xff) <<16) | (dual ? (decStr.charCodeAt(i) & 0xff) <<8 : 0);
|
bits = ((decStr.charCodeAt(i++) & 0xff) <<16) | (dual ? (decStr.charCodeAt(i) & 0xff) <<8 : 0);
|
||||||
encOut += base64s.charAt((bits & 0x00fc0000) >>18) + base64s.charAt((bits & 0x0003f000) >>12) + (dual ? base64s.charAt((bits & 0x00000fc0) >>6) : '=') + '=';
|
encOut += base64s.charAt((bits & 0x00fc0000) >>18) + base64s.charAt((bits & 0x0003f000) >>12) + (dual ? base64s.charAt((bits & 0x00000fc0) >>6) : '=') + '=';
|
||||||
}
|
}
|
||||||
return(encOut);
|
return(encOut);
|
||||||
},
|
},
|
||||||
|
|
||||||
decode: function(encStr){
|
decode: function(encStr){
|
||||||
if (typeof atob === 'function') {
|
if (typeof atob === 'function') {
|
||||||
return atob(encStr);
|
return atob(encStr);
|
||||||
}
|
}
|
||||||
var base64s = this.base64s;
|
var base64s = this.base64s;
|
||||||
var bits;
|
var bits;
|
||||||
var decOut = "";
|
var decOut = "";
|
||||||
var i = 0;
|
var i = 0;
|
||||||
for(; i<encStr.length; i += 4){
|
for(; i<encStr.length; i += 4){
|
||||||
bits = (base64s.indexOf(encStr.charAt(i)) & 0xff) <<18 | (base64s.indexOf(encStr.charAt(i +1)) & 0xff) <<12 | (base64s.indexOf(encStr.charAt(i +2)) & 0xff) << 6 | base64s.indexOf(encStr.charAt(i +3)) & 0xff;
|
bits = (base64s.indexOf(encStr.charAt(i)) & 0xff) <<18 | (base64s.indexOf(encStr.charAt(i +1)) & 0xff) <<12 | (base64s.indexOf(encStr.charAt(i +2)) & 0xff) << 6 | base64s.indexOf(encStr.charAt(i +3)) & 0xff;
|
||||||
decOut += String.fromCharCode((bits & 0xff0000) >>16, (bits & 0xff00) >>8, bits & 0xff);
|
decOut += String.fromCharCode((bits & 0xff0000) >>16, (bits & 0xff00) >>8, bits & 0xff);
|
||||||
}
|
}
|
||||||
if(encStr.charCodeAt(i -2) == 61){
|
if(encStr.charCodeAt(i -2) == 61){
|
||||||
return(decOut.substring(0, decOut.length -2));
|
return(decOut.substring(0, decOut.length -2));
|
||||||
}
|
}
|
||||||
else if(encStr.charCodeAt(i -1) == 61){
|
else if(encStr.charCodeAt(i -1) == 61){
|
||||||
return(decOut.substring(0, decOut.length -1));
|
return(decOut.substring(0, decOut.length -1));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return(decOut);
|
return(decOut);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -1,306 +1,306 @@
|
|||||||
/**
|
/**
|
||||||
* plugin.calendarimporter.js, Kopano calender to ics im/exporter
|
* plugin.calendarimporter.js, Kopano calender to ics im/exporter
|
||||||
*
|
*
|
||||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
* 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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* License as published by the Free Software Foundation; either
|
* License as published by the Free Software Foundation; either
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* License along with this library; if not, write to the Free Software
|
* License along with this library; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Ext.namespace("Zarafa.plugins.calendarimporter"); // Assign the right namespace
|
Ext.namespace("Zarafa.plugins.calendarimporter"); // Assign the right namespace
|
||||||
|
|
||||||
Zarafa.plugins.calendarimporter.ImportPlugin = Ext.extend(Zarafa.core.Plugin, { // create new import plugin
|
Zarafa.plugins.calendarimporter.ImportPlugin = Ext.extend(Zarafa.core.Plugin, { // create new import plugin
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param {Object} config Configuration object
|
* @param {Object} config Configuration object
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
constructor: function (config) {
|
constructor: function (config) {
|
||||||
config = config || {};
|
config = config || {};
|
||||||
|
|
||||||
Zarafa.plugins.calendarimporter.ImportPlugin.superclass.constructor.call(this, config);
|
Zarafa.plugins.calendarimporter.ImportPlugin.superclass.constructor.call(this, config);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* initialises insertion point for plugin
|
* initialises insertion point for plugin
|
||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
initPlugin: function () {
|
initPlugin: function () {
|
||||||
Zarafa.plugins.calendarimporter.ImportPlugin.superclass.initPlugin.apply(this, arguments);
|
Zarafa.plugins.calendarimporter.ImportPlugin.superclass.initPlugin.apply(this, arguments);
|
||||||
|
|
||||||
/* our panel */
|
/* our panel */
|
||||||
Zarafa.core.data.SharedComponentType.addProperty('plugins.calendarimporter.dialogs.importevents');
|
Zarafa.core.data.SharedComponentType.addProperty('plugins.calendarimporter.dialogs.importevents');
|
||||||
|
|
||||||
/* directly import received icals */
|
/* directly import received icals */
|
||||||
this.registerInsertionPoint('common.contextmenu.attachment.actions', this.createAttachmentImportButton);
|
this.registerInsertionPoint('common.contextmenu.attachment.actions', this.createAttachmentImportButton);
|
||||||
|
|
||||||
/* add settings widget */
|
/* add settings widget */
|
||||||
this.registerInsertionPoint('context.settings.category.calendar', this.createSettingsWidget);
|
this.registerInsertionPoint('context.settings.category.calendar', this.createSettingsWidget);
|
||||||
|
|
||||||
/* export a calendar entry via rightclick */
|
/* export a calendar entry via rightclick */
|
||||||
this.registerInsertionPoint('context.calendar.contextmenu.actions', this.createItemExportInsertionPoint, this);
|
this.registerInsertionPoint('context.calendar.contextmenu.actions', this.createItemExportInsertionPoint, this);
|
||||||
|
|
||||||
/* ical sync stuff */
|
/* ical sync stuff */
|
||||||
if (container.getSettingsModel().get("zarafa/v1/plugins/calendarimporter/enable_sync") === true) {
|
if (container.getSettingsModel().get("zarafa/v1/plugins/calendarimporter/enable_sync") === true) {
|
||||||
/* edit panel */
|
/* edit panel */
|
||||||
Zarafa.core.data.SharedComponentType.addProperty('plugins.calendarimporter.settings.dialogs.calsyncedit');
|
Zarafa.core.data.SharedComponentType.addProperty('plugins.calendarimporter.settings.dialogs.calsyncedit');
|
||||||
|
|
||||||
/* enable the settings widget */
|
/* enable the settings widget */
|
||||||
this.registerInsertionPoint('context.settings.category.calendar', this.createSettingsCalSyncWidget);
|
this.registerInsertionPoint('context.settings.category.calendar', this.createSettingsCalSyncWidget);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method hooks to the contact context menu and allows users to export users to vcf.
|
* This method hooks to the contact context menu and allows users to export users to vcf.
|
||||||
*
|
*
|
||||||
* @param include
|
* @param include
|
||||||
* @param btn
|
* @param btn
|
||||||
* @returns {Object}
|
* @returns {Object}
|
||||||
*/
|
*/
|
||||||
createItemExportInsertionPoint: function (include, btn) {
|
createItemExportInsertionPoint: function (include, btn) {
|
||||||
return {
|
return {
|
||||||
text: dgettext('plugin_calendarimporter', 'Export Event'),
|
text: dgettext('plugin_calendarimporter', 'Export Event'),
|
||||||
handler: this.exportToICS.createDelegate(this, [btn]),
|
handler: this.exportToICS.createDelegate(this, [btn]),
|
||||||
scope: this,
|
scope: this,
|
||||||
iconCls: 'icon_calendarimporter_export'
|
iconCls: 'icon_calendarimporter_export'
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates a request to download the selected records as vCard.
|
* Generates a request to download the selected records as vCard.
|
||||||
* @param {Ext.Button} btn
|
* @param {Ext.Button} btn
|
||||||
*/
|
*/
|
||||||
exportToICS: function (btn) {
|
exportToICS: function (btn) {
|
||||||
if (btn.records.length == 0) {
|
if (btn.records.length == 0) {
|
||||||
return; // skip if no records where given!
|
return; // skip if no records where given!
|
||||||
}
|
}
|
||||||
|
|
||||||
var recordIds = [];
|
var recordIds = [];
|
||||||
|
|
||||||
for (var i = 0; i < btn.records.length; i++) {
|
for (var i = 0; i < btn.records.length; i++) {
|
||||||
recordIds.push(btn.records[i].get("entryid"));
|
recordIds.push(btn.records[i].get("entryid"));
|
||||||
}
|
}
|
||||||
|
|
||||||
Zarafa.plugins.calendarimporter.data.Actions.exportToICS(btn.records[0].get("store_entryid"), recordIds, undefined);
|
Zarafa.plugins.calendarimporter.data.Actions.exportToICS(btn.records[0].get("store_entryid"), recordIds, undefined);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the button
|
* Creates the button
|
||||||
*
|
*
|
||||||
* @return {Object} Configuration object for a {@link Ext.Button button}
|
* @return {Object} Configuration object for a {@link Ext.Button button}
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
createSettingsWidget: function () {
|
createSettingsWidget: function () {
|
||||||
return [{
|
return [{
|
||||||
xtype: 'calendarimporter.settingswidget'
|
xtype: 'calendarimporter.settingswidget'
|
||||||
}];
|
}];
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the button
|
* Creates the button
|
||||||
*
|
*
|
||||||
* @return {Object} Configuration object for a {@link Ext.Button button}
|
* @return {Object} Configuration object for a {@link Ext.Button button}
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
createSettingsCalSyncWidget: function () {
|
createSettingsCalSyncWidget: function () {
|
||||||
return [{
|
return [{
|
||||||
xtype: 'calendarimporter.settingscalsyncwidget'
|
xtype: 'calendarimporter.settingscalsyncwidget'
|
||||||
}];
|
}];
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Insert import button in all attachment suggestions
|
* Insert import button in all attachment suggestions
|
||||||
|
|
||||||
* @return {Object} Configuration object for a {@link Ext.Button button}
|
* @return {Object} Configuration object for a {@link Ext.Button button}
|
||||||
*/
|
*/
|
||||||
createAttachmentImportButton: function (include, btn) {
|
createAttachmentImportButton: function (include, btn) {
|
||||||
return {
|
return {
|
||||||
text: dgettext('plugin_calendarimporter', 'Import to Calendar'),
|
text: dgettext('plugin_calendarimporter', 'Import to Calendar'),
|
||||||
handler: this.getAttachmentFileName.createDelegate(this, [btn]),
|
handler: this.getAttachmentFileName.createDelegate(this, [btn]),
|
||||||
scope: this,
|
scope: this,
|
||||||
iconCls: 'icon_calendarimporter_button',
|
iconCls: 'icon_calendarimporter_button',
|
||||||
beforeShow: function (item, record) {
|
beforeShow: function (item, record) {
|
||||||
var extension = record.data.name.split('.').pop().toLowerCase();
|
var extension = record.data.name.split('.').pop().toLowerCase();
|
||||||
|
|
||||||
if (record.data.filetype == "text/calendar" || extension == "ics" || extension == "ifb" || extension == "ical" || extension == "ifbf") {
|
if (record.data.filetype == "text/calendar" || extension == "ics" || extension == "ifb" || extension == "ical" || extension == "ifbf") {
|
||||||
item.setVisible(true);
|
item.setVisible(true);
|
||||||
} else {
|
} else {
|
||||||
item.setVisible(false);
|
item.setVisible(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback for getAttachmentFileName
|
* Callback for getAttachmentFileName
|
||||||
*/
|
*/
|
||||||
gotAttachmentFileName: function (response) {
|
gotAttachmentFileName: function (response) {
|
||||||
if (response.status == true) {
|
if (response.status == true) {
|
||||||
this.scope.openImportDialog(response.tmpname);
|
this.scope.openImportDialog(response.tmpname);
|
||||||
} else {
|
} else {
|
||||||
Zarafa.common.dialogs.MessageBox.show({
|
Zarafa.common.dialogs.MessageBox.show({
|
||||||
title: dgettext('plugin_calendarimporter', 'Error'),
|
title: dgettext('plugin_calendarimporter', 'Error'),
|
||||||
msg: response["message"],
|
msg: response["message"],
|
||||||
icon: Zarafa.common.dialogs.MessageBox.ERROR,
|
icon: Zarafa.common.dialogs.MessageBox.ERROR,
|
||||||
buttons: Zarafa.common.dialogs.MessageBox.OK
|
buttons: Zarafa.common.dialogs.MessageBox.OK
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clickhandler for the button
|
* Clickhandler for the button
|
||||||
*/
|
*/
|
||||||
getAttachmentFileName: function (btn, callback) {
|
getAttachmentFileName: function (btn, callback) {
|
||||||
Zarafa.common.dialogs.MessageBox.show({
|
Zarafa.common.dialogs.MessageBox.show({
|
||||||
title: dgettext('plugin_calendarimporter', 'Please wait'),
|
title: dgettext('plugin_calendarimporter', 'Please wait'),
|
||||||
msg: dgettext('plugin_calendarimporter', 'Loading attachment...'),
|
msg: dgettext('plugin_calendarimporter', 'Loading attachment...'),
|
||||||
progressText: dgettext('plugin_calendarimporter', 'Initializing...'),
|
progressText: dgettext('plugin_calendarimporter', 'Initializing...'),
|
||||||
width: 300,
|
width: 300,
|
||||||
progress: true,
|
progress: true,
|
||||||
closable: false
|
closable: false
|
||||||
});
|
});
|
||||||
|
|
||||||
// progress bar... ;)
|
// progress bar... ;)
|
||||||
var f = function (v) {
|
var f = function (v) {
|
||||||
return function () {
|
return function () {
|
||||||
if (v == 100) {
|
if (v == 100) {
|
||||||
Zarafa.common.dialogs.MessageBox.hide();
|
Zarafa.common.dialogs.MessageBox.hide();
|
||||||
} else {
|
} else {
|
||||||
// # TRANSLATORS: {0} will be replaced by the percentage value (0-100)
|
// # TRANSLATORS: {0} will be replaced by the percentage value (0-100)
|
||||||
Zarafa.common.dialogs.MessageBox.updateProgress(v / 100, String.format(dgettext('plugin_calendarimporter', '{0}% loaded'), Math.round(v)));
|
Zarafa.common.dialogs.MessageBox.updateProgress(v / 100, String.format(dgettext('plugin_calendarimporter', '{0}% loaded'), Math.round(v)));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
for (var i = 1; i < 101; i++) {
|
for (var i = 1; i < 101; i++) {
|
||||||
setTimeout(f(i), 20 * i);
|
setTimeout(f(i), 20 * i);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* store the attachment to a temporary folder and prepare it for uploading */
|
/* store the attachment to a temporary folder and prepare it for uploading */
|
||||||
var attachmentRecord = btn.records;
|
var attachmentRecord = btn.records;
|
||||||
var attachmentStore = attachmentRecord.store;
|
var attachmentStore = attachmentRecord.store;
|
||||||
|
|
||||||
var store = attachmentStore.getParentRecord().get('store_entryid');
|
var store = attachmentStore.getParentRecord().get('store_entryid');
|
||||||
var entryid = attachmentStore.getAttachmentParentRecordEntryId();
|
var entryid = attachmentStore.getAttachmentParentRecordEntryId();
|
||||||
var attachNum = new Array(1);
|
var attachNum = new Array(1);
|
||||||
if (attachmentRecord.get('attach_num') != -1) {
|
if (attachmentRecord.get('attach_num') != -1) {
|
||||||
attachNum[0] = attachmentRecord.get('attach_num');
|
attachNum[0] = attachmentRecord.get('attach_num');
|
||||||
} else {
|
} else {
|
||||||
attachNum[0] = attachmentRecord.get('tmpname');
|
attachNum[0] = attachmentRecord.get('tmpname');
|
||||||
}
|
}
|
||||||
var dialog_attachments = attachmentStore.getId();
|
var dialog_attachments = attachmentStore.getId();
|
||||||
var filename = attachmentRecord.data.name;
|
var filename = attachmentRecord.data.name;
|
||||||
|
|
||||||
var responseHandler = new Zarafa.plugins.calendarimporter.data.ResponseHandler({
|
var responseHandler = new Zarafa.plugins.calendarimporter.data.ResponseHandler({
|
||||||
successCallback: this.gotAttachmentFileName,
|
successCallback: this.gotAttachmentFileName,
|
||||||
scope: this
|
scope: this
|
||||||
});
|
});
|
||||||
|
|
||||||
// request attachment preperation
|
// request attachment preperation
|
||||||
container.getRequest().singleRequest(
|
container.getRequest().singleRequest(
|
||||||
'calendarmodule',
|
'calendarmodule',
|
||||||
'importattachment',
|
'importattachment',
|
||||||
{
|
{
|
||||||
entryid: entryid,
|
entryid: entryid,
|
||||||
store: store,
|
store: store,
|
||||||
attachNum: attachNum,
|
attachNum: attachNum,
|
||||||
dialog_attachments: dialog_attachments,
|
dialog_attachments: dialog_attachments,
|
||||||
filename: filename
|
filename: filename
|
||||||
},
|
},
|
||||||
responseHandler
|
responseHandler
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open the import dialog.
|
* Open the import dialog.
|
||||||
* @param {String} filename
|
* @param {String} filename
|
||||||
*/
|
*/
|
||||||
openImportDialog: function (filename) {
|
openImportDialog: function (filename) {
|
||||||
var componentType = Zarafa.core.data.SharedComponentType['plugins.calendarimporter.dialogs.importevents'];
|
var componentType = Zarafa.core.data.SharedComponentType['plugins.calendarimporter.dialogs.importevents'];
|
||||||
var config = {
|
var config = {
|
||||||
filename: filename,
|
filename: filename,
|
||||||
modal: true
|
modal: true
|
||||||
};
|
};
|
||||||
|
|
||||||
Zarafa.core.data.UIFactory.openLayerComponent(componentType, undefined, config);
|
Zarafa.core.data.UIFactory.openLayerComponent(componentType, undefined, config);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bid for the type of shared component
|
* Bid for the type of shared component
|
||||||
* and the given record.
|
* and the given record.
|
||||||
* This will bid on calendar.dialogs.importevents
|
* This will bid on calendar.dialogs.importevents
|
||||||
* @param {Zarafa.core.data.SharedComponentType} type Type of component a context can bid for.
|
* @param {Zarafa.core.data.SharedComponentType} type Type of component a context can bid for.
|
||||||
* @param {Ext.data.Record} record Optionally passed record.
|
* @param {Ext.data.Record} record Optionally passed record.
|
||||||
* @return {Number} The bid for the shared component
|
* @return {Number} The bid for the shared component
|
||||||
*/
|
*/
|
||||||
bidSharedComponent: function (type, record) {
|
bidSharedComponent: function (type, record) {
|
||||||
var bid = -1;
|
var bid = -1;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Zarafa.core.data.SharedComponentType['plugins.calendarimporter.dialogs.importevents']:
|
case Zarafa.core.data.SharedComponentType['plugins.calendarimporter.dialogs.importevents']:
|
||||||
bid = 2;
|
bid = 2;
|
||||||
break;
|
break;
|
||||||
case Zarafa.core.data.SharedComponentType['plugins.calendarimporter.settings.dialogs.calsyncedit']:
|
case Zarafa.core.data.SharedComponentType['plugins.calendarimporter.settings.dialogs.calsyncedit']:
|
||||||
bid = 2;
|
bid = 2;
|
||||||
break;
|
break;
|
||||||
case Zarafa.core.data.SharedComponentType['common.contextmenu']:
|
case Zarafa.core.data.SharedComponentType['common.contextmenu']:
|
||||||
if (record instanceof Zarafa.core.data.MAPIRecord) {
|
if (record instanceof Zarafa.core.data.MAPIRecord) {
|
||||||
if (record.get('object_type') == Zarafa.core.mapi.ObjectType.MAPI_FOLDER && record.get('container_class') == "IPF.Appointment") {
|
if (record.get('object_type') == Zarafa.core.mapi.ObjectType.MAPI_FOLDER && record.get('container_class') == "IPF.Appointment") {
|
||||||
bid = 2;
|
bid = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return bid;
|
return bid;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will return the reference to the shared component.
|
* Will return the reference to the shared component.
|
||||||
* Based on the type of component requested a component is returned.
|
* Based on the type of component requested a component is returned.
|
||||||
* @param {Zarafa.core.data.SharedComponentType} type Type of component a context can bid for.
|
* @param {Zarafa.core.data.SharedComponentType} type Type of component a context can bid for.
|
||||||
* @param {Ext.data.Record} record Optionally passed record.
|
* @param {Ext.data.Record} record Optionally passed record.
|
||||||
* @return {Ext.Component} Component
|
* @return {Ext.Component} Component
|
||||||
*/
|
*/
|
||||||
getSharedComponent: function (type, record) {
|
getSharedComponent: function (type, record) {
|
||||||
var component;
|
var component;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Zarafa.core.data.SharedComponentType['plugins.calendarimporter.dialogs.importevents']:
|
case Zarafa.core.data.SharedComponentType['plugins.calendarimporter.dialogs.importevents']:
|
||||||
component = Zarafa.plugins.calendarimporter.dialogs.ImportContentPanel;
|
component = Zarafa.plugins.calendarimporter.dialogs.ImportContentPanel;
|
||||||
break;
|
break;
|
||||||
case Zarafa.core.data.SharedComponentType['plugins.calendarimporter.settings.dialogs.calsyncedit']:
|
case Zarafa.core.data.SharedComponentType['plugins.calendarimporter.settings.dialogs.calsyncedit']:
|
||||||
component = Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditContentPanel;
|
component = Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditContentPanel;
|
||||||
break;
|
break;
|
||||||
case Zarafa.core.data.SharedComponentType['common.contextmenu']:
|
case Zarafa.core.data.SharedComponentType['common.contextmenu']:
|
||||||
component = Zarafa.plugins.calendarimporter.ui.ContextMenu;
|
component = Zarafa.plugins.calendarimporter.ui.ContextMenu;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return component;
|
return component;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
/*############################################################################################################################*
|
/*############################################################################################################################*
|
||||||
* STARTUP
|
* STARTUP
|
||||||
*############################################################################################################################*/
|
*############################################################################################################################*/
|
||||||
Zarafa.onReady(function () {
|
Zarafa.onReady(function () {
|
||||||
container.registerPlugin(new Zarafa.core.PluginMetaData({
|
container.registerPlugin(new Zarafa.core.PluginMetaData({
|
||||||
name: 'calendarimporter',
|
name: 'calendarimporter',
|
||||||
displayName: dgettext('plugin_calendarimporter', 'Calendarimporter Plugin'),
|
displayName: dgettext('plugin_calendarimporter', 'Calendarimporter Plugin'),
|
||||||
about: Zarafa.plugins.calendarimporter.ABOUT,
|
about: Zarafa.plugins.calendarimporter.ABOUT,
|
||||||
pluginConstructor: Zarafa.plugins.calendarimporter.ImportPlugin
|
pluginConstructor: Zarafa.plugins.calendarimporter.ImportPlugin
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
@@ -1,136 +1,136 @@
|
|||||||
/**
|
/**
|
||||||
* SettingsCalSyncWidget.js, Kopano calender to ics im/exporter
|
* SettingsCalSyncWidget.js, Kopano calender to ics im/exporter
|
||||||
*
|
*
|
||||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
* 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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* License as published by the Free Software Foundation; either
|
* License as published by the Free Software Foundation; either
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* License along with this library; if not, write to the Free Software
|
* License along with this library; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Ext.namespace('Zarafa.plugins.calendarimporter.settings');
|
Ext.namespace('Zarafa.plugins.calendarimporter.settings');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Zarafa.plugins.calendarimporter.settings.SettingsCalSyncWidget
|
* @class Zarafa.plugins.calendarimporter.settings.SettingsCalSyncWidget
|
||||||
* @extends Zarafa.settings.ui.SettingsWidget
|
* @extends Zarafa.settings.ui.SettingsWidget
|
||||||
* @xtype calendarimporter.settingscalsyncwidget
|
* @xtype calendarimporter.settingscalsyncwidget
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Zarafa.plugins.calendarimporter.settings.SettingsCalSyncWidget = Ext.extend(Zarafa.settings.ui.SettingsWidget, {
|
Zarafa.plugins.calendarimporter.settings.SettingsCalSyncWidget = Ext.extend(Zarafa.settings.ui.SettingsWidget, {
|
||||||
/**
|
/**
|
||||||
* @cfg {Zarafa.settings.SettingsContext} settingsContext
|
* @cfg {Zarafa.settings.SettingsContext} settingsContext
|
||||||
*/
|
*/
|
||||||
settingsContext: undefined,
|
settingsContext: undefined,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param {Object} config Configuration object
|
* @param {Object} config Configuration object
|
||||||
*/
|
*/
|
||||||
constructor: function (config) {
|
constructor: function (config) {
|
||||||
config = config || {};
|
config = config || {};
|
||||||
|
|
||||||
var store = new Ext.data.JsonStore({
|
var store = new Ext.data.JsonStore({
|
||||||
fields: [
|
fields: [
|
||||||
{name: 'id', type: 'int'},
|
{name: 'id', type: 'int'},
|
||||||
{name: 'icsurl'},
|
{name: 'icsurl'},
|
||||||
{name: 'user'},
|
{name: 'user'},
|
||||||
{name: 'pass'},
|
{name: 'pass'},
|
||||||
{name: 'intervall', type: 'int'},
|
{name: 'intervall', type: 'int'},
|
||||||
{name: 'calendar'},
|
{name: 'calendar'},
|
||||||
{name: 'calendarname'},
|
{name: 'calendarname'},
|
||||||
{name: 'lastsync'}
|
{name: 'lastsync'}
|
||||||
],
|
],
|
||||||
sortInfo: {
|
sortInfo: {
|
||||||
field: 'id',
|
field: 'id',
|
||||||
direction: 'ASC'
|
direction: 'ASC'
|
||||||
},
|
},
|
||||||
autoDestroy: true
|
autoDestroy: true
|
||||||
});
|
});
|
||||||
|
|
||||||
Ext.applyIf(config, {
|
Ext.applyIf(config, {
|
||||||
height: 400,
|
height: 400,
|
||||||
title: dgettext('plugin_calendarimporter', 'Calendar Sync settings'),
|
title: dgettext('plugin_calendarimporter', 'Calendar Sync settings'),
|
||||||
xtype: 'calendarimporter.settingscalsyncwidget',
|
xtype: 'calendarimporter.settingscalsyncwidget',
|
||||||
layout: {
|
layout: {
|
||||||
// override from SettingsWidget
|
// override from SettingsWidget
|
||||||
type: 'fit'
|
type: 'fit'
|
||||||
},
|
},
|
||||||
items: [{
|
items: [{
|
||||||
xtype: 'calendarimporter.calsyncpanel',
|
xtype: 'calendarimporter.calsyncpanel',
|
||||||
store: store,
|
store: store,
|
||||||
ref: 'calsyncPanel'
|
ref: 'calsyncPanel'
|
||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
|
|
||||||
Zarafa.plugins.calendarimporter.settings.SettingsCalSyncWidget.superclass.constructor.call(this, config);
|
Zarafa.plugins.calendarimporter.settings.SettingsCalSyncWidget.superclass.constructor.call(this, config);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called by the {@link Zarafa.settings.ui.SettingsCategory Category} when
|
* Called by the {@link Zarafa.settings.ui.SettingsCategory Category} when
|
||||||
* it has been called with {@link zarafa.settings.ui.SettingsCategory#update}.
|
* it has been called with {@link zarafa.settings.ui.SettingsCategory#update}.
|
||||||
* This is used to load the latest version of the settings from the
|
* This is used to load the latest version of the settings from the
|
||||||
* {@link Zarafa.settings.SettingsModel} into the UI of this category.
|
* {@link Zarafa.settings.SettingsModel} into the UI of this category.
|
||||||
* @param {Zarafa.settings.SettingsModel} settingsModel The settings to load
|
* @param {Zarafa.settings.SettingsModel} settingsModel The settings to load
|
||||||
*/
|
*/
|
||||||
update: function (settingsModel) {
|
update: function (settingsModel) {
|
||||||
this.model = settingsModel;
|
this.model = settingsModel;
|
||||||
|
|
||||||
// Convert the signatures into Store data
|
// Convert the signatures into Store data
|
||||||
var icslinks = settingsModel.get('zarafa/v1/contexts/calendar/icssync', true);
|
var icslinks = settingsModel.get('zarafa/v1/contexts/calendar/icssync', true);
|
||||||
var syncArray = [];
|
var syncArray = [];
|
||||||
for (var key in icslinks) {
|
for (var key in icslinks) {
|
||||||
if (icslinks.hasOwnProperty(key)) { // skip inherited props
|
if (icslinks.hasOwnProperty(key)) { // skip inherited props
|
||||||
syncArray.push(Ext.apply({}, icslinks[key], {id: key}));
|
syncArray.push(Ext.apply({}, icslinks[key], {id: key}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load all icslinks into the GridPanel
|
// Load all icslinks into the GridPanel
|
||||||
var store = this.calsyncPanel.calsyncGrid.getStore();
|
var store = this.calsyncPanel.calsyncGrid.getStore();
|
||||||
store.loadData(syncArray);
|
store.loadData(syncArray);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called by the {@link Zarafa.settings.ui.SettingsCategory Category} when
|
* Called by the {@link Zarafa.settings.ui.SettingsCategory Category} when
|
||||||
* it has been called with {@link zarafa.settings.ui.SettingsCategory#updateSettings}.
|
* it has been called with {@link zarafa.settings.ui.SettingsCategory#updateSettings}.
|
||||||
* This is used to update the settings from the UI into the {@link Zarafa.settings.SettingsModel settings model}.
|
* This is used to update the settings from the UI into the {@link Zarafa.settings.SettingsModel settings model}.
|
||||||
* @param {Zarafa.settings.SettingsModel} settingsModel The settings to update
|
* @param {Zarafa.settings.SettingsModel} settingsModel The settings to update
|
||||||
*/
|
*/
|
||||||
updateSettings: function (settingsModel) {
|
updateSettings: function (settingsModel) {
|
||||||
settingsModel.beginEdit();
|
settingsModel.beginEdit();
|
||||||
|
|
||||||
// Start reading the Grid store and convert the contents back into
|
// Start reading the Grid store and convert the contents back into
|
||||||
// an object which can be pushed to the settings.
|
// an object which can be pushed to the settings.
|
||||||
var icslinks = this.calsyncPanel.calsyncGrid.getStore().getRange();
|
var icslinks = this.calsyncPanel.calsyncGrid.getStore().getRange();
|
||||||
var icslinkData = {};
|
var icslinkData = {};
|
||||||
for (var i = 0, len = icslinks.length; i < len; i++) {
|
for (var i = 0, len = icslinks.length; i < len; i++) {
|
||||||
var icslink = icslinks[i];
|
var icslink = icslinks[i];
|
||||||
|
|
||||||
icslinkData[icslink.get('id')] = {
|
icslinkData[icslink.get('id')] = {
|
||||||
'icsurl': icslink.get('icsurl'),
|
'icsurl': icslink.get('icsurl'),
|
||||||
'intervall': icslink.get('intervall'),
|
'intervall': icslink.get('intervall'),
|
||||||
'user': icslink.get('user'),
|
'user': icslink.get('user'),
|
||||||
'pass': icslink.get('pass'),
|
'pass': icslink.get('pass'),
|
||||||
'lastsync': icslink.get('lastsync'),
|
'lastsync': icslink.get('lastsync'),
|
||||||
'calendar': icslink.get('calendar'),
|
'calendar': icslink.get('calendar'),
|
||||||
'calendarname': Zarafa.plugins.calendarimporter.data.Actions.getCalendarFolderByEntryid(icslink.get('calendar')).display_name
|
'calendarname': Zarafa.plugins.calendarimporter.data.Actions.getCalendarFolderByEntryid(icslink.get('calendar')).display_name
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
settingsModel.set('zarafa/v1/contexts/calendar/icssync', icslinkData);
|
settingsModel.set('zarafa/v1/contexts/calendar/icssync', icslinkData);
|
||||||
|
|
||||||
settingsModel.endEdit();
|
settingsModel.endEdit();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Ext.reg('calendarimporter.settingscalsyncwidget', Zarafa.plugins.calendarimporter.settings.SettingsCalSyncWidget);
|
Ext.reg('calendarimporter.settingscalsyncwidget', Zarafa.plugins.calendarimporter.settings.SettingsCalSyncWidget);
|
@@ -1,230 +1,230 @@
|
|||||||
/**
|
/**
|
||||||
* SettingsWidget.js, Kopano calender to ics im/exporter
|
* SettingsWidget.js, Kopano calender to ics im/exporter
|
||||||
*
|
*
|
||||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
* 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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* License as published by the Free Software Foundation; either
|
* License as published by the Free Software Foundation; either
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* License along with this library; if not, write to the Free Software
|
* License along with this library; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Ext.namespace('Zarafa.plugins.calendarimporter.settings');
|
Ext.namespace('Zarafa.plugins.calendarimporter.settings');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Zarafa.plugins.calendarimporter.settings.SettingsWidget
|
* @class Zarafa.plugins.calendarimporter.settings.SettingsWidget
|
||||||
* @extends Zarafa.settings.ui.SettingsWidget
|
* @extends Zarafa.settings.ui.SettingsWidget
|
||||||
* @xtype calendarimporter.settingswidget
|
* @xtype calendarimporter.settingswidget
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Zarafa.plugins.calendarimporter.settings.SettingsWidget = Ext.extend(Zarafa.settings.ui.SettingsWidget, {
|
Zarafa.plugins.calendarimporter.settings.SettingsWidget = Ext.extend(Zarafa.settings.ui.SettingsWidget, {
|
||||||
/**
|
/**
|
||||||
* @cfg {Zarafa.settings.SettingsContext} settingsContext
|
* @cfg {Zarafa.settings.SettingsContext} settingsContext
|
||||||
*/
|
*/
|
||||||
settingsContext: undefined,
|
settingsContext: undefined,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param {Object} config Configuration object
|
* @param {Object} config Configuration object
|
||||||
*/
|
*/
|
||||||
constructor: function (config) {
|
constructor: function (config) {
|
||||||
config = config || {};
|
config = config || {};
|
||||||
|
|
||||||
Ext.applyIf(config, {
|
Ext.applyIf(config, {
|
||||||
title: dgettext('plugin_calendarimporter', 'Calendar Import/Export plugin settings'),
|
title: dgettext('plugin_calendarimporter', 'Calendar Import/Export plugin settings'),
|
||||||
xtype: 'calendarimporter.settingswidget',
|
xtype: 'calendarimporter.settingswidget',
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
xtype: 'checkbox',
|
xtype: 'checkbox',
|
||||||
name: 'zarafa/v1/plugins/calendarimporter/enable_sync',
|
name: 'zarafa/v1/plugins/calendarimporter/enable_sync',
|
||||||
ref: 'enableSync',
|
ref: 'enableSync',
|
||||||
fieldLabel: dgettext('plugin_calendarimporter', 'Enable ical sync'),
|
fieldLabel: dgettext('plugin_calendarimporter', 'Enable ical sync'),
|
||||||
lazyInit: false
|
lazyInit: false
|
||||||
},
|
},
|
||||||
this.createSelectBox(),
|
this.createSelectBox(),
|
||||||
this.createTimezoneBox()
|
this.createTimezoneBox()
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
Zarafa.plugins.calendarimporter.settings.SettingsWidget.superclass.constructor.call(this, config);
|
Zarafa.plugins.calendarimporter.settings.SettingsWidget.superclass.constructor.call(this, config);
|
||||||
},
|
},
|
||||||
|
|
||||||
createSelectBox: function () {
|
createSelectBox: function () {
|
||||||
var myStore = Zarafa.plugins.calendarimporter.data.Actions.getAllCalendarFolders(true);
|
var myStore = Zarafa.plugins.calendarimporter.data.Actions.getAllCalendarFolders(true);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
xtype: "selectbox",
|
xtype: "selectbox",
|
||||||
ref: 'defaultCalendar',
|
ref: 'defaultCalendar',
|
||||||
editable: false,
|
editable: false,
|
||||||
name: "zarafa/v1/plugins/calendarimporter/default_calendar",
|
name: "zarafa/v1/plugins/calendarimporter/default_calendar",
|
||||||
value: Zarafa.plugins.calendarimporter.data.Actions.getCalendarFolderByName(container.getSettingsModel().get("zarafa/v1/plugins/calendarimporter/default_calendar")).entryid,
|
value: Zarafa.plugins.calendarimporter.data.Actions.getCalendarFolderByName(container.getSettingsModel().get("zarafa/v1/plugins/calendarimporter/default_calendar")).entryid,
|
||||||
width: 100,
|
width: 100,
|
||||||
fieldLabel: dgettext('plugin_calendarimporter', 'Default calender'),
|
fieldLabel: dgettext('plugin_calendarimporter', 'Default calender'),
|
||||||
store: myStore,
|
store: myStore,
|
||||||
mode: 'local',
|
mode: 'local',
|
||||||
labelSeperator: ":",
|
labelSeperator: ":",
|
||||||
border: false,
|
border: false,
|
||||||
anchor: "100%",
|
anchor: "100%",
|
||||||
scope: this,
|
scope: this,
|
||||||
allowBlank: false
|
allowBlank: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
createTimezoneBox: function () {
|
createTimezoneBox: function () {
|
||||||
return {
|
return {
|
||||||
xtype: "selectbox",
|
xtype: "selectbox",
|
||||||
ref: 'defaultTimezone',
|
ref: 'defaultTimezone',
|
||||||
editable: false,
|
editable: false,
|
||||||
name: "zarafa/v1/plugins/calendarimporter/default_timezone",
|
name: "zarafa/v1/plugins/calendarimporter/default_timezone",
|
||||||
value: Zarafa.plugins.calendarimporter.data.Timezones.unMap(container.getSettingsModel().get("zarafa/v1/plugins/calendarimporter/default_timezone")),
|
value: Zarafa.plugins.calendarimporter.data.Timezones.unMap(container.getSettingsModel().get("zarafa/v1/plugins/calendarimporter/default_timezone")),
|
||||||
width: 100,
|
width: 100,
|
||||||
fieldLabel: dgettext('plugin_calendarimporter', 'Default timezone'),
|
fieldLabel: dgettext('plugin_calendarimporter', 'Default timezone'),
|
||||||
store: Zarafa.plugins.calendarimporter.data.Timezones.store,
|
store: Zarafa.plugins.calendarimporter.data.Timezones.store,
|
||||||
labelSeperator: ":",
|
labelSeperator: ":",
|
||||||
mode: 'local',
|
mode: 'local',
|
||||||
border: false,
|
border: false,
|
||||||
anchor: "100%",
|
anchor: "100%",
|
||||||
scope: this,
|
scope: this,
|
||||||
allowBlank: false
|
allowBlank: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called by the {@link Zarafa.settings.ui.SettingsCategory Category} when
|
* Called by the {@link Zarafa.settings.ui.SettingsCategory Category} when
|
||||||
* it has been called with {@link zarafa.settings.ui.SettingsCategory#update}.
|
* it has been called with {@link zarafa.settings.ui.SettingsCategory#update}.
|
||||||
* This is used to load the latest version of the settings from the
|
* This is used to load the latest version of the settings from the
|
||||||
* {@link Zarafa.settings.SettingsModel} into the UI of this category.
|
* {@link Zarafa.settings.SettingsModel} into the UI of this category.
|
||||||
* @param {Zarafa.settings.SettingsModel} settingsModel The settings to load
|
* @param {Zarafa.settings.SettingsModel} settingsModel The settings to load
|
||||||
*/
|
*/
|
||||||
update: function (settingsModel) {
|
update: function (settingsModel) {
|
||||||
this.enableSync.setValue(settingsModel.get(this.enableSync.name));
|
this.enableSync.setValue(settingsModel.get(this.enableSync.name));
|
||||||
this.defaultCalendar.setValue(Zarafa.plugins.calendarimporter.data.Actions.getCalendarFolderByName(settingsModel.get(this.defaultCalendar.name)).entryid);
|
this.defaultCalendar.setValue(Zarafa.plugins.calendarimporter.data.Actions.getCalendarFolderByName(settingsModel.get(this.defaultCalendar.name)).entryid);
|
||||||
this.defaultTimezone.setValue(settingsModel.get(this.defaultTimezone.name));
|
this.defaultTimezone.setValue(settingsModel.get(this.defaultTimezone.name));
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called by the {@link Zarafa.settings.ui.SettingsCategory Category} when
|
* Called by the {@link Zarafa.settings.ui.SettingsCategory Category} when
|
||||||
* it has been called with {@link zarafa.settings.ui.SettingsCategory#updateSettings}.
|
* it has been called with {@link zarafa.settings.ui.SettingsCategory#updateSettings}.
|
||||||
* This is used to update the settings from the UI into the {@link Zarafa.settings.SettingsModel settings model}.
|
* This is used to update the settings from the UI into the {@link Zarafa.settings.SettingsModel settings model}.
|
||||||
* @param {Zarafa.settings.SettingsModel} settingsModel The settings to update
|
* @param {Zarafa.settings.SettingsModel} settingsModel The settings to update
|
||||||
*/
|
*/
|
||||||
updateSettings: function (settingsModel) {
|
updateSettings: function (settingsModel) {
|
||||||
// check if the user changed a value
|
// check if the user changed a value
|
||||||
var changed = false;
|
var changed = false;
|
||||||
|
|
||||||
if (settingsModel.get(this.enableSync.name) != this.enableSync.getValue()) {
|
if (settingsModel.get(this.enableSync.name) != this.enableSync.getValue()) {
|
||||||
changed = true;
|
changed = true;
|
||||||
} else if (settingsModel.get(this.defaultCalendar.name) != Zarafa.plugins.calendarimporter.data.Actions.getCalendarFolderByEntryid(this.defaultCalendar.getValue()).display_name) {
|
} else if (settingsModel.get(this.defaultCalendar.name) != Zarafa.plugins.calendarimporter.data.Actions.getCalendarFolderByEntryid(this.defaultCalendar.getValue()).display_name) {
|
||||||
changed = true;
|
changed = true;
|
||||||
} else if (settingsModel.get(this.defaultTimezone.name) != this.defaultTimezone.getValue()) {
|
} else if (settingsModel.get(this.defaultTimezone.name) != this.defaultTimezone.getValue()) {
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (changed) {
|
if (changed) {
|
||||||
// Really save changes
|
// Really save changes
|
||||||
settingsModel.set(this.enableSync.name, this.enableSync.getValue());
|
settingsModel.set(this.enableSync.name, this.enableSync.getValue());
|
||||||
settingsModel.set(this.defaultCalendar.name, Zarafa.plugins.calendarimporter.data.Actions.getCalendarFolderByEntryid(this.defaultCalendar.getValue()).display_name); // store name
|
settingsModel.set(this.defaultCalendar.name, Zarafa.plugins.calendarimporter.data.Actions.getCalendarFolderByEntryid(this.defaultCalendar.getValue()).display_name); // store name
|
||||||
settingsModel.set(this.defaultTimezone.name, this.defaultTimezone.getValue());
|
settingsModel.set(this.defaultTimezone.name, this.defaultTimezone.getValue());
|
||||||
|
|
||||||
this.onUpdateSettings();
|
this.onUpdateSettings();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called after the {@link Zarafa.settings.SettingsModel} fires the {@link Zarafa.settings.SettingsModel#save save}
|
* Called after the {@link Zarafa.settings.SettingsModel} fires the {@link Zarafa.settings.SettingsModel#save save}
|
||||||
* event to indicate the settings were successfully saved and it will forcefully realod the webapp.
|
* event to indicate the settings were successfully saved and it will forcefully realod the webapp.
|
||||||
* settings which were saved to the server.
|
* settings which were saved to the server.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
onUpdateSettings: function () {
|
onUpdateSettings: function () {
|
||||||
var message = _('Your WebApp needs to be reloaded to make the changes visible!');
|
var message = _('Your WebApp needs to be reloaded to make the changes visible!');
|
||||||
message += '<br/><br/>';
|
message += '<br/><br/>';
|
||||||
message += _('WebApp will automatically restart in order for these changes to take effect');
|
message += _('WebApp will automatically restart in order for these changes to take effect');
|
||||||
message += '<br/>';
|
message += '<br/>';
|
||||||
|
|
||||||
Zarafa.common.dialogs.MessageBox.addCustomButtons({
|
Zarafa.common.dialogs.MessageBox.addCustomButtons({
|
||||||
title: _('Restart WebApp'),
|
title: _('Restart WebApp'),
|
||||||
msg: message,
|
msg: message,
|
||||||
icon: Ext.MessageBox.QUESTION,
|
icon: Ext.MessageBox.QUESTION,
|
||||||
fn: this.restartWebapp,
|
fn: this.restartWebapp,
|
||||||
customButton: [{
|
customButton: [{
|
||||||
text: _('Restart'),
|
text: _('Restart'),
|
||||||
name: 'restart'
|
name: 'restart'
|
||||||
}, {
|
}, {
|
||||||
text: _('Cancel'),
|
text: _('Cancel'),
|
||||||
name: 'cancel'
|
name: 'cancel'
|
||||||
}],
|
}],
|
||||||
scope: this
|
scope: this
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Event handler for {@link #onResetSettings}. This will check if the user
|
* Event handler for {@link #onResetSettings}. This will check if the user
|
||||||
* wishes to reset the default settings or not.
|
* wishes to reset the default settings or not.
|
||||||
* @param {String} button The button which user pressed.
|
* @param {String} button The button which user pressed.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
restartWebapp: function (button) {
|
restartWebapp: function (button) {
|
||||||
if (button === 'restart') {
|
if (button === 'restart') {
|
||||||
var contextModel = this.ownerCt.settingsContext.getModel();
|
var contextModel = this.ownerCt.settingsContext.getModel();
|
||||||
var realModel = contextModel.getRealSettingsModel();
|
var realModel = contextModel.getRealSettingsModel();
|
||||||
|
|
||||||
realModel.save();
|
realModel.save();
|
||||||
|
|
||||||
this.loadMask = new Zarafa.common.ui.LoadMask(Ext.getBody(), {
|
this.loadMask = new Zarafa.common.ui.LoadMask(Ext.getBody(), {
|
||||||
msg: '<b>' + _('Webapp is reloading, Please wait.') + '</b>'
|
msg: '<b>' + _('Webapp is reloading, Please wait.') + '</b>'
|
||||||
});
|
});
|
||||||
this.loadMask.show();
|
this.loadMask.show();
|
||||||
|
|
||||||
this.mon(realModel, 'save', this.onSettingsSave, this);
|
this.mon(realModel, 'save', this.onSettingsSave, this);
|
||||||
this.mon(realModel, 'exception', this.onSettingsException, this);
|
this.mon(realModel, 'exception', this.onSettingsException, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the {@link Zarafa.settings.} fires the {@link Zarafa.settings.SettingsModel#save save}
|
* Called when the {@link Zarafa.settings.} fires the {@link Zarafa.settings.SettingsModel#save save}
|
||||||
* event to indicate the settings were successfully saved and it will forcefully realod the webapp.
|
* event to indicate the settings were successfully saved and it will forcefully realod the webapp.
|
||||||
* @param {Zarafa.settings.SettingsModel} model The model which fired the event.
|
* @param {Zarafa.settings.SettingsModel} model The model which fired the event.
|
||||||
* @param {Object} parameters The key-value object containing the action and the corresponding
|
* @param {Object} parameters The key-value object containing the action and the corresponding
|
||||||
* settings which were saved to the server.
|
* settings which were saved to the server.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
onSettingsSave: function (model, parameters) {
|
onSettingsSave: function (model, parameters) {
|
||||||
this.mun(model, 'save', this.onSettingsSave, this);
|
this.mun(model, 'save', this.onSettingsSave, this);
|
||||||
Zarafa.core.Util.reloadWebapp();
|
Zarafa.core.Util.reloadWebapp();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the {@link Zarafa.settings.SettingsModel} fires the {@link Zarafa.settings.SettingsModel#exception exception}
|
* Called when the {@link Zarafa.settings.SettingsModel} fires the {@link Zarafa.settings.SettingsModel#exception exception}
|
||||||
* event to indicate the settings were not successfully saved.
|
* event to indicate the settings were not successfully saved.
|
||||||
* @param {Zarafa.settings.SettingsModel} model The settings model which fired the event
|
* @param {Zarafa.settings.SettingsModel} model The settings model which fired the event
|
||||||
* @param {String} type The value of this parameter will be either 'response' or 'remote'.
|
* @param {String} type The value of this parameter will be either 'response' or 'remote'.
|
||||||
* @param {String} action Name of the action (see {@link Ext.data.Api#actions}).
|
* @param {String} action Name of the action (see {@link Ext.data.Api#actions}).
|
||||||
* @param {Object} options The object containing a 'path' and 'value' field indicating
|
* @param {Object} options The object containing a 'path' and 'value' field indicating
|
||||||
* respectively the Setting and corresponding value for the setting which was being saved.
|
* respectively the Setting and corresponding value for the setting which was being saved.
|
||||||
* @param {Object} response The response object as received from the PHP-side
|
* @param {Object} response The response object as received from the PHP-side
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
onSettingsException: function (model, type, action, options, response) {
|
onSettingsException: function (model, type, action, options, response) {
|
||||||
this.loadMask.hide();
|
this.loadMask.hide();
|
||||||
|
|
||||||
// Remove event handlers
|
// Remove event handlers
|
||||||
this.mun(model, 'save', this.onSettingsSave, this);
|
this.mun(model, 'save', this.onSettingsSave, this);
|
||||||
this.mun(model, 'exception', this.onSettingsException, this);
|
this.mun(model, 'exception', this.onSettingsException, this);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Ext.reg('calendarimporter.settingswidget', Zarafa.plugins.calendarimporter.settings.SettingsWidget);
|
Ext.reg('calendarimporter.settingswidget', Zarafa.plugins.calendarimporter.settings.SettingsWidget);
|
||||||
|
@@ -1,60 +1,60 @@
|
|||||||
/**
|
/**
|
||||||
* CalSyncEditContentPanel.js, Kopano calender to ics im/exporter
|
* CalSyncEditContentPanel.js, Kopano calender to ics im/exporter
|
||||||
*
|
*
|
||||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
* 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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* License as published by the Free Software Foundation; either
|
* License as published by the Free Software Foundation; either
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* License along with this library; if not, write to the Free Software
|
* License along with this library; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Ext.namespace('Zarafa.plugins.calendarimporter.settings.dialogs');
|
Ext.namespace('Zarafa.plugins.calendarimporter.settings.dialogs');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditContentPanel
|
* @class Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditContentPanel
|
||||||
* @extends Zarafa.core.ui.ContentPanel
|
* @extends Zarafa.core.ui.ContentPanel
|
||||||
* @xtype calendarimporter.calsynceditcontentpanel
|
* @xtype calendarimporter.calsynceditcontentpanel
|
||||||
*
|
*
|
||||||
* {@link Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditContentPanel CalSyncEditContentPanel} will be used to edit ics sync entries.
|
* {@link Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditContentPanel CalSyncEditContentPanel} will be used to edit ics sync entries.
|
||||||
*/
|
*/
|
||||||
Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditContentPanel = Ext.extend(Zarafa.core.ui.ContentPanel, {
|
Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditContentPanel = Ext.extend(Zarafa.core.ui.ContentPanel, {
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param config Configuration structure
|
* @param config Configuration structure
|
||||||
*/
|
*/
|
||||||
constructor: function (config) {
|
constructor: function (config) {
|
||||||
config = config || {};
|
config = config || {};
|
||||||
|
|
||||||
// Add in some standard configuration data.
|
// Add in some standard configuration data.
|
||||||
Ext.applyIf(config, {
|
Ext.applyIf(config, {
|
||||||
// Override from Ext.Component
|
// Override from Ext.Component
|
||||||
xtype: 'calendarimporter.calsynceditcontentpanel',
|
xtype: 'calendarimporter.calsynceditcontentpanel',
|
||||||
layout: 'fit',
|
layout: 'fit',
|
||||||
model: true,
|
model: true,
|
||||||
autoSave: false,
|
autoSave: false,
|
||||||
width: 400,
|
width: 400,
|
||||||
height: 400,
|
height: 400,
|
||||||
title: dgettext('plugin_calendarimporter', 'ICAL Sync'),
|
title: dgettext('plugin_calendarimporter', 'ICAL Sync'),
|
||||||
items: [{
|
items: [{
|
||||||
xtype: 'calendarimporter.calsynceditpanel',
|
xtype: 'calendarimporter.calsynceditpanel',
|
||||||
item: config.item
|
item: config.item
|
||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
|
|
||||||
Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditContentPanel.superclass.constructor.call(this, config);
|
Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditContentPanel.superclass.constructor.call(this, config);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Ext.reg('calendarimporter.calsynceditcontentpanel', Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditContentPanel);
|
Ext.reg('calendarimporter.calsynceditcontentpanel', Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditContentPanel);
|
||||||
|
@@ -1,223 +1,223 @@
|
|||||||
/**
|
/**
|
||||||
* CalSyncEditPanel.js, Kopano calender to ics im/exporter
|
* CalSyncEditPanel.js, Kopano calender to ics im/exporter
|
||||||
*
|
*
|
||||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
* 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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* License as published by the Free Software Foundation; either
|
* License as published by the Free Software Foundation; either
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* License along with this library; if not, write to the Free Software
|
* License along with this library; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Ext.namespace('Zarafa.plugins.calendarimporter.settings.dialogs');
|
Ext.namespace('Zarafa.plugins.calendarimporter.settings.dialogs');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel
|
* @class Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel
|
||||||
* @extends Ext.form.FormPanel
|
* @extends Ext.form.FormPanel
|
||||||
* @xtype calendarimporter.calsynceditpanel
|
* @xtype calendarimporter.calsynceditpanel
|
||||||
*
|
*
|
||||||
* Will generate UI for {@link Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel CalSyncEditPanel}.
|
* Will generate UI for {@link Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel CalSyncEditPanel}.
|
||||||
*/
|
*/
|
||||||
Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel = Ext.extend(Ext.form.FormPanel, {
|
Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel = Ext.extend(Ext.form.FormPanel, {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the id of the currently edited item
|
* the id of the currently edited item
|
||||||
*/
|
*/
|
||||||
currentItem: undefined,
|
currentItem: undefined,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param config Configuration structure
|
* @param config Configuration structure
|
||||||
*/
|
*/
|
||||||
constructor: function (config) {
|
constructor: function (config) {
|
||||||
config = config || {};
|
config = config || {};
|
||||||
|
|
||||||
if (config.item)
|
if (config.item)
|
||||||
this.currentItem = config.item;
|
this.currentItem = config.item;
|
||||||
|
|
||||||
Ext.applyIf(config, {
|
Ext.applyIf(config, {
|
||||||
// Override from Ext.Component
|
// Override from Ext.Component
|
||||||
xtype: 'calendarimporter.calsynceditpanel',
|
xtype: 'calendarimporter.calsynceditpanel',
|
||||||
labelAlign: 'top',
|
labelAlign: 'top',
|
||||||
defaultType: 'textfield',
|
defaultType: 'textfield',
|
||||||
items: this.createPanelItems(config),
|
items: this.createPanelItems(config),
|
||||||
buttons: [{
|
buttons: [{
|
||||||
text: _('Save'),
|
text: _('Save'),
|
||||||
handler: this.doSave,
|
handler: this.doSave,
|
||||||
scope: this
|
scope: this
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: _('Cancel'),
|
text: _('Cancel'),
|
||||||
handler: this.doClose,
|
handler: this.doClose,
|
||||||
scope: this
|
scope: this
|
||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
|
|
||||||
Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel.superclass.constructor.call(this, config);
|
Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel.superclass.constructor.call(this, config);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* close the dialog
|
* close the dialog
|
||||||
*/
|
*/
|
||||||
doClose: function () {
|
doClose: function () {
|
||||||
this.dialog.close();
|
this.dialog.close();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* save the data to the store
|
* save the data to the store
|
||||||
*/
|
*/
|
||||||
doSave: function () {
|
doSave: function () {
|
||||||
var store = this.dialog.store;
|
var store = this.dialog.store;
|
||||||
var id = 0;
|
var id = 0;
|
||||||
var record = undefined;
|
var record = undefined;
|
||||||
|
|
||||||
if (!this.currentItem) {
|
if (!this.currentItem) {
|
||||||
record = new store.recordType({
|
record = new store.recordType({
|
||||||
id: this.hashCode(this.icsurl.getValue()),
|
id: this.hashCode(this.icsurl.getValue()),
|
||||||
icsurl: this.icsurl.getValue(),
|
icsurl: this.icsurl.getValue(),
|
||||||
intervall: this.intervall.getValue(),
|
intervall: this.intervall.getValue(),
|
||||||
user: this.user.getValue(),
|
user: this.user.getValue(),
|
||||||
pass: Ext.util.base64.encode(this.pass.getValue()),
|
pass: Ext.util.base64.encode(this.pass.getValue()),
|
||||||
calendar: this.calendar.getValue(),
|
calendar: this.calendar.getValue(),
|
||||||
calendarname: Zarafa.plugins.calendarimporter.data.Actions.getCalendarFolderByEntryid(this.calendar.getValue()).display_name,
|
calendarname: Zarafa.plugins.calendarimporter.data.Actions.getCalendarFolderByEntryid(this.calendar.getValue()).display_name,
|
||||||
lastsync: "never"
|
lastsync: "never"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.icsurl.isValid()) {
|
if (this.icsurl.isValid()) {
|
||||||
if (record) {
|
if (record) {
|
||||||
store.add(record);
|
store.add(record);
|
||||||
} else {
|
} else {
|
||||||
this.currentItem.set('icsurl', this.icsurl.getValue());
|
this.currentItem.set('icsurl', this.icsurl.getValue());
|
||||||
this.currentItem.set('intervall', this.intervall.getValue());
|
this.currentItem.set('intervall', this.intervall.getValue());
|
||||||
this.currentItem.set('user', this.user.getValue());
|
this.currentItem.set('user', this.user.getValue());
|
||||||
this.currentItem.set('pass', Ext.util.base64.encode(this.pass.getValue()));
|
this.currentItem.set('pass', Ext.util.base64.encode(this.pass.getValue()));
|
||||||
this.currentItem.set('calendar', this.calendar.getValue());
|
this.currentItem.set('calendar', this.calendar.getValue());
|
||||||
this.currentItem.set('calendarname', Zarafa.plugins.calendarimporter.data.Actions.getCalendarFolderByEntryid(this.calendar.getValue()).display_name);
|
this.currentItem.set('calendarname', Zarafa.plugins.calendarimporter.data.Actions.getCalendarFolderByEntryid(this.calendar.getValue()).display_name);
|
||||||
}
|
}
|
||||||
this.dialog.close();
|
this.dialog.close();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function will create panel items for {@link Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel CalSyncEditPanel}
|
* Function will create panel items for {@link Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel CalSyncEditPanel}
|
||||||
* @return {Array} array of items that should be added to panel.
|
* @return {Array} array of items that should be added to panel.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
createPanelItems: function (config) {
|
createPanelItems: function (config) {
|
||||||
var icsurl = "";
|
var icsurl = "";
|
||||||
var intervall = "15";
|
var intervall = "15";
|
||||||
var user = "";
|
var user = "";
|
||||||
var pass = "";
|
var pass = "";
|
||||||
var calendarname = "";
|
var calendarname = "";
|
||||||
var calendar = Zarafa.plugins.calendarimporter.data.Actions.getCalendarFolderByName(container.getSettingsModel().get("zarafa/v1/plugins/calendarimporter/default_calendar")).entryid;
|
var calendar = Zarafa.plugins.calendarimporter.data.Actions.getCalendarFolderByName(container.getSettingsModel().get("zarafa/v1/plugins/calendarimporter/default_calendar")).entryid;
|
||||||
var myStore = Zarafa.plugins.calendarimporter.data.Actions.getAllCalendarFolders(true);
|
var myStore = Zarafa.plugins.calendarimporter.data.Actions.getAllCalendarFolders(true);
|
||||||
|
|
||||||
if (config.item) {
|
if (config.item) {
|
||||||
icsurl = config.item.get('icsurl');
|
icsurl = config.item.get('icsurl');
|
||||||
intervall = config.item.get('intervall');
|
intervall = config.item.get('intervall');
|
||||||
user = config.item.get('user');
|
user = config.item.get('user');
|
||||||
pass = Ext.util.base64.decode(config.item.get('pass'));
|
pass = Ext.util.base64.decode(config.item.get('pass'));
|
||||||
calendar = config.item.get('calendar');
|
calendar = config.item.get('calendar');
|
||||||
calendarname = config.item.get('calendarname');
|
calendarname = config.item.get('calendarname');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return [{
|
return [{
|
||||||
xtype: 'fieldset',
|
xtype: 'fieldset',
|
||||||
title: dgettext('plugin_calendarimporter', 'ICAL Information'),
|
title: dgettext('plugin_calendarimporter', 'ICAL Information'),
|
||||||
defaultType: 'textfield',
|
defaultType: 'textfield',
|
||||||
layout: 'form',
|
layout: 'form',
|
||||||
flex: 1,
|
flex: 1,
|
||||||
defaults: {
|
defaults: {
|
||||||
anchor: '100%',
|
anchor: '100%',
|
||||||
flex: 1
|
flex: 1
|
||||||
},
|
},
|
||||||
items: [{
|
items: [{
|
||||||
fieldLabel: dgettext('plugin_calendarimporter', 'ICS Url'),
|
fieldLabel: dgettext('plugin_calendarimporter', 'ICS Url'),
|
||||||
name: 'icsurl',
|
name: 'icsurl',
|
||||||
ref: '../icsurl',
|
ref: '../icsurl',
|
||||||
value: icsurl,
|
value: icsurl,
|
||||||
allowBlank: false
|
allowBlank: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
xtype: 'selectbox',
|
xtype: 'selectbox',
|
||||||
fieldLabel: dgettext('plugin_calendarimporter', 'Destination Calendar'),
|
fieldLabel: dgettext('plugin_calendarimporter', 'Destination Calendar'),
|
||||||
name: 'calendar',
|
name: 'calendar',
|
||||||
ref: '../calendar',
|
ref: '../calendar',
|
||||||
value: calendar,
|
value: calendar,
|
||||||
editable: false,
|
editable: false,
|
||||||
store: myStore,
|
store: myStore,
|
||||||
mode: 'local',
|
mode: 'local',
|
||||||
labelSeperator: ":",
|
labelSeperator: ":",
|
||||||
border: false,
|
border: false,
|
||||||
anchor: "100%",
|
anchor: "100%",
|
||||||
scope: this,
|
scope: this,
|
||||||
allowBlank: false
|
allowBlank: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
xtype: 'numberfield',
|
xtype: 'numberfield',
|
||||||
fieldLabel: dgettext('plugin_calendarimporter', 'Sync Intervall (minutes)'),
|
fieldLabel: dgettext('plugin_calendarimporter', 'Sync Intervall (minutes)'),
|
||||||
name: 'intervall',
|
name: 'intervall',
|
||||||
ref: '../intervall',
|
ref: '../intervall',
|
||||||
value: intervall,
|
value: intervall,
|
||||||
allowBlank: false
|
allowBlank: false
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
xtype: 'fieldset',
|
xtype: 'fieldset',
|
||||||
title: dgettext('plugin_calendarimporter', 'Authentication (optional)'),
|
title: dgettext('plugin_calendarimporter', 'Authentication (optional)'),
|
||||||
defaultType: 'textfield',
|
defaultType: 'textfield',
|
||||||
layout: 'form',
|
layout: 'form',
|
||||||
defaults: {
|
defaults: {
|
||||||
anchor: '100%'
|
anchor: '100%'
|
||||||
},
|
},
|
||||||
items: [{
|
items: [{
|
||||||
fieldLabel: dgettext('plugin_calendarimporter', 'Username'),
|
fieldLabel: dgettext('plugin_calendarimporter', 'Username'),
|
||||||
name: 'user',
|
name: 'user',
|
||||||
ref: '../user',
|
ref: '../user',
|
||||||
value: user,
|
value: user,
|
||||||
allowBlank: true
|
allowBlank: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldLabel: dgettext('plugin_calendarimporter', 'Password'),
|
fieldLabel: dgettext('plugin_calendarimporter', 'Password'),
|
||||||
name: 'pass',
|
name: 'pass',
|
||||||
ref: '../pass',
|
ref: '../pass',
|
||||||
value: pass,
|
value: pass,
|
||||||
inputType: 'password',
|
inputType: 'password',
|
||||||
allowBlank: true
|
allowBlank: true
|
||||||
}]
|
}]
|
||||||
}];
|
}];
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Java String.hashCode() implementation
|
* Java String.hashCode() implementation
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
hashCode: function (str) {
|
hashCode: function (str) {
|
||||||
var hash = 0;
|
var hash = 0;
|
||||||
var chr = 0;
|
var chr = 0;
|
||||||
var i = 0;
|
var i = 0;
|
||||||
|
|
||||||
if (str.length == 0) return hash;
|
if (str.length == 0) return hash;
|
||||||
for (i = 0; i < str.length; i++) {
|
for (i = 0; i < str.length; i++) {
|
||||||
chr = str.charCodeAt(i);
|
chr = str.charCodeAt(i);
|
||||||
hash = ((hash << 5) - hash) + chr;
|
hash = ((hash << 5) - hash) + chr;
|
||||||
hash = hash & hash; // Convert to 32bit integer
|
hash = hash & hash; // Convert to 32bit integer
|
||||||
}
|
}
|
||||||
return Math.abs(hash);
|
return Math.abs(hash);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Ext.reg('calendarimporter.calsynceditpanel', Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel);
|
Ext.reg('calendarimporter.calsynceditpanel', Zarafa.plugins.calendarimporter.settings.dialogs.CalSyncEditPanel);
|
||||||
|
@@ -1,180 +1,180 @@
|
|||||||
/**
|
/**
|
||||||
* CalSyncGrid.js, Kopano calender to ics im/exporter
|
* CalSyncGrid.js, Kopano calender to ics im/exporter
|
||||||
*
|
*
|
||||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
* 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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* License as published by the Free Software Foundation; either
|
* License as published by the Free Software Foundation; either
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* License along with this library; if not, write to the Free Software
|
* License along with this library; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Ext.namespace('Zarafa.plugins.calendarimporter.settings.ui');
|
Ext.namespace('Zarafa.plugins.calendarimporter.settings.ui');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Zarafa.plugins.calendarimporter.settings.ui.CalSyncGrid
|
* @class Zarafa.plugins.calendarimporter.settings.ui.CalSyncGrid
|
||||||
* @extends Ext.grid.GridPanel
|
* @extends Ext.grid.GridPanel
|
||||||
* @xtype calendarimporter.calsyncgrid
|
* @xtype calendarimporter.calsyncgrid
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Zarafa.plugins.calendarimporter.settings.ui.CalSyncGrid = Ext.extend(Ext.grid.GridPanel, {
|
Zarafa.plugins.calendarimporter.settings.ui.CalSyncGrid = Ext.extend(Ext.grid.GridPanel, {
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param {Object} config Configuration structure
|
* @param {Object} config Configuration structure
|
||||||
*/
|
*/
|
||||||
constructor: function (config) {
|
constructor: function (config) {
|
||||||
config = config || {};
|
config = config || {};
|
||||||
|
|
||||||
Ext.applyIf(config, {
|
Ext.applyIf(config, {
|
||||||
xtype: 'calendarimporter.calsyncgrid',
|
xtype: 'calendarimporter.calsyncgrid',
|
||||||
border: true,
|
border: true,
|
||||||
store: config.store,
|
store: config.store,
|
||||||
viewConfig: {
|
viewConfig: {
|
||||||
forceFit: true,
|
forceFit: true,
|
||||||
emptyText: '<div class=\'emptytext\'>' + dgettext('plugin_calendarimporter', 'No ICAL sync entry exists') + '</div>'
|
emptyText: '<div class=\'emptytext\'>' + dgettext('plugin_calendarimporter', 'No ICAL sync entry exists') + '</div>'
|
||||||
},
|
},
|
||||||
loadMask: this.initLoadMask(),
|
loadMask: this.initLoadMask(),
|
||||||
columns: this.initColumnModel(),
|
columns: this.initColumnModel(),
|
||||||
selModel: this.initSelectionModel(),
|
selModel: this.initSelectionModel(),
|
||||||
listeners: {
|
listeners: {
|
||||||
viewready: this.onViewReady,
|
viewready: this.onViewReady,
|
||||||
rowdblclick: this.onRowDblClick,
|
rowdblclick: this.onRowDblClick,
|
||||||
scope: this
|
scope: this
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Zarafa.plugins.calendarimporter.settings.ui.CalSyncGrid.superclass.constructor.call(this, config);
|
Zarafa.plugins.calendarimporter.settings.ui.CalSyncGrid.superclass.constructor.call(this, config);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* initialize events for the grid panel.
|
* initialize events for the grid panel.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
initEvents: function () {
|
initEvents: function () {
|
||||||
Zarafa.plugins.calendarimporter.settings.ui.CalSyncGrid.superclass.initEvents.call(this);
|
Zarafa.plugins.calendarimporter.settings.ui.CalSyncGrid.superclass.initEvents.call(this);
|
||||||
|
|
||||||
// select first icssync when store has finished loading
|
// select first icssync when store has finished loading
|
||||||
this.mon(this.store, 'load', this.onViewReady, this, {single: true});
|
this.mon(this.store, 'load', this.onViewReady, this, {single: true});
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render function
|
* Render function
|
||||||
* @return {String}
|
* @return {String}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
renderAuthColumn: function (value, p, record) {
|
renderAuthColumn: function (value, p, record) {
|
||||||
return value ? "true" : "false";
|
return value ? "true" : "false";
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render function
|
* Render function
|
||||||
* @return {String}
|
* @return {String}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
renderCalendarColumn: function (value, p, record) {
|
renderCalendarColumn: function (value, p, record) {
|
||||||
return Zarafa.plugins.calendarimporter.data.Actions.getCalendarFolderByEntryid(value).display_name;
|
return Zarafa.plugins.calendarimporter.data.Actions.getCalendarFolderByEntryid(value).display_name;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a column model object, used in {@link #colModel} config
|
* Creates a column model object, used in {@link #colModel} config
|
||||||
* @return {Ext.grid.ColumnModel} column model object
|
* @return {Ext.grid.ColumnModel} column model object
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
initColumnModel: function () {
|
initColumnModel: function () {
|
||||||
return [{
|
return [{
|
||||||
dataIndex: 'icsurl',
|
dataIndex: 'icsurl',
|
||||||
header: dgettext('plugin_calendarimporter', 'ICS File'),
|
header: dgettext('plugin_calendarimporter', 'ICS File'),
|
||||||
renderer: Zarafa.common.ui.grid.Renderers.text
|
renderer: Zarafa.common.ui.grid.Renderers.text
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
dataIndex: 'calendarname',
|
dataIndex: 'calendarname',
|
||||||
header: dgettext('plugin_calendarimporter', 'Destination Calender'),
|
header: dgettext('plugin_calendarimporter', 'Destination Calender'),
|
||||||
renderer: Zarafa.common.ui.grid.Renderers.text
|
renderer: Zarafa.common.ui.grid.Renderers.text
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
dataIndex: 'user',
|
dataIndex: 'user',
|
||||||
header: dgettext('plugin_calendarimporter', 'Authentication'),
|
header: dgettext('plugin_calendarimporter', 'Authentication'),
|
||||||
renderer: this.renderAuthColumn
|
renderer: this.renderAuthColumn
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
dataIndex: 'intervall',
|
dataIndex: 'intervall',
|
||||||
header: dgettext('plugin_calendarimporter', 'Sync Intervall')
|
header: dgettext('plugin_calendarimporter', 'Sync Intervall')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
dataIndex: 'lastsync',
|
dataIndex: 'lastsync',
|
||||||
header: dgettext('plugin_calendarimporter', 'Last Synchronisation'),
|
header: dgettext('plugin_calendarimporter', 'Last Synchronisation'),
|
||||||
renderer: Zarafa.common.ui.grid.Renderers.text
|
renderer: Zarafa.common.ui.grid.Renderers.text
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a selection model object, used in {@link #selModel} config
|
* Creates a selection model object, used in {@link #selModel} config
|
||||||
* @return {Ext.grid.RowSelectionModel} selection model object
|
* @return {Ext.grid.RowSelectionModel} selection model object
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
initSelectionModel: function () {
|
initSelectionModel: function () {
|
||||||
return new Ext.grid.RowSelectionModel({
|
return new Ext.grid.RowSelectionModel({
|
||||||
singleSelect: true
|
singleSelect: true
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the {@link Ext.grid.GridPanel.loadMask} field
|
* Initialize the {@link Ext.grid.GridPanel.loadMask} field
|
||||||
*
|
*
|
||||||
* @return {Ext.LoadMask} The configuration object for {@link Ext.LoadMask}
|
* @return {Ext.LoadMask} The configuration object for {@link Ext.LoadMask}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
initLoadMask: function () {
|
initLoadMask: function () {
|
||||||
return {
|
return {
|
||||||
msg: dgettext('plugin_calendarimporter', 'Loading ics sync entries...')
|
msg: dgettext('plugin_calendarimporter', 'Loading ics sync entries...')
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Event handler which is fired when the gridPanel is ready. This will automatically
|
* Event handler which is fired when the gridPanel is ready. This will automatically
|
||||||
* select the first row in the grid.
|
* select the first row in the grid.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
onViewReady: function () {
|
onViewReady: function () {
|
||||||
this.getSelectionModel().selectFirstRow();
|
this.getSelectionModel().selectFirstRow();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function will be called to remove a ics sync entry.
|
* Function will be called to remove a ics sync entry.
|
||||||
*/
|
*/
|
||||||
removeIcsSyncAs: function () {
|
removeIcsSyncAs: function () {
|
||||||
var icsRecord = this.getSelectionModel().getSelected();
|
var icsRecord = this.getSelectionModel().getSelected();
|
||||||
if (!icsRecord) {
|
if (!icsRecord) {
|
||||||
Ext.Msg.alert(dgettext('plugin_calendarimporter', 'Alert'), dgettext('plugin_calendarimporter', 'Please select a ics sync entry.'));
|
Ext.Msg.alert(dgettext('plugin_calendarimporter', 'Alert'), dgettext('plugin_calendarimporter', 'Please select a ics sync entry.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.store.remove(icsRecord);
|
this.store.remove(icsRecord);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Event handler which is fired when the {@link Zarafa.plugins.calendarimporter.settings.ui.CalSyncGrid CalSyncGrid} is double clicked.
|
* Event handler which is fired when the {@link Zarafa.plugins.calendarimporter.settings.ui.CalSyncGrid CalSyncGrid} is double clicked.
|
||||||
* it will call generic function to handle the functionality.
|
* it will call generic function to handle the functionality.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
onRowDblClick: function (grid, rowIndex) {
|
onRowDblClick: function (grid, rowIndex) {
|
||||||
Zarafa.core.data.UIFactory.openLayerComponent(Zarafa.core.data.SharedComponentType['plugins.calendarimporter.settings.dialogs.calsyncedit'], undefined, {
|
Zarafa.core.data.UIFactory.openLayerComponent(Zarafa.core.data.SharedComponentType['plugins.calendarimporter.settings.dialogs.calsyncedit'], undefined, {
|
||||||
store: grid.getStore(),
|
store: grid.getStore(),
|
||||||
item: grid.getStore().getAt(rowIndex),
|
item: grid.getStore().getAt(rowIndex),
|
||||||
manager: Ext.WindowMgr
|
manager: Ext.WindowMgr
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Ext.reg('calendarimporter.calsyncgrid', Zarafa.plugins.calendarimporter.settings.ui.CalSyncGrid);
|
Ext.reg('calendarimporter.calsyncgrid', Zarafa.plugins.calendarimporter.settings.ui.CalSyncGrid);
|
||||||
|
@@ -1,172 +1,172 @@
|
|||||||
/**
|
/**
|
||||||
* CalSyncPanel.js, Kopano calender to ics im/exporter
|
* CalSyncPanel.js, Kopano calender to ics im/exporter
|
||||||
*
|
*
|
||||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
* 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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* License as published by the Free Software Foundation; either
|
* License as published by the Free Software Foundation; either
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* License along with this library; if not, write to the Free Software
|
* License along with this library; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Ext.namespace('Zarafa.plugins.calendarimporter.settings.ui');
|
Ext.namespace('Zarafa.plugins.calendarimporter.settings.ui');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Zarafa.plugins.calendarimporter.settings.ui.CalSyncPanel
|
* @class Zarafa.plugins.calendarimporter.settings.ui.CalSyncPanel
|
||||||
* @extends Ext.Panel
|
* @extends Ext.Panel
|
||||||
* @xtype calendarimporter.calsyncpanel
|
* @xtype calendarimporter.calsyncpanel
|
||||||
* Will generate UI for the {@link Zarafa.common.settings.SettingsSendAsWidget SettingsSendAsWidget}.
|
* Will generate UI for the {@link Zarafa.common.settings.SettingsSendAsWidget SettingsSendAsWidget}.
|
||||||
*/
|
*/
|
||||||
Zarafa.plugins.calendarimporter.settings.ui.CalSyncPanel = Ext.extend(Ext.Panel, {
|
Zarafa.plugins.calendarimporter.settings.ui.CalSyncPanel = Ext.extend(Ext.Panel, {
|
||||||
|
|
||||||
// store
|
// store
|
||||||
store: undefined,
|
store: undefined,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param config Configuration structure
|
* @param config Configuration structure
|
||||||
*/
|
*/
|
||||||
constructor: function (config) {
|
constructor: function (config) {
|
||||||
config = config || {};
|
config = config || {};
|
||||||
if (config.store)
|
if (config.store)
|
||||||
this.store = config.store;
|
this.store = config.store;
|
||||||
|
|
||||||
Ext.applyIf(config, {
|
Ext.applyIf(config, {
|
||||||
// Override from Ext.Component
|
// Override from Ext.Component
|
||||||
xtype: 'calendarimporter.calsyncpanel',
|
xtype: 'calendarimporter.calsyncpanel',
|
||||||
border: false,
|
border: false,
|
||||||
layout: {
|
layout: {
|
||||||
type: 'vbox',
|
type: 'vbox',
|
||||||
align: 'stretch',
|
align: 'stretch',
|
||||||
pack: 'start'
|
pack: 'start'
|
||||||
},
|
},
|
||||||
items: this.createPanelItems(this.store)
|
items: this.createPanelItems(this.store)
|
||||||
});
|
});
|
||||||
|
|
||||||
Zarafa.plugins.calendarimporter.settings.ui.CalSyncPanel.superclass.constructor.call(this, config);
|
Zarafa.plugins.calendarimporter.settings.ui.CalSyncPanel.superclass.constructor.call(this, config);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function will create panel items for {@link Zarafa.plugins.calendarimporter.settings.ui.CalSyncPanel CalSyncPanel}
|
* Function will create panel items for {@link Zarafa.plugins.calendarimporter.settings.ui.CalSyncPanel CalSyncPanel}
|
||||||
* @return {Array} array of items that should be added to panel.
|
* @return {Array} array of items that should be added to panel.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
createPanelItems: function (store) {
|
createPanelItems: function (store) {
|
||||||
return [{
|
return [{
|
||||||
xtype: 'displayfield',
|
xtype: 'displayfield',
|
||||||
value: dgettext('plugin_calendarimporter', 'Setup calendars you want to subscribe to.'),
|
value: dgettext('plugin_calendarimporter', 'Setup calendars you want to subscribe to.'),
|
||||||
fieldClass: 'x-form-display-field'
|
fieldClass: 'x-form-display-field'
|
||||||
}, {
|
}, {
|
||||||
xtype: 'container',
|
xtype: 'container',
|
||||||
flex: 1,
|
flex: 1,
|
||||||
layout: {
|
layout: {
|
||||||
type: 'hbox',
|
type: 'hbox',
|
||||||
align: 'stretch',
|
align: 'stretch',
|
||||||
pack: 'start'
|
pack: 'start'
|
||||||
},
|
},
|
||||||
items: [{
|
items: [{
|
||||||
xtype: 'calendarimporter.calsyncgrid',
|
xtype: 'calendarimporter.calsyncgrid',
|
||||||
ref: '../calsyncGrid',
|
ref: '../calsyncGrid',
|
||||||
store: store,
|
store: store,
|
||||||
flex: 1
|
flex: 1
|
||||||
}, {
|
}, {
|
||||||
xtype: 'container',
|
xtype: 'container',
|
||||||
width: 160,
|
width: 160,
|
||||||
defaults: {
|
defaults: {
|
||||||
width: 140
|
width: 140
|
||||||
},
|
},
|
||||||
layout: {
|
layout: {
|
||||||
type: 'vbox',
|
type: 'vbox',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
pack: 'start'
|
pack: 'start'
|
||||||
},
|
},
|
||||||
items: [{
|
items: [{
|
||||||
xtype: 'button',
|
xtype: 'button',
|
||||||
text: _('Add') + '...',
|
text: _('Add') + '...',
|
||||||
handler: this.onCalSyncAdd,
|
handler: this.onCalSyncAdd,
|
||||||
ref: '../../addButton',
|
ref: '../../addButton',
|
||||||
scope: this
|
scope: this
|
||||||
}, {
|
}, {
|
||||||
xtype: 'spacer',
|
xtype: 'spacer',
|
||||||
height: 20
|
height: 20
|
||||||
}, {
|
}, {
|
||||||
xtype: 'button',
|
xtype: 'button',
|
||||||
text: _('Remove') + '...',
|
text: _('Remove') + '...',
|
||||||
disabled: true,
|
disabled: true,
|
||||||
ref: '../../removeButton',
|
ref: '../../removeButton',
|
||||||
handler: this.onCalSyncRemove,
|
handler: this.onCalSyncRemove,
|
||||||
scope: this
|
scope: this
|
||||||
}]
|
}]
|
||||||
}]
|
}]
|
||||||
}];
|
}];
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* initialize events for the panel.
|
* initialize events for the panel.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
initEvents: function () {
|
initEvents: function () {
|
||||||
Zarafa.plugins.calendarimporter.settings.ui.CalSyncPanel.superclass.initEvents.call(this);
|
Zarafa.plugins.calendarimporter.settings.ui.CalSyncPanel.superclass.initEvents.call(this);
|
||||||
|
|
||||||
// register event to enable/disable buttons
|
// register event to enable/disable buttons
|
||||||
this.mon(this.calsyncGrid.getSelectionModel(), 'selectionchange', this.onGridSelectionChange, this);
|
this.mon(this.calsyncGrid.getSelectionModel(), 'selectionchange', this.onGridSelectionChange, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handler function will be called when user clicks on 'Add' button.
|
* Handler function will be called when user clicks on 'Add' button.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
onCalSyncAdd: function () {
|
onCalSyncAdd: function () {
|
||||||
Zarafa.core.data.UIFactory.openLayerComponent(Zarafa.core.data.SharedComponentType['plugins.calendarimporter.settings.dialogs.calsyncedit'], undefined, {
|
Zarafa.core.data.UIFactory.openLayerComponent(Zarafa.core.data.SharedComponentType['plugins.calendarimporter.settings.dialogs.calsyncedit'], undefined, {
|
||||||
store: this.store,
|
store: this.store,
|
||||||
item: undefined,
|
item: undefined,
|
||||||
manager: Ext.WindowMgr
|
manager: Ext.WindowMgr
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Event handler will be called when selection in {@link Zarafa.plugins.calendarimporter.settings.ui.CalSyncGrid CalSyncGrid}
|
* Event handler will be called when selection in {@link Zarafa.plugins.calendarimporter.settings.ui.CalSyncGrid CalSyncGrid}
|
||||||
* has been changed
|
* has been changed
|
||||||
* @param {Ext.grid.RowSelectionModel} selectionModel selection model that fired the event
|
* @param {Ext.grid.RowSelectionModel} selectionModel selection model that fired the event
|
||||||
*/
|
*/
|
||||||
onGridSelectionChange: function (selectionModel) {
|
onGridSelectionChange: function (selectionModel) {
|
||||||
var noSelection = (selectionModel.hasSelection() === false);
|
var noSelection = (selectionModel.hasSelection() === false);
|
||||||
|
|
||||||
this.removeButton.setDisabled(noSelection);
|
this.removeButton.setDisabled(noSelection);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handler function will be called when user clicks on 'Remove' button.
|
* Handler function will be called when user clicks on 'Remove' button.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
onCalSyncRemove: function () {
|
onCalSyncRemove: function () {
|
||||||
this.calsyncGrid.removeIcsSyncAs();
|
this.calsyncGrid.removeIcsSyncAs();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function will be used to reload data in the store.
|
* Function will be used to reload data in the store.
|
||||||
*/
|
*/
|
||||||
discardChanges: function () {
|
discardChanges: function () {
|
||||||
this.store.load();
|
this.store.load();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function will be used to save changes in the store.
|
* Function will be used to save changes in the store.
|
||||||
*/
|
*/
|
||||||
saveChanges: function () {
|
saveChanges: function () {
|
||||||
this.store.save();
|
this.store.save();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Ext.reg('calendarimporter.calsyncpanel', Zarafa.plugins.calendarimporter.settings.ui.CalSyncPanel);
|
Ext.reg('calendarimporter.calsyncpanel', Zarafa.plugins.calendarimporter.settings.ui.CalSyncPanel);
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
* ContectMenu.js, Kopano calender to ics im/exporter
|
* ContectMenu.js, Kopano calender to ics im/exporter
|
||||||
*
|
*
|
||||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
* 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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
104
manifest.xml
104
manifest.xml
@@ -1,52 +1,52 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<!DOCTYPE plugin SYSTEM "manifest.dtd">
|
<!DOCTYPE plugin SYSTEM "manifest.dtd">
|
||||||
<plugin version="2">
|
<plugin version="2">
|
||||||
<info>
|
<info>
|
||||||
<version>2.2.1</version>
|
<version>2.2.3</version>
|
||||||
<name>calendarimporter</name>
|
<name>calendarimporter</name>
|
||||||
<title>ICS Calendar Importer/Exporter</title>
|
<title>ICS Calendar Importer/Exporter</title>
|
||||||
<author>Christoph Haas</author>
|
<author>Christoph Haas</author>
|
||||||
<authorURL>http://www.sprinternet.at</authorURL>
|
<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>
|
</info>
|
||||||
<translations>
|
<config>
|
||||||
<translationsdir>languages</translationsdir>
|
<configfile>config.php</configfile>
|
||||||
</translations>
|
</config>
|
||||||
<config>
|
<translations>
|
||||||
<configfile>config.php</configfile>
|
<translationsdir>languages</translationsdir>
|
||||||
</config>
|
</translations>
|
||||||
<components>
|
<components>
|
||||||
<component>
|
<component>
|
||||||
<files>
|
<files>
|
||||||
<server>
|
<server>
|
||||||
<serverfile>php/plugin.calendarimporter.php</serverfile>
|
<serverfile>php/plugin.calendarimporter.php</serverfile>
|
||||||
<serverfile type="module" module="calendarmodule">php/module.calendar.php</serverfile>
|
<serverfile type="module" module="calendarmodule">php/module.calendar.php</serverfile>
|
||||||
</server>
|
</server>
|
||||||
<client>
|
<client>
|
||||||
<clientfile load="release">js/calendarimporter.js</clientfile>
|
<clientfile load="release">js/calendarimporter.js</clientfile>
|
||||||
<clientfile load="debug">js/calendarimporter-debug.js</clientfile>
|
<clientfile load="debug">js/calendarimporter-debug.js</clientfile>
|
||||||
|
|
||||||
<clientfile load="source">js/data/timezones.js</clientfile>
|
<clientfile load="source">js/data/timezones.js</clientfile>
|
||||||
<clientfile load="source">js/data/Actions.js</clientfile>
|
<clientfile load="source">js/data/Actions.js</clientfile>
|
||||||
<clientfile load="source">js/data/ResponseHandler.js</clientfile>
|
<clientfile load="source">js/data/ResponseHandler.js</clientfile>
|
||||||
<clientfile load="source">js/external/Ext.util.base64.js</clientfile>
|
<clientfile load="source">js/external/Ext.util.base64.js</clientfile>
|
||||||
<clientfile load="source">js/ui/ContextMenu.js</clientfile>
|
<clientfile load="source">js/ui/ContextMenu.js</clientfile>
|
||||||
<clientfile load="source">js/dialogs/ImportContentPanel.js</clientfile>
|
<clientfile load="source">js/dialogs/ImportContentPanel.js</clientfile>
|
||||||
<clientfile load="source">js/dialogs/ImportPanel.js</clientfile>
|
<clientfile load="source">js/dialogs/ImportPanel.js</clientfile>
|
||||||
<clientfile load="source">js/dialogs/settings/SettingsWidget.js</clientfile>
|
<clientfile load="source">js/dialogs/settings/SettingsWidget.js</clientfile>
|
||||||
<clientfile load="source">js/dialogs/settings/SettingsCalSyncWidget.js</clientfile>
|
<clientfile load="source">js/dialogs/settings/SettingsCalSyncWidget.js</clientfile>
|
||||||
<clientfile load="source">js/dialogs/settings/ui/CalSyncGrid.js</clientfile>
|
<clientfile load="source">js/dialogs/settings/ui/CalSyncGrid.js</clientfile>
|
||||||
<clientfile load="source">js/dialogs/settings/ui/CalSyncPanel.js</clientfile>
|
<clientfile load="source">js/dialogs/settings/ui/CalSyncPanel.js</clientfile>
|
||||||
<clientfile load="source">js/dialogs/settings/dialogs/CalSyncEditContentPanel.js</clientfile>
|
<clientfile load="source">js/dialogs/settings/dialogs/CalSyncEditContentPanel.js</clientfile>
|
||||||
<clientfile load="source">js/dialogs/settings/dialogs/CalSyncEditPanel.js</clientfile>
|
<clientfile load="source">js/dialogs/settings/dialogs/CalSyncEditPanel.js</clientfile>
|
||||||
<clientfile load="source">js/plugin.calendarimporter.js</clientfile>
|
<clientfile load="source">js/plugin.calendarimporter.js</clientfile>
|
||||||
</client>
|
</client>
|
||||||
<resources>
|
<resources>
|
||||||
<resourcefile load="release">resources/css/calendarimporter.css</resourcefile>
|
<resourcefile load="release">resources/css/calendarimporter.css</resourcefile>
|
||||||
<resourcefile load="debug">resources/css/calendarimporter.css</resourcefile>
|
<resourcefile load="debug">resources/css/calendarimporter.css</resourcefile>
|
||||||
<resourcefile load="source">resources/css/calendarimporter-main.css</resourcefile>
|
<resourcefile load="source">resources/css/calendarimporter-main.css</resourcefile>
|
||||||
</resources>
|
</resources>
|
||||||
</files>
|
</files>
|
||||||
</component>
|
</component>
|
||||||
</components>
|
</components>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
148
php/download.php
148
php/download.php
@@ -1,75 +1,75 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* download.php, Kopano calendar to ics im/exporter
|
* download.php, Kopano calendar to ics im/exporter
|
||||||
*
|
*
|
||||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
* 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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* License as published by the Free Software Foundation; either
|
* License as published by the Free Software Foundation; either
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* License along with this library; if not, write to the Free Software
|
* License along with this library; if not, write to the Free Software
|
||||||
* 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;
|
namespace calendarimporter;
|
||||||
|
|
||||||
class DownloadHandler
|
class DownloadHandler
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Download the given vcf file.
|
* Download the given vcf file.
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public static function doDownload()
|
public static function doDownload()
|
||||||
{
|
{
|
||||||
if (isset($_GET["token"])) {
|
if (isset($_GET["token"])) {
|
||||||
$token = $_GET["token"];
|
$token = $_GET["token"];
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_GET["filename"])) {
|
if (isset($_GET["filename"])) {
|
||||||
$filename = $_GET["filename"];
|
$filename = $_GET["filename"];
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// validate token
|
// validate token
|
||||||
if (!preg_match('/^[a-zA-Z0-9]+$/', $token)) { // token is a md5 hash
|
if (!preg_match('/^[a-zA-Z0-9]+$/', $token)) { // token is a md5 hash
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$file = PLUGIN_CALENDARIMPORTER_TMP_UPLOAD . "ics_" . $token . ".ics";
|
$file = PLUGIN_CALENDARIMPORTER_TMP_UPLOAD . "ics_" . $token . ".ics";
|
||||||
|
|
||||||
if (!file_exists($file)) { // invalid token
|
if (!file_exists($file)) { // invalid token
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set headers here
|
// set headers here
|
||||||
header('Content-Disposition: attachment; filename="' . $filename . '"');
|
header('Content-Disposition: attachment; filename="' . $filename . '"');
|
||||||
|
|
||||||
// no caching
|
// no caching
|
||||||
header('Expires: 0'); // set expiration time
|
header('Expires: 0'); // set expiration time
|
||||||
header('Content-Description: File Transfer');
|
header('Content-Description: File Transfer');
|
||||||
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
|
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
|
||||||
header('Content-Length: ' . filesize($file));
|
header('Content-Length: ' . filesize($file));
|
||||||
header('Content-Type: application/octet-stream');
|
header('Content-Type: application/octet-stream');
|
||||||
header('Pragma: public');
|
header('Pragma: public');
|
||||||
flush();
|
flush();
|
||||||
|
|
||||||
// print the downloaded file
|
// print the downloaded file
|
||||||
readfile($file);
|
readfile($file);
|
||||||
ignore_user_abort(true);
|
ignore_user_abort(true);
|
||||||
unlink($file);
|
unlink($file);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -3,7 +3,7 @@
|
|||||||
* helper.php, Kopano calender to ics im/exporter
|
* helper.php, Kopano calender to ics im/exporter
|
||||||
*
|
*
|
||||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
* 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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -3,7 +3,7 @@
|
|||||||
* plugin.calendarimporter.php, Kopano calender to ics im/exporter
|
* plugin.calendarimporter.php, Kopano calender to ics im/exporter
|
||||||
*
|
*
|
||||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
* 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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
* upload.php, Kopano calender to ics im/exporter
|
* upload.php, Kopano calender to ics im/exporter
|
||||||
*
|
*
|
||||||
* Author: Christoph Haas <christoph.h@sprinternet.at>
|
* 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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
@@ -1,30 +1,30 @@
|
|||||||
.icon_calendarimporter_button {
|
.icon_calendarimporter_button {
|
||||||
background: url(../images/import_icon.png) no-repeat;
|
background: url(../images/import_icon.png) no-repeat;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-position: center;
|
background-position: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon_calendarimporter_export {
|
.icon_calendarimporter_export {
|
||||||
background: url(../images/download.png) no-repeat;
|
background: url(../images/download.png) no-repeat;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-position: center;
|
background-position: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon_calendarimporter_import {
|
.icon_calendarimporter_import {
|
||||||
background: url(../images/upload.png) no-repeat;
|
background: url(../images/upload.png) no-repeat;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-position: center;
|
background-position: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.zarafa-caiplg-container {
|
.zarafa-caiplg-container {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 50px;
|
height: 50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.zarafa-caiplg-button .x-btn-small {
|
.zarafa-caiplg-button .x-btn-small {
|
||||||
width: 80%;
|
width: 80%;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
margin-left: 10%;
|
margin-left: 10%;
|
||||||
margin-right: 10%;
|
margin-right: 10%;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
|
BIN
usage_sync.png
Normal file
BIN
usage_sync.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 64 KiB |
Reference in New Issue
Block a user