|
part 2
[code]
'Small Calendar Function FormatSmallCalendar() Dim strHighLightCalendarDays Dim saryHighLightCalendarDays Dim intEventHightLightCellCounter Dim dtmSCNextMonthDate Dim dtmSCLastMonthDate Dim strSCMonth Dim strSCYear Dim strSCDate
Call FormatTableTitleTop2(strTxtCalendar, "SmallCalendar", "100%", 7)
If Request.Cookies("box" & intBoxID) = "Hide" Then Response.Write(vbCrLf & "<script lanauge=""Javascript"">showhide('box" & intBoxID & "');</script>")
strSCMonth = Clng(Request.QueryString("SM")) strSCYear = Clng(Request.QueryString("SY"))
If strSCMonth = 0 Then strSCMonth = Month(Now()) If strSCYear = 0 Then strSCYear = Year(Now())
dtmSCNextMonthDate = strSCMonth + 1 dtmSCLastMonthDate = strSCMonth - 1
If dtmSCNextMonthDate = 13 Then dtmSCNextMonthDate = 1 If dtmSCLastMonthDate = 0 Then dtmSCLastMonthDate = 12 If strSCMonth = 12 Then dtmNextYearDate = strSCYear + 1 Else dtmNextYearDate = strSCYear
strSCDate = MonthName(strSCMonth) & " 1 " & strSCYear
strHighLightCalendarDays = ""
If strDatabaseType = "SQLServer" Then strSQL = "EXECUTE " & strDbProc & "SmallCalendar @strDay = " & Day(strSCDate) & ", @strMonth = " & Month(strSCDate) & ", @strYear = " & Year(strSCDate) Else strSQL = "SELECT " & strDbTable & "Calendar.Day, " & strDbTable & "Calendar.Month, " & strDbTable & "Calendar.Year FROM " & strDbTable & "Calendar " strSQL = strSQL & "WHERE " & strDbTable & "Calendar.Month = " & Month(strSCDate) & " AND " & strDbTable & "Calendar.Year = " & Year(strSCDate) & " AND " & strDbTable & "Calendar.Private = False;" End If
rsCommon.Open strSQL, adoCon
If NOT rsCommon.EOF Then DO UNTIL rsCommon.EOF strHighLightCalendarDays = strHighLightCalendarDays & rsCommon("Day") & ";" rsCommon.MoveNext Loop End If
rsCommon.Close
saryHighLightCalendarDays = Split(strHighLightCalendarDays, ";")
Response.Write(vbCrLf & " <tr>") Response.Write(vbCrLf & " <td bgcolor=""" & strTableTitleColour2 & """ background=""" & strTableTitleBgImage2 & """ class=""tiHeading"" colspan=""7"" align=""center"">" & MonthName(strSCMonth) & "</td>") Response.Write(vbCrLf & " </tr>") Response.Write(vbCrLf & " <tr>") Response.Write(vbCrLf & " <td bgcolor=""" & strTableColour & """ width=""14%"" align=""center"" class=""table"">S</td>") Response.Write(vbCrLf & " <td bgcolor=""" & strTableColour & """ width=""14%"" align=""center"" class=""table"">M</td>") Response.Write(vbCrLf & " <td bgcolor=""" & strTableColour & """ width=""14%"" align=""center"" class=""table"">T</td>") Response.Write(vbCrLf & " <td bgcolor=""" & strTableColour & """ width=""14%"" align=""center"" class=""table"">W</td>") Response.Write(vbCrLf & " <td bgcolor=""" & strTableColour & """ width=""14%"" align=""center"" class=""table"">T</td>") Response.Write(vbCrLf & " <td bgcolor=""" & strTableColour & """ width=""14%"" align=""center"" class=""table"">F</td>") Response.Write(vbCrLf & " <td bgcolor=""" & strTableColour & """ width=""14%"" align=""center"" class=""table"">S</td>") Response.Write(vbCrLf & " </tr>") Response.Write(vbCrLf & " <tr>")
For intCalendarLoopCounter = 1 to Weekday(strSCDate) - 1 Response.Write(vbCrLf & " <td bgcolor=""" & strLastMonthColour & """ width=""14%"" class=""table""> </td>") Next
DO Response.Write(vbCrLf & " <td width=""14%"" bgcolor=""")
If Month(strSCDate) < Month(Now()) Then Response.Write(strNextMonthCol our) ElseIf strSCDate = Date() Then Response.Write(strTodayMonthCo lour) ElseIf Year(strSCDate) < Year(Now()) Then Response.Write(strNextMonthCol our) ElseIf strSCDate => Date() Then Response.Write(strThisMonthCol our) ElseIf Month(strSCDate) = Month(Now()) Then Response.Write(strThisMonthCol our) Else Response.Write(strLastMonthCol our) End If
For intLoopCounter = 0 to UBound(saryHighLightCalendarDays) If saryHighLightCalendarDays(intLoopCounter) = "" & Day(strSCDate) Then Response.Write(""" style=""background-color: " & strCalendarHighLightColour & ";""") Next
Response.Write(""" width=""14%"" height=""20"" align=""center"" class=""table""><a href=""event.asp?Day=" & Day(strSCDate) & "&Month=" & Month(strSCDate) & "&Year=" & Year(strSCDate) & """ class=""smLink"" style=""font-size: 8px;""><b>" & Day(strSCDate) & "</b></a></b></td>")
If WeekDay(strSCDate) = 7 AND NOT DateSerial(Year(strSCDate), Month(strSCDate) + 1, 0) = strSCDate Then Response.Write(vbCrLf & " </tr>" & vbCrLf & " <tr>")
strSCDate = DateAdd("d", 1, strSCDate) Loop Until (Month(strSCDate) <> CInt(strSCMonth))
If Weekday(strSCDate) <> 1 Then For intCalendarLoopCounter = Weekday(strSCDate) to 7 Response.Write(" <td bgcolor=""" & strNextMonthColour & """ class=""table""> </td>") Next End If
strSCDate = DateSerial(strSCYear, strSCMonth, 1)
Response.Write(vbCrLf & " </tr>") Response.Write(vbCrLf & " <tr>") Response.Write(vbCrLf & " <td bgcolor=""" & strTableColour & """ colspan=""7"" align=""center"" class=""table""><br>")
Dim strNextMonthURL Dim strLastMonthURL Dim strTempQueryString
strLastMonthURL = Request.ServerVariables("SCRIPT_NAME") strNextMonthURL = Request.ServerVariables("SCRIPT_NAME") strTempQueryString = Request.ServerVariables("QUERY_STRING")
 
|