Kalender vil ikke vise December
Hej Folkens...Håber i kan hjælpe..
Har fundet en kanon kalender, men det vil bare ikke vise December
<%
'************************************************************************************************************************
'*
'* Class Name : clsCalendar_Class
'* Author : Dan Powderhill
'* Email : dan@diado.com
'* Start Date : 30 September 2003
'* Last Update : 01 October 2003
'* URL : http://www.diado.com/classes/calendar
'*
'************************************************************************************************************************
'*
'* Description : Provides a fully customisable MonthView calendar
'*
'* Usage Instructions : See above URL for full usage instructions
'*
'* Usage Restrictions : Please drop me a line if you intend to use this on any projects, commercial or otherwise, for no
'* other reason that I'd be interested to know where and how it's being used. Please do not sell
'* this code as your own, although you are free to package it with other work which you may be
'* selling. If you want to acknowledge me on the site you use this code on, that'd be nice, but it's
'* not mandatory.
'*
'************************************************************************************************************************
Class clsCalendar_Class
Public Version
Public DisplayDay
Public DisplayMonth
Public DisplayYear
Public DisplaySelection
Public TargetPage
Public LinkTarget
Public MinYear
Public MaxYear
Public DaysInMonth
Public FirstDayOfMonth
Public LargeCellSquare
Public SmallCellSquare
Public StartOnSunday
Private HostPage
Private Disabled(30)
Private Sub Class_Initialize()
Version = "0.4"
'Default the minimum and maximum years to allow - these can be overwritten once the class has been initialised
MinYear = 1990
MaxYear = 2020
'Default the cell sizes - these can be overwritten once the class has been initialised
LargeCellSquare = 50
SmallCellSquare = 20
'Default to not displaying the current day selection
DisplaySelection = false
'Get back the name of the page which is hosting this class
HostPage = request.ServerVariables("SCRIPT_NAME")
'Default to not starting on Sunday... i.e. start on Monday
StartOnSunday = false
end sub
Public Function BuildCalendar(CalendarType, UseInternalStyles)
dim i, strReturn, intRow, intDay, intCellSize, strClassPrefix, intAbbreviateTo
'If we've been passed the day, month and year to view from a calendar link then set to them
if len(request.querystring("calday")) > 0 then DisplayDay = cInt(request.querystring("calday"))
if len(request.querystring("calmonth")) > 0 then DisplayMonth = cInt(request.querystring("calmonth"))
if len(request.querystring("calyear")) > 0 then DisplayYear = cInt(request.querystring("calyear"))
'Check that we have a valid year, defaulting if not
if len(DisplayYear) = 0 then
DisplayYear = Year(Now())
else
if isNumeric(DisplayYear) then
if cInt(DisplayYear) < MinYear or cInt(DisplayYear) > MaxYear then
DisplayYear = Year(Now())
end if
else
DisplayYear = Year(Now())
end if
end if
'Check that we have a valid month, defaulting if not
if len(DisplayMonth) = 0 then
DisplayMonth = Month(Now())
else
if isNumeric(DisplayMonth) then
if DisplayMonth < 1 or DisplayMonth > 12 then
DisplayMonth = 1
end if
else
DisplayMonth = Month(Now())
end if
end if
'Work out how many days there are in the selected month
if DisplayMonth = 12 then
DaysInMonth = Day(DateAdd("d", -1, cDate("01/January/" & (DisplayYear + 1))))
else
DaysInMonth = Day(DateAdd("d", -1, cDate("01/" & MonthName(DisplayMonth + 1) & "/" & (DisplayYear))))
end if
'Check that we have a valid day, defaulting if not
if len(DisplayDay) = 0 then
DisplayDay = Day(Now())
else
if isNumeric(DisplayDay) then
if DisplayDay < 1 or DisplayDay > DaysInMonth then
DisplayDay = 1
end if
else
DisplayDay = Day(Now())
end if
end if
'Default the target page to the host page if it's not been populated
if len(TargetPage) = 0 then TargetPage = HostPage
'Work out what day of the week the selected month starts on
if StartOnSunday then
FirstDayOfMonth = WeekDay(cDate("01/" & MonthName(DisplayMonth) & "/" & DisplayYear), vbSunday)
else
FirstDayOfMonth = WeekDay(cDate("01/" & MonthName(DisplayMonth) & "/" & DisplayYear), vbMonday)
end if
'Write out the CSS styles if UseInternalStyles is true
if UseInternalStyles then
strReturn = strReturn & "<style>" & VbCrLf
strReturn = strReturn & " TABLE.clsCalendar_Small_Table {" & VbCrLf
strReturn = strReturn & " border : 1px solid #000000;" & VbCrLf
strReturn = strReturn & " }" & VbCrLf
strReturn = strReturn & " TD.clsCalendar_Small_WeekDayName {" & VbCrLf
strReturn = strReturn & " border : 1px solid #000000;" & VbCrLf
strReturn = strReturn & " font : 10px Verdana,Geneva,Arial,Helvetica,sans-serif;" & VbCrLf
strReturn = strReturn & " text-align : center;" & VbCrLf
strReturn = strReturn & " }" & VbCrLf
strReturn = strReturn & " TD.clsCalendar_Small_MonthAndYear {" & VbCrLf
strReturn = strReturn & " border : 1px solid #000000;" & VbCrLf
strReturn = strReturn & " font : 12px Verdana,Geneva,Arial,Helvetica,sans-serif;" & VbCrLf
strReturn = strReturn & " text-align : center;" & VbCrLf
strReturn = strReturn & " }" & VbCrLf
strReturn = strReturn & " TD.clsCalendar_Small_WeekEnd {" & VbCrLf
strReturn = strReturn & " border : 1px solid #000000;" & VbCrLf
strReturn = strReturn & " font : 11px Verdana,Geneva,Arial,Helvetica,sans-serif;" & VbCrLf
strReturn = strReturn & " text-align : center;" & VbCrLf
strReturn = strReturn & " font-weight : bold;" & VbCrLf
strReturn = strReturn & " background-color : #DDDDDD;" & VbCrLf
strReturn = strReturn & " }" & VbCrLf
strReturn = strReturn & " TD.clsCalendar_Small_SelectedWeekEnd {" & VbCrLf
strReturn = strReturn & " border : 2px solid #000000;" & VbCrLf
strReturn = strReturn & " font : 11px Verdana,Geneva,Arial,Helvetica,sans-serif;" & VbCrLf
strReturn = strReturn & " text-align : center;" & VbCrLf
strReturn = strReturn & " font-weight : bold;" & VbCrLf
strReturn = strReturn & " background-color : #00CCFF;" & VbCrLf
strReturn = strReturn & " }" & VbCrLf
strReturn = strReturn & " TD.clsCalendar_Small_SelectedWeekDay {" & VbCrLf
strReturn = strReturn & " border : 2px solid #000000;" & VbCrLf
strReturn = strReturn & " font : 11px Verdana,Geneva,Arial,Helvetica,sans-serif;" & VbCrLf
strReturn = strReturn & " text-align : center;" & VbCrLf
strReturn = strReturn & " font-weight : bold;" & VbCrLf
strReturn = strReturn & " background-color : #00CCFF;" & VbCrLf
strReturn = strReturn & " }" & VbCrLf
strReturn = strReturn & " TD.clsCalendar_Small_WeekDay {" & VbCrLf
strReturn = strReturn & " border : 1px solid #000000;" & VbCrLf
strReturn = strReturn & " font : 11px Verdana,Geneva,Arial,Helvetica,sans-serif;" & VbCrLf
strReturn = strReturn & " text-align : center;" & VbCrLf
strReturn = strReturn & " background-color : #FFFFCC;" & VbCrLf
strReturn = strReturn & " font-weight : bold;" & VbCrLf
strReturn = strReturn & " }" & VbCrLf
strReturn = strReturn & " SPAN.clsCalendar_Small_Disabled {" & VbCrLf
strReturn = strReturn & " font-size : 10px;" & VbCrLf
strReturn = strReturn & " font-weight : normal;" & VbCrLf
strReturn = strReturn & " }" & VbCrLf
strReturn = strReturn & " A.clsCalendar_Small_Link:Link {" & VbCrLf
strReturn = strReturn & " text-align : center;" & VbCrLf
strReturn = strReturn & " color : #000000;" & VbCrLf
strReturn = strReturn & " text-decoration : none;" & VbCrLf
strReturn = strReturn & " }" & VbCrLf
strReturn = strReturn & " A.clsCalendar_Small_Link:Visited {" & VbCrLf
strReturn = strReturn & " text-align : center;" & VbCrLf
strReturn = strReturn & " color : #000000;" & VbCrLf
strReturn = strReturn & " text-decoration : none;" & VbCrLf
strReturn = strReturn & " }" & VbCrLf
strReturn = strReturn & " A.clsCalendar_Small_Link:Hover {" & VbCrLf
strReturn = strReturn & " text-align : center;" & VbCrLf
strReturn = strReturn & " color : #000000;" & VbCrLf
strReturn = strReturn & " text-decoration : underline;" & VbCrLf
strReturn = strReturn & " }" & VbCrLf
strReturn = strReturn & " TABLE.clsCalendar_Large_Table {" & VbCrLf
strReturn = strReturn & " border : 1px solid #000000;" & VbCrLf
strReturn = strReturn & " }" & VbCrLf
strReturn = strReturn & " TD.clsCalendar_Large_WeekDayName {" & VbCrLf
strReturn = strReturn & " border : 1px solid #000000;" & VbCrLf
strReturn = strReturn & " font : 10px Verdana,Geneva,Arial,Helvetica,sans-serif;" & VbCrLf
strReturn = strReturn & " text-align : center;" & VbCrLf
strReturn = strReturn & " }" & VbCrLf
strReturn = strReturn & " TD.clsCalendar_Large_MonthAndYear {" & VbCrLf
strReturn = strReturn & " border : 1px solid #000000;" & VbCrLf
strReturn = strReturn & " font : 12px Verdana,Geneva,Arial,Helvetica,sans-serif;" & VbCrLf
strReturn = strReturn & " text-align : center;" & VbCrLf
strReturn = strReturn & " }" & VbCrLf
strReturn = strReturn & " TD.clsCalendar_Large_WeekEnd {" & VbCrLf
strReturn = strReturn & " border : 1px solid #000000;" & VbCrLf
strReturn = strReturn & " font : 12px Verdana,Geneva,Arial,Helvetica,sans-serif;" & VbCrLf
strReturn = strReturn & " text-align : center;" & VbCrLf
strReturn = strReturn & " background-color : #DDDDDD;" & VbCrLf
strReturn = strReturn & " font-weight : bold;" & VbCrLf
strReturn = strReturn & " }" & VbCrLf
strReturn = strReturn & " TD.clsCalendar_Large_WeekDay {" & VbCrLf
strReturn = strReturn & " border : 1px solid #000000;" & VbCrLf
strReturn = strReturn & " font : 12px Verdana,Geneva,Arial,Helvetica,sans-serif;" & VbCrLf
strReturn = strReturn & " text-align : center;" & VbCrLf
strReturn = strReturn & " background-color : #FFFFCC;" & VbCrLf
strReturn = strReturn & " font-weight : bold;" & VbCrLf
strReturn = strReturn & " }" & VbCrLf
strReturn = strReturn & " TD.clsCalendar_Large_SelectedWeekEnd {" & VbCrLf
strReturn = strReturn & " border : 2px solid #000000;" & VbCrLf
strReturn = strReturn & " font : 12px Verdana,Geneva,Arial,Helvetica,sans-serif;" & VbCrLf
strReturn = strReturn & " text-align : center;" & VbCrLf
strReturn = strReturn & " font-weight : bold;" & VbCrLf
strReturn = strReturn & " background-color : #00CCFF;" & VbCrLf
strReturn = strReturn & " }" & VbCrLf
strReturn = strReturn & " TD.clsCalendar_Large_SelectedWeekDay {" & VbCrLf
strReturn = strReturn & " border : 2px solid #000000;" & VbCrLf
strReturn = strReturn & " font : 12px Verdana,Geneva,Arial,Helvetica,sans-serif;" & VbCrLf
strReturn = strReturn & " text-align : center;" & VbCrLf
strReturn = strReturn & " font-weight : bold;" & VbCrLf
strReturn = strReturn & " background-color : #00CCFF;" & VbCrLf
strReturn = strReturn & " }" & VbCrLf
strReturn = strReturn & " SPAN.clsCalendar_Large_Disabled {" & VbCrLf
strReturn = strReturn & " font-size : 10px;" & VbCrLf
strReturn = strReturn & " font-weight : normal;" & VbCrLf
strReturn = strReturn & " }" & VbCrLf
strReturn = strReturn & " A.clsCalendar_Large_Link:Link {" & VbCrLf
strReturn = strReturn & " text-align : center;" & VbCrLf
strReturn = strReturn & " color : #000000;" & VbCrLf
strReturn = strReturn & " text-decoration : none;" & VbCrLf
strReturn = strReturn & " }" & VbCrLf
strReturn = strReturn & " A.clsCalendar_Large_Link:Visited {" & VbCrLf
strReturn = strReturn & " text-align : center;" & VbCrLf
strReturn = strReturn & " color : #000000;" & VbCrLf
strReturn = strReturn & " text-decoration : none;" & VbCrLf
strReturn = strReturn & " }" & VbCrLf
strReturn = strReturn & " A.clsCalendar_Large_Link:Hover {" & VbCrLf
strReturn = strReturn & " text-align : center;" & VbCrLf
strReturn = strReturn & " color : #000000;" & VbCrLf
strReturn = strReturn & " text-decoration : underline;" & VbCrLf
strReturn = strReturn & " }" & VbCrLf
strReturn = strReturn & "</style>" & VbCrLf
end if
'Use large calendar settings
if CalendarType = 1 then
intCellSize = LargeCellSquare
strClassPrefix = "clsCalendar_Large_"
intAbbreviateTo = 3
'Use small calendar settings
else
intCellSize = SmallCellSquare
strClassPrefix = "clsCalendar_Small_"
intAbbreviateTo = 1
end if
'Write out the table header and the day of week headings
strReturn = strReturn & "<table class=""" & strClassPrefix & "Table"">" & VbCrLf
strReturn = strReturn & "<tr>" & VbCrLf
strReturn = strReturn & "<td height=""" & intCellSize & """ colspan=""7"" class=""" & strClassPrefix & "MonthAndYear"">"
strReturn = strReturn & "<a href=""" & HostPage & "?calmonth="
if DisplayMonth - 1 < 1 then
strReturn = strReturn & "12&calyear=" & DisplayYear - 1
else
strReturn = strReturn & DisplayMonth - 1 & "&calyear=" & DisplayYear
end if
strReturn = strReturn & """ class=""" & strClassPrefix & "Link""><</a> "
strReturn = strReturn & Monthname(DisplayMonth) & " " & DisplayYear
strReturn = strReturn & " <a href=""" & HostPage & "?calmonth="
if DisplayMonth + 1 > 12 then
strReturn = strReturn & "1&calyear=" & DisplayYear + 1
else
strReturn = strReturn & DisplayMonth + 1 & "&calyear=" & DisplayYear
end if
strReturn = strReturn & """ class=""" & strClassPrefix & "Link"">></a>"
strReturn = strReturn & "</td>" & VbCrLf
strReturn = strReturn & "</tr>" & VbCrLf
strReturn = strReturn & "<tr>" & VbCrLf
for i = 1 to 7
strReturn = strReturn & "<td height=""" & intCellSize & "px"" width=""" & intCellSize & "px"" class=""" & strClassPrefix & "WeekDayName"">"
if StartOnSunday then
strReturn = strReturn & AbbreviateWeekDayName(i, intAbbreviateTo, vbSunday)
else
strReturn = strReturn & AbbreviateWeekDayName(i, intAbbreviateTo, vbMonday)
end if
strReturn = strReturn & "</td>" & VbCrLf
next
strReturn = strReturn & "</tr>" & VbCrLf
'Write out the dates by row
intDay = 1
for intRow = 1 to 6
if intDay <= DaysInMonth then
strReturn = strReturn & "<tr>" & VbCrLf
for i = 1 to 7
strReturn = strReturn & "<td height=""" & intCellSize & """ width=""" & intCellSize & """ class="""
if StartOnSunday then
if i > 1 and i < 7 then
if intDay = DisplayDay and (((intRow-1)* 6) + i) >= FirstDayOfMonth and DisplaySelection = true then
strReturn = strReturn & strClassPrefix & "SelectedWeekDay"
else
strReturn = strReturn & strClassPrefix & "WeekDay"
end if
else
if intDay = DisplayDay and i >= FirstDayOfMonth and DisplaySelection = true then
strReturn = strReturn & strClassPrefix & "SelectedWeekEnd"
else
strReturn = strReturn & strClassPrefix & "WeekEnd"
end if
end if
else
if i < 6 then
if intDay = DisplayDay and (((intRow-1)* 6) + i) >= FirstDayOfMonth and DisplaySelection = true then
strReturn = strReturn & strClassPrefix & "SelectedWeekDay"
else
strReturn = strReturn & strClassPrefix & "WeekDay"
end if
else
if intDay = DisplayDay and i >= FirstDayOfMonth and DisplaySelection = true then
strReturn = strReturn & strClassPrefix & "SelectedWeekEnd"
else
strReturn = strReturn & strClassPrefix & "WeekEnd"
end if
end if
end if
strReturn = strReturn & """>"
if intRow = 1 then
if i < FirstDayOfMonth then
strReturn = strReturn & " "
else
if IsDisabled(intDay) then
strReturn = strReturn & "<span class=""" & strClassPrefix & "Disabled"">" & intDay & "</span>"
else
strReturn = strReturn & "<a href=""" & TargetPage & ReturnQA(TargetPage) & "calday=" & intDay & "&calmonth=" & DisplayMonth & "&calyear=" & DisplayYear & """ class=""" & strClassPrefix & "Link"""
if len(LinkTarget) > 0 then strReturn - strReturn & " target=""" & LinkTarget & """"
strReturn = strReturn & ">" & intDay & "</a>"
end if
intDay = intDay + 1
end if
else
if intDay <= DaysInMonth then
if IsDisabled(intDay) then
strReturn = strReturn & "<span class=""" & strClassPrefix & "Disabled"">" & intDay & "</span>"
else
strReturn = strReturn & "<a href=""" & TargetPage & ReturnQA(TargetPage) & "calday=" & intDay & "&calmonth=" & DisplayMonth & "&calyear=" & DisplayYear & """ class=""" & strClassPrefix & "Link"""
if len(LinkTarget) > 0 then strReturn - strReturn & " target=""" & LinkTarget & """"
strReturn = strReturn & ">" & intDay & "</a>"
end if
intDay = intDay + 1
else
strReturn = strReturn & " "
end if
end if
strReturn = strReturn & "</td>" & VbCrLf
next
strReturn = strReturn & "</tr>" & VbCrLf
end if
next
strReturn = strReturn & "</table>" & VbCrLf
BuildCalendar = strReturn
end function
public sub Disable(intDay)
dim i
'Check we have a valid day
if len(intDay) = 0 or not isNumeric(intDay) then exit sub
'Loop through the disabled array to see if this day is already disabled, in which case abort the sub
for i = 0 to 30
if intDay = Disabled(i) then exit sub
next
'Add it to the array at the appropriate place
for i = 0 to 30
if len(Disabled(i)) = 0 or Disabled(i) = 0 then
Disabled(i) = intDay
exit sub
end if
next
end sub
public sub Enable(intDay)
dim i
'Check we have a valid day
if len(intDay) = 0 or not isNumeric(intDay) then exit sub
'Loop through the disabled array to see if this day is disabled, and zero that array value
for i = 0 to 30
if intDay = Disabled(i) then Disabled(i) = 0
next
end sub
Public Function IsDisabled(intDay)
dim i
IsDisabled = false
for i = 0 to 30
if Disabled(i) = intDay then
IsDisabled = true
exit function
end if
next
end function
'Returns either a question mark or an ampersand dependant on whether the input string contains a question mark already
private function ReturnQA(strInput)
if instr(strInput, "?") > 0 then
ReturnQA = "&"
else
ReturnQA = "?"
end if
end function
Private Function AbbreviateWeekDayName(intWeekDay, intAbbreviateTo, StartDay)
AbbreviateWeekDayName = WeekDayName(intWeekDay, True, StartDay)
AbbreviateWeekDayName = Left(AbbreviateWeekDayName, intAbbreviateTo)
end function
Private Sub Class_Terminate()
end sub
end Class
dd = date()
d = day(now)
m = month(now)
y = year(now)
dim myCalendar
set myCalendar = new clsCalendar_Class
myCalendar.DisplayDay = d
myCalendar.DisplayMonth = m
myCalendar.DisplayYear = y
myCalendar.DisplaySelection = true
'myCalendar.TargetPage = "target.asp"
'myCalendar.LinkTarget = "frmContentFrame"
myCalendar.LargeCellSquare = 45
myCalendar.SmallCellSquare = 20
myCalendar.MinYear = 2003
myCalendar.MaxYear = 2020
'myCalendar.Disable 10
myCalendar.Disable 33
'myCalendar.StartsOnSunday = false
response.write myCalendar.BuildCalendar(2,true)
%>
