%
Dim myPublicGoogleCalendar
myPublicGoogleCalendar = "http://www.google.com/calendar/feeds/dakjrjcqd5v4gfmc5o8ir1a6cg@group.calendar.google.com/public/basic"
' ASP Script to show current events in a neatly formatted table
Function ShowGcalendarEventList()
' Program variables
Dim calendarPageUrl ' Change this to the name of your site's calendar page
calendarPageUrl = "gcalendar.asp"
Dim nMaxEvents ' The maximum number of events that will appear at one time
nMaxEvents = 5
Dim nEventsAdded
nEventsAdded = 0
Dim strEventHeader
strEventHeader = ""
Dim strEventFooter
strEventFooter = "
"
Dim strDateFormat
strDateFormat = ""
Dim strDateFormatClose
strDateFormatClose = "
"
Dim strTitleFormat
strTitleFormat = ""
Dim strTitleFormatClose
strTitleFormat = ""
Dim strDateSeparator
strDateSeparator = "/"
Dim numEvents
numEvents = 0 ' Used to limit how many events are shown
' Database Variables
Dim rsEvents ' The events recordset
Dim strQuery ' The SQL query string
' Output the data
Dim boolHasEvents
boolHasEvents = false ' This will be true is there are any events to write
Dim nEventNum
nEventNum = 0
Do Until nEventNum = GetGcalendarEventCount() or numEvents >= nMaxEvents
' Determine if we should show this event
If GCalendarEventListShouldShow( GetGcalendarEventDateBegin(nEventNum) ) Then
numEvents = numEvents + 1
' Only write a header if we're writing events
If not boolHasEvents Then
boolHasEvents = true
End If
Response.Write(strEventHeader)
' Write Date
Response.Write( strDateFormat _
& FormatDateTime( GetGcalendarEventDateBegin(nEventNum),VBLongDate ) _
& strDateFormatClose )
' Write Title - Go to calendar entry on click
Response.Write( strTitleFormat _
& "" & GetGcalendarEventTitle(nEventNum) & "" _
& strTitleFormatClose )
Response.Write( strEventFooter )
End If
nEventNum = nEventNum + 1 'Increment event num to continue iteration
Loop
' Make sure we write SOMETHING
If not boolHasEvents Then
Response.Write("No events")
End If
End Function
Function GCalendarEventListShouldShow( dateBegin )
GCalendarEventListShouldShow = dateBegin >= Date
End Function
ParseGcalendar( myPublicGoogleCalendar ) ' Parse and sort the XML data (gcalendar_parse.asp)
ShowGcalendarEventList() ' Show it on this webpage in a nice, pretty format (gcalendar_formatter.asp)
%>