My favorites | Sign in
Project Home Issues
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 1391: Manually created events dont parse gCal recurrence
1 person starred this issue and may be notified of changes. Back to list
Status:  Invalid
Owner:  ----
Closed:  Aug 2013


Sign in to add a comment
 
Reported by clearb...@goodmannetworks.com, May 3, 2012
can you add a source-type value or something so that manually created sources can be treated as google calendar feeds.
 I have an issue where i have to authenticate my calendar, i was able to use an XHR and tie it into the calendar, but it doesnt know how to handle recurrence.


here is the code im using to pull events
events: function(start, end, callback) {
				xhr=new XMLHttpRequest();


				xurl='https://www.google.com/calendar/feeds/clearband.com_vl5ggei2hdh44jneejjet6qfso%40group.calendar.google.com/private/full'
				n=new Date()
				parameters="start="+start+"&end="+end+"&max-results=9999&_="+n
				xhr.open("Get",xurl,true);

				xhr.setRequestHeader("Authorization","GoogleLogin auth="+gctoken)
				xhr.send(parameters)			
				xhr.onreadystatechange=function() {
					if ( xhr.readyState==4) {
						xd=xhr.responseXML
						entries=xd.getElementsByTagName('entry')
						events=[]
						c=entries.length
						e=0
						while (e<c) {
							id=entries[e].getElementsByTagName('gCal:uid')
							id=id[0].getAttribute('value')
							id=id.replace('@google.com','')
							title=entries[e].getElementsByTagName('title')
								title=title[0].text
							try {
								when=entries[e].getElementsByTagName('gd:when')
							
								start=when[0].getAttribute('startTime')
								allDay = start.indexOf('T') == -1;
								start=$.fullCalendar.parseISO8601(start, true);
								end=when[0].getAttribute('endTime')
								end=$.fullCalendar.parseISO8601(end, true);
								} catch(err) {
									when=entries[e].getElementsByTagName('gd:recurrence')
									when=when[0].firstChild.nodeValue
									sinit=when.indexOf('DTSTART')+7+6+5+1
									
									start=when.substr(sinit,8)
									allDay = start.indexOf('T') == -1;	
									syr=start.substr(0,4)
									smo=start.substr(4,2)
									
									sda=start.substr(6,2)
									start=new Date()
									start.setFullYear(syr)
									start.setDate(sda)
									start.setMonth(smo-1)

															
								

									einit=when.indexOf('DTEND')+7+6+5
									eend=einit+8
									end=when.substr(einit,eend)
									eyr=end.substr(0,4)
									emo=end.substr(4,2)
									eda=end.substr(6,2)
									end=new Date()
									end.setFullYear(eyr)
									end.setDate(eda)
									end.setMonth(emo-1)
							
								}
						
							var callnk
							var url
							var icolnk=""
							links=entries[e].getElementsByTagName('link')
							l=links.length
							s=0
								while (s<l) {
									currType=links[s].getAttribute('type')

									if (currType=='test/html') { url=links[s].getAttribute('href') }
									if (currType=='application/atom+xml') { callnk=links[s].getAttribute('href') }													if (currType.indexOf('image') > 0) { icolnk=links[s].getAttribute('href') }
									if (currType.indexOf('image') == 0) { icolnk=links[s].getAttribute('href') }								
								 s++;
								}
							
							description=entries[e].getElementsByTagName('content')
						
								description=description[0].text
							
							lcn=entries[e].getElementsByTagName('gd:where')
							
							pubStr=entries[e].getElementsByTagName('published')
							pubStr=pubStr[0].firstChild.nodeValue
							published=$.fullCalendar.parseISO8601(pubStr, true);
							updStr=entries[e].getElementsByTagName('updated')
							updStr=updStr[0].firstChild.nodeValue
							updated=$.fullCalendar.parseISO8601(updStr, true);
							events.push({
								id: id,
								title: title,
								description: description,
								start: start,
								end: end,
								allDay: allDay,
								lnk: url,
								cid: callnk,
								icon: icolnk,
								location: lcn[0].getAttribute('valueString'),
								published: published,
								updated:  updated
						
							
							});
							e++;						
						}

						callback(events)
					}



and here is the event  'recurrence' tag from google

<gd:recurrence>DTSTART;VALUE=DATE:20120503
DTEND;VALUE=DATE:20120504
RRULE:FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR
BEGIN:VTIMEZONE
TZID:America/New_York
X-LIC-LOCATION:America/New_York
BEGIN:DAYLIGHT
TZOFFSETFROM:-0500
TZOFFSETTO:-0400
TZNAME:EDT
DTSTART:19700308T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:-0400
TZOFFSETTO:-0500
TZNAME:EST
DTSTART:19701101T020000
RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU
END:STANDARD
END:VTIMEZONE
</gd:recurrence>

tehre is no end to this string of events, but it recurrs m-f as an all day

Aug 18, 2013
Project Member #1 adamrs...@gmail.com
the fullcalendar gcal plugin sets the "singleevents" parameter to `true`, and google sends recurring events that are each distinct events, but i can't help you much more than that, as your main issue is dealing w/ google calendar's api, not with fullcalendar itself.

fyi, for native recurring event support in fullcalendar, see  issue 116 
Status: Invalid
Sign in to add a comment

Powered by Google Project Hosting