aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r--Zotlabs/Module/Cdav.php51
-rw-r--r--Zotlabs/Module/Channel_calendar.php37
-rw-r--r--Zotlabs/Module/Editpost.php2
-rw-r--r--Zotlabs/Module/Ping.php2
4 files changed, 65 insertions, 27 deletions
diff --git a/Zotlabs/Module/Cdav.php b/Zotlabs/Module/Cdav.php
index 8985e257a..6e302935c 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,50 @@ class Cdav extends Controller {
head_add_js('/library/fullcalendar/packages/list/main.min.js');
$sources = '';
+ $resource_id = '';
+ $resource = null;
+
+ if(argc() == 3)
+ $resource_id = argv(2);
+
+ if($resource_id) {
+ $r = q("SELECT event.*, item.author_xchan, item.owner_xchan, item.plink, item.id as item_id FROM event LEFT JOIN item ON event.event_hash = item.resource_id
+ WHERE event.uid = %d AND event.event_hash = '%s' LIMIT 1",
+ intval(local_channel()),
+ dbesc($resource_id)
+ );
+ 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'));
+
+ $r[0]['plink'] = [$r[0]['plink'], t('Link to source')];
+
+ $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($r[0]['dismissed'] == 0) {
+ q("UPDATE event SET dismissed = 1 WHERE event.uid = %d AND event.event_hash = '%s'",
+ intval(local_channel()),
+ dbesc($resource_id)
+ );
+ }
+ }
+ }
if(get_pconfig(local_channel(), 'cdav_calendar', 'channel_calendar')) {
$sources .= '{
@@ -1005,7 +1049,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 d47d5ad49..67e6557f9 100644
--- a/Zotlabs/Module/Channel_calendar.php
+++ b/Zotlabs/Module/Channel_calendar.php
@@ -125,10 +125,6 @@ class Channel_calendar extends \Zotlabs\Web\Controller {
}
//goaway($onerror_url);
}
-
- // $share = ((intval($_POST['distr'])) ? intval($_POST['distr']) : 0);
-
- $share = 1;
$channel = \App::get_channel();
@@ -152,23 +148,10 @@ class Channel_calendar extends \Zotlabs\Web\Controller {
$created = $x[0]['created'];
$edited = datetime_convert();
-
- if($x[0]['allow_cid'] === '<' . $channel['channel_hash'] . '>'
- && $x[0]['allow_gid'] === '' && $x[0]['deny_cid'] === '' && $x[0]['deny_gid'] === '') {
- $share = false;
- }
- else {
- $share = true;
- }
}
else {
$created = $edited = datetime_convert();
- if($share) {
- $acl->set_from_array($_POST);
- }
- else {
- $acl->set(array('allow_cid' => '<' . $channel['channel_hash'] . '>', 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => ''));
- }
+ $acl->set_from_array($_POST);
}
$post_tags = array();
@@ -239,8 +222,7 @@ class Channel_calendar extends \Zotlabs\Web\Controller {
}
}
- if($share)
- \Zotlabs\Daemon\Master::Summon(array('Notifier','event',$item_id));
+ \Zotlabs\Daemon\Master::Summon(array('Notifier','event',$item_id));
killme();
@@ -524,6 +506,14 @@ class Channel_calendar extends \Zotlabs\Web\Controller {
}
}
+ $allDay = false;
+
+ // allDay event rules
+ if(!strpos($start, 'T') && !strpos($end, 'T'))
+ $allDay = true;
+ if(strpos($start, 'T00:00:00') && strpos($end, 'T00:00:00'))
+ $allDay = true;
+
$is_first = ($d !== $last_date);
$last_date = $d;
@@ -550,17 +540,18 @@ class Channel_calendar extends \Zotlabs\Web\Controller {
'start'=> $start,
'end' => $end,
'drop' => $drop,
- 'allDay' => false,
+ 'allDay' => $allDay,
'title' => $title,
'j' => $j,
'd' => $d,
- 'is_editable' => $edit ? true : false,
+
+ 'editable' => $edit ? true : false,
'is_first'=>$is_first,
'item'=>$rr,
'html'=>$html,
- 'plink' => array($rr['plink'],t('Link to Source'),'',''),
+ 'plink' => [$rr['plink'], t('Link to source')],
'description' => $rr['description'],
'location' => $rr['location'],
diff --git a/Zotlabs/Module/Editpost.php b/Zotlabs/Module/Editpost.php
index 85882bf0a..49b2892e8 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]['resource_id']);
//goaway(z_root() . '/events/' . $itm[0]['resource_id'] . '?expandform=1');
}
diff --git a/Zotlabs/Module/Ping.php b/Zotlabs/Module/Ping.php
index f0c3a8821..3dabe0f7b 100644
--- a/Zotlabs/Module/Ping.php
+++ b/Zotlabs/Module/Ping.php
@@ -447,7 +447,7 @@ class Ping extends \Zotlabs\Web\Controller {
$when = day_translate(datetime_convert('UTC', (($rr['adjust']) ? date_default_timezone_get() : 'UTC'), $rr['dtstart'], $bd_format)) . (($today) ? ' ' . t('[today]') : '');
$result[] = array(
- 'notify_link' => z_root() . '/cdav/calendar', /// @FIXME this takes you to an edit page and it may not be yours, we really want to just view the single event --> '/events/event/' . $rr['event_hash'],
+ 'notify_link' => z_root() . '/cdav/calendar/' . $rr['event_hash'],
'name' => $rr['xchan_name'],
'addr' => $rr['xchan_addr'],
'url' => $rr['xchan_url'],