Page 1 of 1

CGCalendar multi-day events not showing correctly

Posted: Tue Jul 25, 2017 6:42 pm
by webform

Code: Select all

CGCalendar v.2.4.4
I have customised CGCalendar defaultView for FullCalendar template and for most parts it's working correctly except multi-day events is omitted, if the events start date is before current date.

So if CGCalendar view is today + next 2 days (duration is set to 3 days) and the multi-day event start date is also today then the event is displayed in the calendar.
Multi-day event is displayed if start date is today date.
Multi-day event is displayed if start date is today date.
But if the multi-day event start date is before today, the event is NOT displayed in the calendar.
Multi-day event not displayed if start date is before today date.
Multi-day event not displayed if start date is before today date.
The setting in the FullCalendar template:

Code: Select all

     defaultView: 'agenda',
     duration: { days: 3 },
If i manually insert the event dates in the FullCalendar template then the multi-day event is displayed in the calendar.

So it seems to have something to do with how the dates is fetched via URL but i don't now if it's abug or something that can be solved?

Re: CGCalendar multi-day events not showing correctly

Posted: Tue Jul 25, 2017 8:24 pm
by calguy1000
I just tested this with the standard templates and it works fine here.

I suggest you test using the standard templates. If it works fine there... then you need to dig further.

Re: CGCalendar multi-day events not showing correctly

Posted: Tue Jul 25, 2017 10:37 pm
by webform
Hmm! I've just installed a fresh copy of CMSMS 2.2.2 and CGCalendar 2.4.7.

Created a new event with start date 'July 24 9.00 AM' and end date 'August 4 2.00 PM'.

Default 'CGCalendar FullCalendar View Sample' template.

The event display just fine.
Default CGCalendar View.
Default CGCalendar View.
If i then add 'defaultView' and 'duration' to the FullCalendar View template, it stops working and the event is not displayed in the current view.

Code: Select all

     defaultView: 'agenda',
     duration: { days: 3 },
When 'defaultView' and 'duration' is added to the FullCalendar View template.
When 'defaultView' and 'duration' is added to the FullCalendar View template.
So the event is not showing if the start date is earlier than current date/view.

If i navigate back to the event start date, the event starts to show again.
When navigating to the event start date the event is showing.
When navigating to the event start date the event is showing.
Is this setup any different from yours?

Re: CGCalendar multi-day events not showing correctly

Posted: Tue Jul 25, 2017 10:39 pm
by calguy1000
I changed the defaultDays, but did not play with the duration.

I created an event that went from a Saturday through to a Monday.

Re: CGCalendar multi-day events not showing correctly

Posted: Tue Jul 25, 2017 11:04 pm
by webform
Yes it seems to be somehow connected to 'duration' and that the events is fetched as a feed.

If i in the FullCalendar View template replace the event feed

Code: Select all

events: {
       url:  '{$fetch_url}',
       type: 'GET',
       data: {
         '{$actionid}showchildren': 1,
	 '{$actionid}detailpage': '{$detailpage}',
	 '{$actionid}eventtemplate': '{$actionparams.eventtemplate|default:''}',
	 '{$actionid}editpage': '{$actionparams.editpage|default:''}',
	 '{$actionid}editeventtemplate': '{$actionparams.editeventtemplate|default:''}',
       },
       error: function() {
         alert('{$mod->Lang('error_fetching_events')|cms_escape}');
       }
     },
     defaultView: 'agenda',
     duration: { days: 3 },
with

Code: Select all

events: [
	{
		id:'1',
		title:'Multi-day event',
		summary:'',
		details:'',
		canedit:1,
		candelete:1,
		color:null,
		textColor:null,
		start:'2017-07-24 09:00:00',
		end:'2017-08-04 14:00:00',
		allDay:false,
		detail_url:'\/\/localhost:8888\/cmsms222\/index.php?mact=CGCalendar,cntnt01,default,0&cntnt01event_id=1&cntnt01display=event&cntnt01returnid=1'
	}
],
     defaultView: 'agenda',
     duration: { days: 3 },
Then the event display correctly.
So something goes wrong in the combination of 'duration' and using event feed.

Re: CGCalendar multi-day events not showing correctly

Posted: Wed Jul 26, 2017 10:32 pm
by webform
I've figured out a "work around" to my issue with fullcalendar, defaultView and duration.

I've used an Upcoming list template where the output is formatted to use in FullCalendar and replaced the feed script in the fullcalendar template.

So now my "CGCalendar::fullCalendar View" template is fetching the events like this:

Code: Select all

events: {cms_module module='CGCalendar' display='upcominglist'},
defaultView: 'agenda',
duration: { days: 3 },
My output from the upcominglist template looks like this:

Code: Select all

[ {title: 'Multi-day event', color:'#ff0000', textColor:'#FFFFFF', allDay:false, start: '2017-07-24 09:00:00', end: '2017-08-04 14:00:00'},{title: 'Some all day event', color:'#ff0000', textColor:'#FFFFFF', allDay:true, start: '2017-07-27 07:00:00'} ]