aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Module/Cdav.php1
-rw-r--r--Zotlabs/Module/Channel_calendar.php141
-rw-r--r--Zotlabs/Module/Ping.php2
-rw-r--r--view/tpl/cdav_calendar.tpl16
-rwxr-xr-xview/tpl/jot-header.tpl2
5 files changed, 17 insertions, 145 deletions
diff --git a/Zotlabs/Module/Cdav.php b/Zotlabs/Module/Cdav.php
index da013e8c8..85926db8c 100644
--- a/Zotlabs/Module/Cdav.php
+++ b/Zotlabs/Module/Cdav.php
@@ -988,6 +988,7 @@ class Cdav extends Controller {
'$more' => t('More'),
'$less' => t('Less'),
'$calendar_select_label' => t('Select calendar'),
+ '$calendar_optiopns_label' => [t('Channel Calendars'), t('CalDAV Calendars')],
'$delete' => t('Delete'),
'$delete_all' => t('Delete all'),
'$cancel' => t('Cancel'),
diff --git a/Zotlabs/Module/Channel_calendar.php b/Zotlabs/Module/Channel_calendar.php
index 70758e920..7518a4d9b 100644
--- a/Zotlabs/Module/Channel_calendar.php
+++ b/Zotlabs/Module/Channel_calendar.php
@@ -272,12 +272,6 @@ class Channel_calendar extends \Zotlabs\Web\Controller {
return;
}
-/*
-
- \App::$profile_uid = local_channel();
- nav_set_selected('Events');
-*/
-
if((argc() > 2) && (argv(1) === 'ignore') && intval(argv(2))) {
$r = q("update event set dismissed = 1 where id = %d and uid = %d",
intval(argv(2)),
@@ -291,33 +285,14 @@ class Channel_calendar extends \Zotlabs\Web\Controller {
intval(local_channel())
);
}
-
- $first_day = feature_enabled(local_channel(), 'events_cal_first_day');
- $first_day = (($first_day) ? $first_day : 0);
-
- $htpl = get_markup_template('event_head.tpl');
- \App::$page['htmlhead'] .= replace_macros($htpl,array(
- '$baseurl' => z_root(),
- '$module_url' => '/events',
- '$modparams' => 1,
- '$lang' => \App::$language,
- '$first_day' => $first_day
- ));
-
- $o = '';
-
+
$channel = \App::get_channel();
$mode = 'view';
$y = 0;
$m = 0;
$ignored = ((x($_REQUEST,'ignored')) ? " and dismissed = " . intval($_REQUEST['ignored']) . " " : '');
-
-
- // logger('args: ' . print_r(\App::$argv,true));
-
-
-
+
if(argc() > 1) {
if(argc() > 2 && argv(1) === 'add') {
$mode = 'add';
@@ -361,18 +336,6 @@ class Channel_calendar extends \Zotlabs\Web\Controller {
if(!x($orig_event))
$orig_event = array();
- // In case of an error the browser is redirected back here, with these parameters filled in with the previous values
- /*
- if(x($_REQUEST,'nofinish')) $orig_event['nofinish'] = $_REQUEST['nofinish'];
- if(x($_REQUEST,'adjust')) $orig_event['adjust'] = $_REQUEST['adjust'];
- if(x($_REQUEST,'summary')) $orig_event['summary'] = $_REQUEST['summary'];
- if(x($_REQUEST,'description')) $orig_event['description'] = $_REQUEST['description'];
- if(x($_REQUEST,'location')) $orig_event['location'] = $_REQUEST['location'];
- if(x($_REQUEST,'start')) $orig_event['dtstart'] = $_REQUEST['start'];
- if(x($_REQUEST,'finish')) $orig_event['dtend'] = $_REQUEST['finish'];
- if(x($_REQUEST,'type')) $orig_event['etype'] = $_REQUEST['type'];
- */
-
$n_checked = ((x($orig_event) && $orig_event['nofinish']) ? ' checked="checked" ' : '');
$a_checked = ((x($orig_event) && $orig_event['adjust']) ? ' checked="checked" ' : '');
$t_orig = ((x($orig_event)) ? $orig_event['summary'] : '');
@@ -382,17 +345,6 @@ class Channel_calendar extends \Zotlabs\Web\Controller {
$event_xchan = ((x($orig_event)) ? $orig_event['event_xchan'] : $channel['channel_hash']);
$mid = ((x($orig_event)) ? $orig_event['mid'] : '');
- if(! x($orig_event)) {
- $sh_checked = '';
- $a_checked = ' checked="checked" ';
- }
- else {
- $sh_checked = ((($orig_event['allow_cid'] === '<' . $channel['channel_hash'] . '>' || (! $orig_event['allow_cid'])) && (! $orig_event['allow_gid']) && (! $orig_event['deny_cid']) && (! $orig_event['deny_gid'])) ? '' : ' checked="checked" ' );
- }
-
- if($orig_event['event_xchan'])
- $sh_checked .= ' disabled="disabled" ';
-
$sdt = ((x($orig_event)) ? $orig_event['dtstart'] : 'now');
$fdt = ((x($orig_event)) ? $orig_event['dtend'] : '+1 hour');
@@ -444,62 +396,7 @@ class Channel_calendar extends \Zotlabs\Web\Controller {
}
}
}
-/*
- require_once('include/acl_selectors.php');
-
- $acl = new \Zotlabs\Access\AccessList($channel);
- $perm_defaults = $acl->get();
-
- $permissions = ((x($orig_event)) ? $orig_event : $perm_defaults);
-
- $tpl = get_markup_template('event_form.tpl');
-
- $form = replace_macros($tpl,array(
- '$post' => z_root() . '/events',
- '$eid' => $eid,
- '$type' => $type,
- '$xchan' => $event_xchan,
- '$mid' => $mid,
- '$event_hash' => $event_id,
- '$summary' => array('summary', (($event_id) ? t('Edit event title') : t('Event title')), $t_orig, t('Required'), '*'),
- '$catsenabled' => $catsenabled,
- '$placeholdercategory' => t('Categories (comma-separated list)'),
- '$c_text' => (($event_id) ? t('Edit Category') : t('Category')),
- '$category' => $category,
- '$required' => '<span class="required" title="' . t('Required') . '">*</span>',
- '$s_dsel' => datetimesel($f,new \DateTime(),\DateTime::createFromFormat('Y',$syear+5),\DateTime::createFromFormat('Y-m-d H:i',"$syear-$smonth-$sday $shour:$sminute"), (($event_id) ? t('Edit start date and time') : t('Start date and time')), 'start_text',true,true,'','',true,$first_day),
- '$n_text' => t('Finish date and time are not known or not relevant'),
- '$n_checked' => $n_checked,
- '$f_dsel' => datetimesel($f,new \DateTime(),\DateTime::createFromFormat('Y',$fyear+5),\DateTime::createFromFormat('Y-m-d H:i',"$fyear-$fmonth-$fday $fhour:$fminute"), (($event_id) ? t('Edit finish date and time') : t('Finish date and time')),'finish_text',true,true,'start_text','',false,$first_day),
- '$nofinish' => array('nofinish', t('Finish date and time are not known or not relevant'), $n_checked, '', array(t('No'),t('Yes')), 'onclick="enableDisableFinishDate();"'),
- '$adjust' => array('adjust', t('Adjust for viewer timezone'), $a_checked, t('Important for events that happen in a particular place. Not practical for global holidays.'), array(t('No'),t('Yes'))),
- '$a_text' => t('Adjust for viewer timezone'),
- '$d_text' => (($event_id) ? t('Edit Description') : t('Description')),
- '$d_orig' => $d_orig,
- '$l_text' => (($event_id) ? t('Edit Location') : t('Location')),
- '$l_orig' => $l_orig,
- '$t_orig' => $t_orig,
- '$preview' => t('Preview'),
- '$perms_label' => t('Permission settings'),
- // populating the acl dialog was a permission description from view_stream because Cal.php, which
- // displays events, says "since we don't currently have an event permission - use the stream permission"
- '$acl' => (($orig_event['event_xchan']) ? '' : populate_acl(((x($orig_event)) ? $orig_event : $perm_defaults), false, \Zotlabs\Lib\PermissionDescription::fromGlobalPermission('view_stream'))),
- '$allow_cid' => acl2json($permissions['allow_cid']),
- '$allow_gid' => acl2json($permissions['allow_gid']),
- '$deny_cid' => acl2json($permissions['deny_cid']),
- '$deny_gid' => acl2json($permissions['deny_gid']),
- '$tz_choose' => feature_enabled(local_channel(),'event_tz_select'),
- '$timezone' => array('timezone_select' , t('Timezone:'), date_default_timezone_get(), '', get_timezones()),
-
- '$lockstate' => (($acl->is_private()) ? 'lock' : 'unlock'),
-
- '$submit' => t('Submit'),
- '$advanced' => t('Advanced Options')
-
- ));
-*/
-
$thisyear = datetime_convert('UTC',date_default_timezone_get(),'now','Y');
$thismonth = datetime_convert('UTC',date_default_timezone_get(),'now','m');
if(! $y)
@@ -684,40 +581,6 @@ class Channel_calendar extends \Zotlabs\Web\Controller {
if (\App::$argv[1] === 'json'){
json_return_and_die($events);
}
-
-/*
- // links: array('href', 'text', 'extra css classes', 'title')
- if (x($_GET,'id')){
- $tpl = get_markup_template("event.tpl");
- }
- else {
- $tpl = get_markup_template("events-js.tpl");
- }
-
-
- $o = replace_macros($tpl, array(
- '$baseurl' => z_root(),
- '$new_event' => array(z_root().'/events',(($event_id) ? t('Edit Event') : t('Create Event')),'',''),
- '$previus' => array(z_root()."/events/$prevyear/$prevmonth",t('Previous'),'',''),
- '$next' => array(z_root()."/events/$nextyear/$nextmonth",t('Next'),'',''),
- '$export' => array(z_root()."/events/$y/$m/export",t('Export'),'',''),
- '$calendar' => cal($y,$m,$links, ' eventcal'),
- '$events' => $events,
- '$view_label' => t('View'),
- '$month' => t('Month'),
- '$week' => t('Week'),
- '$day' => t('Day'),
- '$prev' => t('Previous'),
- '$next' => t('Next'),
- '$today' => t('Today'),
- '$form' => $form,
- '$expandform' => ((x($_GET,'expandform')) ? true : false),
- ));
-
- if (x($_GET,'id')){ echo $o; killme(); }
-
- return $o;
-*/
}
diff --git a/Zotlabs/Module/Ping.php b/Zotlabs/Module/Ping.php
index a367b1062..f0c3a8821 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() . '/events', /// @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', /// @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'],
'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 56f3670ba..f33ccda26 100644
--- a/view/tpl/cdav_calendar.tpl
+++ b/view/tpl/cdav_calendar.tpl
@@ -69,12 +69,20 @@ $(document).ready(function() {
eventClick: function(info) {
- console.log(info);
-
var event = info.event._def;
var dtstart = new Date(info.event._instance.range.start);
var dtend = new Date(info.event._instance.range.end);
+ if(event.extendedProps.plink) {
+ if(! $('#l2s').length)
+ $('#id_title_wrapper').prepend('<span id="l2s" class="float-right"></span>');
+
+ $('#l2s').html('<a href="' + event.extendedProps.plink[0] + '" target="_blank"><i class="fa fa-external-link"></i> ' + event.extendedProps.plink[1] + '</a>');
+ }
+ else {
+ $('#l2s').remove();
+ }
+
if(event.publicId == new_event_id) {
$('#calendar_select').trigger('change');
$('#event_submit').show();
@@ -470,12 +478,12 @@ function exportDate() {
{{include file="field_input.tpl" field=$title}}
<label for="calendar_select">{{$calendar_select_label}}</label>
<select id="calendar_select" name="target" class="form-control form-group">
- <optgroup label="Channel Calendars">
+ <optgroup label="{{$calendar_optiopns_label.0}}">
{{foreach $channel_calendars as $channel_calendar}}
<option value="channel_calendar">{{$channel_calendar.displayname}}</option>
{{/foreach}}
</optgroup>
- <optgroup label="CalDAV Calendars">
+ <optgroup label="{{$calendar_optiopns_label.1}}">
{{foreach $writable_calendars as $writable_calendar}}
<option value="{{$writable_calendar.id.0}}:{{$writable_calendar.id.1}}">{{$writable_calendar.displayname}}{{if $writable_calendar.sharer}} ({{$writable_calendar.sharer}}){{/if}}</option>
{{/foreach}}
diff --git a/view/tpl/jot-header.tpl b/view/tpl/jot-header.tpl
index afaaa62d9..7b1f4ee05 100755
--- a/view/tpl/jot-header.tpl
+++ b/view/tpl/jot-header.tpl
@@ -354,7 +354,7 @@ var activeCommentText = '';
}
function itemAddToCal(id) {
- $.get('{{$baseurl}}/events/add/' + id);
+ $.get('{{$baseurl}}/channel_calendar/add/' + id);
if(timer) clearTimeout(timer);
timer = setTimeout(updateInit,1000);
}