aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Module/Cdav.php17
-rw-r--r--Zotlabs/Module/Channel_calendar.php14
-rw-r--r--Zotlabs/Module/Settings/Calendar.php2
-rw-r--r--Zotlabs/Widget/Cdav.php5
-rw-r--r--include/features.php2
-rw-r--r--view/tpl/cdav_widget_calendar.tpl3
6 files changed, 22 insertions, 21 deletions
diff --git a/Zotlabs/Module/Cdav.php b/Zotlabs/Module/Cdav.php
index ed8a641b8..6b4f57ea5 100644
--- a/Zotlabs/Module/Cdav.php
+++ b/Zotlabs/Module/Cdav.php
@@ -754,16 +754,27 @@ class Cdav extends Controller {
//Import calendar or addressbook
if(($_FILES) && array_key_exists('userfile',$_FILES) && intval($_FILES['userfile']['size']) && $_REQUEST['target']) {
- $src = @file_get_contents($_FILES['userfile']['tmp_name']);
+ $src = $_FILES['userfile']['tmp_name'];
if($src) {
if($_REQUEST['c_upload']) {
+ if($_REQUEST['target'] == 'channel_calendar') {
+ $result = parse_ical_file($src,local_channel());
+ if($result)
+ info( t('Calendar entries imported.') . EOL);
+ else
+ notice( t('No calendar entries found.') . EOL);
+
+ @unlink($src);
+ return;
+ }
+
$id = explode(':', $_REQUEST['target']);
$ext = 'ics';
$table = 'calendarobjects';
$column = 'calendarid';
- $objects = new \Sabre\VObject\Splitter\ICalendar($src);
+ $objects = new \Sabre\VObject\Splitter\ICalendar(@file_get_contents($src));
$profile = \Sabre\VObject\Node::PROFILE_CALDAV;
$backend = new \Sabre\CalDAV\Backend\PDO($pdo);
}
@@ -773,7 +784,7 @@ class Cdav extends Controller {
$ext = 'vcf';
$table = 'cards';
$column = 'addressbookid';
- $objects = new \Sabre\VObject\Splitter\VCard($src);
+ $objects = new \Sabre\VObject\Splitter\VCard(@file_get_contents($src));
$profile = \Sabre\VObject\Node::PROFILE_CARDDAV;
$backend = new \Sabre\CardDAV\Backend\PDO($pdo);
}
diff --git a/Zotlabs/Module/Channel_calendar.php b/Zotlabs/Module/Channel_calendar.php
index e6c5e6e54..ad748401f 100644
--- a/Zotlabs/Module/Channel_calendar.php
+++ b/Zotlabs/Module/Channel_calendar.php
@@ -17,20 +17,6 @@ class Channel_calendar extends \Zotlabs\Web\Controller {
if(! local_channel())
return;
- if(($_FILES) && array_key_exists('userfile',$_FILES) && intval($_FILES['userfile']['size'])) {
- $src = $_FILES['userfile']['tmp_name'];
- if($src) {
- $result = parse_ical_file($src,local_channel());
- if($result)
- info( t('Calendar entries imported.') . EOL);
- else
- notice( t('No calendar entries found.') . EOL);
- @unlink($src);
- }
- goaway(z_root() . '/channel_calendar');
- }
-
-
$event_id = ((x($_POST,'event_id')) ? intval($_POST['event_id']) : 0);
$event_hash = ((x($_POST,'event_hash')) ? $_POST['event_hash'] : '');
diff --git a/Zotlabs/Module/Settings/Calendar.php b/Zotlabs/Module/Settings/Calendar.php
index a27bf0fa5..0298b412e 100644
--- a/Zotlabs/Module/Settings/Calendar.php
+++ b/Zotlabs/Module/Settings/Calendar.php
@@ -36,7 +36,7 @@ class Calendar {
'$rpath' => $rpath,
'$action_url' => 'settings/' . $module,
'$form_security_token' => get_form_security_token('settings_' . $module),
- '$title' => t('CalDAV Settings'),
+ '$title' => t('Calendar Settings'),
'$features' => process_module_features_get(local_channel(), $features),
'$submit' => t('Submit')
));
diff --git a/Zotlabs/Widget/Cdav.php b/Zotlabs/Widget/Cdav.php
index 7794d7617..7972d839e 100644
--- a/Zotlabs/Widget/Cdav.php
+++ b/Zotlabs/Widget/Cdav.php
@@ -136,10 +136,11 @@ class Cdav {
'$share' => t('Share'),
'$edit_label' => t('Calendar name and color'),
'$edit' => t('Edit'),
- '$create_label' => t('Create new calendar'),
+ '$create_label' => t('Create new CalDAV calendar'),
'$create' => t('Create'),
'$create_placeholder' => t('Calendar Name'),
- '$tools_label' => t('CalDAV Calendar Tools'),
+ '$tools_label' => t('Calendar Tools'),
+ '$tools_options_label' => [t('Channel Calendar'), t('CalDAV Calendars')],
'$import_label' => t('Import calendar'),
'$import_placeholder' => t('Select a calendar to import to'),
'$upload' => t('Upload'),
diff --git a/include/features.php b/include/features.php
index b0d02c141..d8607f447 100644
--- a/include/features.php
+++ b/include/features.php
@@ -79,7 +79,7 @@ function get_features($filtered = true, $level = (-1)) {
'calendar' => [
- t('CalDAV'),
+ t('Calendar'),
[
'cal_first_day',
diff --git a/view/tpl/cdav_widget_calendar.tpl b/view/tpl/cdav_widget_calendar.tpl
index a538cd26d..faee5a791 100644
--- a/view/tpl/cdav_widget_calendar.tpl
+++ b/view/tpl/cdav_widget_calendar.tpl
@@ -119,6 +119,9 @@
<div class="form-group">
<select id="import" name="target" class="form-control">
<option value="">{{$import_placeholder}}</option>
+ <optgroup label="{{$tools_options_label.0}}">
+ <option value="{{$channel_calendar.calendarid}}">{{$channel_calendar.displayname}}</option>
+ <optgroup label="{{$tools_options_label.1}}">
{{foreach $writable_calendars as $writable_calendar}}
<option value="{{$writable_calendar.id.0}}:{{$writable_calendar.id.1}}">{{$writable_calendar.displayname}}</option>
{{/foreach}}