Kalender hjelp
Jeg har en kalender som viser en uke som er koblet til database.Jeg vil gjerne ha en halvårs kalender, hvor alle månedene blir vist på en side bygd på denne ukevisningen.
Altså at hver måned vises vertikalt.
Jeg er ikke interesert i enkel månedsvisning.
Jeg har lett lenge men har ikke funnet noen som viser et halvt år om gangen.
Jeg blir svært takknemlig for hjelp!
Her er koden til ukekalenderen:
<%
'WeekView dagatal-------------------------------
ThisDate = Now()
ThisWeek = Now()
'ThisDate = DateAdd("d",-3,Now())
If request.querystring("d") = "" Then
ThisDate = FormatDateTime(ThisDate,VBShortDate)
else
ThisDate = request.querystring("d")
End If
ThisDay = weekday(ThisDate)
lastweek = DateAdd("d",-7,ThisDate)
lastweek = FormatDateTime(lastweek,vbShortDate)
nextweek = DateAdd("d",7,ThisDate)
nextweek = FormatDateTime(nextweek,vbShortDate)
'ef það er mánudagur
If ThisDay = 2 Then
TWMonday = ThisDate
TWTuesday = DateAdd("d",1,ThisDate)
TWTuesday = FormatDateTime(TWTuesday,VBShostDate)
TWWednesday = DateAdd("d",2,ThisDate)
TWWednesday = FormatDateTime(TWWednesday,VBShostDate)
TWThursday = DateAdd("d",3,ThisDate)
TWThursday = FormatDateTime(TWThursday,VBShostDate)
TWFriday = DateAdd("d",4,ThisDate)
TWFriday = FormatDateTime(TWFriday,VBShostDate)
TWSaturday = DateAdd("d",5,ThisDate)
TWSaturday = FormatDateTime(TWSaturday,VBShostDate)
TWSunday = DateAdd("d",6,ThisDate)
TWSunday = FormatDateTime(TWSunday,VBShostDate)
End If
'ef það er þriðjudagur
If ThisDay = 3 Then
TWMonday = DateAdd("d",-1,ThisDate)
TWTuesday = ThisDate
TWWednesday = DateAdd("d",1,ThisDate)
TWWednesday = FormatDateTime(TWWednesday,VBShostDate)
TWThursday = DateAdd("d",2,ThisDate)
TWThursday = FormatDateTime(TWThursday,VBShostDate)
TWFriday = DateAdd("d",3,ThisDate)
TWFriday = FormatDateTime(TWFriday,VBShostDate)
TWSaturday = DateAdd("d",4,ThisDate)
TWSaturday = FormatDateTime(TWSaturday,VBShostDate)
TWSunday = DateAdd("d",5,ThisDate)
TWSunday = FormatDateTime(TWSunday,VBShostDate)
End If
'ef það er miðvikudagur
If ThisDay = 4 Then
TWMonday = DateAdd("d",-2,ThisDate)
TWTuesday = DateAdd("d",-1,ThisDate)
TWTuesday = FormatDateTime(TWTuesday,VBShostDate)
TWWednesday = ThisDate
TWThursday = DateAdd("d",1,ThisDate)
TWThursday = FormatDateTime(TWThursday,VBShostDate)
TWFriday = DateAdd("d",2,ThisDate)
TWFriday = FormatDateTime(TWFriday,VBShostDate)
TWSaturday = DateAdd("d",3,ThisDate)
TWSaturday = FormatDateTime(TWSaturday,VBShostDate)
TWSunday = DateAdd("d",4,ThisDate)
TWSunday = FormatDateTime(TWSunday,VBShostDate)
End If
'ef það er Fimmtudagur
If ThisDay = 5 Then
TWMonday = DateAdd("d",-3,ThisDate)
TWMonday = FormatDateTime(TWMonday,VBShostDate)
TWTuesday = DateAdd("d",-2,ThisDate)
TWTuesday = FormatDateTime(TWTuesday,VBShostDate)
TWWednesday = DateAdd("d",-1,ThisDate)
TWWednesday = FormatDateTime(TWWednesday,VBShostDate)
TWThursday = ThisDate
TWFriday = DateAdd("d",1,ThisDate)
TWFriday = FormatDateTime(TWFriday,VBShostDate)
TWSaturday = DateAdd("d",2,ThisDate)
TWSaturday = FormatDateTime(TWSaturday,VBShostDate)
TWSunday = DateAdd("d",3,ThisDate)
TWSunday = FormatDateTime(TWSunday,VBShostDate)
End If
'ef það er föstudagur
If ThisDay = 6 Then
TWMonday = DateAdd("d",-4,ThisDate)
TWMonday = FormatDateTime(TWMonday,VBShostDate)
TWTuesday = DateAdd("d",-3,ThisDate)
TWTuesday = FormatDateTime(TWTuesday,VBShostDate)
TWWednesday = DateAdd("d",-2,ThisDate)
TWWednesday = FormatDateTime(TWWednesday,VBShostDate)
TWThursday = DateAdd("d",-1,ThisDate)
TWThursday = FormatDateTime(TWThursday,VBShostDate)
TWFriday = ThisDate
TWSaturday = DateAdd("d",1,ThisDate)
TWSaturday = FormatDateTime(TWSaturday,VBShostDate)
TWSunday = DateAdd("d",2,ThisDate)
TWSunday = FormatDateTime(TWSunday,VBShostDate)
End If
'ef það er laugardagur
If ThisDay = 7 Then
TWMonday = DateAdd("d",-5,ThisDate)
TWMonday = FormatDateTime(TWMonday,VBShostDate)
TWTuesday = DateAdd("d",-4,ThisDate)
TWTuesday = FormatDateTime(TWTuesday,VBShostDate)
TWWednesday = DateAdd("d",-3,ThisDate)
TWWednesday = FormatDateTime(TWWednesday,VBShostDate)
TWThursday = DateAdd("d",-2,ThisDate)
TWThursday = FormatDateTime(TWThursday,VBShostDate)
TWFriday = DateAdd("d",-1,ThisDate)
TWFriday = FormatDateTime(TWFriday,VBShostDate)
TWSaturday = ThisDate
TWSunday = DateAdd("d",1,ThisDate)
TWSunday = FormatDateTime(TWSunday,VBShostDate)
End If
'ef það er Sunnudagur
If ThisDay = 1 Then
TWMonday = DateAdd("d",-6,ThisDate)
TWMonday = FormatDateTime(TWMonday,VBShostDate)
TWTuesday = DateAdd("d",-5,ThisDate)
TWTuesday = FormatDateTime(TWTuesday,VBShostDate)
TWWednesday = DateAdd("d",-4,ThisDate)
TWWednesday = FormatDateTime(TWWednesday,VBShostDate)
TWThursday = DateAdd("d",-3,ThisDate)
TWThursday = FormatDateTime(TWThursday,VBShostDate)
TWFriday = DateAdd("d",-2,ThisDate)
TWFriday = FormatDateTime(TWFriday,VBShostDate)
TWSaturday = DateAdd("d",-1,ThisDate)
TWSaturday = FormatDateTime(TWSaturday,VBShostDate)
TWSunday = ThisDate
End If
%>
<br>
<table width="164" border="1" cellpadding="1" cellspacing="1" class="agenda2">
<tr>
<td height="30" valign="bottom" align="center" colspan="2" class="agenda2">
<%
response.write "<center>"
response.write "<font size=2>"
response.write "<strong>"
response.write "Uke"
response.write DatePart("ww",Date())
response.write "</strong>"
response.write "</font>"
%>
<br>
<%
frW = DoDateTime(TWMonday, 1, Cint(intLocale))
tmp = Len(frw)
tmp = tmp - 4
frw = Left(frw,tmp)
response.write frW
%>
-
<%
toW = DoDateTime(TWSunday, 1, Cint(intLocale))
response.write toW
%></td>
</tr>
<tr valign="top" >
<%
selBG = "#5A8EC1"
theBG = "#5A8EC1"
dbg = "#174775"
Weekdayname(Weekday(DateValue(TWMonday)))
frW = Weekdayname(Weekday(DateValue(TWMonday)))
tmp = Len(frw)
tmp = tmp - 4
frw = Left(frw,tmp)
If ThisDate = TWMonday Then
response.write "<<td class=""agenda2"" height=""30"" bgcolor="""&selBG&""">"&frW&"</td>"
else
response.write "<td class=""agenda2"" height=""30"" bgcolor="""&dBG&""">"&frW&"</td>"
If ThisDate = TWMonday Then
response.write "<td bgcolor="""&selBG&""">"
else
response.write "<td class=""agenda3"" bgcolor="""&theBG&"""> "
End if
'mánudagspantanir------------------------------------
RS.MoveFirst
While Not RS.EOF
If RS("dags") = CDate(TWMonday) Then
IF RS("READ") = 0 Then
OrderColor = "red"
else
OrderColor = "black"
End If
response.write "<font color="&OrderColor&">"
response.write RS("kl1")&" "&RS("extra")&"<font></a>"
End If
RS.MoveNext
Wend
response.write "</td>"
End If
%>
<tr valign="top">
<%
frW = Weekdayname(Weekday(DateValue(TWTuesday)))
tmp = Len(frw)
tmp = tmp - 4
frw = Left(frw,tmp)
If ThisDate = TWTuesday Then
response.write "<td class=""agenda2"" height=""30"" bgcolor="""&selBG&""">"&frw&"</td>"
else
response.write "<td class=""agenda2"" height=""30"" bgcolor="""&dBG&""">"&frw&"</td>"
End If
If ThisDate = TWTuesday Then
response.write "<td bgcolor="""&selBG&""">"
else
response.write "<td class=""agenda3"" bgcolor="""&theBG&"""> "
End if
'þriðjudagspantanir-----------------------------------
RS.MoveFirst
While Not RS.EOF
If RS("dags") = CDate(TWTuesday) Then
IF RS("READ") = 0 Then
OrderColor = "red"
else
OrderColor = "black"
End If
response.write "<font size=1>"
response.write RS("kl1")&" "&RS("extra")&"<font><br>"
End If
RS.MoveNext
Wend
response.write "</td>"
%>
<tr valign="top">
<%
frW = Weekdayname(Weekday(DateValue(TWWednesday)))
tmp = Len(frw)
tmp = tmp - 4
frw = Left(frw,tmp)
If ThisDate = TWWednesday Then
response.write "<td class=""agenda2"" height=""30"" bgcolor="""&selBG&""">"&frw&"</td>"
else
response.write "<td class=""agenda2"" height=""30"" bgcolor="""&dBG&""">"&frw&"</td>"
End If
If ThisDate = TWWednesDay Then
response.write "<td bgcolor="""&selBG&""">"
else
response.write "<td class=""agenda3"" bgcolor="""&theBG&"""> "
End if
'miðvikudagsdagspantanir-------------------------------
RS.MoveFirst
While Not RS.EOF
If RS("dags") = CDate(TWWednesDay) Then
IF RS("READ") = 0 Then
OrderColor = "red"
else
OrderColor = "black"
End If
response.write "<table width=""100%"" cellspacing=""0"" cellpadding=""0"" border=""0"" class=""txtBlack"" style=""border-bottom:solid 1px #999999""><tr><td align=""center"" onmouseOver=""this.style.backgroundColor='#FFFFFF'"" onMouseOut=""this.style.backgroundColor=''"">"
response.write "<a href=""pop_detail.asp?ID="&RS("ID")&""" onclick=""window.open(this.href, 'popupwindow', 'width=400,height=350,scrollbars'); return false;"">"
response.write "<font color="&OrderColor&">"
response.write RS("kl1")&" "&RS("extra")&"<font></a>"
response.write "<tr><td><img width=""100%"" height=""1""></td></tr>"
response.write "</td></tr></table>"
End If
RS.MoveNext
Wend
Response.write "</td>"
%>
<tr valign="top" align="center">
<%
frW = Weekdayname(Weekday(DateValue(TWThursday)))
tmp = Len(frw)
tmp = tmp - 4
frw = Left(frw,tmp)
If ThisDate = TWThursday Then
response.write "<td class=""agenda2"" height=""30"" bgcolor="""&selBG&""">"&frw&"</td>"
else
response.write "<td class=""agenda2"" height=""30"" bgcolor="""&dBG&""">"&frw&"</td>"
End If
If ThisDate = TWThursday Then
response.write "<td bgcolor="""&selBG&""">"
else
response.write "<td class=""agenda3"" bgcolor="""&theBG&"""> "
End if
'Fimmtudagsdagspantanir-------------------------------
RS.MoveFirst
While Not RS.EOF
If RS("dags") = CDate(TWThursday) Then
IF RS("READ") = 0 Then
OrderColor = "red"
else
OrderColor = "black"
End If
response.write "<table width=""100%"" cellspacing=""0"" cellpadding=""0"" border=""0"" class=""txtBlack"" style=""border-bottom:solid 1px #999999""><tr><td align=""center"" onmouseOver=""this.style.backgroundColor='#FFFFFF'"" onMouseOut=""this.style.backgroundColor=''"">"
response.write "<a href=""pop_detail.asp?ID="&RS("ID")&""" onclick=""window.open(this.href, 'popupwindow', 'width=400,height=350,scrollbars'); return false;"">"
response.write "<font color="&OrderColor&">"
response.write RS("kl1")&" "&RS("extra")&"<font></a>"
response.write "<tr><td><img width=""100%"" height=""1""></td></tr>"
response.write "</td></tr></table>"
End If
RS.MoveNext
Wend
'-----------------------------------------------------
response.write "</td>"
%>
<tr valign="top" align="center">
<%
frW = Weekdayname(Weekday(DateValue(TWFriday)))
tmp = Len(frw)
tmp = tmp - 4
frw = Left(frw,tmp)
If ThisDate = TWFriday Then
response.write "<td class=""agenda2"" height=""30"" bgcolor="""&selBG&""">"&frw&"</td>"
else
response.write "<td class=""agenda2"" height=""30"" bgcolor="""&dBG&""">"&frw&"</td>"
End If
If ThisDate = TWFriday Then
response.write "<td bgcolor="""&selBG&""">"
else
response.write "<td class=""agenda3"" bgcolor="""&theBG&"""> "
End if
'Föstudagsdagspantanir--------------------------------
RS.MoveFirst
While Not RS.EOF
If RS("dags") = CDate(TWFriday) Then
IF RS("READ") = 0 Then
OrderColor = "red"
else
OrderColor = "black"
End If
response.write "<table width=""100%"" cellspacing=""0"" cellpadding=""0"" border=""0"" class=""txtBlack"" style=""border-bottom:solid 1px #999999""><tr><td align=""center"" onmouseOver=""this.style.backgroundColor='#FFFFFF'"" onMouseOut=""this.style.backgroundColor=''""> "
response.write "<a href=""pop_detail.asp?ID="&RS("ID")&""" onclick=""window.open(this.href, 'popupwindow', 'width=400,height=350,scrollbars'); return false;"">"
response.write "<font color="&OrderColor&">"
response.write " "
response.write RS("kl1")&" "&RS("extra")&"<font></a>"
response.write "<tr><td><img width=""100%"" height=""1""></td></tr>"
response.write " </td></tr></table>"
End If
RS.MoveNext
Wend
'-----------------------------------------------------
response.write "</td>"
%>
<tr valign="top" align="center">
<%
frW = Weekdayname(Weekday(DateValue(TWSaturday)))
tmp = Len(frw)
tmp = tmp - 4
frw = Left(frw,tmp)
If ThisDate = TWSaturday Then
response.write "<td class=""agenda2"" height=""30"" bgcolor="""&selBG&""">"&frw&"</td>"
else
response.write "<td class=""agenda2"" height=""30"" bgcolor="""&dBG&""">"&frw&"</td>"
End If
If ThisDate = TWSaturday Then
response.write "<td bgcolor="""&selBG&""">"
else
response.write "<td class=""agenda3"" bgcolor="""&theBG&"""> "
End if
'Laugardagsdagspantanir-------------------------------
RS.MoveFirst
While Not RS.EOF
If RS("dags") = CDate(TWSaturday) Then
IF RS("READ") = 0 Then
OrderColor = "red"
else
OrderColor = "black"
End If
response.write "<table width=""100%"" cellspacing=""0"" cellpadding=""0"" border=""0"" class=""txtBlack"" style=""border-bottom:solid 1px #999999""><tr><td align=""center"" onmouseOver=""this.style.backgroundColor='#FFFFFF'"" onMouseOut=""this.style.backgroundColor=''"">"
response.write "<a href=""pop_detail.asp?ID="&RS("ID")&""" onclick=""window.open(this.href, 'popupwindow', 'width=400,height=350,scrollbars'); return false;"">"
response.write "<font color="&OrderColor&">"
response.write RS("kl1")&" "&RS("extra")&"<font></a>"
response.write "<tr><td><img width=""100%"" height=""1""></td></tr>"
response.write "</td></tr></table>"
End If
RS.MoveNext
Wend
'-----------------------------------------------------
response.write "</td>"
%>
<tr valign="top" align="center">
<%
frW = Weekdayname(Weekday(DateValue(TWSunday)))
tmp = Len(frw)
tmp = tmp - 4
frw = Left(frw,tmp)
If ThisDate = Weekdayname(Weekday(DateValue(TWSunday))) Then
response.write "<td class=""agenda2"" height=""30"" bgcolor="""&selBG&""">"&frw&"</td>"
else
response.write "<td class=""agenda2"" height=""30"" bgcolor="""&dBG&""">"&frw&"</td>"
End If
If ThisDate = TWSunday Then
response.write "<td class=""agenda3"" bgcolor="""&selBG&""">"
else
response.write "<td class=""agenda3"" bgcolor="""&theBG&"""> "
End if
'Sunnudagsdagspantanir--------------------------------
RS.MoveFirst
While Not RS.EOF
If RS("dags") = CDate(TWSunday) Then
IF RS("READ") = 0 Then
OrderColor = "red"
else
OrderColor = "black"
End If
response.write "<table width=""100%"" cellspacing=""0"" cellpadding=""0"" border=""0"" class=""txtBlack"" style=""border-bottom:solid 1px #999999""><tr><td align=""center"" onmouseOver=""this.style.backgroundColor='#FFFFFF'"" onMouseOut=""this.style.backgroundColor=''"">"
response.write "<a href=""pop_detail.asp?ID="&RS("ID")&""" onclick=""window.open(this.href, 'popupwindow', 'width=400,height=350,scrollbars'); return false;"">"
response.write "<font color="&OrderColor&">"
response.write RS("kl1")&" "&RS("extra")&"<font></a>"
response.write "<tr><td><img width=""100%"" height=""1""></td></tr>"
response.write "</td></tr></table>"
End If
RS.MoveNext
Wend
'-----------------------------------------------------
response.write "</td>"
%>
</tr>
