<%@ Language=VBScript %> <%option explicit dim colorScheme : colorScheme = "blue" dim pageTitle : pageTitle = "title_calendar.gif" dim thisMonth : thisMonth = MonthName(Month(sDate), true) & Right("0" & Year(sDate), 2) 'dim thisWeek : thisWeek = "week_1" %> <% dim numEvents dim curEvent dim oConn dim oCmd dim oRs dim isAdmin: isAdmin = true dim iOrigDayOfWeek dim iDayOfWeek dim sCurDate dim allDayEvents dim rowspan dim dDate dim sTime dim sMonth dim sStartDate dim sEndDate dim aDateTitles(7) dim aDateIcons(7) dim i dim iCurDate Dim dMinDate : dMinDate = "1/1/2003" Dim dMaxDate : dMaxDate = "12/26/" & CStr(Year(date()) + 2) dim sDate: sDate = Request.Item("date") if sDate = "" then sDate = date end if dim iCatId: iCatId = -1 If IsNumeric(Request.Item("category_id")) And Request.Item("category_id") <> "" Then iCatId = CInt(Request.Item("category_id")) Response.Cookies("category_id") = Request.Item("category_id") ElseIf IsNumeric(Request.Cookies("category_id")) And Request.Cookies("category_id") <> "" Then iCatId = CInt(Request.Cookies("category_id")) End If 'Calculate start and end days of the week and use it for the Header. sStartDate = DateAdd("D", 0 - (WeekDay(sDate) - 1), sDate) sEndDate = DateAdd("D", 0 - (WeekDay(sDate) - 7), sDate) %> <%'=sWeekDayName(WeekDay(sStartDate) - 1) & ", " & MonthName(Month(sStartDate)) & " " & Day(sStartDate) & sDateAbbrev(Day(sStartDate) - 1) %> <%'=sWeekDayName(WeekDay(sEndDate) - 1) & ", " & MonthName(Month(sEndDate)) & " " & Day(sEndDate) & sDateAbbrev(Day(sEndDate) - 1) %>
" border="0" alt="<%=MonthName(Month(sStartDate), true)%>." /> " border="0" alt="<%=MonthName(Month(sStartDate), true)%>." />" border="0" alt="<%=MonthName(Month(sStartDate), true)%>." /> <%=MonthName(Month(sStartDate), true)%>. " border="0" alt="<%=MonthName(Month(sEndDate), true)%>." /> " border="0" alt="<%=MonthName(Month(sEndDate), true)%>." />" border="0" alt="<%=MonthName(Month(sEndDate), true)%>." /> Week-At-A-Glance.
<% if datediff("d", dMinDate, DateAdd("D", 0 - (WeekDay(dateadd("WW", -1, sDate)) - 7), sDate)) > 7 then %> "> <% else %> <% end if %> <% if datediff("d", dMinDate, dateadd("D", 0 - datepart("D", sDate) + 1, dateadd("M", -1, sDate))) >= 0 then %> "> <% else %> <% end if %> <% if datediff("d", dMaxDate, DateAdd("D", 0 - (WeekDay(dateadd("WW", 1, sDate)) - 9), sDate)) <= 0 then %> "> <% else %> <% end if %> <% if datediff("d", dMaxDate, dateadd("D", 0 - datepart("D", sDate) + 1, dateadd("M", 1, sDate))) < 0 then %> "> <% else %> <% end if %>
Month-At-A-Glance.
 
<%renderMiniCalendar sDate, 0, isAdmin, true%> <% 'Create the command object to return the reports set oConn = Server.CreateObject("ADODB.Connection") with oConn .ConnectionString = Application("ConnString") .Open end with %>

Daily Minyan Schedule

Category: <% '--------------------------------------------------------------------------- ' ' populate with categories ' '--------------------------------------------------------------------------- set oCmd = server.CreateObject("ADODB.Command") with oCmd set .ActiveConnection = oConn .CommandText = "p_SelectCategories" .CommandType = adCmdStoredProc '.Parameters.Append .CreateParameter("@DateID", adInteger, adParamInput, 4, iDateID) .Execute set oRs = Server.CreateObject("ADODB.Recordset") with oRs .Open oCmd, , adOpenForwardOnly, adLockReadOnly redim preserve aCategories(2,0) aCategories(0,i) = "-1" aCategories(1,i) = "(No Category)" aCategories(2,i) = "" i = 1 while not .EOF redim preserve aCategories(2,i) aCategories(0,i) = .Fields("CategoryID").Value aCategories(1,i) = .Fields("CategoryName").Value aCategories(2,i) = "EditCat" & .Fields("CategoryID").Value .MoveNext i = i + 1 wend end with oRs.close set oRs = nothing end with set oCmd = nothing printDropBox "category_id", CStr(iCatID), aCategories %> <% If sDate <> date Then Response.Write "" End If %>

<% iOrigDayOfWeek = Weekday(sDate) ' Since the dateID is an int, we compare by numbers, which are created by concatening strings. ' The database won't care that the 20020231 is invalid because February has 28 days... it's still an int. ' As long as months don't have 32 days, we'll be fine. :) sMonth = Month(dDate) if sMonth < 10 then sMonth = "0" & sMonth end if 'Reformat start and end days of the week and use it for the stored procedure. sStartDate = cDbl(Year(sStartDate) & Right("0" & Month(sStartDate), 2) & Right("0" & Day(sStartDate), 2)) sEndDate = cDbl(Year(sEndDate) & Right("0" & Month(sEndDate), 2) & Right("0" & Day(sEndDate), 2)) 'Get all of the date titles and stick 'em in an array set oCmd = Server.CreateObject("ADODB.Command") with oCmd set .ActiveConnection = oConn .CommandText = "p_SelectCalendarDateInfoByRange" .CommandType = adCmdStoredProc .Parameters.Append .CreateParameter("@Begin", adDouble, adParamInput, 4, sStartDate) .Parameters.Append .CreateParameter("@End", adDouble, adParamInput, 4, sEndDate) .Execute set oRs = Server.CreateObject("ADODB.Recordset") oRs.Open oCmd,,adOpenForwardOnly,adLockReadOnly i = 0 if not oRs.EOF then with oRs '.Open oCmd,,adOpenForwardOnly,adLockReadOnly aDateTitles(.Fields("DateID").Value - sStartDate) = .Fields("DateTitle").Value aDateIcons(.Fields("DateID").Value - sStartDate) = .Fields("IconFileName").Value i = i + 1 end with end if end with oRs.Close set oRs = nothing set oCmd = nothing 'Get the events for the week set oCmd = Server.CreateObject("ADODB.Command") with oCmd set .ActiveConnection = oConn .CommandText = "p_SelectCalendarEvents" .CommandType = adCmdStoredProc .Parameters.Append .CreateParameter("@Begin", adDouble, adParamInput, 4, sStartDate) .Parameters.Append .CreateParameter("@End", adDouble, adParamInput, 4, sEndDate) If iCatId > -1 Then oCmd.Parameters.Append .CreateParameter("@Category", adDouble, adParamInput, 4, iCatId) End If oCmd.Execute set oRs = Server.CreateObject("ADODB.Recordset") with oRs .Open oCmd,,adOpenForwardOnly,adLockReadOnly for iDayOfWeek = 1 to 7 sCurDate = DateAdd("D", 0 - (WeekDay(sDate) - iDayOfWeek), sDate) iCurDate = cDbl(Year(sCurDate) & Right("0" & Month(sCurDate), 2) & Right("0" & Day(sCurDate), 2)) numEvents = 0 allDayEvents = " " redim aEvents(2,0) aEvents(0,0) = " " aEvents(1,0) = " " aEvents(2,0) = "" %> <% do while not .EOF if CStr(DateSerial(Year(sCurDate), Month(sCurDate), Day(sCurDate))) <> _ CStr(DateSerial(Left(.Fields("DateID").Value, 4), Left(Right(.Fields("DateID").Value, 4), 2), Right(.Fields("DateID").Value, 2))) then exit do end if if .Fields("AllDayEvent").Value then if allDayEvents = " " then allDayEvents = "" & .Fields("ShortDescription").Value & "" else allDayEvents = allDayEvents & "
" & "" & .Fields("ShortDescription").Value & "" end if else redim preserve aEvents(2,numEvents) aEvents(0,numEvents) = .Fields("StartTime").Value aEvents(1,numEvents) = "" & .Fields("ShortDescription").Value & "" aEvents(2,numEvents) = .Fields("IconFileName").Value numEvents = numEvents + 1 end if .MoveNext loop if numEvents > 4 then rowspan = numEvents else rowspan = 4 end if if aEvents(0,0) = " " then sTime = " " else sTime = getPrettyTime(aEvents(0,0)) end if %> <% for curEvent = 1 to numEvents - 1 if aEvents(0,0) = " " then sTime = " " else sTime = getPrettyTime(aEvents(0,curEvent)) end if %> <% next 'add empty lines to fill in the rows up to the length of the all day events rowspan=4. if numEvents < 4 then for curEvent = curEvent + 1 to 4 %> <% next end if %> <% next end with end with oRs.Close set oRs = nothing set oCmd = nothing oConn.Close set oConn = nothing %>
"> <%=sWeekDayName(WeekDay(sCurDate) - 1) & ", " & MonthName(Month(sCurDate)) & " " & Day(sCurDate) & sDateAbbrev(Day(sCurDate) - 1) %> <% if not .EOF then if len(aDateTitles(iDayOfWeek - 1)) > 0 then Response.Write " (" & aDateTitles(iDayOfWeek - 1) & ")" end if end if if not .EOF then if len(aDateIcons(iDayOfWeek - 1)) > 0 then Response.Write "  " end if end if %> <%=HebrewDate(sCurDate)%>
<%=sTime%> <% if len(aEvents(2,0)) > 0 then Response.Write "" end if %> <%=aEvents(1,0)%>
<%=allDayEvents%>
<%=sTime%> <% if len(aEvents(2,curEvent)) > 0 then Response.Write "" end if %> <%=aEvents(1,curEvent)%>