%
Class calClass
Private calendarID_
Private calDate_
Private calName_
Private mem_
Private isGroupManager_
Private canAddEvent_
Private isCalendarModerator_
Private canAddRecurring_
Private canReadCalendar_
Private canDiscussEvent_
Private uploadRestriction_
Private uploadSize_
Private uploadFormat_
Private eventID_
Private canSubscribeCalendar_
Private canDeleteEvent_
Private isSubscribed_
Private eventByMem_
Private eventSignupAble_
Private discussForumID_
Private Sub Class_Initialize()
calendarID_ = -1000
calDate_ = SQLNowDateOnly()
isGroupManager_ = false
canAddEvent_ = false
isCalendarModerator_ = false
canAddRecurring_ = false
canReadCalendar_ = true
canDiscussEvent_ = false
isSubscribed_ = false
canDeleteEvent_ = false
canSubscribeCalendar_ = false
uploadSize_ = 0
uploadFormat_ = ""
eventID_ = 0
eventByMem_=-1000
eventSignupAble_ = false
discussForumID_ = 0
End Sub
Public Property Let calendarID(val)
calendarID_ = val
End Property
Public Property Let calDate(val)
calDate_ = val
End Property
Public Property Let eventID(val)
eventID_ = iff((len(val)<>0 and isNumeric(val)),val,0)
End Property
Public Property Let Mem(val)
mem_ = val
End Property
Public Property Get eventSignupAble
eventSignupAble = eventSignupAble_
End Property
Public Property Get discussForumID
discussForumID = discussForumID_
End Property
Public Property Get canSubscribeCalendar
canSubscribeCalendar = canSubscribeCalendar_
End Property
Public Property Get calendarID
calendarID = calendarID_
End Property
Public Property Get isSubscribed
isSubscribed = isSubscribed_
End Property
Public Property Get canDeleteEvent
canDeleteEvent = canDeleteEvent_
End Property
Public Property Get eventByMem
eventByMem = eventByMem_
End Property
Public Property Get calName
calName = calName_
End Property
Public Property Get isGroupManager
isGroupManager = isGroupManager_
End Property
Public Property Get isCalendarModerator
isCalendarModerator = isCalendarModerator_
End Property
Public Property Get canAddEvent
canAddEvent = canAddEvent_
End Property
Public Property Get canAddRecurring
canAddRecurring = canAddRecurring_
End Property
Public Property Get canReadCalendar
canReadCalendar = canReadCalendar_
End Property
Public Property Get canDiscussEvent
canDiscussEvent = canDiscussEvent_
End Property
Public Property Get uploadSize
uploadSize = uploadSize_
End Property
Public Property Get uploadFormat
uploadFormat = uploadFormat_
End Property
Public Sub GetPermission ()
'response.write calendarID_&":"&eventID_
if eventID_ <> 0 and (isNumeric(calendarID_) or len(calendarID_)=0) then _
calendarID_ = -1000
'response.write calendarID_
if not isNumeric(calendarID_) then
if memID="-1" and calendarID_="b" then
canReadCalendar_ = true
calName_ = iff(calendarID_="a",defAnnounceDesc,profBirthday)
else
canReadCalendar_ = true
calName_ = iff(calendarID_="a",defAnnounceDesc,profBirthday)
end if
elseif isNumeric(calendarID_) then
Dim objCom,tempArr
Set objCom = server.createobject("adodb.command")
with objCom
.activeconnection = datastore
'.commandTimeout = 200
.commandText = dbOwnerPrefix&"spGetCalendarPermission"
.commandType = adCmdStoredProc
.Parameters.Append .Createparameter("@RETURN_VALUE", adInteger, adParamReturnValue, 0 )
.Parameters.Append .Createparameter("@calendarID", adInteger, adParamInputOutput, 0, calendarID_)
.Parameters.Append .Createparameter("@memID", adInteger, adParamInput, 0, mem_)
.Parameters.Append .Createparameter("@eventID", adInteger, adParamInput, 0, eventID_)
.Parameters.Append .Createparameter("@canReadCalendar", adUnsignedTinyInt, adParamOutput, 0)
.Parameters.Append .Createparameter("@canAddEvent", adUnsignedTinyInt, adParamOutput, 0)
.Parameters.Append .Createparameter("@canDeleteEvent", adUnsignedTinyInt, adParamOutput, 0)
.Parameters.Append .Createparameter("@canSubscribeCalendar", adUnsignedTinyInt, adParamOutput, 0)
.Parameters.Append .Createparameter("@canAddRecurring", adUnsignedTinyInt, adParamOutput, 0)
.Parameters.Append .Createparameter("@isCalendarModerator", adUnsignedTinyInt, adParamOutput, 0)
.Parameters.Append .Createparameter("@isGroupManager", adUnsignedTinyInt, adParamOutput, 0)
.Parameters.Append .Createparameter("@canDiscussEvent", adUnsignedTinyInt, adParamOutput, 0)
.Parameters.Append .Createparameter("@uploadRestriction", adVarChar, adParamOutput, 150)
.Parameters.Append .Createparameter("@CalendarName", adVarchar, adParamOutput, 50)
.Parameters.Append .Createparameter("@isSubsribed", adUnsignedTinyInt, adParamOutput, 0)
.Parameters.Append .Createparameter("@eventByMem", adInteger, adParamOutput, 0)
.Parameters.Append .Createparameter("@eventSignupAble", adUnsignedTinyInt, adParamOutput, 0)
.Parameters.Append .Createparameter("@discussForumID", adInteger, adParamOutput, 0)
.execute , , adExecuteNoRecords
isGroupManager_ = iff(.parameters("@isGroupManager")=1,true,false)
canAddEvent_ = iff(.parameters("@canAddEvent")=1,true,false)
canDeleteEvent_ = iff(.parameters("@canDeleteEvent")=1,true,false)
canSubscribeCalendar_ = iff(.parameters("@canSubscribeCalendar")=1,true,false)
isCalendarModerator_ = iff(.parameters("@isCalendarModerator")=1,true,false)
canAddRecurring_ = iff(.parameters("@canAddRecurring")=1,true,false)
canReadCalendar_ = iff(.parameters("@canReadCalendar")=1,true,false)
canDiscussEvent_ = iff(.parameters("@canDiscussEvent")=1,true,false)
eventByMem_ = .parameters("@eventByMem")
uploadRestriction_ = .parameters("@uploadRestriction")
calName_ = .parameters("@CalendarName")
isSubscribed_ = iff(.parameters("@isSubsribed")=1,true,false)
calendarID_ = iff(calendarID_=-1000,.parameters("@calendarID"),calendarID_)
eventSignupAble_ = iff(.parameters("@eventSignupAble")=1,true,false)
discussForumID_ = .parameters("@discussForumID")
if uploadRestriction_ <> "" and lcase(Application(dbName&"upload")) <> "noupload" then
tempArr = split(uploadRestriction_,"|")
if isArray(tempArr) then
uploadSize_ = tempArr(0)
if ubound(tempArr)=1 then uploadFormat_ = tempArr(1)
end if
end if
'response.write .parameters("@canReadCalendar")
end with
Set objCom = nothing
end if
if isAdmin then
isGroupManager_ = true
canSubscribeCalendar_ = true
canAddEvent_ = true
canDeleteEvent_ = true
isCalendarModerator_ = true
canAddRecurring_ = true
canReadCalendar_ = true
'canDiscussEvent_ = true
if lcase(Application(dbName&"upload")) <> "noupload" then
uploadSize_ = 9999
uploadFormat_ = "*.*"
end if
end if
End Sub
Public Sub generateEvent()
if not canReadCalendar_ then
response.redirect ("calendar.asp")
response.end
end if
Dim strSQL,objRS,allEvents
If (isNumeric(eventID_) and calendarID_ = "a") then
strSQL = "spGetAnnouncementWithCal ("&eventID_&")"
elseif (isNumeric(eventID_) and isNumeric(calendarID_)) then
strSQL = "spGetEvent ("&eventID_&")"
else
response.end
end if
set objRS = server.createobject("adodb.recordset")
with objRS
.CacheSize = 150
.open dbOwnerPrefix&strSQL, datastore, , , adcmdStoredProc 'adCmdText
If not (.EOF or .BOF) then
allEvents = .getrows
End if
.close
end with
set objRS=nothing
call generateHeader("D")
Dim iEvent
Dim isPmEnabled:isPmEnabled = iff(Application(dbName&"maxShortMsg")=0,false,true)
if isArray(allEvents) then
Dim objPGDCode
Set objPGDCode = New RegExp
objPGDCode.global = true
objPGDCode.ignorecase = true
'for iEvent = 0 to ubound(allEvents,2)
if isNumeric(calendarID_) then
Dim CalendarID:CalendarID = allEvents(0,0)
Dim mem:mem = allEvents(1,0)
Dim login:login = allEvents(2,0)
Dim dateinserted:dateinserted = allEvents(3,0)
Dim withsig:withsig = allEvents(4,0)
Dim upfile:upfile = allEvents(5,0)
Dim allowSignUp:allowSignUp = allEvents(6,0)
Dim allowDiscussion:allowDiscussion = allEvents(7,0)
Dim discussionMsgID:discussionMsgID = allEvents(8,0)
Dim msgIcons:msgIcons = allEvents(9,0)
Dim edit:edit = allEvents(10,0)&""
Dim subject:subject = SQLout(allEvents(11,0))
Dim body:body = SQLout(allEvents(12,0))
Dim EventStartDate:EventStartDate = allEvents(13,0)
Dim EventStartTime:EventStartTime = allEvents(14,0)
Dim EventEndDate :EventEndDate = allEvents(15,0)
Dim EventEndTime:EventEndTime = allEvents(16,0)
Dim RecurrenceType :RecurrenceType = allEvents(17,0)
Dim PeriodicCode:PeriodicCode = allEvents(18,0)
Dim PeriodicAmount :PeriodicAmount = allEvents(19,0)
Dim MonthlyCode :MonthlyCode = allEvents(20,0)
Dim MonthlyOrdinal :MonthlyOrdinal = allEvents(21,0)
Dim MonthlyDay :MonthlyDay = allEvents(22,0)
Dim AnniversaryDate:AnniversaryDate = allEvents(23,0)
Dim signature:signature = allEvents(24,0)
Dim allowShortMsg:allowShortMsg = allEvents(25,0)
Dim acceptShortMsg:acceptShortMsg = allEvents(26,0)
Dim dispPMLink:dispPMLink = false
if isPmEnabled then
if (allowShortMsg = 1 and acceptShortMsg = 1) or isAdmin then dispPMLink = true
end if
else
'title, body, startDate,endDate
subject = SQLout(allEvents(0,0))
body = SQLout(allEvents(1,0))
EventStartDate = allEvents(2,0)
EventEndDate = allEvents(3,0)
end if
response.write ("
"&vbcrlf)
response.write ("")
response.write ("")
if isNumeric(calendarID_) then _
response.write (" "&iff(RecurrenceType <> "N"," ","")) _
else response.write (" ")
response.write (""&SQLOut(subject)&" | ")
response.write ("
")
if isNumeric(calendarID_) then
response.write ("")
response.write ("| "&calDayBy&" | ")
response.write (" "&login&" ")
if dispPMLink then response.write (" ")
response.write (" ")
response.write (" | ")
response.write (iff(mem&"" = memID or isCalendarModerator_," "," "))
response.write (iff((canDeleteEvent_ and (mem&"" = memID)) or isCalendarModerator_," "," "))
response.write (" |
| ")
response.write ("
")
response.write ("")
response.write ("| "&calEvenTypeDesc&" | ")
response.write (""&explainEventType(RecurrenceType,PeriodicCode,PeriodicAmount,MonthlyCode,MonthlyOrdinal,MonthlyDay,AnniversaryDate)&" | ")
response.write ("
")
end if
response.write ("")
response.write ("| "&calAddStart&" | ")
if isNumeric(calendarID_) then
response.write (""&SQLdate(EventStartDate, timeoffset, true)&" | ")
else
response.write (""&SQLdate(EventStartDate, -100, true)&" | ")
end if
response.write ("
")
response.write ("")
response.write ("| "&calAddEnd&" | ")
if isNumeric(calendarID_) then
response.write (""&SQLdate(EventEndDate, timeoffset, true)&" | ")
else
response.write (""&SQLdate(EventEndDate, -100, true)&" | ")
end if
response.write ("
")
response.write ("")
response.write (""&(PGDCodeResolution(objPGDCode,body,1))&_
iff(len(upfile)<>0,"
"&upfile&"","")&_
iff(len(edit)=0,"","
"&edit&""))
NoImage = NoSigImage
response.write (iff(withsig = 1,PGDCodeResolution(objPGDCode,sigDivider&signature,1),"")&_
" | ")
response.write ("
")
if isNumeric(calendarID_) then
response.write ("")
response.write ("| "&_
iff((allowSignUp=1 and mem&"" = memID) or isCalendarModerator_,""&calWhoSignedUp&" | ","")&_
iff(allowSignUp=1,""&calSignup&" | ","")&_
iff(not isNull(discussionMsgID) and canDiscussEvent_ and allowDiscussion=1,""&calJoinDiscuss&" | ","")&_
tmDate&": "&SQLDate(dateinserted,timeoffset,true)&" | ")
response.write ("
")
end if
response.write ("
")
'next
Set objPGDCode = nothing
else
response.redirect ("calendar.asp")
response.end
end if
end sub
Public Sub generateDailyCalendar()
if not canReadCalendar_ then
response.redirect ("calendar.asp")
response.end
end if
call generateHeader("D")
Dim strStoredProc
Dim calMonth, calYear
calMonth = Month(calDate_)
calYear = Year(calDate_)
if isNumeric(calendarID_) then
strStoredProc = "spGetCalendarByMonth ("&calendarID_&",'"&startDateOfMonth(calDate_)&"','"&endDateOfMonth(calDate_)&"')"
' response.write strStoredProc
else
if calendarID_ = "a" then
strStoredProc = "spGetCalendarAnnouncement ('"&startDateOfMonth(calDate_)&"','"&endDateOfMonth(calDate_)&"')"
elseif calendarID_ = "b" then
strStoredProc = "spGetCalendarBirthday ("&calMonth&")"
end if
end if
Dim objRS, allEvents,i
set objRS = server.createobject("adodb.recordset")
with objRS
.CacheSize = 150
.open dbOwnerPrefix&strStoredProc, datastore, , , adcmdStoredProc 'adCmdText
If not (.EOF or .BOF) then
allEvents = .getrows
End if
.close
end with
set objRS=nothing
if isNumeric(calendarID_) then
call writeCalendarEvents(allEvents,calendarID_,day(calDate_),calDate_&" "&SQLTime(time(),24),"D")
else
call writeDefaultEvents(allEvents,calendarID_,day(calDate_),calDate_&" "&SQLTime(time(),24),"D")
end if
End sub
Public Sub generateMonthlyCalendar()
'response.write canReadCalendar_
'response.end
if not canReadCalendar_ then
response.redirect ("calendar.asp")
response.end
end if
call generateHeader("M")
Dim strStoredProc
Dim calMonth, calYear
calMonth = Month(calDate_)
calYear = Year(calDate_)
if isNumeric(calendarID_) then
strStoredProc = "spGetCalendarByMonth ("&calendarID_&",'"&startDateOfMonth(calDate_)&"','"&endDateOfMonth(calDate_)&"')"
' response.write strStoredProc
else
if calendarID_ = "a" then
strStoredProc = "spGetCalendarAnnouncement ('"&startDateOfMonth(calDate_)&"','"&endDateOfMonth(calDate_)&"')"
elseif calendarID_ = "b" then
strStoredProc = "spGetCalendarBirthday ("&calMonth&")"
end if
end if
Dim objRS, allEvents
set objRS = server.createobject("adodb.recordset")
with objRS
.CacheSize = 150
.open dbOwnerPrefix&strStoredProc, datastore, , , adcmdStoredProc 'adCmdText
If not (.EOF or .BOF) then
allEvents = .getrows
End if
.close
end with
set objRS=nothing
Dim c_Position,i,c_Total_day_in_month,k
c_Total_day_in_month = day(endDateOfMonth(calDate_))
response.write (""&vbcrlf)
response.write("")
for i = 1 to 7
response.write ("| "&weekdayname(i)&" | ")
next
response.write("
")
response.write("")
c_Position = weekday (startDateOfMonth(calDate_))
Dim todayAfterTimeOffset
todayAfterTimeOffset = DateAdd("h",timeoffset+memTimeOffset,SQLNowDate())
todayAfterTimeOffset = SQLMediumDate(todayAfterTimeOffset)
if c_Position<>1 then
for i=1 to (c_Position-1)
response.write ("| | "&vbcrlf)
next
end if
Dim allEventDays, eventArray
If not isNumeric(calendarID_) and isArray(allEvents) then
eventArray = ExtractOneDimension(allEvents, 2) ' third field denotes day
allEventDays = Join(eventArray,",")
elseif isNumeric(calendarID_) and isArray(allEvents) then
'allEventDays = ParseOutEventDays(allEvents) ' available in later version
'response.write allEventDays
end if
for i=1 to c_Total_day_in_month
Dim currentDate
currentDate = year(calDate_)&"-"&LeadingZero(month(calDate_))&"-"&LeadingZero(i)&" "&SQLTime(time(),24)
currentDate = SQLMediumDate(currentDate)
response.write ("")
Dim iEvent
If not isNumeric(calendarID_) then
if Instr(1, "," & allEventDays & ",", "," & i & ",", 0) > 0 then
response.write(""&i&"")
call writeDefaultEvents(allEvents,calendarID_,i,currentDate,"M")
else
response.write(""&i&"")
end if
Else
'if Instr(1, "," & allEventDays & ",", "," & i & ",", 0) > 0 then
call writeCalendarEvents(allEvents,calendarID_,i,currentDate,"M")
'else
'response.write(""&i&"")
'end if
End If
response.write (" | "&vbcrlf)
if c_Position = 7 then
response.write ("
"&vbcrlf)
if i<>c_Total_day_in_month then response.write ("" &vbcrlf)
end if
if i<>c_Total_day_in_month then
c_Position=c_Position+1
if c_Position > 7 then c_Position=c_Position-7
end if
next
if c_Position<>7 then
for k=1 to (7-c_position)
response.write ("| | "&vbcrlf)
next
response.write ("
"&vbcrlf)
end if
response.write ("
")
End Sub
Private sub writeDefaultEvents(byVal allEvents,byVal calendarID,byVal i,byVal currentDate, byVal types)
Dim iEvent
if types="M" then
if calendarID = "a" then
Dim announceCount:announceCount = 0
for iEvent = 0 to ubound(allEvents,2)
if allEvents(2,iEvent) = i then
announceCount = announceCount + 1
if announceCount = 4 then
response.write("
"&calMoreEvents&"")
exit for
else
response.write ("
"&left(SQLOut(allEvents(1,iEvent)),15)&"..")
end if
end if
next
elseif calendarID = "b" then
Dim birthCount:birthCount = 0
for iEvent = 0 to ubound(allEvents,2)
memBirth = allEvents(0,iEvent)
loginBirth = allEvents(1,iEvent)
bYear = allEvents(3,iEvent)
hideYear = allEvents(4,iEvent)
bMonth = month(calDate_)
bDay = allEvents(2,iEvent)
if bDay = i then
birthCount = birthCount + 1
if birthCount = 4 then
response.write("
"&calMoreEvents&"")
exit for
else
response.write ("
"&left(loginBirth,15)&"..")
end if
end if
next
end if
else
if calendarID = "a" then
Dim hasEvent:hasEvent = false
if isArray(allEvents) then
for iEvent = 0 to ubound(allEvents,2)
if allEvents(2,iEvent) = i then
response.write (""&vbcrlf)
response.write ("")
response.write (""&(iEvent+1)&". "&SQLOut(allEvents(1,iEvent))&" | ")
response.write ("
")
response.write ("")
response.write ("| "&calAddStart&" | ")
response.write (""&SQLDate(allEvents(3,iEvent),-100,true))
response.write (" | ")
response.write ("
")
response.write ("")
response.write ("| "&calAddEnd&" | ")
response.write (""&SQLDate(allEvents(4,iEvent),-100,true))
response.write (" | ")
response.write ("
")
response.write ("
")
hasEvent = true
end if
next
end if
if not hasEvent then
response.write (""&vbcrlf)
response.write ("| "&calNoAnnouncementsToday&" |
")
end if
elseif calendarID = "b" then
Dim memBirth,loginBirth,bYear,hideYear,bMonth,bDay,allowShortMsg,acceptShortMsg
hasEvent = false
Dim isPmEnabled:isPmEnabled = iff(Application(dbName&"maxShortMsg")=0,false,true)
if isArray(allEvents) then
for iEvent = 0 to ubound(allEvents,2)
if allEvents(2,iEvent) = i then
memBirth = allEvents(0,iEvent)
loginBirth = allEvents(1,iEvent)
bYear = allEvents(3,iEvent)
allowShortMsg = allEvents(5,iEvent)
acceptShortMsg = allEvents(6,iEvent)
Dim dispPMLink:dispPMLink = false
if isPmEnabled then
if (allowShortMsg = 1 and acceptShortMsg = 1) or isAdmin then dispPMLink = true
end if
bMonth = month(calDate_)
bDay = i
hideYear = allEvents(4,iEvent)
response.write (""&vbcrlf)
response.write ("")
response.write (""&(iEvent+1)&". "&SQLOut(loginBirth)&" | ")
response.write ("
")
response.write ("")
response.write ("| "&calName_&" | ")
response.write (""&iff((hideYear and not isAdmin and not (""&memBirth=memID)),replace(SQLBirthdate(bDay,bMonth,bYear),bYear,"**"),SQLBirthdate(bDay,bMonth,bYear))&" ")
if dispPMLink then response.write (" ")
response.write (" ")
response.write (" | ")
response.write ("
")
response.write ("
")
hasEvent = true
end if
next
end if
if not hasEvent then
response.write (""&vbcrlf)
response.write ("| "&calNoBirthdaysToday&" |
")
end if
end if
end if
end sub
Private sub writeCalendarEvents(byVal allEvents,byVal calendarID,byVal i, byVal currentDate, byVal types)
Dim iEvent, iOrdi, proceedWithEvent, writeThisEvent
'------0------1-----2---------3--------------4------------5--------
Dim EventID,login,subject,EventStartDate,EventEndDate,RecurrenceType
'--------6--------------7--------8-------------9------------10------------11-----------12--------13-------14-----------15
Dim PeriodicCode,PeriodicAmount,MonthlyCode,MonthlyOrdinal,MonthlyDay,AnniversaryDate, msgIcons,byMem,allowShortMsg,acceptShortMsg
Dim fStr, hasEvent:hasEvent = false
Dim pDifference, pReAdded, timeoffset:timeoffset = Application(dbName&"timeoffset")
Dim dayEventCount:dayEventCount = 0
Dim monthEventCount:monthEventCount = 0
Dim isPmEnabled:isPmEnabled = iff(Application(dbName&"maxShortMsg")=0,false,true)
Set fStr = new StringBuilder
if isArray(allEvents) then
for iEvent = 0 to ubound(allEvents,2)
proceedWithEvent = false
writeThisEvent = false
EventID = allEvents(0,iEvent)
login = allEvents(1,iEvent)
subject = allEvents(2,iEvent)
EventStartDate = SQLMediumDate(DateAdd("h",timeoffset+memTimeOffset,allEvents(3,iEvent)))
EventEndDate = SQLMediumDate(DateAdd("h",timeoffset+memTimeOffset,allEvents(4,iEvent)))
RecurrenceType = allEvents(5,iEvent)
PeriodicCode = allEvents(6,iEvent)
PeriodicAmount = allEvents(7,iEvent)
MonthlyCode = allEvents(8,iEvent)
MonthlyOrdinal = allEvents(9,iEvent)
MonthlyDay = allEvents(10,iEvent)
AnniversaryDate = allEvents(11,iEvent)
msgIcons = allEvents(12,iEvent)
byMem = allEvents(13,iEvent)
allowShortMsg = allEvents(14,iEvent)
acceptShortMsg = allEvents(15,iEvent)
Dim dispPMLink:dispPMLink = false
if isPmEnabled then
if (allowShortMsg = 1 and acceptShortMsg = 1) or isAdmin then dispPMLink = true
end if
if datediff("d",EventStartDate,currentDate)>=0 and datediff("d",currentDate,EventEndDate)>=0 then proceedWithEvent = true
if proceedWithEvent then
SELECT Case RecurrenceType
Case "N"
if day(EventStartDate) = i and month(EventStartDate) = month(currentDate) then writeThisEvent = true
Case "A"
if day(AnniversaryDate) = i then
writeThisEvent = true
end if
Case "M"
if MonthlyCode = "A" then
pDifference = DateDiff("m",EventStartDate,currentDate)
if MonthlyDay = 32 and i>=28 then
if i = day(endDateOfMonth(currentDate)) and (pDifference mod monthlyOrdinal = 0) then writeThisEvent = true
elseif MonthlyDay = i and (pDifference mod monthlyOrdinal = 0) then
writeThisEvent = true
end if
elseif getLogicalMonthDate(MonthlyDay,MonthlyOrdinal,endDateOfMonth(currentDate)) = i and MonthlyCode = "L" then
writeThisEvent = true
end if
Case "P"
pDifference = DateDiff(PeriodicCode,EventStartDate,currentDate)
pReAdded = DateAdd(PeriodicCode,pDifference,EventStartDate)
'response.write SQLMediumDateOnly(pReAdded)&":"¤tDate
If (SQLMediumDateOnly(pReAdded) = SQLMediumDateOnly(currentDate)) and _
(pDifference mod PeriodicAmount = 0) then writeThisEvent = true
End SELECT
if writeThisEvent then
hasEvent = true
if types = "M" then
monthEventCount = monthEventCount + 1
if monthEventCount = 4 then
fStr.Append("
"&calMoreEvents&"")
exit for
else
fStr.Append("
"&_
"
"&iff(RecurrenceType <> "N","
","")&left(SQLOut(subject),15)&"..")
end if
else'generate calendar by day
dayEventCount = dayEventCount +1
fStr.Append (""&vbcrlf)
fStr.Append ("")
fStr.Append (""&dayEventCount&". "&iff(RecurrenceType <> "N"," ","")&""&SQLOut(subject)&" | ")
fStr.Append ("
")
fStr.Append ("")
fStr.Append ("| "&calDayBy&" | ")
fStr.Append (" "&login&" ")
if dispPMLink then fStr.Append (" ")
fStr.Append (" ")
fStr.Append (" | ")
fStr.Append (iff(byMem&"" = memID or isCalendarModerator_," "," "))
fStr.Append (iff((canDeleteEvent_ and (byMem&"" = memID)) or isCalendarModerator_," "," "))
fStr.Append (" |
| ")
fStr.Append ("
")
fStr.Append ("")
fStr.Append ("| "&calEvenTypeDesc&" | ")
fStr.Append (""&explainEventType(RecurrenceType,PeriodicCode,PeriodicAmount,MonthlyCode,MonthlyOrdinal,MonthlyDay,AnniversaryDate)&" | ")
fStr.Append ("
")
fStr.Append ("")
fStr.Append ("| "&calAddStart&" | ")
fStr.Append (""&SQLdate(EventStartDate, -100, true)&" | ")
fStr.Append ("
")
fStr.Append ("")
fStr.Append ("| "&calAddEnd&" | ")
fStr.Append (""&SQLdate(EventEndDate, -100, true)&" | ")
fStr.Append ("
")
fStr.Append ("
")
end if
end if
end if
next
end if
if types="M" then
if hasEvent then
response.write (""&i&""&fStr.Value)
else
response.write(""&i&"")
end if
else
if hasEvent then
response.write (fStr.Value)
else
response.write (""&vbcrlf)
response.write ("| "&calTodayHasNoEvent&" |
")
end if
end if
Set fStr = nothing
End sub
Private function istoday(byVal currentDate, byVal todayAfterTimeOffset)
isToday=iff(datediff("d",currentDate,todayAfterTimeOffset)<>0,tableinside," class='high' ")
end function
Private function getLogicalMonthDate(MonthDay,MonthlyOrdinal,endDateOfMonth)
Dim firstDayWeekday:firstDayWeekday = weekday(startDateOfMonth(calDate_))
Dim startingDate:startingDate = iff(Monthday day(endDateOfMonth),startingDate + 21,startingDate + 28)
else
getLogicalMonthDate = startingDate + (MonthlyOrdinal-1)*7
end if
end function
Private Sub generateHeader(T)
Response.Write ("" & VbCrLf)
Response.Write ("" & VbCrLf)
Response.Write ("" & VbCrLf)
Response.Write ("" & VbCrLf)
Response.Write ("" & VbCrLf)
if T="M" then
Response.Write ("| << | " & VbCrLf)
Response.Write (""& calMonthName(month(calDate_)) &", "&year(calDate_) & " | " & VbCrLf)
Response.Write (">> | " & VbCrLf)
else
Response.Write ("<< | " & VbCrLf)
Response.Write ("" & calWeekdayName(weekday(calDate_)) &", "& calMonthName(month(calDate_)) & " " & day(calDate_) &", "&year(calDate_) & " | " & VbCrLf)
Response.Write (">> | " & VbCrLf)
end if
Response.Write (" " & VbCrLf)
Response.Write (" " & VbCrLf)
Response.Write (" | " & VbCrLf)
Response.Write ("
" & VbCrLf)
Response.Write ("
" & VbCrLf)
End Sub
Private function explainEventType(RecurrenceType,PeriodicCode,PeriodicAmount,MonthlyCode,MonthlyOrdinal,MonthlyDay,AnniversaryDate)
SELECT CASE lcase(RecurrenceType)
CASE "n"
explainEventType = calEventTypeOneTime
CASE "p"
explainEventType = calEventTypePeriodic&PeriodicAmount&" "
SELECT CASE PeriodicCode
CASE "d"
explainEventType = explainEventType & calPeriodicCodeDay
CASE "m"
explainEventType = explainEventType & calPeriodicCodeMonth
CASE "q"
explainEventType = explainEventType & calPeriodicCodeQuarter
CASE "ww"
explainEventType = explainEventType & calPeriodicCodeWeek
CASE "yyyy"
explainEventType = explainEventType & calPeriodicCodeYear
END SELECT
CASE "m"
if MonthlyCode = "L" then
explainEventType = calEventTypeMonthlyLogicalStart&_
iff(MonthlyOrdinal<=5,calMonthlyOrdinal(MonthlyOrdinal),calLastDayOrdinal)&" "&_
calWeekdayName(MonthlyDay)&calEventTypeMonthlyLogicalEnd
else
explainEventType = calEventTypeMonthlyActualStart&_
iff(MonthlyDay<32,MonthlyDay,calLastDayOrdinal)&" "&_
replace(calEventTypeMonthlyActualEnd,"%input%",MonthlyOrdinal)
end if
CASE "a"
explainEventType = calEventTypeAnniversary&LocaleMonthName(month(AnniversaryDate),false)&" "&day(AnniversaryDate)
END SELECT
end function
end class
function startDateOfMonth(strDate)
startDateOfMonth = year(strDate)&"-"&leadingZero(month(strDate))&"-01"
end function
function endDateOfMonth(strDate)
endDateOfMonth = SQLMediumDateOnly(dateadd("d",-1,dateAdd("m",1,year(strDate)&"-"&leadingZero(month(strDate))&"-01")))
end function
%>