<%@ 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=""'
 
" dim sTblMid if bEvent then 'sTblMid ="" & _ '"

" & _ 'iDay & "

" & vbCrLf sTblMid ="" & _ iDay & "" & vbCrLf else sTblMid = iDay & vbCrLf end if EventCell=sTblBgn & sTblMid & sTblEnd end function %> Children's Museum Los Angeles
"> " />
"> " />
<%if (Request.Form("keywords")="") Then %>
Event Type:    
" /> " & vbCrLf) End If if not(rs.eof) then iEventDay=day(Rs.Fields("EventDate")) '** Compile any information about todays activities ** if Rs.EOF then 'Response.Write(" Rs.EOF=True" & "
") 'jck else 'Response.Write(" Rs.EOF=False" & "
") 'jck end if 'Response.Write("Going into loop, iEventDay='" & iEventDay & "' iDay" & iDay & "
") 'jck if iEventDay <> iDay then 'Response.Write "iEventDay <> iDay" else 'Response.Write "iEventDay = iDay" end if Do Until Rs.EOF or iEventDay <> iDay bEvent=true sEventType = Rs.Fields("EventType") if sEventType = "Public" then bPublicEvent = true sDayText = EventCell(iDay,True) 'Response.Write("Inside loop-bEvent=" & bEvent & " iEventDay=" & iEventDay & " iDay=" & iDay & "
") 'jck Rs.MoveNext if not rs.eof then iEventDay=day(Rs.Fields("EventDate")) 'Response.Write("Inside loop-iEventDay just changed to " & iEventDay & " iDay=" & iDay & "
") 'jck Loop if bEvent then if bPublicEvent then sbk="background='DayUp.jpg'" else sbk="background='DayDwn.jpg'" end if else sbk=""'background='DayNone.gif'" end if Response.Write(vbTab & vbTab & "" & vbCrLf) 'Response.Write("About to write td tag for " & iDay & " sDayText=" & sDayText & "
") 'jck bPublicEvent=false sDayText="" '** End the row ** If iDayofWeek = 7 Then Response.Write vbTab & "" & vbCrLf iDayofWeek = 0 End If '** Increment variables ** iDay = iDay + 1 iDayofWeek = iDayofWeek + 1 Loop '** You are done with the month ** '** Fill in any remaining boxes If iDayofWeek <> 1 Then Do While iDayofWeek <= 7 '** Start a new day ** Response.Write(vbTab & vbTab & "" & vbCrLf) iDayofWeek = iDayofWeek + 1 Loop Response.Write vbTab & "" & vbCrLf End If %>
<% If iDOW <> 1 Then Response.Write(vbTab & "" & vbCrLf) iDayofWeek = 1 Do While iDayofWeek < iDOW Response.Write(vbTab & vbTab & "" & vbCrLf) iDayofWeek = iDayofWeek + 1 Loop End If '** Days of the month ** iDay = 1 iDayofWeek = iDOW function getDayName(pos) select case pos case vbSunday getDayName="Sunday" case vbMonday getDayName="Monday" case vbTuesday getDayName="Tuesday" case vbWednesday getDayName="Wednesday" case vbThursday getDayName="Thurday" case vbFriday getDayName="Friday" case vbSaturday getDayName="Saturday" end select end function dim bHasEvent dim iEventDay dim sDayText dim bPublicEvent dim sbk dim sEventType dim bEvent dim iNextEventDay dim sTblBgn, sTblEnd dim sDayName 'Response.Write("
Previous Month      Next Month
Sun Mon Tues Weds Thurs Fri Sat
 
" & "
") 'jck Do While iDay <= iDIM bEvent=false bPublicEvent=false sDayText = EventCell(iDay,False) sDayName=getDayName(iDayofWeek+1) '** start a new row if you are at the first day of the week** If iDayofWeek = 1 Then if rs.eof then bHasEvent=false else 'You have at least one event bHasEvent=true end if Response.Write(vbTab & "
" & sDayText & "
 
<% Else %>

Search Results

<% End If %> <% if not rs.bof then Rs.MoveFirst If rs.EOF Then %>

 

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 %>
<% Do While Not rs.EOF EventDate=rs.fields("EventDate") Title = RetrieveSQLData( rs.fields("Title") ) Description = RetrieveSQLData( rs.fields("Description")) if len(Description)>0 then Description=" " URL = RetrieveSQLData( rs.fields("URL") ) & "" if len(URL)>0 then Title="" & Title & "" Location = RetrieveSQLData( rs.fields("Location") ) RSVP = RetrieveSQLData( rs.fields("RSVP") ) EventType = rs.fields("EventType") %> <% rs.MoveNext Loop Rs.Close Set Rs = Nothing end if Conn.close Set Conn = nothing %>
" & Description & " 
<%=monthname(month(EventDate)) & " " & day(EventDate) & ", " & year(EventDate)%>

 

   <%=Description%>
<%=Title%>

 

  
     Type:<%=EventType%>
Time:<%=RetrieveSQLData(rs.fields("EventTime"))%>
Location:<%=Location%>
RSVP:<%=RSVP%>