<% ' browser detection Set bc = Server.CreateObject("MSWC.BrowserType") ie_enhance = 0 if(bc.browser = "IE" and bc.version => 4.0) then ie_enhance = 1 Set bc = nothing %> Community Calendar

community_calendar.gif (4750 bytes)

<% Set Conn = Server.CreateObject("ADODB.Connection") Conn.Open "EVENTS" requested_month = Trim(Request.QueryString("month")) requested_year = Trim(Request.QueryString("year")) if(requested_month = "") then current_month = Month(Date) else current_month = requested_month end if if(requested_year = "") then current_year = Year(Date) else current_year = requested_year end if start_date = DateSerial(current_year, current_month, 1) function number_of_days_in_month(month) if(month = 1) then number_of_days_in_month = 31 if(month = 2) then number_of_days_in_month = 28 if(requested_year = "2000") and (month = 2) then number_of_days_in_month = 29 if(month = 3) then number_of_days_in_month = 31 if(month = 4) then number_of_days_in_month = 30 if(month = 5) then number_of_days_in_month = 31 if(month = 6) then number_of_days_in_month = 30 if(month = 7) then number_of_days_in_month = 31 if(month = 8) then number_of_days_in_month = 31 if(month = 9) then number_of_days_in_month = 30 if(month = 10) then number_of_days_in_month = 31 if(month = 11) then number_of_days_in_month = 31 if(month = 12) then number_of_days_in_month = 31 end function function month_word_from_number(month_number) if(month_number = 1) then month_word_from_number = "January" if(month_number = 2) then month_word_from_number = "February" if(month_number = 3) then month_word_from_number = "March" if(month_number = 4) then month_word_from_number = "April" if(month_number = 5) then month_word_from_number = "May" if(month_number = 6) then month_word_from_number = "June" if(month_number = 7) then month_word_from_number = "July" if(month_number = 8) then month_word_from_number = "August" if(month_number = 9) then month_word_from_number = "September" if(month_number = 10) then month_word_from_number = "October" if(month_number = 11) then month_word_from_number = "November" if(month_number = 12) then month_word_from_number = "December" end function function day_word_from_number(day_number) if(day_number = 1) then day_word_from_number = "Sunday" if(day_number = 2) then day_word_from_number = "Monday" if(day_number = 3) then day_word_from_number = "Tuesday" if(day_number = 4) then day_word_from_number = "Wednesday" if(day_number = 5) then day_word_from_number = "Thursday" if(day_number = 6) then day_word_from_number = "Friday" if(day_number = 7) then day_word_from_number = "Saturday" end function function number_of_cells_to_start number_of_cells_to_start = Weekday(current_month &"/1/" & current_year)-1 end function function make_start_week Dim return_html for i=0 to (number_of_cells_to_start-1) return_html = return_html & "x" next for i=1 to (7-number_of_cells_to_start) return_html = return_html & "" & i & "" next make_start_week = return_html end function function number_of_rows_in_month number_of_days_on_first_week = 7-(number_of_cells_to_start-1) 'number of days on first week remaining_days = number_of_days_in_month(current_month) - number_of_days_on_first_week 'remaining days whole_weeks = (remaining_days\7)+1 remaining_days = remaining_day - (whole_weeks*7) if(remaining_days = 0) then number_of_rows_in_month = whole_weeks exit function end if number_of_rows_in_month = whole_weeks+1 end function function eventsDay(var_day) dim return_html event_sql = "SELECT ID, contact, Date, Time, Location, Description, Group FROM Events WHERE (((Events.Date)=#" & var_day & "#));" Set eventRS = Conn.execute(event_sql) do while not eventRS.eof if(ie_enhance = 0) then return_html = return_html & "Event!
" end if if(ie_enhance = 1) then return_html = return_html & "

Event!
" return_html = return_html & "" return_html = return_html & "
" & eventRS("Group") & "

" return_html = return_html & "Time:" return_html = return_html & "" & eventRS("time") & "
" return_html = return_html & "Location:" return_html = return_html & "" & eventRS("Location") & "
" return_html = return_html & "Description:" return_html = return_html & "" & eventRS("Description") & "
" return_html = return_html & "


" return_html = return_html & "
Close
" return_html = return_html & "
" end if return_html = return_html & "" & eventRS("Group") & "
" eventRS.movenext loop eventRS.close eventsDay = return_html end function function GenerateDay(var_day) dim return_html if(var_day = Date) then return_html = "
" & Day(var_day) & "

" else return_html = "
" & Day(var_day) & "

" end if meeting_sql = "SELECT contact, agenda, minutes, Meetings.ID, Meetings.Date, Meetings.Time, Meetings.Location, Description, Meetings.Group FROM Meetings WHERE (((Meetings.Date)=#" & var_day & "#));" Set meetingRS = Conn.execute(meeting_sql) do while not meetingRS.eof if(ie_enhance = 0) then return_html = return_html & "Meeting!
" end if if(ie_enhance = 1) then return_html = return_html & "
Meeting!
" return_html = return_html & "" return_html = return_html & "
" &meetingRS("Group") & "

" return_html = return_html & "Time:" return_html = return_html & "" & meetingRS("time") & "
" return_html = return_html & "Location:" return_html = return_html & "" & meetingRS("Location") & "
" return_html = return_html & "Description:" return_html = return_html & "" & meetingRS("Description") & "
" if(not meetingRS("agenda") = "") then return_html = return_html & "Agenda:" return_html = return_html & "Agenda available online.
" end if if(not meetingRS("minutes") = "") then return_html = return_html & "Minutes:" return_html = return_html & "Minutes available online.
" end if return_html = return_html & "


" return_html = return_html & "
Close
" return_html = return_html & "
" end if return_html = return_html & "" & meetingRS("Group") & "
" meetingRS.movenext loop meetingRS.close return_html = return_html & " " & eventsDay(var_day) GenerateDay = return_html end function %>

<% next_month = current_month+1 next_year = current_year if(next_month = 13) then next_month = 1 next_year = current_year +1 end if prev_month = current_month-1 prev_year = current_year if(prev_month = 0) then prev_month = 12 prev_year = current_year -1 end if %>

<%=month_word_from_number(current_month)%> <%=current_year%>

<%=month_word_from_number(prev_month)%> <%=prev_year%>      <%=month_word_from_number(next_month)%> <%=next_year%>

<% for blank_count = 0 to (Weekday(start_date)-2) %> <% next %> <% for day_number = 1 to number_of_days_in_month(current_month) Dynamic_Date = DateSerial(current_year, current_month, day_number) Dynamic_Weekday = Weekday(Dynamic_Date) %> <% if(Dynamic_Weekday = 1) then %> <% end if %> <% if(Dynamic_Weekday = 7) then %> <% end if %> <% next %>
Sunday Monday Tuesday Wednesday Thursday Friday Saturday
 
<%=GenerateDay(Dynamic_Date)%>

<% Conn.close %>

 

Jump to another month: