<%@ LANGUAGE = "VBscript" %> <% OPTION EXPLICIT %> <% sub ShowHeader if not headerVisible then %> Backroads Internet Solutions: Community Calendar
Backroads Internet SolutionsQuick Links
  Home Page       Support      Rates & Plans       Calendar

Community Calendar
<% end if headerVisible=true end sub ' Display dropdown box including 3 months to either side of displayed date sub ShowMonthDropdown(centerDate) Response.Write "
Add Your New event
<% end sub sub OpenQuery(firstDayDate, nextMonth) SQL = "SELECT EventID, EventTitle, EventDate FROM CalendarEvent WHERE EventDate >= '" & firstDayDate SQL = SQL & "' AND EventDate < '" & nextMonth & "'" SQL = SQL & " AND Approved <> 0" SQL = SQL & " ORDER BY EventDate" call GetQuery(SQL, queryReadOnly) end sub sub GetNextEvent(byRef eventID, byRef eventTitle, byRef eventDate) if oRs.eof then eventID=null eventTitle=null eventDate=null else eventID=oRs("EventID").Value eventTitle=oRs("EventTitle").Value eventDate=oRs("EventDate").Value oRs.moveNext end if end sub 'Display calendar based on passed date sub ShowCalendar(specifiedDate) dim specifiedMonth, specifiedMonthName dim specifiedYear specifiedMonth = Month(specifiedDate) specifiedMonthName = MonthName(specifiedMonth) specifiedYear = Year(specifiedDate) ' Which day the first day of the month occurs dim FirstDayDate, FirstDay FirstDayDate = DateSerial(specifiedYear, specifiedMonth, 1) FirstDay = WeekDay(FirstDayDate, 0) ' Determine number of days in month dim daysInMonth, endOfMonth, nextMonth nextMonth=DateAdd("m", 1, firstDayDate) endOfMonth=DateAdd("d", -1, nextMonth) daysInMonth=day(endOfMonth) ' Determine first day to hyperlink; don't allow previous days dim today, firstValidDay, currentMonth today=date currentMonth=Month(today) firstValidDay=0 if (Month(today)=specifiedMonth) AND (Year(today)=specifiedYear) then firstValidDay=Day(today) end if call ShowMonthDropdown(specifiedDate) %> <% dim dayNumber For DayNumber = 1 to 7 Response.Write "" Next Response.Write "" ' Count out the days in the current month. We need a flag ' to say that we are now in the month we want. We are also going to have a counter, ' so we know when to put in a tag, and start the next week dim dayOfWeek dayOfWeek = 1 ' Start the first week %> <% ' Pad the beginning of the month out. If FirstDay <> 1 Then %><% End if ' We have moved some days through the week, so we need to offset dayOfWeek dayOfWeek = FirstDay dim dateIndex dateIndex = firstDayDate call OpenQuery(firstDayDate, nextMonth) dim eventID, eventTitle, eventDate call GetNextEvent(eventID, eventTitle, eventDate) dim moreEvents ' We now need to write out the days of the month FOR dayNumber=1 TO daysInMonth 'If the day we are writing out is specifiedDate, then set the cell's background colour to red. response.Write "" dayOfWeek = dayOfWeek + 1 'If we have finished the week, then start a new one. If dayOfWeek > 7 then dayOfWeek = 1 Response.Write "" End if ' move to next day dateIndex = DateAdd("d", 1, dateIndex) Next ' Fill out remaining days and close table IF dayOfWeek <> 1 Then Response.Write "" End if %>
">< <%= specifiedMonthName & ", " & specifiedYear %> ">>
" & WeekDayName(dayNumber, True, 0) & "
BGCOLOR="#ccccff">" Response.Write dayNumber & "
" moreEvents=true dim rowNumber, backColor rowNumber=0 while (NOT IsNull(eventID)) AND moreEvents if day(eventDate) = dayNumber then rowNumber = rowNumber+1 if (rowNumber MOD 2) =0 then backColor=" BGCOLOR=""lightgrey"" " ELSE backColor="" end if Response.Write "" call GetNextEvent(eventID, eventTitle, eventDate) else moreEvents=false end if wend Response.Write "
" & eventTitle & "
 
Backroads Internet, Inc. does not accept any liability for the accuracy or content of any information submitted to this Calendar. <% oRs.close set oRs=nothing end sub sub showFooter %>

<% end sub dim specifiedDate specifiedDate=Request.QueryString("specifiedDate") if specifiedDate="" OR (Not IsDate(specifiedDate)) then specifiedDate = date end if ' Main execution begins here call ShowHeader call InitConn call ShowCalendar(specifiedDate) call DeinitConn call ShowFooter %>