aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2019-04-30 00:09:57 +0200
committerMario Vavti <mario@mariovavti.com>2019-04-30 00:09:57 +0200
commit327e5d06e12b3ddad0a83a223c1673a4d0dafb15 (patch)
treed5ae844d7f1498e1552df4cd4ffd4df00b30815b /Zotlabs
parent674215e9e6632ac22a1b87f9996f0323f5949d94 (diff)
downloadvolse-hubzilla-327e5d06e12b3ddad0a83a223c1673a4d0dafb15.tar.gz
volse-hubzilla-327e5d06e12b3ddad0a83a223c1673a4d0dafb15.tar.bz2
volse-hubzilla-327e5d06e12b3ddad0a83a223c1673a4d0dafb15.zip
calendar merge: implement single event editing UI
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Module/Cdav.php44
-rw-r--r--Zotlabs/Module/Channel_calendar.php1
-rw-r--r--Zotlabs/Module/Editpost.php2
-rw-r--r--Zotlabs/Widget/Cdav.php2
4 files changed, 45 insertions, 4 deletions
diff --git a/Zotlabs/Module/Cdav.php b/Zotlabs/Module/Cdav.php
index 8985e257a..ce5b777f5 100644
--- a/Zotlabs/Module/Cdav.php
+++ b/Zotlabs/Module/Cdav.php
@@ -890,7 +890,7 @@ class Cdav extends Controller {
}
//Display calendar(s) here
- if(argc() == 2 && argv(1) === 'calendar') {
+ if(argc() <= 3 && argv(1) === 'calendar') {
head_add_css('/library/fullcalendar/packages/core/main.min.css');
head_add_css('/library/fullcalendar/packages/daygrid/main.min.css');
@@ -905,6 +905,43 @@ class Cdav extends Controller {
head_add_js('/library/fullcalendar/packages/list/main.min.js');
$sources = '';
+ $iid = '';
+ $resource = null;
+
+ if(argc() == 3 && intval(argv(2)))
+ $iid = argv(2);
+
+ if($iid) {
+ $r = q("SELECT event.*, item.author_xchan, item.owner_xchan, item.id as item_id FROM item LEFT JOIN event ON item.resource_id = event.event_hash
+ WHERE item.id = %d AND item.uid = %d LIMIT 1",
+ dbesc($iid),
+ intval(local_channel())
+ );
+
+ if($r) {
+ xchan_query($r);
+ $r = fetch_post_tags($r,true);
+
+ $r[0]['dtstart'] = (($r[0]['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$r[0]['dtstart'], 'c') : datetime_convert('UTC','UTC',$r[0]['dtstart'],'c'));
+ $r[0]['dtend'] = (($r[0]['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$r[0]['dtend'], 'c') : datetime_convert('UTC','UTC',$r[0]['dtend'],'c'));
+
+ $resource = $r[0];
+
+ $catsenabled = feature_enabled(local_channel(),'categories');
+ $categories = '';
+ if($catsenabled){
+ if($r[0]['term']) {
+ $cats = get_terms_oftype($r[0]['term'], TERM_CATEGORY);
+ foreach ($cats as $cat) {
+ if(strlen($categories))
+ $categories .= ', ';
+ $categories .= $cat['term'];
+ }
+ }
+ }
+
+ }
+ }
if(get_pconfig(local_channel(), 'cdav_calendar', 'channel_calendar')) {
$sources .= '{
@@ -1005,7 +1042,10 @@ class Cdav extends Controller {
'$deny_cid' => acl2json($permissions['deny_cid']),
'$deny_gid' => acl2json($permissions['deny_gid']),
'$catsenabled' => $catsenabled,
- '$categories_label' => t('Categories')
+ '$categories_label' => t('Categories'),
+
+ '$resource' => json_encode($resource),
+ '$categories' => $categories
]);
return $o;
diff --git a/Zotlabs/Module/Channel_calendar.php b/Zotlabs/Module/Channel_calendar.php
index ee7c722c3..538951d32 100644
--- a/Zotlabs/Module/Channel_calendar.php
+++ b/Zotlabs/Module/Channel_calendar.php
@@ -565,6 +565,7 @@ class Channel_calendar extends \Zotlabs\Web\Controller {
'd' => $d,
'editable' => $edit ? true : false,
+ 'className' => 'channel_calendar_id_' . $rr['id'],
'is_first'=>$is_first,
'item'=>$rr,
diff --git a/Zotlabs/Module/Editpost.php b/Zotlabs/Module/Editpost.php
index 85882bf0a..77f139467 100644
--- a/Zotlabs/Module/Editpost.php
+++ b/Zotlabs/Module/Editpost.php
@@ -45,7 +45,7 @@ class Editpost extends \Zotlabs\Web\Controller {
}
if($itm[0]['resource_type'] === 'event' && $itm[0]['resource_id']) {
- goaway(z_root() . '/cdav/calendar');
+ goaway(z_root() . '/cdav/calendar/' . $itm[0]['id']);
//goaway(z_root() . '/events/' . $itm[0]['resource_id'] . '?expandform=1');
}
diff --git a/Zotlabs/Widget/Cdav.php b/Zotlabs/Widget/Cdav.php
index c88530c0b..20c70903f 100644
--- a/Zotlabs/Widget/Cdav.php
+++ b/Zotlabs/Widget/Cdav.php
@@ -22,7 +22,7 @@ class Cdav {
$o = '';
- if(argc() == 2 && argv(1) === 'calendar') {
+ if(argc() <= 3 && argv(1) === 'calendar') {
$caldavBackend = new \Sabre\CalDAV\Backend\PDO($pdo);