From 7856f5882bceaf83d5df42e117c23badc89ad1a8 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sat, 15 Sep 2018 10:10:43 +0200 Subject: appify cdav stuff. WARNING: if you use caldav or carddav from a client or the webinterface you will need to enable those apps to make things work again --- Zotlabs/Module/Cdav.php | 52 ++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 47 insertions(+), 5 deletions(-) (limited to 'Zotlabs/Module/Cdav.php') diff --git a/Zotlabs/Module/Cdav.php b/Zotlabs/Module/Cdav.php index 6737ac4ee..69030b582 100644 --- a/Zotlabs/Module/Cdav.php +++ b/Zotlabs/Module/Cdav.php @@ -1,6 +1,9 @@ setRealm(ucfirst(\Zotlabs\Lib\System::get_platform_name()) . 'CalDAV/CardDAV'); if (local_channel()) { + logger('loggedin'); - $channel = \App::get_channel(); + + if((argv(1) == 'calendars') && (!Apps::system_app_installed(local_channel(), 'CalDAV'))) { + killme(); + } + + if((argv(1) == 'addressbooks') && (!Apps::system_app_installed(local_channel(), 'CardDAV'))) { + killme(); + } + + $channel = App::get_channel(); $auth->setCurrentUser($channel['channel_address']); $auth->channel_id = $channel['channel_id']; $auth->channel_hash = $channel['channel_hash']; @@ -161,12 +174,15 @@ class Cdav extends \Zotlabs\Web\Controller { $nodes = [ // /principals new \Sabre\CalDAV\Principal\Collection($principalBackend), + // /calendars new \Sabre\CalDAV\CalendarRoot($principalBackend, $caldavBackend), + // /addressbook - new \Sabre\CardDAV\AddressBookRoot($principalBackend, $carddavBackend), + new \Sabre\CardDAV\AddressBookRoot($principalBackend, $carddavBackend) ]; + // The object tree needs in turn to be passed to the server class $server = new \Sabre\DAV\Server($nodes); @@ -204,7 +220,15 @@ class Cdav extends \Zotlabs\Web\Controller { if(! local_channel()) return; - $channel = \App::get_channel(); + if((argv(1) === 'calendar') && (! Apps::system_app_installed(local_channel(), 'CalDAV'))) { + return; + } + + if((argv(1) === 'addressbook') && (! Apps::system_app_installed(local_channel(), 'CardDAV'))) { + return; + } + + $channel = App::get_channel(); $principalUri = 'principals/' . $channel['channel_address']; if(!cdav_principal($principalUri)) @@ -807,7 +831,25 @@ class Cdav extends \Zotlabs\Web\Controller { if(!local_channel()) return; - $channel = \App::get_channel(); + if((argv(1) === 'calendar') && (! Apps::system_app_installed(local_channel(), 'CalDAV'))) { + //Do not display any associated widgets at this point + App::$pdl = ''; + + $o = 'CalDAV App (Not Installed):
'; + $o .= t('CalDAV capable calendar'); + return $o; + } + + if((argv(1) === 'addressbook') && (! Apps::system_app_installed(local_channel(), 'CardDAV'))) { + //Do not display any associated widgets at this point + App::$pdl = ''; + + $o = 'CardDAV App (Not Installed):
'; + $o .= t('CalDAV capable addressbook'); + return $o; + } + + $channel = App::get_channel(); $principalUri = 'principals/' . $channel['channel_address']; $pdo = \DBA::$dba->db; @@ -874,7 +916,7 @@ class Cdav extends \Zotlabs\Web\Controller { $o .= replace_macros(get_markup_template('cdav_calendar.tpl'), [ '$sources' => $sources, '$color' => $color, - '$lang' => \App::$language, + '$lang' => App::$language, '$first_day' => $first_day, '$prev' => t('Previous'), '$next' => t('Next'), -- cgit v1.2.3 From 0f9a8a43e4ab274e251240f6091a5bf87c2ac205 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sat, 15 Sep 2018 10:48:51 +0200 Subject: appify invite --- Zotlabs/Module/Cdav.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Zotlabs/Module/Cdav.php') diff --git a/Zotlabs/Module/Cdav.php b/Zotlabs/Module/Cdav.php index 69030b582..bff308dfa 100644 --- a/Zotlabs/Module/Cdav.php +++ b/Zotlabs/Module/Cdav.php @@ -3,13 +3,14 @@ namespace Zotlabs\Module; use App; use Zotlabs\Lib\Apps; +use Zotlabs\Web\Controller; require_once('include/event.php'); require_once('include/auth.php'); require_once('include/security.php'); -class Cdav extends \Zotlabs\Web\Controller { +class Cdav extends Controller { function init() { -- cgit v1.2.3 From 781fdaafcd6a8086b76409b0a39d8edbca2e04c9 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 23 Sep 2018 19:18:05 +0200 Subject: settings for events and cdav calendar --- Zotlabs/Module/Cdav.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Zotlabs/Module/Cdav.php') diff --git a/Zotlabs/Module/Cdav.php b/Zotlabs/Module/Cdav.php index bff308dfa..7142615d5 100644 --- a/Zotlabs/Module/Cdav.php +++ b/Zotlabs/Module/Cdav.php @@ -850,6 +850,8 @@ class Cdav extends Controller { return $o; } + App::$profile_uid = local_channel(); + $channel = App::get_channel(); $principalUri = 'principals/' . $channel['channel_address']; @@ -905,7 +907,7 @@ class Cdav extends Controller { $sources = rtrim($sources, ', '); - $first_day = get_pconfig(local_channel(),'system','cal_first_day'); + $first_day = feature_enabled(local_channel(), 'cal_first_day'); $first_day = (($first_day) ? $first_day : 0); $title = ['title', t('Event title')]; -- cgit v1.2.3 From d8c6d93c6e564b166275bdcd730a5251dfdd7304 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Fri, 28 Sep 2018 15:31:22 +0200 Subject: Update Cdav.php --- Zotlabs/Module/Cdav.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Module/Cdav.php') diff --git a/Zotlabs/Module/Cdav.php b/Zotlabs/Module/Cdav.php index 7142615d5..860864e99 100644 --- a/Zotlabs/Module/Cdav.php +++ b/Zotlabs/Module/Cdav.php @@ -836,7 +836,7 @@ class Cdav extends Controller { //Do not display any associated widgets at this point App::$pdl = ''; - $o = 'CalDAV App (Not Installed):
'; + $o = '' . t('CalDAV App (Not Installed):') . '
'; $o .= t('CalDAV capable calendar'); return $o; } @@ -845,7 +845,7 @@ class Cdav extends Controller { //Do not display any associated widgets at this point App::$pdl = ''; - $o = 'CardDAV App (Not Installed):
'; + $o = '' . t('CardDAV App (Not Installed):') . '
'; $o .= t('CalDAV capable addressbook'); return $o; } -- cgit v1.2.3 From c6fce5de24df96cb8048543fb6b8a6907ecaa610 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Fri, 28 Sep 2018 19:46:04 +0200 Subject: Update Cdav.php --- Zotlabs/Module/Cdav.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Module/Cdav.php') diff --git a/Zotlabs/Module/Cdav.php b/Zotlabs/Module/Cdav.php index 860864e99..d644e48b1 100644 --- a/Zotlabs/Module/Cdav.php +++ b/Zotlabs/Module/Cdav.php @@ -836,7 +836,7 @@ class Cdav extends Controller { //Do not display any associated widgets at this point App::$pdl = ''; - $o = '' . t('CalDAV App (Not Installed):') . '
'; + $o = '' . t('CalDAV App') . ' (' . t('Not Installed') . '):
'; $o .= t('CalDAV capable calendar'); return $o; } @@ -845,7 +845,7 @@ class Cdav extends Controller { //Do not display any associated widgets at this point App::$pdl = ''; - $o = '' . t('CardDAV App (Not Installed):') . '
'; + $o = '' . t('CardDAV App') . ' (' . t('Not Installed') . '):
'; $o .= t('CalDAV capable addressbook'); return $o; } -- cgit v1.2.3