%
'***********Connect To Database ************************
strconn = "driver={microsoft access driver (*.mdb)};" & _
"dbq=" & databasepath & ";"
set objconn = server.createobject("adodb.connection")
objconn.open strconn
'*******************************************************
strsql = "select * from calendar_config;"
set objrec = objconn.execute(strsql)
calendar_title = objrec("calendar_title")
calendar_height = objrec("calendar_height")
calendar_width = objrec("calendar_width")
day_abbr = objrec("day_abbr")
headerrowcolor = objrec("headerrowcolor")
headertextcolor = objrec("headertextcolor")
headertext = objrec("headertext")
headertextsize = objrec("headertextsize")
headertextcolor = objrec("headertextcolor")
showheadertext = objrec("showheadertext")
monthrowcolor = objrec("monthrowcolor")
monthtext = objrec("monthtext")
monthtextsize = objrec("monthtextsize")
monthtextcolor = objrec("monthtextcolor")
showmonthtext = objrec("showmonthtext")
daycellcolor = objrec("daycellcolor")
daytext = objrec("daytext")
daytextsize = objrec("daytextsize")
daytextcolor = objrec("daytextcolor")
publiccellcolor = objrec("publiccellcolor")
publictext = objrec("publictext")
publictextsize = objrec("publictextsize")
publiccellcolor = objrec("publiccellcolor")
publictextcolor = objrec("publictextcolor")
highlightpublic = objrec("highlightpublic")
todaycellcolor = objrec("todaycellcolor")
todaytext = objrec("todaytext")
todaytextsize = objrec("todaytextsize")
todaytextcolor = objrec("todaytextcolor")
highlighttoday = objrec("highlighttoday")
'Get public holidays
strsql = "select * from public_hols"
set objrec = objconn.execute(strsql)
Redim arrPublic(0)
arrIndex = 0
Do While NOT objREC.EOF
arrPublic(arrIndex) = objREC("HolDate")
arrIndex = arrIndex + 1
Redim Preserve arrPublic(arrIndex)
objREC.MoveNext
Loop
Redim Preserve arrPublic(Ubound(arrPublic)-1)
if Len(Request.Querystring("MONTH")) then
dtSelected = Request.querystring("YEAR") &"/" &Request.querystring("MONTH") &"/1"
strMonth = MONTHNAME(Request.QueryString("MONTH"))
strYear = Request.Querystring("YEAR")
strNewDate = Request.querystring("YEAR") &"/" &Request.querystring("MONTH") &"/"
elseif Len(Request.Form("MONTH")) then
dtSelected = Request.form("YEAR") &"/" &Request.form("MONTH") &"/1"
strMonth = MONTHNAME(Request.form("MONTH"))
strYear = Request.form("YEAR")
strNewDate = Request.form("YEAR") &"/" &Request.form("MONTH") &"/"
else
dtSelected = CDAte(NOW-DAY(NOW)+1)
strMonth = MONTHNAME(MONTH(NOW))
strYear = YEAR(NOW)
strNewDate = YEAR(NOW) &"/" &MONTH(NOW) &"/"
end if
strSQL = "select top 24 DueDate,Count(*) as Total,MAX(LastModified) as Latest from message where Month(DueDate)= " _
&Month(dtSelected) &" and Year(DueDate) = " &Year(dtSelected) _
&" group by DueDate order by DueDate DESC"
'Response.Write strSQL
set objREC = objCONN.Execute(strSQL)
Redim aMessages(0)
Redim aMessageDate(0)
Redim aMessageStatus(0)
arrIndex = 0
Do While NOT objREC.EOF
aMessages(arrIndex) = objREC("Total")
aMessageDate(arrIndex) = objREC("DueDate")
aMessageStatus(arrIndex) = objREC("Latest")
arrIndex = arrIndex + 1
Redim Preserve aMessages(arrIndex)
Redim Preserve aMessageDate(arrIndex)
Redim Preserve aMessageStatus(arrIndex)
objREC.MoveNext
Loop
objrec.close
objconn.close
set objrec = nothing
set objconn = nothing
%>
:: Kolej Yayasan UEM
<%
'*************************************
' Get the cell dimensions
'*************************************
CELL_WIDTH = calendar_width
CELL_HEIGHT = calendar_height
'*************************************
' Must the Day Names be abbreviated
'*************************************
blnAbbr = Day_Abbr
prevMonth = MONTH(DATEADD("M",-1,dtSelected))
nextMonth = MONTH(DATEADD("M",1,dtSelected))
prevYear = YEAR(DATEADD("M",-1,dtSelected))
nextYear = YEAR(DATEADD("M",1,dtSelected))
'******************************************************************
' Work out the number of days in the month that was submitted
'******************************************************************
datetime = dateadd("d", -datepart("d",dtSelected)+1,dtSelected)
datetime = dateadd("m", 1, datetime)
datetime = dateadd("d", -1, datetime)
intDays = datepart("d",datetime)
'****************************************************************
' CALENDAR HEADER
'****************************************************************
%>
<%
'****************************************************************
'Use intCounter to see how many cells have been written out
'****************************************************************
For I = 1 to Weekday(dtSelected)-1
Response.Write "
"
intCounter = intCounter + 1
Next
If intCounter-1 >= 7 then
intCounter = 0
Response.Write "
"
End if
For I = 1 to intDays
blnISPublic = FALSE
intCounter = intCounter + 1
newdate = strNewDate &I
If HighlightPublic then
For J = 0 to UBOUND(arrPublic)
If CDate(NewDate) = CDate(arrPublic(J)) then
blnIsPublic = TRUE
End if
Next
end if
If CDate(NewDate) = DATE then
If highlighttoday then
strCLASS = "TODAY"
end if
elseif blnIsPublic then
strCLASS = "PUBLIC"
else
strCLASS = "DAYS"
end if
'****************************************************************
' Write out data
'****************************************************************
For J= 0 to UBOUND(aMessageDate)-1
DatePlus7 = CDate(dateadd("d", -7,NOW))
DatePlus14 = CDate(dateadd("d", -14,NOW))
If CDate(aMessageStatus(J)) >= DatePlus7 then
strDateIMG = ""
elseif CDate(aMessageStatus(J)) >= DatePlus14 and CDate(aMessageStatus(J)) < DatePlus7 then
strDateIMG = ""
else
strDateIMG = ""
end if
If CDate(aMessagedate(J)) = CDate(NEWDATE) then
strIMG = "
"
exit For
else strIMG = " "
End if
Next
if intCounter mod 7 <> 0 then
Response.Write "