aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2019-04-30 10:47:48 +0200
committerMario Vavti <mario@mariovavti.com>2019-04-30 10:47:48 +0200
commit0b062d0b8ae89b40b4e036f874f6af3780c30451 (patch)
treedd37934714db3344ce7770c14755f7a62c92c25b
parent9cc1eff15cae3884458a6f7171140f2780665ff7 (diff)
downloadvolse-hubzilla-0b062d0b8ae89b40b4e036f874f6af3780c30451.tar.gz
volse-hubzilla-0b062d0b8ae89b40b4e036f874f6af3780c30451.tar.bz2
volse-hubzilla-0b062d0b8ae89b40b4e036f874f6af3780c30451.zip
select event by event_hash instead of item_id
-rw-r--r--Zotlabs/Module/Cdav.php25
-rw-r--r--Zotlabs/Module/Channel_calendar.php2
-rw-r--r--Zotlabs/Module/Editpost.php2
-rw-r--r--Zotlabs/Module/Ping.php2
-rw-r--r--view/tpl/cdav_calendar.tpl4
5 files changed, 23 insertions, 12 deletions
diff --git a/Zotlabs/Module/Cdav.php b/Zotlabs/Module/Cdav.php
index ce5b777f5..6e302935c 100644
--- a/Zotlabs/Module/Cdav.php
+++ b/Zotlabs/Module/Cdav.php
@@ -905,19 +905,18 @@ class Cdav extends Controller {
head_add_js('/library/fullcalendar/packages/list/main.min.js');
$sources = '';
- $iid = '';
+ $resource_id = '';
$resource = null;
- if(argc() == 3 && intval(argv(2)))
- $iid = argv(2);
+ if(argc() == 3)
+ $resource_id = 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($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);
@@ -925,6 +924,8 @@ class Cdav extends Controller {
$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');
@@ -940,6 +941,12 @@ class Cdav extends Controller {
}
}
+ 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)
+ );
+ }
}
}
diff --git a/Zotlabs/Module/Channel_calendar.php b/Zotlabs/Module/Channel_calendar.php
index 538951d32..6741d611c 100644
--- a/Zotlabs/Module/Channel_calendar.php
+++ b/Zotlabs/Module/Channel_calendar.php
@@ -570,7 +570,7 @@ class Channel_calendar extends \Zotlabs\Web\Controller {
'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 77f139467..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/' . $itm[0]['id']);
+ 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'],
diff --git a/view/tpl/cdav_calendar.tpl b/view/tpl/cdav_calendar.tpl
index 6dc88b493..8b91275ee 100644
--- a/view/tpl/cdav_calendar.tpl
+++ b/view/tpl/cdav_calendar.tpl
@@ -309,6 +309,10 @@ $(document).ready(function() {
if(resource !== null) {
$('.section-content-tools-wrapper, #event_form_wrapper').show();
+
+ $('#id_title_wrapper').prepend('<span id="l2s" class="float-right"></span>');
+ $('#l2s').html('<a href="' + resource.plink[0] + '" target="_blank"><i class="fa fa-external-link"></i> ' + resource.plink[1] + '</a>');
+
event_id = resource.id;
event_uri = resource.event_hash;
$('#calendar_select').val('channel_calendar').attr('disabled', true);