calendar merge: bring back event categories
This commit is contained in:
parent
79654635d3
commit
f616b2d49a
@ -952,6 +952,8 @@ class Cdav extends Controller {
|
|||||||
$description = ['description', t('Description')];
|
$description = ['description', t('Description')];
|
||||||
$location = ['location', t('Location')];
|
$location = ['location', t('Location')];
|
||||||
|
|
||||||
|
$catsenabled = feature_enabled(local_channel(), 'categories');
|
||||||
|
|
||||||
require_once('include/acl_selectors.php');
|
require_once('include/acl_selectors.php');
|
||||||
|
|
||||||
$accesslist = new \Zotlabs\Access\AccessList($channel);
|
$accesslist = new \Zotlabs\Access\AccessList($channel);
|
||||||
@ -1001,7 +1003,9 @@ class Cdav extends Controller {
|
|||||||
'$allow_cid' => acl2json($permissions['allow_cid']),
|
'$allow_cid' => acl2json($permissions['allow_cid']),
|
||||||
'$allow_gid' => acl2json($permissions['allow_gid']),
|
'$allow_gid' => acl2json($permissions['allow_gid']),
|
||||||
'$deny_cid' => acl2json($permissions['deny_cid']),
|
'$deny_cid' => acl2json($permissions['deny_cid']),
|
||||||
'$deny_gid' => acl2json($permissions['deny_gid'])
|
'$deny_gid' => acl2json($permissions['deny_gid']),
|
||||||
|
'$catsenabled' => $catsenabled,
|
||||||
|
'$categories_label' => t('Categories')
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return $o;
|
return $o;
|
||||||
|
@ -47,7 +47,7 @@ class Channel_calendar extends \Zotlabs\Web\Controller {
|
|||||||
|
|
||||||
$tz = (($timezone) ? $timezone : date_default_timezone_get());
|
$tz = (($timezone) ? $timezone : date_default_timezone_get());
|
||||||
|
|
||||||
$categories = escape_tags(trim($_POST['category']));
|
$categories = escape_tags(trim($_POST['categories']));
|
||||||
|
|
||||||
// only allow editing your own events.
|
// only allow editing your own events.
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ class Channel_calendar extends \Zotlabs\Web\Controller {
|
|||||||
|
|
||||||
//fixme: this url gives a wsod if there is a linebreak detected in one of the variables ($desc or $location)
|
//fixme: this url gives a wsod if there is a linebreak detected in one of the variables ($desc or $location)
|
||||||
//$onerror_url = z_root() . "/events/" . $action . "?summary=$summary&description=$desc&location=$location&start=$start_text&finish=$finish_text&adjust=$adjust&nofinish=$nofinish&type=$type";
|
//$onerror_url = z_root() . "/events/" . $action . "?summary=$summary&description=$desc&location=$location&start=$start_text&finish=$finish_text&adjust=$adjust&nofinish=$nofinish&type=$type";
|
||||||
$onerror_url = z_root() . "/events";
|
//$onerror_url = z_root() . "/events";
|
||||||
|
|
||||||
if(strcmp($finish,$start) < 0 && !$nofinish) {
|
if(strcmp($finish,$start) < 0 && !$nofinish) {
|
||||||
notice( t('Event can not end before it has started.') . EOL);
|
notice( t('Event can not end before it has started.') . EOL);
|
||||||
@ -114,7 +114,7 @@ class Channel_calendar extends \Zotlabs\Web\Controller {
|
|||||||
echo( t('Unable to generate preview.'));
|
echo( t('Unable to generate preview.'));
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
goaway($onerror_url);
|
//goaway($onerror_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
if((! $summary) || (! $start)) {
|
if((! $summary) || (! $start)) {
|
||||||
@ -123,7 +123,7 @@ class Channel_calendar extends \Zotlabs\Web\Controller {
|
|||||||
echo( t('Unable to generate preview.'));
|
echo( t('Unable to generate preview.'));
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
goaway($onerror_url);
|
//goaway($onerror_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
// $share = ((intval($_POST['distr'])) ? intval($_POST['distr']) : 0);
|
// $share = ((intval($_POST['distr'])) ? intval($_POST['distr']) : 0);
|
||||||
@ -242,6 +242,8 @@ class Channel_calendar extends \Zotlabs\Web\Controller {
|
|||||||
if($share)
|
if($share)
|
||||||
\Zotlabs\Daemon\Master::Summon(array('Notifier','event',$item_id));
|
\Zotlabs\Daemon\Master::Summon(array('Notifier','event',$item_id));
|
||||||
|
|
||||||
|
killme();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -379,26 +381,6 @@ class Channel_calendar extends \Zotlabs\Web\Controller {
|
|||||||
if(! $f)
|
if(! $f)
|
||||||
$f = 'ymd';
|
$f = 'ymd';
|
||||||
|
|
||||||
$catsenabled = feature_enabled(local_channel(),'categories');
|
|
||||||
|
|
||||||
$category = '';
|
|
||||||
|
|
||||||
if($catsenabled && x($orig_event)){
|
|
||||||
$itm = q("select * from item where resource_type = 'event' and resource_id = '%s' and uid = %d limit 1",
|
|
||||||
dbesc($orig_event['event_hash']),
|
|
||||||
intval(local_channel())
|
|
||||||
);
|
|
||||||
$itm = fetch_post_tags($itm);
|
|
||||||
if($itm) {
|
|
||||||
$cats = get_terms_oftype($itm[0]['term'], TERM_CATEGORY);
|
|
||||||
foreach ($cats as $cat) {
|
|
||||||
if(strlen($category))
|
|
||||||
$category .= ', ';
|
|
||||||
$category .= $cat['term'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$thisyear = datetime_convert('UTC',date_default_timezone_get(),'now','Y');
|
$thisyear = datetime_convert('UTC',date_default_timezone_get(),'now','Y');
|
||||||
$thismonth = datetime_convert('UTC',date_default_timezone_get(),'now','m');
|
$thismonth = datetime_convert('UTC',date_default_timezone_get(),'now','m');
|
||||||
if(! $y)
|
if(! $y)
|
||||||
@ -472,7 +454,7 @@ class Channel_calendar extends \Zotlabs\Web\Controller {
|
|||||||
// Noting this for now - it will need to be fixed here and in Friendica.
|
// Noting this for now - it will need to be fixed here and in Friendica.
|
||||||
// Ultimately the finish date shouldn't be involved in the query.
|
// Ultimately the finish date shouldn't be involved in the query.
|
||||||
|
|
||||||
$r = q("SELECT event.*, item.plink, item.item_flags, item.author_xchan, item.owner_xchan
|
$r = q("SELECT event.*, item.plink, item.item_flags, item.author_xchan, item.owner_xchan, item.id as item_id
|
||||||
from event left join item on event_hash = resource_id
|
from event left join item on event_hash = resource_id
|
||||||
where resource_type = 'event' and event.uid = %d and event.uid = item.uid $ignored
|
where resource_type = 'event' and event.uid = %d and event.uid = item.uid $ignored
|
||||||
AND (( adjust = 0 AND ( dtend >= '%s' or nofinish = 1 ) AND dtstart <= '%s' )
|
AND (( adjust = 0 AND ( dtend >= '%s' or nofinish = 1 ) AND dtstart <= '%s' )
|
||||||
@ -483,6 +465,8 @@ class Channel_calendar extends \Zotlabs\Web\Controller {
|
|||||||
dbesc($adjust_start),
|
dbesc($adjust_start),
|
||||||
dbesc($adjust_finish)
|
dbesc($adjust_finish)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$links = array();
|
$links = array();
|
||||||
@ -527,6 +511,18 @@ class Channel_calendar extends \Zotlabs\Web\Controller {
|
|||||||
$end = null;
|
$end = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$catsenabled = feature_enabled(local_channel(),'categories');
|
||||||
|
$categories = '';
|
||||||
|
if($catsenabled){
|
||||||
|
if($rr['term']) {
|
||||||
|
$cats = get_terms_oftype($rr['term'], TERM_CATEGORY);
|
||||||
|
foreach ($cats as $cat) {
|
||||||
|
if(strlen($categories))
|
||||||
|
$categories .= ', ';
|
||||||
|
$categories .= $cat['term'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$is_first = ($d !== $last_date);
|
$is_first = ($d !== $last_date);
|
||||||
|
|
||||||
@ -573,6 +569,8 @@ class Channel_calendar extends \Zotlabs\Web\Controller {
|
|||||||
'allow_gid' => expand_acl($rr['allow_gid']),
|
'allow_gid' => expand_acl($rr['allow_gid']),
|
||||||
'deny_cid' => expand_acl($rr['deny_cid']),
|
'deny_cid' => expand_acl($rr['deny_cid']),
|
||||||
'deny_gid' => expand_acl($rr['deny_gid']),
|
'deny_gid' => expand_acl($rr['deny_gid']),
|
||||||
|
|
||||||
|
'categories' => $categories
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,3 +29,9 @@ main.fullscreen .fc td:last-child {
|
|||||||
.fc-list-view {
|
.fc-list-view {
|
||||||
border-width: 0px;
|
border-width: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.bootstrap-tagsinput {
|
||||||
|
width: 100%;
|
||||||
|
padding: 6px 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -69,10 +69,13 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
eventClick: function(info) {
|
eventClick: function(info) {
|
||||||
|
|
||||||
|
//reset categories
|
||||||
|
$('#id_categories').tagsinput('removeAll');
|
||||||
|
|
||||||
var event = info.event._def;
|
var event = info.event._def;
|
||||||
var dtstart = new Date(info.event._instance.range.start);
|
var dtstart = new Date(info.event._instance.range.start);
|
||||||
var dtend = new Date(info.event._instance.range.end);
|
var dtend = new Date(info.event._instance.range.end);
|
||||||
|
console.log(event.extendedProps.categories);
|
||||||
if(event.extendedProps.plink) {
|
if(event.extendedProps.plink) {
|
||||||
if(! $('#l2s').length)
|
if(! $('#l2s').length)
|
||||||
$('#id_title_wrapper').prepend('<span id="l2s" class="float-right"></span>');
|
$('#id_title_wrapper').prepend('<span id="l2s" class="float-right"></span>');
|
||||||
@ -110,6 +113,7 @@ $(document).ready(function() {
|
|||||||
event_uri = event.extendedProps.uri;
|
event_uri = event.extendedProps.uri;
|
||||||
$('#id_title').val(event.title);
|
$('#id_title').val(event.title);
|
||||||
$('#calendar_select').val(calendar_id).attr('disabled', true).trigger('change');
|
$('#calendar_select').val(calendar_id).attr('disabled', true).trigger('change');
|
||||||
|
$('#id_categories').tagsinput('add', event.extendedProps.categories);
|
||||||
$('#id_dtstart').val(dtstart.toUTCString());
|
$('#id_dtstart').val(dtstart.toUTCString());
|
||||||
$('#id_dtend').val(dtend.toUTCString());
|
$('#id_dtend').val(dtend.toUTCString());
|
||||||
$('#id_description').val(event.extendedProps.description);
|
$('#id_description').val(event.extendedProps.description);
|
||||||
@ -233,9 +237,9 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
$('#calendar_select').on('change', function() {
|
$('#calendar_select').on('change', function() {
|
||||||
if(this.value === 'channel_calendar')
|
if(this.value === 'channel_calendar')
|
||||||
$('#dbtn-acl').removeClass('d-none');
|
$('#dbtn-acl, #id_categories_wrapper').removeClass('d-none');
|
||||||
else
|
else
|
||||||
$('#dbtn-acl').addClass('d-none');
|
$('#dbtn-acl, #id_categories_wrapper').addClass('d-none');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.color-edit').colorpicker({ input: '.color-edit-input' });
|
$('.color-edit').colorpicker({ input: '.color-edit-input' });
|
||||||
@ -325,7 +329,7 @@ function on_submit() {
|
|||||||
'dtstart': $('#id_dtstart').val(),
|
'dtstart': $('#id_dtstart').val(),
|
||||||
'dtend': $('#id_dtend').val(),
|
'dtend': $('#id_dtend').val(),
|
||||||
'adjust': 0,
|
'adjust': 0,
|
||||||
'category': '',
|
'categories': $('#id_categories').val(),
|
||||||
'desc': $('#id_description').val(),
|
'desc': $('#id_description').val(),
|
||||||
'location': $('#id_location').val(),
|
'location': $('#id_location').val(),
|
||||||
'submit': $('#event_submit').val(),
|
'submit': $('#event_submit').val(),
|
||||||
@ -403,6 +407,7 @@ function reset_form() {
|
|||||||
$('#calendar_select').val('');
|
$('#calendar_select').val('');
|
||||||
event_uri = '';
|
event_uri = '';
|
||||||
$('#id_title').val('');
|
$('#id_title').val('');
|
||||||
|
$('#id_categories').tagsinput('removeAll');
|
||||||
$('#id_dtstart').val('');
|
$('#id_dtstart').val('');
|
||||||
$('#id_dtend').val('');
|
$('#id_dtend').val('');
|
||||||
|
|
||||||
@ -490,6 +495,12 @@ function exportDate() {
|
|||||||
</optgroup>
|
</optgroup>
|
||||||
</select>
|
</select>
|
||||||
<div id="more_block" style="display: none;">
|
<div id="more_block" style="display: none;">
|
||||||
|
{{if $catsenabled}}
|
||||||
|
<div id="id_categories_wrapper" class="form-group">
|
||||||
|
<label id="label_categories" for="id_categories">{{$categories_label}}</label>
|
||||||
|
<input name="categories" id="id_categories" class="form-control" type="text" value="{{$categories}}" data-role="cat-tagsinput" />
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
{{include file="field_input.tpl" field=$dtstart}}
|
{{include file="field_input.tpl" field=$dtstart}}
|
||||||
{{include file="field_input.tpl" field=$dtend}}
|
{{include file="field_input.tpl" field=$dtend}}
|
||||||
{{include file="field_textarea.tpl" field=$description}}
|
{{include file="field_textarea.tpl" field=$description}}
|
||||||
|
Reference in New Issue
Block a user