Fejl i min Event kalender
HejsaJeg har en lille event kalender som opføre sig underligt...
Hvis vi tager udgangspunkt i februar måned så vil datoerne:
01/03/04/05/06/07/08/09/10/11/12
Ikke vise hvis der er oprettet et arrangement... Men fra 13 vil det god igen :|
Lidt hjælp?
Min kode:
<% if Request.Querystring("site")="" then %>
<%
navmonth = request.querystring("month")
navyear = request.querystring("year")
If navmonth = "" Then
navmonth = Month(Date)
End If
If navyear = "" Then
navyear = Year(Date)
End If
firstday = Weekday(CDate(navmonth & "/" & 1 & "/" & navyear))
leapTestNumbers = navyear / 4
leapTest = (leapTestNumbers) - Round(leapTestNumbers)
If navmonth = 2 Then
If leapTest <> 0 Then
lastDate = 28
Else
lastDate = 29
End If
ElseIf ((navmonth = 4) OR (navmonth = 6) OR (navmonth = 9) OR (navmonth = 11)) Then
lastDate = 30
Else
lastDate = 31
End If
lastMonth = navmonth - 1
lastYear = navyear
If lastMonth < 1 Then
lastMonth = 12
lastYear = lastYear - 1
End If
nextMonth = navmonth + 1
nextYear = navyear
If nextMonth >12 Then
nextMonth = 1
nextYear = nextYear + 1
End If
dateCounter = 1
weekCount = 1
DateEnd = lastDate
DateBegin = firstDate
Weekday_Font = RSBODY("Weekday_Font")
Weekday_Font_Size = RSBODY("Weekday_Font_Size")
Weekday_Font_Color = RSBODY("Weekday_Font_Color")
Weekday_Background_Color = RSBODY("Weekday_Background_Color")
Date_Font = RSBODY("Date_Font")
Date_Font_Size = RSBODY("Date_Font_Size")
Date_Font_Color = RSBODY("Date_Font_Color")
Date_Background_Color = RSBODY("Date_Background_Color")
Event_Font = RSBODY("Event_Font")
Event_Font_Size = RSBODY("Event_Font_Size")
Event_Font_Color = RSBODY("Event_Font_Color")
Cell_Width = RSBODY("Cell_Width")
Cell_Height = RSBODY("Cell_Height")
Cell_Background_Color = RSBODY("Cell_Background_Color")
Border_Size = RSBODY("Border_Size")
Border_Color = RSBODY("Border_Color")
%>
<%=RSBODY("Header")%>
<table border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<td align="center">
<table border="0" cellpadding="2" cellspacing="0" width="100%">
<tr>
<td align="left" valign="bottom"><font face="verdana" size="2"><b><a href="vagtplan.asp?month=<%=lastMonth%>&year=<%=lastYear%>"><%If (RSBODY("Abbreviate_Months") = True) Then%><%=MonthName(lastMonth, true)%><%Else%><%=MonthName(lastMonth)%><%End If%></a></b></font></td>
<td align="center" valign="bottom"><font face="verdana" size="4"><b><%If (RSBODY("Abbreviate_Months") = True) Then%><%=MonthName(navMonth, true)%><%Else%><%=MonthName(navMonth)%><%End If%> <%=navyear%></b></font></td>
<td align="right" valign="bottom"><font face="verdana" size="2"><b><a href="vagtplan.asp?month=<%=nextMonth%>&year=<%=nextYear%>"><%If (RSBODY("Abbreviate_Months") = True) Then%><%=MonthName(nextMonth, true)%><%Else%><%=MonthName(nextMonth)%><%End If%></a></b></font></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<td bgcolor="<%=Border_Color%>">
<table border="0" cellpadding="2" cellspacing="<%=Border_Size%>">
<tr>
<td width="<%=Cell_Width%>" align="center" bgcolor="<%=Weekday_Background_Color%>"><font face="<%=Weekday_Font%>" size="<%=Weekday_Font_Size%>" color="<%=Weekday_Font_Color%>"><b><%If (RSBODY("Abbreviate_Days") = True) Then%>Sun<%Else%>Søndag<%End If%></b></font></td>
<td width="<%=Cell_Width%>" align="center" bgcolor="<%=Weekday_Background_Color%>"><font face="<%=Weekday_Font%>" size="<%=Weekday_Font_Size%>" color="<%=Weekday_Font_Color%>"><b><%If (RSBODY("Abbreviate_Days") = True) Then%>Mon<%Else%>Mandag<%End If%></b></font></td>
<td width="<%=Cell_Width%>" align="center" bgcolor="<%=Weekday_Background_Color%>"><font face="<%=Weekday_Font%>" size="<%=Weekday_Font_Size%>" color="<%=Weekday_Font_Color%>"><b><%If (RSBODY("Abbreviate_Days") = True) Then%>Tues<%Else%>Tirsdag<%End If%></b></font></td>
<td width="<%=Cell_Width%>" align="center" bgcolor="<%=Weekday_Background_Color%>"><font face="<%=Weekday_Font%>" size="<%=Weekday_Font_Size%>" color="<%=Weekday_Font_Color%>"><b><%If (RSBODY("Abbreviate_Days") = True) Then%>Wed<%Else%>Onsdag<%End If%></b></font></td>
<td width="<%=Cell_Width%>" align="center" bgcolor="<%=Weekday_Background_Color%>"><font face="<%=Weekday_Font%>" size="<%=Weekday_Font_Size%>" color="<%=Weekday_Font_Color%>"><b><%If (RSBODY("Abbreviate_Days") = True) Then%>Thurs<%Else%>Torsdag<%End If%></b></font></td>
<td width="<%=Cell_Width%>" align="center" bgcolor="<%=Weekday_Background_Color%>"><font face="<%=Weekday_Font%>" size="<%=Weekday_Font_Size%>" color="<%=Weekday_Font_Color%>"><b><%If (RSBODY("Abbreviate_Days") = True) Then%>Fri<%Else%>Fredag<%End If%></b></font></td>
<td width="<%=Cell_Width%>" align="center" bgcolor="<%=Weekday_Background_Color%>"><font face="<%=Weekday_Font%>" size="<%=Weekday_Font_Size%>" color="<%=Weekday_Font_Color%>"><b><%If (RSBODY("Abbreviate_Days") = True) Then%>Sat<%Else%>Lørdag<%End If%></b></font></td>
</tr>
<tr>
<% Do while weekCount <= 7
dateSelect = navmonth & "/" & dateCounter & "/" & navyear %>
<% If (weekCount < firstDay) OR (dateCounter > lastDate) Then %>
<td height="<%=Cell_Height%>" bgcolor="<%=Cell_Background_Color%>"><img src="im/clear.gif" height="1" width="1"></td>
<% else %>
<td height="<%=Cell_Height%>" bgcolor="<%=Date_Background_Color%>" valign="top"><a href="vagtplan.asp?site=vis&date=<%=dateSelect%>"><font face="<%=Date_Font%>" size="<%=Date_Font_Size%>" color="<%=Date_Font_Color%>"><b><%=dateCounter%></b></font><font face="<%=Event_Font%>" size="<%=Event_Font_Size%>" color="<%=Event_Font_Color%>">
<%
Set RSEVENT = Server.CreateObject("ADODB.RecordSet")
RSEVENT.Open "SELECT * FROM Events", Conn, 1, 3
Do while NOT RSEVENT.EOF
rsdate = RSEVENT("Date")
If (Day(rsdate) = dateCounter) AND (Month(rsdate) = CInt(navmonth)) AND (Year(rsdate) = CInt(navyear)) Then%>
<br>
<%If RSBODY("Event_Display") = True Then%>
<%=RSEVENT("Category")%>
<%Else%>
<%=RSEVENT("overskrift")%>
<% End If
End If
RSEVENT.movenext
Loop
RSEVENT.close
%>
</font></a></td>
<%
dateCounter = dateCounter + 1
end if
weekCount = weekCount + 1
Loop
weekCount = 1
%>
</tr>
<% Do while dateCounter <= lastDate %>
<tr>
<% Do while weekCount <= 7
dateSelect = navmonth & "/" & dateCounter & "/" & navyear %>
<% If dateCounter > lastDate Then %>
<td height="<%=Cell_Height%>" bgcolor="<%=Cell_Background_Color%>"><img src="im/clear.gif" height="1" width="1"></td>
<% else %>
<td height="<%=Cell_Height%>" bgcolor="<%=Date_Background_Color%>" valign="top"><a href="vagtplan.asp?site=vis&date=<%=dateSelect%>"><font face="<%=Date_Font%>" size="<%=Date_Font_Size%>" color="<%=Date_Font_Color%>"><b><%=dateCounter%></b></font><font face="<%=Event_Font%>" size="<%=Event_Font_Size%>" color="<%=Event_Font_Color%>">
<%
Set RSEVENT = Server.CreateObject("ADODB.RecordSet")
RSEVENT.Open "SELECT * FROM Events", Conn, 1, 3
Do while NOT RSEVENT.EOF
rsdate = RSEVENT("Date")
If (Day(rsdate) = dateCounter) AND (Month(rsdate) = CInt(navmonth)) AND (Year(rsdate) = CInt(navyear)) Then%>
<br>
<%If RSBODY("Event_Display") = True Then%>
<%=RSEVENT("Category")%>
<%Else%>
<%=RSEVENT("overskrift")%>
<% End If
End If
RSEVENT.movenext
Loop
RSEVENT.close
%>
</font></a></td>
<%
dateCounter = dateCounter + 1
end if
weekCount = weekCount + 1
Loop
weekCount = 1
%>
</tr>
<% Loop %>
<% End If %>
