<%@ Language=VBScript %> Alexandria Cosmopolitan Rotary Club













 

EVENTS

 

Home l About Us l Roster l Committees I News I Events l Newsletter I Projects I Contact Us

 
 
  <% '============ Beginning of ASP code (Inclusion inside a tag) ======================= '============ View days containing events in a calendar like form ======================= Function GetDaysInMonth(iMonth, iYear) Dim dTemp dTemp = DateAdd("d", -1, DateSerial(iYear, iMonth + 1, 1)) GetDaysInMonth = Day(dTemp) End Function Function GetWeekdayMonthStartsOn(dAnyDayInTheMonth) Dim dTemp dTemp = DateAdd("d", -(Day(dAnyDayInTheMonth) - 1), dAnyDayInTheMonth) GetWeekdayMonthStartsOn = WeekDay(dTemp) End Function Function SubtractOneMonth(dDate) SubtractOneMonth = DateAdd("m", -1, dDate) End Function Function AddOneMonth(dDate) AddOneMonth = DateAdd("m", 1, dDate) End Function ' ***End Function Declaration*** Dim dDate ' Date we're displaying calendar for Dim iDIM ' Days In Month Dim iDOW ' Day Of Week that month starts on Dim iCurrent ' Variable we use to hold current day of month as we write table Dim iPosition ' Variable we use to hold current position in table ' Get selected date. There are two ways to do this. ' First check if we were passed a full date in RQS("date"). ' If so use it, if not look for seperate variables, putting them togeter into a date. ' Lastly check if the date is valid...if not use today If IsDate(Request.QueryString("date")) Then dDate = CDate(Request.QueryString("date")) Else If IsDate(Request.QueryString("month") & "-" & Request.QueryString("day") & "-" & Request.QueryString("year")) Then dDate = CDate(Request.QueryString("month") & "-" & Request.QueryString("day") & "-" & Request.QueryString("year")) Else dDate = Date() ' The annoyingly bad solution for those of you running IIS3 If Len(Request.QueryString("month")) <> 0 Or Len(Request.QueryString("day")) <> 0 Or Len(Request.QueryString("year")) <> 0 Or Len(Request.QueryString("date")) <> 0 Then Response.Write "The date you picked was not a valid date. The calendar was set to today's date.

" End If ' The elegant solution for those of you running IIS4 'If Request.QueryString.Count <> 0 Then Response.Write "The date you picked was not a valid date. The calendar was set to today's date.

" End If End If 'Now we've got the date. Now get Days in the choosen month and the day of the week it starts on. iDIM = GetDaysInMonth(Month(dDate), Year(dDate)) iDOW = GetWeekdayMonthStartsOn(dDate) %> Click on the days that appear highlighted in "GREY" to view a list of events in these days.
<% ' Write spacer cells at beginning of first row if month doesn't start on a Sunday. If iDOW <> 1 Then Response.Write vbTab & "" & vbCrLf iPosition = 1 Do While iPosition < iDOW Response.Write vbTab & vbTab & "" & vbCrLf iPosition = iPosition + 1 Loop End If ' Write days of month in proper day slots iCurrent = 1 iPosition = iDOW Do While iCurrent <= iDIM ' If we're at the begginning of a row then write TR If iPosition = 1 Then Response.Write vbTab & "" & vbCrLf End If ' If the day we're writing is the selected day then highlight it somehow. Set rs1 = Server.CreateObject ("ADODB.Recordset") rs1.ActiveConnection = OBJdbConnection rs1.open "select * from events where EventFromDay="&iCurrent&"and EventFromMonth ="&Month(dDate)&"and EventFromYear="&Year(dDate) if not rs1.eof then Response.Write vbTab & vbTab & "" & vbCrLf Else Response.Write vbTab & vbTab & "" & vbCrLf End If rs1.close ' If we're at the endof a row then write /TR If iPosition = 7 Then Response.Write vbTab & "" & vbCrLf iPosition = 0 End If ' Increment variables iCurrent = iCurrent + 1 iPosition = iPosition + 1 Loop ' Write spacer cells at end of last row if month doesn't end on a Saturday. If iPosition <> 1 Then Do While iPosition <= 7 Response.Write vbTab & vbTab & "" & vbCrLf iPosition = iPosition + 1 Loop Response.Write vbTab & "" & vbCrLf End If set OBJdbConnection = Nothing %>
<<< <%if MonthName("1")= MonthName(Month(dDate)) then %>January <%elseif MonthName("2")= MonthName(Month(dDate)) then%>February <%elseif MonthName("3")= MonthName(Month(dDate)) then%>March <%elseif MonthName("4")= MonthName(Month(dDate)) then%>April <%elseif MonthName("5")= MonthName(Month(dDate)) then%>May <%elseif MonthName("6")= MonthName(Month(dDate)) then%>June <%elseif MonthName("7")= MonthName(Month(dDate)) then%>July <%elseif MonthName("8")= MonthName(Month(dDate)) then%>August <%elseif MonthName("9")= MonthName(Month(dDate)) then%>September <%elseif MonthName("10")= MonthName(Month(dDate)) then%>October <%elseif MonthName("11")= MonthName(Month(dDate)) then%>November <%elseif MonthName("12")= MonthName(Month(dDate)) then%>December <%end if%> <%= " " & Year(dDate) %> >>>
Sun
Mon
Tue
Wed
Thu
Fri
Sat
 
" & iCurrent & "

" & iCurrent & "

 
 
<% '============ End of ASP code =========================================================== %>
 
     
 
  Copyright 2005 Alexandria Cosmopolitan Rotary Club.
Powered by: ClubWeb v1.0