%@ LANGUAGE=VBSCRIPT %>
<%
response.expires=0
response.buffer=true
%>
<%
'Calendar.asp
Dim Rs
Dim Conn
Dim sSQL ,sWhere
Dim dDate ' Date we're displaying calendar for
Dim iDay ' Variable we use to hold current day of month as we write table
Dim iDayofWeek ' Variable we use to hold current position in table
Dim iThisMonth, iThisYear
Dim bgnDate,endDate, EventDate
Dim iDIM ' Days In Month
Dim iDOW ' Day Of Week that month starts on
dDate=Request.Form("date")
If IsDate(dDate) Then
dDate = CDate(Request.Form("date"))
iThisMonth=Month(dDate)
iThisYear=Year(dDate)
Else
iThisMonth=cint(request.form("cboMonth"))
iThisYear=cint(request.form("cboYear"))
If IsDate(iThisMonth & "-1-" & iThisYear) Then
dDate = CDate(iThisMonth & "-1-" & iThisYear)
Else
dDate = Date()
iThisMonth=Month(dDate)
iThisYear=Year(dDate)
End If
End If
bgnDate=cstr(dateserial(iThisYear,iThisMonth ,1 ) & " 00:00 AM")
endDate=cstr(dateserial(iThisYear,(iThisMonth + 1),1 ) & " 00:00 AM")
Set Conn=Server.CreateObject("ADODB.Connection")
Conn.ConnectionString= GetConnectString()
Conn.Open
Set Rs = Server.CreateObject("ADODB.Recordset")
if (Request.Form("keywords")<>"") then
Dim titleSearch
titleSearch = Trim(Request.Form("keywords"))
titleSearch = Replace (titleSearch,"'","''")
titleSearch = Replace (titleSearch," ","%' or Title like '%")
titleSearch = "Title like '%"&titleSearch&"%'"
Dim descSearch
descSearch = Replace(titleSearch,"Title","Description")
Dim locSearch
locSearch = Replace(titleSearch,"Title","Location")
sWhere=" Where ( ("&titleSearch&") or ("&descSearch&") or ("&locSearch&")) "
else
if instr(Conn.ConnectionString,".mdb")>1 then
sWhere=" Where ( (EventDate >= #" & bgnDate & "#) And (EventDate < #" & endDate & "#) "
else
sWhere=" Where ( (EventDate >= '" & bgnDate & "') And (EventDate < '" & endDate & "') "
end if
if (Request.Form("EventType")<>"") then
sWhere = sWhere & " And (EventType='"&Request.Form("EventType")&"')"
end if
sWhere = sWhere & ") "
end if
sSQL="Select EventID, EventDate, EventTime, Title, Description, " & _
"URL, Location, RSVP, EventType from Event" & _
sWhere & _
"ORDER BY EventDate, Title"
Set Rs=Conn.Execute(sSQL)
'Response.write(sSQL & "
")
Function SelectedMonth(iMonth)
If iMonth=iThisMonth then
SelectedMonth="selected"
else
SelectedMonth=""
end If
End Function
Function SelectedYear(iYear)
If iYear=iThisYear then
SelectedYear="selected"
else
SelectedYear=""
end If
End Function
iDIM = GetDaysInMonth(iThisMonth, iThisYear)
iDOW = GetWeekdayMonthStartsOn(iThisMonth, iThisYear)
function EventCell(iDay,bEvent)
dim sDayImg
sDayImg=cstr(iDay)'"
"
sTblBgn=""'
| " & sDayName & " |
| " sTblEnd=""' |
" & _ 'iDay & "
" & vbCrLf sTblMid ="" & _ iDay & "" & vbCrLf else sTblMid = iDay & vbCrLf end if EventCell=sTblBgn & sTblMid & sTblEnd end function %>
No <%if(Request.Form("keywords")<>"") then %>Records Matching this Criteria<% else Response.write(Request.Form("EventType"))%> Events for this Month<%end if%>
<% Else Rs.MoveFirst %>| " & Description & " | ||||||||||||||
| <%=monthname(month(EventDate)) & " " & day(EventDate) & ", " & year(EventDate)%> | ||||||||||||||
| ||||||||||||||
| ||||||||||||||
| ||||||||||||||
| ||||||||||||||
| ||||||||||||||