aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Lib/ThreadItem.php10
-rw-r--r--Zotlabs/Module/Cdav.php51
-rw-r--r--Zotlabs/Module/Channel_calendar.php21
-rw-r--r--Zotlabs/Module/Display.php2
-rw-r--r--Zotlabs/Module/Editpost.php2
-rw-r--r--Zotlabs/Module/Item.php16
-rw-r--r--Zotlabs/Module/Ping.php2
-rw-r--r--Zotlabs/Widget/Cdav.php2
8 files changed, 86 insertions, 20 deletions
diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php
index 40c0fca4b..31259f012 100644
--- a/Zotlabs/Lib/ThreadItem.php
+++ b/Zotlabs/Lib/ThreadItem.php
@@ -305,6 +305,7 @@ class ThreadItem {
if($this->is_commentable() && $observer) {
$like = array( t("I like this \x28toggle\x29"), t("like"));
$dislike = array( t("I don't like this \x28toggle\x29"), t("dislike"));
+ $reply_to = array( t("Reply on this comment"), t("reply"), t("Reply to"));
}
if ($shareable) {
@@ -348,9 +349,6 @@ class ThreadItem {
$list_unseen_txt = (($unseen_comments) ? sprintf('%d unseen',$unseen_comments) : '');
-
-
-
$children = $this->get_children();
$has_tags = (($body['tags'] || $body['categories'] || $body['mentions'] || $body['attachments'] || $body['folders']) ? true : false);
@@ -373,6 +371,8 @@ class ThreadItem {
'text' => strip_tags($body['html']),
'id' => $this->get_id(),
'mid' => $item['mid'],
+ 'parent' => $item['parent'],
+ 'author_id' => $item['author']['xchan_addr'],
'isevent' => $isevent,
'attend' => $attend,
'consensus' => $consensus,
@@ -425,9 +425,10 @@ class ThreadItem {
'has_tags' => $has_tags,
'reactions' => $this->reactions,
// Item toolbar buttons
- 'emojis' => (($this->is_toplevel() && $this->is_commentable() && $observer && feature_enabled($conv->get_profile_owner(),'emojis')) ? '1' : ''),
+ 'emojis' => (($this->is_toplevel() && $this->is_commentable() && $observer && feature_enabled($conv->get_profile_owner(),'emojis')) ? '1' : ''),
'like' => $like,
'dislike' => ((feature_enabled($conv->get_profile_owner(),'dislike')) ? $dislike : ''),
+ 'reply_to' => (((! $this->is_toplevel()) && feature_enabled($conv->get_profile_owner(),'reply_to')) ? $reply_to : ''),
'share' => $share,
'embed' => $embed,
'rawmid' => $item['mid'],
@@ -869,4 +870,3 @@ class ThreadItem {
}
-
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..7fa03fb34 100644
--- a/Zotlabs/Module/Channel_calendar.php
+++ b/Zotlabs/Module/Channel_calendar.php
@@ -147,6 +147,11 @@ class Channel_calendar extends \Zotlabs\Web\Controller {
}
return;
}
+
+ if($x[0]['event_xchan'] !== $channel['xchan_hash']) {
+ notice( t('Not allowed.') . EOL);
+ return;
+ }
$acl->set($x[0]);
@@ -524,6 +529,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 +563,19 @@ 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,
+ 'className' => 'channel_calendar_id_' . $rr['id'],
'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/Display.php b/Zotlabs/Module/Display.php
index 5983578b3..b7d4a5922 100644
--- a/Zotlabs/Module/Display.php
+++ b/Zotlabs/Module/Display.php
@@ -265,7 +265,7 @@ class Display extends \Zotlabs\Web\Controller {
$sysid = $sys['channel_id'];
if(local_channel()) {
- $r = q("SELECT item.id as item_id from item WHERE uid = %d and mid = '%s' $item_normal limit 1",
+ $r = q("SELECT item.parent as item_id from item WHERE uid = %d and mid = '%s' $item_normal limit 1",
intval(local_channel()),
dbesc($target_item['parent_mid'])
);
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/Item.php b/Zotlabs/Module/Item.php
index 6bc8c645f..11ce1d268 100644
--- a/Zotlabs/Module/Item.php
+++ b/Zotlabs/Module/Item.php
@@ -216,7 +216,7 @@ class Item extends Controller {
$parent = ((x($_REQUEST,'parent')) ? intval($_REQUEST['parent']) : 0);
$parent_mid = ((x($_REQUEST,'parent_mid')) ? trim($_REQUEST['parent_mid']) : '');
-
+
$remote_xchan = ((x($_REQUEST,'remote_xchan')) ? trim($_REQUEST['remote_xchan']) : false);
$r = q("select * from xchan where xchan_hash = '%s' limit 1",
dbesc($remote_xchan)
@@ -329,9 +329,14 @@ class Item extends Controller {
$obj_type = ACTIVITY_OBJ_COMMENT;
if($parent) {
- $r = q("SELECT * FROM item WHERE id = %d LIMIT 1",
+ // Get commented post data
+ $rr = q("SELECT parent, mid FROM item WHERE id = %d LIMIT 1",
intval($parent)
);
+ // and its parent
+ $r = q("SELECT * FROM item WHERE id = %d LIMIT 1",
+ intval($rr[0]['parent'])
+ );
}
elseif($parent_mid && $uid) {
// This is coming from an API source, and we are logged in
@@ -910,8 +915,7 @@ class Item extends Controller {
}
if($parent_item)
- $parent_mid = $parent_item['mid'];
-
+ $parent_mid = $rr[0]['mid'];
// Fallback so that we alway have a thr_parent
@@ -1014,7 +1018,7 @@ class Item extends Controller {
$datarray['term'] = $post_tags;
$datarray['plink'] = $plink;
$datarray['route'] = $route;
-
+
// A specific ACL over-rides public_policy completely
@@ -1160,7 +1164,7 @@ class Item extends Controller {
'verb' => ACTIVITY_POST,
'otype' => 'item',
'parent' => $parent,
- 'parent_mid' => $parent_item['mid']
+ 'parent_mid' => $rr[0]['mid']
));
}
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'],
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);