" & SiteTitle & ""
MonthSundayName = WeekDayName(1)
MonthMondayName = WeekDayName(2)
MonthTuesdayName = WeekDayName(3)
MonthWednesdayName = WeekDayName(4)
MonthThursdayName = WeekDayName(5)
MonthFridayName = WeekDayName(6)
MonthSaturdayName = WeekDayName(7)
'******* Added in the 4.5.3b release ******************************
AllowOvernightEvents = "YES" 'Change this to YES to allow users to post events that span more than one day
'******* Added in the 4.5.3a release ******************************
ShowUserName = "NO" 'Change this to YES to show the username on all event views
AllowOtherUserToEdit = "YES" 'Change this to YES to allow ANY group admin user to modify/delete an event created by another user.. NOTE admin users will be able to edit anything...
'******* Added in the 4.5.2 release *******************************
ClientBrowser = GetBrowserType(request.ServerVariables("HTTP_USER_AGENT"))
'response.write "Client Browser: " & ClientBrowser
'******* Added in 4.5 release *************************************
UsePageTemplate = "NO"
StartWeeksOnMonday = "NO"
ShowHelpInAdminOnly = "YES"
UsePrintButton = "YES"
DefaultColorScheme = "gray" 'blue, silver, olivegreen, red, gray, purple, green, orange, redorange
ImageFolder = "calendar/images/"
'******* Added in 4.0 release *************************************
NoSummary = "YES"
LengendColumns = 1
If request.querystring("cascade") = "" then
If Session("CascadeEvents") <> "" then
Session("CascadeEvents") = "NO"
End If
Else
Session("CascadeEvents") = request.querystring("cascade")
End If
CascadeWidth = 800
'******* Added for 3.5 release ************************************
UseEmailFunctions = "YES"
UseInviteFunction = "NO"
StartDaysAtEight = "YES"
ServerAddress = request.ServerVariables("HTTP_HOST")
CalendarURL2 = request.ServerVariables("URL")
If CalendarURL2 <> "" then
FullURL = "http://" & ServerAddress & left(CalendarURL2, len(CalendarURL2) - 13) & "/calendar.asp"
PathToCalendar = "http://" & ServerAddress & left(CalendarURL2, len(CalendarURL2) - 12)
Else
FullURL = "http://" & ServerAddress & "/calendar.asp"
PathToCalendar = "http://" & ServerAddress & "/"
End If
ShowRollInfo = "NO"
'****** Check Time Formatting for LCID *****************************
TestTime = "1:00PM"
TestTime = FormatDateTime(TestTime)
If TestTime = "13:00:00" then
TimeFormatToUse = "24"
Else
TimeFormatToUse = "12"
End If
'******* Pull In Config From DB ************************************
Sub LoadConfig
If UseSQLServer = "YES" then
SQL = "SELECT * FROM Cal_Config"
Else
SQL = "SELECT * FROM Cal_Config"
End If
Set RS=dbc.execute(SQL)
Session("User1") = RS("Cal_ConfigUserField1")
Session("User2") = RS("Cal_ConfigUserField2")
Session("User3") = RS("Cal_ConfigUserField3")
Session("User4") = RS("Cal_ConfigUserField4")
Session("User5") = RS("Cal_ConfigUserField5")
Session("SiteTitle") = RS("Cal_ConfigSiteTitle")
Session("RequireLogin") = RS("Cal_ConfigRequireLogin")
Session("PopupBackColor") = RS("Cal_ConfigPopupBackColor")
Session("TimeZoneBias") = RS("Cal_ConfigTimeZone")
Session("MiniSundayName") = RS("Cal_ConfigMiniSundayName")
Session("MiniMondayName") = RS("Cal_ConfigMiniMondayName")
Session("MiniTuesdayName") = RS("Cal_ConfigMiniTuesdayName")
Session("MiniWednesdayName") = RS("Cal_ConfigMiniWednesdayName")
Session("MiniThursdayName") = RS("Cal_ConfigMiniThursdayName")
Session("MiniFridayName") = RS("Cal_ConfigMiniFridayName")
Session("MiniSaturdayName") = RS("Cal_ConfigMiniSaturdayName")
Session("SkinFolder") = RS("Cal_ConfigSkinFolder")
Session("LanguageFolder") = RS("Cal_ConfigLanguageFolder")
Session("ScriptLCID") = RS("Cal_ConfigLCID")
Session("CountryCode") = RS("Cal_ConfigCountryCode")
Session("ConfigLoaded") = "YES"
Session("EmailComponent") = RS("Cal_ConfigEmailComponent")
Session("EmailHost") = RS("Cal_ConfigEmailHost")
Session("SendFromEmailAddress") = RS("Cal_ConfigSendFromAddress")
RS.Close
Set RS=Nothing
End Sub
'****** Some Java Functions and Page Header *************************************************
If request.querystring("action") <> "eventlist" AND request.querystring("action") <> "embedmini" and request.querystring("action") <> "embedgrouplist" and request.querystring("action") <> "vcalexport" and request.querystring("action") <> "print" then
response.write PageHeader
%>
<%
End If
'********* Include the CSS from the current skin ********************************
If request.querystring("action") <> "eventlist" AND request.querystring("action") <> "embedmini" and request.querystring("action") <> "embedgrouplist" and request.querystring("action") <> "vcalexport" and request.querystring("action") <> "print" then
SkinFile= SkinFolder & "calendar.css"
Call ReadSkinFile(SkinFile)
SUB ReadSkinFile(FileToRead)
SkinFile=server.mappath(FileToRead)
Set fs = CreateObject("Scripting.FileSystemObject")
Set thisfile = fs.OpenTextFile(Skinfile, 1, False)
tempSTR=thisfile.readall
response.write replace(tempSTR, "$$SKINFOLDER", SkinFolder)
thisfile.Close
set thisfile=nothing
set fs=nothing
END SUB
'*********************************************************************************
'******** Setup Color Scheme *****************************************************
'*********************************************************************************
If ColorScheme = "" or ColorScheme = " " then
ColorScheme = DefaultColorScheme
End If
SELECT CASE ColorScheme
CASE "blue"
LightColor = "#DDECFE"
MidLightColor = "#81A9E2"
LightMainColor = "#5987D6"
DarkMainColor = "#073B96"
LightLineColor = "#3B619C"
PrimaryHighlightColor = "#FBE694"
SecondaryHighlightColor = "#EE9515"
CASE "silver"
LightColor = "#F0F0F5"
MidLightColor = "#D7D7E5"
LightMainColor = "#A09FB9"
DarkMainColor = "#757495"
LightLineColor = "#7C7C94"
PrimaryHighlightColor = "#FBE694"
SecondaryHighlightColor = "#EE9515"
CASE "olivegreen"
LightColor = "#EAE9D1"
MidLightColor = "#D9D9A7"
LightMainColor = "#ABBC7F"
DarkMainColor = "#698049"
LightLineColor = "#608058"
PrimaryHighlightColor = "#FBE694"
SecondaryHighlightColor = "#EE9515"
CASE "red"
LightColor = "#E9C6C6"
MidLightColor = "#C28E8E"
LightMainColor = "#BC7F7F"
DarkMainColor = "#804949"
LightLineColor = "#805858"
PrimaryHighlightColor = "#FBE694"
SecondaryHighlightColor = "#EE9515"
CASE "purple"
LightColor = "#E7D1F5"
MidLightColor = "#DCB4F5"
LightMainColor = "#D0A4ED"
DarkMainColor = "#B16BDD"
LightLineColor = "#A059CD"
PrimaryHighlightColor = "#FBE694"
SecondaryHighlightColor = "#EE9515"
CASE "gray"
LightColor = "#EFEFEF"
MidLightColor = "#CFCFCF"
LightMainColor = "#848485"
DarkMainColor = "#525252"
LightLineColor = "#757575"
PrimaryHighlightColor = "#FBE694"
SecondaryHighlightColor = "#EE9515"
CASE "green"
LightColor = "#B5FEAF"
MidLightColor = "#60CE68"
LightMainColor = "#57CC44"
DarkMainColor = "#168D0D"
LightLineColor = "#4B9C3B"
PrimaryHighlightColor = "#FBE694"
SecondaryHighlightColor = "#EE9515"
CASE "orange"
LightColor = "#FF7F29"
MidLightColor = "#E4752B"
LightMainColor = "#D85600"
DarkMainColor = "#AE4702"
LightLineColor = "#953D02"
PrimaryHighlightColor = "#FBE694"
SecondaryHighlightColor = "#EE9515"
CASE "redorange"
LightColor = "#FF9600"
MidLightColor = "#DE8302"
LightMainColor = "#EF3400"
DarkMainColor = "#940000"
LightLineColor = "#850101"
PrimaryHighlightColor = "#FBE694"
SecondaryHighlightColor = "#EE9515"
END SELECT
%>
<%
End If
'******** Find out what we should be doing **************************************
'----------- Figure out the current view information -----------------------------
'If request.querystring("view") <> "" and request.querystring("view") <> "0" then
' Session("Cal_CurrentView") = cint(request.querystring("view"))
' SQL = "SELECT * FROM Cal_Views WHERE Cal_ViewID = " & request.querystring("view")
' Set RS=dbc.execute(SQL)
' CalendarType = RS("Cal_ViewCalType")
' Session("Cal_ShowSideBar") = RS("Cal_ViewSideBar")
' Session("Cal_FilterGroups") = RS("Cal_ViewGroups")
' RS.Close
' Set RS=Nothing
'End If
If request.querystring("expandlegend") <> "" then
Session("Cal_ExpandLegend") = request.querystring("expandlegend")
End If
If request.querystring("expandfilter") <> "" then
Session("Cal_ExpandFilter") = request.querystring("expandfilter")
End If
If request.querystring("expandlinks") <> "" then
Session("Cal_ExpandLinks") = request.querystring("expandlinks")
End If
If request.querystring("view") = "" or request.querystring("view") = "0" and request.querystring("caltype") = "" then
CalendarType = "month"
If Session("Cal_ShowSideBar") = "" then
Session("Cal_ShowSideBar") = "YES"
End If
End If
If request.querystring("date") = "" then
theDate = Date()
Else
theDate = cDate(request.querystring("date"))
End If
If request.querystring("sidebar") <> "" then
Session("Cal_ShowSideBar") = request.querystring("sidebar")
End If
If Session("Cal_User_ID") = "" then
Session("Cal_User_AllGroups") = GetGroupArray("Cal_Group_Type", "PUBLIC")
Session("Cal_User_PublicGroups") = Session("Cal_User_AllGroups")
If Session("Cal_FilterGroups") = "" then
Session("Cal_FilterGroups") = Session("Cal_User_PublicGroups")
End If
End If
If request.querystring("view") = "0" then
Session("Cal_CurrentView") = ""
Session("Cal_FilterGroups") = Session("Cal_User_AllGroups")
End If
If request.querystring("filter") <> "" then
Session("Cal_FilterGroups") = request.querystring("filter")
End If
ScriptAction = request.querystring("action")
If RequireLogin = "YES" and Session("Cal_User_ID") = "" and request.querystring("action") <> "login" then
If request.querystring("action") <> "embedmini" or request.querystring("action") <> "eventlist" then
Call MustLogin
End If
End If
If request.querystring("caltype") <> "" then
CalendarType = request.querystring("caltype")
End If
SELECT CASE ScriptAction
CASE ""
If RequireLogin = "YES" and Session("Cal_User_ID") <> "" OR RequireLogin = "NO" then
If CalendarType = "month" or request.querystring("caltype") = "month" then
CalendarType = "month"
'-- Call WriteHeaderOrFooter("cal_footer.asp")
Call DrawHeaderBar
Call DrawContainerStart
Call DrawMonthCalendar(theDate)
Call DrawContainerEnd
'-- Call WriteHeaderOrFooter("cal_footer.asp")
End If
If request.querystring("caltype") = "day" or CalendarType = "day" then
CalendarType = "day"
'-- Call WriteHeaderOrFooter("cal_header.asp")
Call DrawHeaderBar
Call DrawContainerStart
Call DrawDayCalendar(theDate)
Call DrawContainerEnd
'-- Call WriteHeaderOrFooter("cal_footer.asp")
End If
If request.querystring("caltype") = "mini" then
CalendarType = "mini"
Call DrawMiniCalendar(theDate)
End If
If request.querystring("caltype") = "week" or CalendarType = "week" then
CalendarType = "week"
'-- Call WriteHeaderOrFooter("cal_header.asp")
Call DrawHeaderBar
Call DrawContainerStart
Call DrawWeekCalendar(theDate)
Call DrawContainerEnd
'-- Call WriteHeaderOrFooter("cal_footer.asp")
End If
If request.querystring("caltype") = "year" or CalendarType = "year" then
CalendarType = "year"
'-- Call WriteHeaderOrFooter("cal_header.asp")
Call DrawHeaderBar
Call DrawContainerStart
Call DrawYearCalendar(theDate)
Call DrawContainerEnd
'-- Call WriteHeaderOrFooter("cal_footer.asp")
End If
If request.querystring("caltype") = "listing" or CalendarType = "listing" then
CalendarType = "listing"
'-- Call WriteHeaderOrFooter("cal_header.asp")
Call DrawHeaderBar
Call DrawContainerStart
Call DrawEventListView(theDate)
Call DrawContainerEnd
'-- Call WriteHeaderOrFooter("cal_footer.asp")
End If
End If
CASE "print"
CalendarType = request.querystring("caltype")
Call DrawPrintWindow(theDate)
CASE "printcalendar"
If request.querystring("caltype") = "month" then
CalendarType = "month"
Call PrintMonthCalendar(theDate)
End If
If request.querystring("caltype") = "week" then
CalendarType = "week"
Call PrintWeekCalendar(theDate)
End If
If request.querystring("caltype") = "day" then
CalendarType = "day"
Call PrintDayCalendar(theDate)
End If
If request.querystring("caltype") = "eventlist" then
CalendarType = "eventlist"
Call PrintEventList(theDate)
End If
CASE "summary"
Sum_Message = request.querystring("message")
Sum_LinkType = request.querystring("linktype")
Sum_From = request.querystring("from")
Call DrawSummary(Sum_Message, Sum_LinkType, Sum_From)
CASE "login"
Call DrawLoginPage
CASE "processlogin"
Call ProcessLogin
Case "logoff"
Call Logoff
CASE "viewoptions"
Call ViewOptions
CASE "eventdetail"
Call DrawEventPopup
CASE "eventlist"
Call DrawEventListing(request.querystring("date"), request.querystring("range"), request.querystring("type"))
CASE "embedmini"
Call DrawMiniCalendar(theDate)
CASE "embedgrouplist"
Call DrawGroupList
CASE "processinvites"
Call ProcessInvites
CASE "processfilter"
Call ProcessFilter
CASE "vcalexport"
Call ExportVCal(theDate, request.querystring("caltype"))
CASE "emailuser"
Call SendUserEmail
CASE "emailuserprocess"
SendFromEmailAddress = Session("Cal_User_EmailAddress")
Call SendUserEmailProcess
CASE ELSE
END SELECT
If request.querystring("action") <> "eventlist" AND request.querystring("action") <> "embedmini" and request.querystring("action") <> "embedgrouplist" and request.querystring("action") <> "vcalexport" then
%>
<%
End If
'*********************************************************************************
'*********************************************************************************
'*********************************************************************************
'*********************************************************************************
'************************* Routines Below Here Only ******************************
'*********************************************************************************
'*********************************************************************************
'*********************************************************************************
'*********************************************************************************
'*********************************************************************************
'*********************************************************************************
'******** Draw Container Table Start *********************************************
'*********************************************************************************
Sub DrawContainerStart
If Session("Cal_ShowSideBar") = "YES" then
response.write "
"
response.write "
"
response.write "
"
Call DrawSideBar
response.write "
"
response.write "
"
Else
response.write "
"
response.write "
"
response.write "
"
End If
End Sub
'*********************************************************************************
'******** Draw Container Table End ***********************************************
'*********************************************************************************
Sub DrawContainerEnd
response.write "
"
response.write "
"
response.write "
"
End Sub
'*********************************************************************************
'******** Draw Side Bar **********************************************************
'*********************************************************************************
Sub DrawSideBar
response.write "
"
response.write "
"
response.write "
"
response.write "
"
response.write "
"
response.write "
"
If Session("Cal_ExpandFilter") = "NO" then
response.write " "
Else
response.write " "
End If
response.write Sub1Var24
response.write "
"
response.write "
"
If Session("Cal_ExpandFilter") <> "NO" then
'Call DrawViews
Call DrawFilter
End If
response.write "
"
response.write "
"
response.write "
"
response.write "
"
response.write "
"
response.write "
"
response.write "
"
If Session("Cal_ExpandLinks") = "NO" then
response.write " "
Else
response.write " "
End If
response.write Sub1Var29
response.write "
"
response.write "
"
If Session("Cal_ExpandLinks") <> "NO" then
Call DrawQuickLinks
End If
response.write "
"
response.write "
"
response.write "
"
End Sub
'*********************************************************************************
'******** Draw Quick Links *******************************************************
'*********************************************************************************
Sub DrawQuickLinks
ThePreviousMonth = DateAdd("m", -1, theDate)
TheNextMonth = DateAdd("m", 1, theDate)
response.write "
"
End Sub
'*********************************************************************************
'******** Draw Legend ************************************************************
'*********************************************************************************
Sub DrawLegend
LegendColCounter = 1
FilterGroups = Session("Cal_User_AllGroups")
response.write "
"
If UseSQLServer = "YES" then
SQL = "SELECT * FROM Cal_Group WHERE Cal_Group_ID IN("& FilterGroups &") ORDER BY Cal_Group_Name"
Else
SQL = "SELECT * FROM Cal_Group WHERE Cal_Group_ID IN("& FilterGroups &") ORDER BY Cal_Group_Name"
End If
Set RS=dbc.execute(SQL)
Do While NOT RS.EOF
If RS("Cal_Group_ID") <> 2 then
GroupColor = RS("Cal_Group_Color")
GroupName = RS("Cal_Group_Name")
Else
GroupColor = Session("Cal_User_EventColor")
GroupName = RS("Cal_Group_Name")
End If
If LegendColCounter = 1 then
response.write "
"
If ClientBrowser <> "OTHER" then
Call DrawButton("button_back.gif","Back a Month","","window.location.reload('calendar.asp?date=" & PrevDate & "&caltype=" & CalendarType & "');",30)
Call DrawButton("","",HeaderInfo,"",150)
Call DrawButton("button_forward.gif","Forward a Month","","window.location.reload('calendar.asp?date=" & NextDate & "&caltype=" & CalendarType & "');",30)
Call DrawButtonSep
Call DrawButton("button_day.gif","Day View","","window.location.reload('calendar.asp?caltype=day&date=" & theDate & "#Eight');",30)
Call DrawButton("button_week.gif","Week View","","window.location.reload('calendar.asp?caltype=week&date=" & theDate & "');",30)
Call DrawButton("button_month.gif","Month View","","window.location.reload('calendar.asp?caltype=month&date=" & theDate & "');",30)
Call DrawButton("button_year.gif","Year View","","window.location.reload('calendar.asp?caltype=year&date=" & theDate & "');",30)
Call DrawButton("button_gototoday.gif","Goto Today","","window.location.reload('calendar.asp?caltype=day&date=" & Date() & "#Eight');",30)
Call DrawButton("button_list.gif","Event List View","","window.location.reload('calendar.asp?caltype=listing&date=" & theDate & "');",30)
Call DrawButtonSep
Call DrawButton("button_refresh.gif","Refresh View","","window.location.reload();",30)
Call DrawButton("button_print.gif","Print Calendars","","NewWindow('calendar.asp?action=print&caltype=" & CalendarType & "&date=" & theDate & "','aspWebCalendarPRINT','600','462','no');",30)
Call DrawButton("button_vcal.gif","Export To VCAL","","NewWindow('calendar.asp?action=vcalexport&caltype=" & CalendarType & "&date=" & theDate & "','aspWebCalendarVCAL','500','350','no');",30)
Call DrawButtonSep
If Session("Cal_User_ID") <> "" then
Call DrawButton("button_addevent.gif","Add Event","","NewWindow('calendar_admin.asp?action=addevent&date=" & theDate & "','aspWebCalendarADDEVENT','500','440','no');",30)
End If
If UseEmailFunctions <> "NO" then
Call DrawButton("button_email.gif","Email A User","","NewWindow('calendar.asp?action=emailuser','aspWebCalendarEMAILUSER','400','350','no');",30)
End If
If Session("Cal_ShowSideBar") <> "YES" then
Call DrawButton("button_showsidebar.gif","Show Side Bar","","window.location.reload('calendar.asp?date=" & theDate & "&caltype=" & CalendarType & "&sidebar=YES');",30)
Else
Call DrawButton("button_hidesidebar.gif","Hide Side Bar","","window.location.reload('calendar.asp?date=" & theDate & "&caltype=" & CalendarType & "&sidebar=NO');",30)
End If
If request.querystring("caltype") = "day" then
If Session("CascadeEvents") <> "YES" then
Call DrawButton("button_cascade.gif","Cascade Events","","window.location.reload('calendar.asp?date=" & theDate & "&caltype=" & CalendarType & "&cascade=YES');",30)
Else
Call DrawButton("button_stack.gif","Stack Events","","window.location.reload('calendar.asp?date=" & theDate & "&caltype=" & CalendarType & "&cascade=NO');",30)
End If
End If
If ShowHelpInAdminOnly <> "YES" then
Call DrawButton("button_help.gif","Help","","NewWindow('calendar/help','aspWebCalendarHELP','600','500','no');",30)
End If
If Session("Cal_User_ID") = "" then
Call DrawButton("button_logon.gif","Login","","NewWindow('calendar.asp?action=login','aspWebCalendarLOGIN','400','350','no');",30)
End If
If Session("Cal_User_ID") <> "" Then
If Session("Cal_User_RightsLevel") = 1 then
Call DrawButtonSep
If ShowHelpInAdminOnly = "YES" then
Call DrawButton("button_help.gif","Help","","NewWindow('calendar/help','aspWebCalendarHELP','600','500','no');",30)
End If
Call DrawButton("button_embed.gif","Embed Content","","NewWindow('calendar_admin.asp?action=embedcontent','aspWebCalendarEMBED','500','500','no');",30)
Call DrawButton("button_approve.gif","Approve Event Additions","","NewWindow('calendar_admin.asp?action=approveevents','aspWebCalendarAPPROVE','400','500','yes');",30)
Call DrawButton("button_config.gif","Modify Config","","NewWindow('calendar_admin.asp?action=modifyconfig','aspWebCalendarCONFIG','500','600','yes');",30)
Call DrawButton("button_groups.gif","Manage Groups","","NewWindow('calendar_admin.asp?action=managegroups','aspWebCalendarGROUPS','500','400','no');",30)
Call DrawButton("button_users.gif","Manage Users","","NewWindow('calendar_admin.asp?action=manageusers','aspWebCalendarUSERS','500','400','no');",30)
Call DrawButtonSep
End If
Call DrawButton("button_logoff.gif","Logoff","","window.location.reload('calendar.asp?action=logoff');",30)
End If
Else
'-- Call DrawBadBrowserButton("button_back.gif","Back a Month","","calendar.asp?date=" & PrevDate & "&caltype=" & CalendarType,30)
Call DrawBadBrowserButton("","",HeaderInfo,"",150)
Call DrawBadBrowserButton("button_forward.gif","Forward a Month","","calendar.asp?date=" & NextDate & "&caltype=" & CalendarType,30)
Call DrawButtonSep
Call DrawBadBrowserButton("button_day.gif","Day View","","calendar.asp?caltype=day&date=" & theDate & "#Eight",30)
Call DrawBadBrowserButton("button_week.gif","Week View","","calendar.asp?caltype=week&date=" & theDate,30)
Call DrawBadBrowserButton("button_month.gif","Month View","","calendar.asp?caltype=month&date=" & theDate,30)
Call DrawBadBrowserButton("button_year.gif","Year View","","calendar.asp?caltype=year&date=" & theDate,30)
Call DrawBadBrowserButton("button_gototoday.gif","Goto Today","","calendar.asp?caltype=day&date=" & Date() & "#Eight",30)
Call DrawBadBrowserButton("button_list.gif","Event List View","","calendar.asp?caltype=listing&date=" & theDate,30)
Call DrawButtonSep
Call DrawBadBrowserButton("button_refresh.gif","Refresh View","","window.location.reload();",30)
Call DrawButton("button_print.gif","Print Calendars","","NewWindow('calendar.asp?action=print&caltype=" & CalendarType & "&date=" & theDate & "','aspWebCalendarPRINT','600','462','no');",30)
Call DrawButton("button_vcal.gif","Export To VCAL","","NewWindow('calendar.asp?action=vcalexport&caltype=" & CalendarType & "&date=" & theDate & "','aspWebCalendarVCAL','500','350','no');",30)
Call DrawButtonSep
If Session("Cal_User_ID") <> "" then
Call DrawButton("button_addevent.gif","Add Event","","NewWindow('calendar_admin.asp?action=addevent&date=" & theDate & "','aspWebCalendarADDEVENT','500','440','no');",30)
End If
If UseEmailFunctions <> "NO" then
Call DrawButton("button_email.gif","Email A User","","NewWindow('calendar.asp?action=emailuser','aspWebCalendarEMAILUSER','400','350','no');",30)
End If
If Session("Cal_ShowSideBar") <> "YES" then
Call DrawBadBrowserButton("button_showsidebar.gif","Show Side Bar","","calendar.asp?date=" & theDate & "&caltype=" & CalendarType & "&sidebar=YES",30)
Else
Call DrawBadBrowserButton("button_hidesidebar.gif","Hide Side Bar","","calendar.asp?date=" & theDate & "&caltype=" & CalendarType & "&sidebar=NO",30)
End If
If request.querystring("caltype") = "day" then
If Session("CascadeEvents") <> "YES" then
Call DrawBadBrowserButton("button_cascade.gif","Cascade Events","","calendar.asp?date=" & theDate & "&caltype=" & CalendarType & "&cascade=YES",30)
Else
Call DrawBadBrowserButton("button_stack.gif","Stack Events","","calendar.asp?date=" & theDate & "&caltype=" & CalendarType & "&cascade=NO",30)
End If
End If
If ShowHelpInAdminOnly <> "YES" then
Call DrawButton("button_help.gif","Help","","NewWindow('calendar/help','aspWebCalendarHELP','600','500','no');",30)
End If
If Session("Cal_User_ID") = "" then
Call DrawButton("button_logon.gif","Login","","NewWindow('calendar.asp?action=login','aspWebCalendarLOGIN','400','350','no');",30)
End If
If Session("Cal_User_ID") <> "" Then
If Session("Cal_User_RightsLevel") = 1 then
Call DrawButtonSep
If ShowHelpInAdminOnly = "YES" then
Call DrawButton("button_help.gif","Help","","NewWindow('calendar/help','aspWebCalendarHELP','600','500','no');",30)
End If
Call DrawButton("button_embed.gif","Embed Content","","NewWindow('calendar_admin.asp?action=embedcontent','aspWebCalendarEMBED','500','500','no');",30)
Call DrawButton("button_approve.gif","Approve Event Additions","","NewWindow('calendar_admin.asp?action=approveevents','aspWebCalendarAPPROVE','400','500','yes');",30)
Call DrawButton("button_config.gif","Modify Config","","NewWindow('calendar_admin.asp?action=modifyconfig','aspWebCalendarCONFIG','500','600','yes');",30)
Call DrawButton("button_groups.gif","Manage Groups","","NewWindow('calendar_admin.asp?action=managegroups','aspWebCalendarGROUPS','500','400','no');",30)
Call DrawButton("button_users.gif","Manage Users","","NewWindow('calendar_admin.asp?action=manageusers','aspWebCalendarUSERS','500','400','no');",30)
Call DrawButtonSep
End If
Call DrawBadBrowserButton("button_logoff.gif","Logoff","","calendar.asp?action=logoff",30)
End If
End If
response.write "
"
response.write "
"
'-----------------------------------------------------------------------------------
End Sub
Sub DrawButton(ButtonImage, ButtonAlt, ButtonText, ButtonAction, ButtonWidth)
response.write "
"
If ButtonAction <> "" then
response.write "
"
Else
response.write "
"
End If
response.write "
"
response.write "
"
If ButtonImage <> "" then
response.write "
"
End If
If ButtonText <> "" then
response.write "
" & ButtonText & "
"
End If
response.write "
"
response.write "
"
response.write "
"
response.write "
"
End Sub
Sub DrawBadBrowserButton(ButtonImage, ButtonAlt, ButtonText, ButtonAction, ButtonWidth)
response.write "
"
End If
If ButtonText <> "" then
response.write "
" & ButtonText & "
"
End If
response.write "
"
response.write "
"
If ButtonAction <> "" then
response.write ""
End If
response.write "
"
response.write "
"
End Sub
Sub DrawButtonSep
response.write "
"
response.write "
"
response.write "
"
response.write "
"
response.write "
"
response.write "
"
response.write "
"
response.write "
"
response.write "
"
response.write "
"
End Sub
'*********************************************************************************
'******** Draw Day View ********************************************************
'*********************************************************************************
Sub DrawDayCalendar(theDate)
If Session("DateFormat") = "US" then
ThisMonthsFirstDay = cDate(Month(theDate) & "/1/" & Year(theDate))
Else
ThisMonthsFirstDay = cDate("1/" & Month(theDate) & "/" & Year(theDate))
End If
NextMonthsFirstDay = dateAdd("m",1,ThisMonthsFirstDay)
ThisMonthsLastDay = dateadd("d",-1,NextMonthsFirstDay)
LastMonthsLastDay = dateadd("d",-1,ThisMonthsFirstDay)
StartDate = dateadd("d",1-weekday(ThisMonthsFirstDay),ThisMonthsFirstDay)
response.write "
"
response.write "
"
'response.write "
"
'response.write "
"
'response.write "
"
'response.write "All Day"
'response.write "
"
'response.write "
"
'response.write "
"
'response.write "
"
'response.write "
"
'response.write "
"
'response.write "
"
'response.write "
"
'response.write "
"
If BrowserType <> "OTHER" then
response.write "
"
Else
response.write "
"
End If
If TimeFormatToUse = "12" then
response.write "
"
Call WriteAgendaRow("12", "am")
For I = 1 to 11
Call WriteAgendaRow(I,"00")
Next
Call WriteAgendaRow("12", "pm")
For I = 1 to 11
Call WriteAgendaRow(I, "OO")
Next
response.write "
"
Call WriteAgendaRow("00", "00")
For I = 1 to 9
Call WriteAgendaRow("0" & I,"00")
Next
For I = 10 to 23
Call WriteAgendaRow(I,"00")
Next
response.write "
"
Call WriteEvent(theDate, "DAY")
End If
response.write "
"
End Sub
'------ Write Agenda Row --------------------------------------------------------
Sub WriteAgendaRow(TimeToWrite1, TimeToWrite2)
response.write "
"
response.write "
"
If TimeToWrite1 = 8 then
response.write ""
End If
response.write "" & TimeToWrite1 & " " & TimeToWrite2 & ""
response.write "
"
response.write "
"
response.write "
"
response.write "
"
response.write "
"
response.write "
"
response.write "
"
response.write "
"
End Sub
'*********************************************************************************
'******** Draw Week View *********************************************************
'*********************************************************************************
Sub DrawWeekCalendar(theDate)
If Session("DateFormat") = "US" then
ThisMonthsFirstDay = cDate(Month(theDate) & "/1/" & Year(theDate))
Else
ThisMonthsFirstDay = cDate("1/" & Month(theDate) & "/" & Year(theDate))
End If
NextMonthsFirstDay = dateAdd("m",1,ThisMonthsFirstDay)
ThisMonthsLastDay = dateadd("d",-1,NextMonthsFirstDay)
LastMonthsLastDay = dateadd("d",-1,ThisMonthsFirstDay)
StartDate = dateadd("d",1-weekday(ThisMonthsFirstDay),ThisMonthsFirstDay)
WeekDayTitleName = Weekday(theDate, 2)
HeaderInfo = Sub3Var1 & DateAdd("w", 1-WeekDayTitleName, theDate)
DateToSend = DateAdd("w", 1-WeekDayTitleName, theDate)
DayNameNumber = Weekday(theDate, 2)
response.write "
"
End Sub
'*********************************************************************************
'******** Draw Month View ********************************************************
'*********************************************************************************
Sub DrawMonthCalendar(theDate)
Dim ThisMonthsFirstDay
Dim NextMonthsFirstDay
Dim ThisMonthsLastDay
Dim LastMonthsLastDay
Dim StartDate
Dim Counter
'------- Setup some information about the month -----------------
If Session("DateFormat") = "US" then
ThisMonthsFirstDay = cDate(Month(theDate) & "/1/" & Year(theDate))
Else
ThisMonthsFirstDay = cDate("1/" & Month(theDate) & "/" & Year(theDate))
End If
NextMonthsFirstDay = dateAdd("m",1,ThisMonthsFirstDay)
ThisMonthsLastDay = dateadd("d",-1,NextMonthsFirstDay)
LastMonthsLastDay = dateadd("d",-1,ThisMonthsFirstDay)
If StartWeeksOnMonday <> "YES" then
StartDate = dateadd("d",1-weekday(ThisMonthsFirstDay),ThisMonthsFirstDay)
Else
If weekday(ThisMonthsFirstDay) <> 1 then
StartDate = dateadd("d",2-weekday(ThisMonthsFirstDay),ThisMonthsFirstDay)
Else
StartDate = dateadd("d",-6,ThisMonthsFirstDay)
End If
End If
'------- Draw the beginning of the calendar ----------------------
response.write "
"
response.write "
"
If StartWeeksOnMonday <> "YES" then
response.write "
" & MonthSundayName & "
"
response.write "
" & MonthMondayName & "
"
response.write "
" & MonthTuesdayName & "
"
response.write "
" & MonthWednesdayName & "
"
response.write "
" & MonthThursdayName & "
"
response.write "
" & MonthFridayName & "
"
response.write "
" & MonthSaturdayName & "
"
Else
response.write "
" & MonthMondayName & "
"
response.write "
" & MonthTuesdayName & "
"
response.write "
" & MonthWednesdayName & "
"
response.write "
" & MonthThursdayName & "
"
response.write "
" & MonthFridayName & "
"
response.write "
" & MonthSaturdayName & "
"
response.write "
" & MonthSundayName & "
"
End If
response.write "
"
response.write "
"
'-------- Main Calendar Table -------------------------------------
response.write "
"
response.write "
"
If StartWeeksOnMonday <> "YES" then
'-------- If the first day is not sunday --------------------------
If weekday(ThisMonthsFirstDay) > 1 then
For Counter = day(StartDate) to day(LastMonthsLastDay)
Call DrawOtherMonthDay (Counter)
Next
End if
Else
'-------- If the first day is not monday --------------------------
If weekday(ThisMonthsFirstDay) <> 2 then
For Counter = day(StartDate) to day(LastMonthsLastDay)
Call DrawOtherMonthDay (Counter)
Next
End if
End If
'-------- Draw normal days after Saturday, start a new row --------
For Counter = 1 to day(ThisMonthsLastDay)
If Session("DateFormat") = "US" then
DateToUse = cDate(Month(theDate) & "/" & Counter & "/" & Year(theDate))
Else
DateToUse = cDate(Counter & "/" & Month(theDate) & "/" & Year(theDate))
End If
DrawMonthNormalDay (Counter)
If StartWeeksOnMonday <> "YES" then
If weekday(DateToUse) = 7 then
response.write "
"
If Counter <> day(ThisMonthsLastDay) then
response.write "
"
End If
End if
Else ' ---- Start Weeks On Monday
If weekday(DateToUse) = 1 then
response.write "
"
If Counter <> day(ThisMonthsLastDay) then
response.write "
"
End If
End if
End If
Next
'-------- If last day is not saturday -----------------------------
If StartWeeksOnMonday <> "YES" then
If weekday(ThisMonthsLastDay) < 7 then
For Counter = 1 to 7 - weekday(ThisMonthsLastDay)
DrawOtherMonthDay (Counter)
Next
End if
Else
If weekday(ThisMonthsLastDay) <> 1 then
For Counter = 1 to 7 - weekday(ThisMonthsLastDay) + 1
DrawOtherMonthDay (Counter)
Next
End if
End If
'-------- Draw the last row of the calendar -----------------------
response.write "
"
response.write "
"
End Sub
Sub DrawMonthNormalDay(DayNumber) '----------------------------------- Draw a Normal Day
If Session("DateFormat") = "US" then
DateToUse = Month(theDate) & "/" & DayNumber & "/" & Year(theDate)
Else
DateToUse = DayNumber & "/" & Month(theDate) & "/" & Year(theDate)
End If
If Date() = cDate(DateToUse) then
MonthCalDayClass = "TableMonthDayCellToday"
Else
MonthCalDayClass = "TableMonthDayCell"
End If
response.write "
"
End Sub
'*********************************************************************************
'******** Draw Mini Calendar *****************************************************
'*********************************************************************************
Sub DrawMiniCalendar(theDate)
Dim ThisMonthsFirstDay
Dim NextMonthsFirstDay
Dim ThisMonthsLastDay
Dim LastMonthsLastDay
Dim StartDate
Dim Counter
'------- Setup some information about the month -----------------
If Session("DateFormat") = "US" then
ThisMonthsFirstDay = cDate(Month(theDate) & "/1/" & Year(theDate))
Else
ThisMonthsFirstDay = cDate("1/" & Month(theDate) & "/" & Year(theDate))
End If
NextMonthsFirstDay = dateAdd("m",1,ThisMonthsFirstDay)
ThisMonthsLastDay = dateadd("d",-1,NextMonthsFirstDay)
LastMonthsLastDay = dateadd("d",-1,ThisMonthsFirstDay)
If StartWeeksOnMonday <> "YES" then
StartDate = dateadd("d",1-weekday(ThisMonthsFirstDay),ThisMonthsFirstDay)
Else
If weekday(ThisMonthsFirstDay) <> 1 then
StartDate = dateadd("d",2-weekday(ThisMonthsFirstDay),ThisMonthsFirstDay)
Else
StartDate = dateadd("d",-6,ThisMonthsFirstDay)
End If
End If
'------- Containter for whole mini calendar ----------------------
MiniOutput = "
"
If StartWeeksOnMonday <> "YES" then
'-------- If the first day is not sunday --------------------------
If weekday(ThisMonthsFirstDay) > 1 then
For Counter = day(StartDate) to day(LastMonthsLastDay)
Call DrawOtherMiniDay (Counter)
Next
End if
Else
'-------- If the first day is not monday --------------------------
If weekday(ThisMonthsFirstDay) <> 2 then
For Counter = day(StartDate) to day(LastMonthsLastDay)
Call DrawOtherMiniDay (Counter)
Next
End if
End If
'-------- Draw normal days after Saturday, start a new row --------
For Counter = 1 to day(ThisMonthsLastDay)
If Session("DateFormat") = "US" then
DateToUse = cDate(Month(theDate) & "/" & Counter & "/" & Year(theDate))
Else
DateToUse = cDate(Counter & "/" & Month(theDate) & "/" & Year(theDate))
End If
Call DrawMiniNormalDay (Counter, DateToUse)
If StartWeeksOnMonday <> "YES" then
If weekday(DateToUse) = 7 then
MiniOutput = MiniOutput & "
"
If Counter <> day(ThisMonthsLastDay) then
MiniOutput = MiniOutput & "
"
End If
End if
Else ' ---- Start Weeks On Monday
If weekday(DateToUse) = 1 then
MiniOutput = MiniOutput & "
"
If Counter <> day(ThisMonthsLastDay) then
MiniOutput = MiniOutput & "
"
End If
End if
End If
Next
'-------- If last day is not saturday -----------------------------
If StartWeeksOnMonday <> "YES" then
If weekday(ThisMonthsLastDay) < 7 then
For Counter = 1 to 7 - weekday(ThisMonthsLastDay)
DrawOtherMiniDay (Counter)
Next
End if
Else
If weekday(ThisMonthsLastDay) <> 1 then
For Counter = 1 to 7 - weekday(ThisMonthsLastDay) + 1
DrawOtherMiniDay (Counter)
Next
End if
End If
'-------- Draw the last row of the calendar -----------------------
MiniOutput = MiniOutput & "
"
MiniOutput = MiniOutput & "
"
'-------- End of Container ----------------------------------------
MiniOutput = MiniOutput & "
"
If request.querystring("action") <> "embedmini" then
response.write MiniOutput
Else
MiniOutput = Replace(MiniOutput, "'", "\'")
%>
function ShowMiniCal() {
var tmpStr;
tmpStr = ('<%=MiniOutput%>');
document.write(tmpStr);
}
<%
End If
End Sub
Sub DrawMiniNormalDay(DayNumber, theDate) '----------------------------------- Draw a Normal Day
If Session("DateFormat") = "US" then
DateToUse = Month(theDate) & "/" & DayNumber & "/" & Year(theDate)
Else
DateToUse = DayNumber & "/" & Month(theDate) & "/" & Year(theDate)
End If
If Date() = cDate(DateToUse) then
MonthCalDayClass = "TableMiniDayCellToday"
Else
MonthCalDayClass = "TableMiniDayCell"
End If
IsThereAnEvent = CheckForEvent(DateToUse)
If IsThereAnEvent = "YES" then
MonthCalDayClass = "TableMiniDayCellWithEvent"
End If
MiniOutput = MiniOutput & "
"
End Sub
'*********************************************************************************
'******** Write Event Month ******************************************************
'*********************************************************************************
Sub WriteEvent(DateToUse, CalViewType)
If Session("Cal_User_ID") = "" then
GroupArray = GetGroupArray("Cal_Group_Type", "PUBLIC")
If UseSQLServer = "YES" then
SQL = "SELECT * FROM Cal_Events WHERE Cal_EventGroupID IN("& GroupArray &") AND Cal_EventStartDate <= '" & FormatDateFix(DateToUse) & "' AND Cal_EventEndDate >= '" & FormatDateFix(DateToUse) & "' AND Cal_EventStatus = 'APPROVED' ORDER BY Cal_EventStartTime, Cal_EventEndTime"
Else
SQL = "SELECT * FROM Cal_Events WHERE Cal_EventGroupID IN("& GroupArray &") AND Cal_EventStartDate <= #" & FormatDateFix(DateToUse) & "# AND Cal_EventEndDate >= #" & FormatDateFix(DateToUse) & "# AND Cal_EventStatus = 'APPROVED' ORDER BY Cal_EventStartTime, Cal_EventEndTime"
End If
set RS=Server.CreateObject("adodb.Recordset")
RS.Open SQL, dbc, adopenstatic
Else
UserGroupArray1 = Session("Cal_User_NormalGroups")
UserGroupArray2 = Session("Cal_User_AdminGroups")
UserGroupArray = Session("Cal_User_AllGroups")
If UseSQLServer = "YES" then
SQL = "SELECT * FROM Cal_Events WHERE Cal_EventGroupID IN("& UserGroupArray &") AND Cal_EventStartDate <= '" & FormatDateFix(DateToUse) & "' AND Cal_EventEndDate >= '" & FormatDateFix(DateToUse) & "' AND Cal_EventStatus = 'APPROVED' ORDER BY Cal_EventStartTime, Cal_EventEndTime"
Else
SQL = "SELECT * FROM Cal_Events WHERE Cal_EventGroupID IN("& UserGroupArray &") AND Cal_EventStartDate <= #" & FormatDateFix(DateToUse) & "# AND Cal_EventEndDate >= #" & FormatDateFix(DateToUse) & "# AND Cal_EventStatus = 'APPROVED' ORDER BY Cal_EventStartTime, Cal_EventEndTime"
End If
set RS=Server.CreateObject("adodb.Recordset")
RS.Open SQL, dbc, adopenstatic
End If
If CalViewType <> "DAY" then
Do While NOT RS.EOF
If RS("Cal_EventGroupID") = 2 then
If UseSQLServer = "YES" then
SQLc = "SELECT Cal_User_EventColor FROM Cal_User WHERE Cal_User_ID = " & Session("Cal_User_ID")
Else
SQLc = "SELECT Cal_User_EventColor FROM Cal_User WHERE Cal_User_ID = " & Session("Cal_User_ID")
End If
Set RSc=dbc.execute(SQLc)
EventColor = RSc("Cal_User_EventColor")
RSc.Close
Set RSc=Nothing
Else
If UseSQLServer = "YES" then
SQLc = "SELECT Cal_Group_Color, Cal_Group_Icon FROM Cal_Group WHERE Cal_Group_ID = " & RS("Cal_EventGroupID")
Else
SQLc = "SELECT Cal_Group_Color, Cal_Group_Icon FROM Cal_Group WHERE Cal_Group_ID = " & RS("Cal_EventGroupID")
End If
Set RSc=dbc.execute(SQLc)
EventColor = RSc("Cal_Group_Color")
GroupIcon = RSc("Cal_Group_Icon")
RSc.Close
Set RSc=Nothing
End If
If RS("Cal_EventGroupID") <> 2 OR RS("Cal_EventGroupID") = 2 AND RS("Cal_EventUserID") = Session("Cal_User_ID") then
IsVisible = IsEventVisible(RS("Cal_EventGroupID"))
If IsVisible = "TRUE" then
If RS("Cal_EventAllDay") <> "TRUE" then
response.write "
"
response.write "
"
response.write "
"
response.write "
"
response.write "
"
'----- Changed this to allow overnight events ----------------------------------------------
If cdate(RS("Cal_EventStartDate")) = cdate(DateToUse) then
If Session("DateFormat") = "US" then
response.write FormatTime(RS("Cal_EventStartTime"))
Else
TempTime = FormatTime(RS("Cal_EventStartTime"))
response.write FormatTimeFix(TempTime, "MONTH")
End If
Else
If Session("DateFormat") = "US" then
'-- response.write FormatTime(RS("Cal_EventStartTime"))
Else
'-- TempTime = FormatTime(RS("Cal_EventStartTime"))
'-- response.write FormatTimeFix(TempTime, "MONTH")
End If
End If
'------ End Of Change -----------------------------------------------------------------------
response.write "
"
End If
End If
End If
RS.MoveNext
Loop
Else
If RS.RecordCount >= 1 then
RS.MoveFirst
EventCounter = 0
End If
Dim SlotArray(20)
Do While NOT RS.EOF
If RS("Cal_EventGroupID") <> 2 OR RS("Cal_EventGroupID") = 2 AND RS("Cal_EventUserID") = Session("Cal_User_ID") then
IsVisible = IsEventVisible(RS("Cal_EventGroupID"))
If IsVisible = "TRUE" then
If RS("Cal_EventAllDay") <> "TRUE" then
EventTimeSlot = GetTimeSlot(DateToUse, RS("Cal_EventStartTime"), RS("Cal_EventID"))
If Session("CascadeEvents") = "YES" then
If EventCounter > 0 then
If RS.RecordCount <= 4 then
AddtoLeft = 110
Else
AddtoLeft = (CascadeWidth / RS.RecordCount) + 5
End If
EventLeft = EventLeft + AddtoLeft
Else
EventLeft = 80
End If
If RS.RecordCount <= 4 then
EventWidth = 100
Else
EventWidth = (CascadeWidth / RS.RecordCount)
End If
If ClientBrowser = "OTHER" then
If EventCounter = 0 then
EventLeft = EventLeft + 200
End If
End If
Else
'----- Stacked Events ---------------------------
EventWidth = 150
AddtoLeft = 160 * EventTimeSlot - 160
EventLeft = AddtoLeft + 80
If ClientBrowser = "OTHER" then
EventLeft = EventLeft + 200
End If
End If
'----- Changed to allow overnight events -----------------------------------------------
If AllowOvernightEvents = "YES" then
If Session("DateFormat") = "US" then
If cdate(RS("Cal_EventStartDate")) <> cdate(RS("Cal_EventEndDate")) then
If cdate(RS("Cal_EventStartDate")) = cDate(DateToUse) then
StartTime = FormatDateTime(CDate(RS("Cal_EventStartTime")),3)
EndTime = FormatDateTime(CDate("11:59PM"),3)
Else
StartTime = FormatTimeFix(StartTime, "")
EndTime = FormatTimeFix(EndTime, "")
End If
Else
StartTime = FormatDateTime(CDate(RS("Cal_EventStartTime")),3)
EndTime = FormatDateTime(CDate(RS("Cal_EventEndTime")),3)
End If
Else
StartTime = FormatDateTime(CDate(RS("Cal_EventStartTime")),3)
EndTime = FormatDateTime(CDate(RS("Cal_EventEndTime")),3)
StartTime = FormatTimeFix(StartTime, "")
EndTime = FormatTimeFix(EndTime, "")
End If
Else
If Session("DateFormat") = "US" then
StartTime = FormatDateTime(CDate(RS("Cal_EventStartTime")),3)
EndTime = FormatDateTime(CDate(RS("Cal_EventEndTime")),3)
Else
StartTime = FormatDateTime(CDate(RS("Cal_EventStartTime")),3)
EndTime = FormatDateTime(CDate(RS("Cal_EventEndTime")),3)
StartTime = FormatTimeFix(StartTime, "")
EndTime = FormatTimeFix(EndTime, "")
End If
End If
'----- End of change --------------------------------------------------------------------
EventHeight = DateDiff("n", StartTime, EndTime)
EventTop = DateDiff("n", "12:00a", StartTime)
'EventHeight = ((EventHeight * 19) * 2) / 60 + 1
'EventTop = (((EventTop * 19) * 2)) / 60
If ClientBrowser <> "OTHER" then
EventHeight = ((EventHeight * 29) * 2) / 60 + 1
EventTop = (((EventTop * 29) * 2)) / 60
Else
'EventHeight = ((EventHeight * 29) * 2) / 60 + 1
EventHeight = ((EventHeight * 58) / 60) + 1
EventTop = ((EventTop * 58)) / 60 + 32
End If
If RS("Cal_EventGroupID") = 2 then
If UseSQLServer = "YES" then
SQLc = "SELECT Cal_User_EventColor FROM Cal_User WHERE Cal_User_ID = " & Session("Cal_User_ID")
Else
SQLc = "SELECT Cal_User_EventColor FROM Cal_User WHERE Cal_User_ID = " & Session("Cal_User_ID")
End If
Set RSc=dbc.execute(SQLc)
EventColor = RSc("Cal_User_EventColor")
RSc.Close
Set RSc=Nothing
Else
If UseSQLServer = "YES" then
SQLc = "SELECT Cal_Group_Color FROM Cal_Group WHERE Cal_Group_ID = " & RS("Cal_EventGroupID")
Else
SQLc = "SELECT Cal_Group_Color FROM Cal_Group WHERE Cal_Group_ID = " & RS("Cal_EventGroupID")
End If
Set RSc=dbc.execute(SQLc)
EventColor = RSc("Cal_Group_Color")
RSc.Close
Set RSc=Nothing
End If
response.write "
"
EventCounter = EventCounter + 1
End If
End If
End If
RS.MoveNext
Loop
End If
End Sub
'*********************************************************************************
'******** Write Event Listing ****************************************************
'*********************************************************************************
Sub DrawEventListing(DateToUse, Range, CalType)
If DateToUse = "" then
DateToUse = Date()
Else
DateToUse = cDate(DateToUse)
End If
If Range = "" then
NumOfTimes = 1
Else
If Range = "TODAY" then
NumOfTimes = 1
End If
If Range = "WEEK" then
NumOfTimes = 7
End If
If Range = "MONTH" then
NumOfTimes = 31
End If
End If
For I = 1 to NumOfTimes
If I > 1 then
DateToUse = DateAdd("d", DateToUse, 1)
End If
If Session("Cal_User_ID") = "" then
GroupArray = GetGroupArray("Cal_Group_Type", "PUBLIC")
If UseSQLServer = "YES" then
SQL = "SELECT * FROM Cal_Events WHERE Cal_EventGroupID IN("& GroupArray &") AND Cal_EventStartDate <= '" & FormatDateFix(DateToUse) & "' AND Cal_EventEndDate >= '" & FormatDateFix(DateToUse) & "' AND Cal_EventStatus = 'APPROVED' ORDER BY Cal_EventStartTime, Cal_EventEndTime"
Else
SQL = "SELECT * FROM Cal_Events WHERE Cal_EventGroupID IN("& GroupArray &") AND Cal_EventStartDate <= #" & FormatDateFix(DateToUse) & "# AND Cal_EventEndDate >= #" & FormatDateFix(DateToUse) & "# AND Cal_EventStatus = 'APPROVED' ORDER BY Cal_EventStartTime, Cal_EventEndTime"
End If
Set RS=dbc.execute(SQL)
Else
UserGroupArray1 = Session("Cal_User_NormalGroups")
UserGroupArray2 = Session("Cal_User_AdminGroups")
UserGroupArray = Session("Cal_User_AllGroups")
If UseSQLServer = "YES" then
SQL = "SELECT * FROM Cal_Events WHERE Cal_EventGroupID IN("& UserGroupArray &") AND Cal_EventStartDate <= '" & FormatDateFix(DateToUse) & "' AND Cal_EventEndDate >= '" & FormatDateFix(DateToUse) & "' AND Cal_EventStatus = 'APPROVED' ORDER BY Cal_EventStartTime, Cal_EventEndTime"
Else
SQL = "SELECT * FROM Cal_Events WHERE Cal_EventGroupID IN("& UserGroupArray &") AND Cal_EventStartDate <= #" & FormatDateFix(DateToUse) & "# AND Cal_EventEndDate >= #" & FormatDateFix(DateToUse) & "# AND Cal_EventStatus = 'APPROVED' ORDER BY Cal_EventStartTime, Cal_EventEndTime"
End If
Set RS=dbc.execute(SQL)
End If
Do While NOT RS.EOF
If RS("Cal_EventGroupID") = 2 then
If UseSQLServer = "YES" then
SQLc = "SELECT Cal_User_EventColor FROM Cal_User WHERE Cal_User_ID = " & Session("Cal_User_ID")
Else
SQLc = "SELECT Cal_User_EventColor FROM Cal_User WHERE Cal_User_ID = " & Session("Cal_User_ID")
End If
Set RSc=dbc.execute(SQLc)
EventColor = RSc("Cal_User_EventColor")
RSc.Close
Set RSc=Nothing
Else
If UseSQLServer = "YES" then
SQLc = "SELECT Cal_Group_Color FROM Cal_Group WHERE Cal_Group_ID = " & RS("Cal_EventGroupID")
Else
SQLc = "SELECT Cal_Group_Color FROM Cal_Group WHERE Cal_Group_ID = " & RS("Cal_EventGroupID")
End If
Set RSc=dbc.execute(SQLc)
EventColor = RSc("Cal_Group_Color")
RSc.Close
Set RSc=Nothing
End If
If RS("Cal_EventGroupID") <> 2 OR RS("Cal_EventGroupID") = 2 AND RS("Cal_EventUserID") = Session("Cal_User_ID") then
If cDate(RS("Cal_EventStartDate")) = cDate(DateToUse) then
IsVisible = IsEventVisible(RS("Cal_EventGroupID"))
If weekday(DateToUse)=1 AND RS("Cal_EventStartTime")=#10:00AM# then IsVisible = "FALSE" End If
If weekday(DateToUse)=1 AND RS("Cal_EventStartTime")=#06:00PM# AND RS("Cal_EventTitle")="Evening Service" then IsVisible = "FALSE" End If
If weekday(DateToUse)=1 AND RS("Cal_EventStartTime")=#06:00PM# AND RS("Cal_EventTitle")="Youth Group" then IsVisible = "FALSE" End If
If weekday(DateToUse)=4 AND RS("Cal_EventStartTime")=#06:30PM# AND RS("Cal_EventTitle")="Wednesday Night Groups" then IsVisible = "FALSE" End If
If weekday(DateToUse)=5 AND RS("Cal_EventStartTime")=#09:30AM# then IsVisible = "FALSE" End If '-- Thursday Bible Study
If weekday(DateToUse)=7 AND RS("Cal_EventStartTime")=#06:00PM# AND RS("Cal_EventTitle")="Saturday Service" then IsVisible = "FALSE" End If
'--
If IsVisible = "TRUE" then
FoundEvent = "YES"
TempOutput = "
"
TempOutput = TempOutput & "
"
'-- Changes for Fairton
TempOutput = TempOutput & "
"
TempOutput = TempOutput & "
"
If RS("Cal_EventAllDay") <> "TRUE" then
If Session("DateFormat") = "US" then
'----- Changed to allow overnight events -------------------------------------------------------------------------
If AllowOvernightEvents = "YES" then
If cDate(RS("Cal_EventStartDate")) <> cDate(RS("Cal_EventEndDate")) then
If cDate(RS("Cal_EventStartDate")) = cDate(DateToUse) then
TempOutput = TempOutput & "" & MonthName(month(DateToUse), True) & " " & day(DateToUse) & " - " & day(cdate(RS("Cal_EventEndDate"))) & "
"
End If
'-- added 8/27/2012 per Cathy
TempOutput = TempOutput & "
"
TempOutput = TempOutput & "
"
If CalType = "inside" then
response.write TempOutput
End If
FinalOutput = FinalOutput & TempOutput
End If
End If
End If
RS.MoveNext
Loop
Next
If FoundEvent <> "YES" then
FinalOutput = "" & Sub1Var33 & ""
If CalType = "inside" then
response.write FinalOutput
End If
End If
FinalOutput = Replace(FinalOutput, "'", "\'")
If CalType = "outside" then
%>
function ShowListing() {
var tmpStr;
tmpStr = ('<%=FinalOutput%>');
document.write(tmpStr);
}
<%
End If
End Sub
'*********************************************************************************
'******** Draw Event Popup *******************************************************
'*********************************************************************************
Sub DrawEventPopup
If UseSQLServer = "YES" then
SQL = "SELECT * FROM Cal_Events WHERE Cal_EventID = " & SafeSQL(request.querystring("eventID"))
Else
SQL = "SELECT * FROM Cal_Events WHERE Cal_EventID = " & SafeSQL(request.querystring("eventID"))
End If
Set RS=dbc.execute(SQL)
If NOT RS.EOF then
response.write "
"
response.write "
"
response.write "
"
response.write "
Fairton Event Detail " & Sub10Var2 & "
"
response.write "
"
response.write "
"
response.write "
"
response.write "
"
response.write "
"
response.write "
"
response.write "
"
response.write "" & Sub10Var3 & ":
"
response.write "
"
%><%=RS("Cal_EventTitle")%><%
If RS("Cal_EventRecurrID") <> "" then
response.write " "
End If
If RS("Cal_EventLink") <> "" then
response.write ""
response.write ""
End If
response.write "
"
If RS("Cal_EventStartDate") <> RS("Cal_EventEndDate") then
response.write "" & RS("Cal_EventStartDate") & " - " & RS("Cal_EventEndDate") & ""
Else
response.write "" & RS("Cal_EventStartDate") & ""
End If
response.write "
"
response.write "
"
If ShowUserName = "YES" then
response.write "
"
response.write "
"
response.write "User / Owner:
"
response.write "
"
SQLu = "SELECT * FROM Cal_User WHERE Cal_User_ID = " & RS("Cal_EventUserID")
Set RSu=dbc.execute(SQLu)
If NOT RSu.EOF then
response.write RSu("Cal_User_FirstName") & " " & RSu("Cal_User_LastName")
End If
RSu.Close
Set RSu=Nothing
response.write "
"
response.write "
"
End If
response.write "
"
response.write "
"
response.write "" & Sub10Var8 & ":
"
response.write "
"
If RS("Cal_EventAllDay") <> "TRUE" then
If Session("DateFormat") = "US" then
response.write "" & FormatTime(RS("Cal_EventStartTime")) & " - " & FormatTime(RS("Cal_EventEndTime")) & ""
Else
TempStartTime = FormatDateTime(CDate(RS("Cal_EventStartTime")),3)
TempStartTime = FormatTimeFix(TempStartTime,"")
TempEndTime = FormatDateTime(CDate(RS("Cal_EventEndTime")),3)
TempEndTime = FormatTimeFix(TempEndTime,"")
response.write "" & TempStartTime & " - " & TempEndTime & ""
End If
Else
response.write "" & Sub10Var9 & ""
End If
response.write "
"
response.write "
"
If RS("Cal_EventGroupID") = 2 then
If UseSQLServer = "YES" then
SQLc = "SELECT Cal_User_EventColor FROM Cal_User WHERE Cal_User_ID = " & Session("Cal_User_ID")
Else
SQLc = "SELECT Cal_User_EventColor FROM Cal_User WHERE Cal_User_ID = " & Session("Cal_User_ID")
End If
Set RSc=dbc.execute(SQLc)
EventColor = RSc("Cal_User_EventColor")
EventGroup = "Personal"
RSc.Close
Set RSc=Nothing
Else
If UseSQLServer = "YES" then
SQLc = "SELECT Cal_Group_Color, Cal_Group_Name FROM Cal_Group WHERE Cal_Group_ID = " & RS("Cal_EventGroupID")
Else
SQLc = "SELECT Cal_Group_Color, Cal_Group_Name FROM Cal_Group WHERE Cal_Group_ID = " & RS("Cal_EventGroupID")
End If
Set RSc=dbc.execute(SQLc)
EventColor = RSc("Cal_Group_Color")
EventGroup = RSc("Cal_Group_Name")
RSc.Close
Set RSc=Nothing
End If
response.write "
"
End If
RS.Close
Set RS=Nothing
End Sub
'*********************************************************************************
'******** Draw Login Page ********************************************************
'*********************************************************************************
'-- Fairton Changed
Sub DrawLoginPage
response.write "
"
response.write "
"
response.write "
"
response.write "
" & " " & Sub11Var2 & "
"
response.write "
"
response.write "
"
response.write "
"
response.write "
"
response.write ""
response.write "
"
response.write "
"
response.write "
"
End Sub
'*********************************************************************************
'******** Process The Login ******************************************************
'*********************************************************************************
Sub ProcessLogin
If UseSQLServer = "YES" then
SQL = "SELECT * FROM Cal_User WHERE Cal_User_UserName = '" & SafeSQL(request.form("txtUserName")) & "'"
Else
SQL = "SELECT * FROM Cal_User WHERE Cal_User_UserName = '" & SafeSQL(request.form("txtUserName")) & "'"
End If
Set RS=dbc.execute(SQL)
If NOT RS.EOF then
If RS("Cal_User_Password") = request.form("txtPassword") then
Session("Cal_User_ID") = RS("Cal_User_ID")
Session("Cal_User_UserName") = RS("Cal_User_UserName")
Session("Cal_User_FirstName") = RS("Cal_User_FirstName")
Session("Cal_User_LastName") = RS("Cal_User_LastName")
Session("Cal_User_EmailAddress") = RS("Cal_User_EmailAddress")
Session("Cal_User_RightsLevel") = RS("Cal_User_RightsLevel")
Session("Cal_User_RequireApproval") = RS("Cal_User_RequireApproval")
Session("Cal_User_EventColor") = RS("Cal_User_EventColor")
Session("Cal_User_NormalGroups") = GetUserGroupArray("NORMAL")
Session("Cal_User_AdminGroups") = GetUserGroupArray("ADMIN")
Session("Cal_User_AllGroups") = Session("Cal_User_NormalGroups") & ", " & Session("Cal_User_PublicGroups") & "," & Session("Cal_User_AdminGroups") & ", 2"
If RS("Cal_User_LastFilter") <> "" then
Session("Cal_FilterGroups") = RS("Cal_User_LastFilter")
Else
Session("Cal_FilterGroups") = Session("Cal_User_AllGroups")
End If
response.redirect "calendar.asp?action=summary&message=" & Sub12Var1 & "&linktype=window&from=loginscreen"
Else
response.redirect "calendar.asp?action=login&error=wrongpassword"
End If
Else
response.redirect "calendar.asp?action=login&error=nouser"
End If
End Sub
'*********************************************************************************
'******** Draw View Options Page *************************************************
'*********************************************************************************
Sub ViewOptions
response.write "
"
response.write "
"
response.write "
"
response.write "
" & Sub13Var1 & " " & Sub13Var2 & "
"
response.write "
"
response.write "
"
response.write "
"
response.write "
"
response.write ""
response.write "
"
response.write "
"
response.write "
"
End Sub
'*********************************************************************************
'******** Process Logoff *********************************************************
'*********************************************************************************
Sub Logoff
Session.Abandon
response.redirect "calendar.asp"
End Sub
'*********************************************************************************
'******** Draw the Summary Page **************************************************
'*********************************************************************************
Sub DrawSummary(Sum_Message, Sum_LinkType, Sum_From)
If NoSummary = "YES" then
%><%
End If
SELECT CASE Sum_From
CASE "loginscreen"
TopIconImage = SkinFolder & "popup_head_login.gif"
TopMessage = Sub14Var1
TopMessage2 = " " & Sub14Var2 & ":"
CASE "filterview"
TopIconImage = SkinFolder & "popup_head_filter.gif"
TopMessage = Sub14Var3
TopMessage2 = " " & Sub14Var2
CASE "emailuser"
TopIconImage = SkinFolder & "popup_head_email.gif"
TopMessage = Sub14Var9
TopMessage2 = " " & Sub14Var10
CASE ELSE
END SELECT
response.write "
"
response.write "
"
response.write "
"
response.write "
" & TopMessage & " " & TopMessage2 & "
"
response.write "
"
response.write "
"
response.write "
"
response.write "
"
response.write "
"
response.write "
"
response.write "
"
response.write ""
If Sum_From <> "loginscreen" or UseInviteFunction = "NO" then
response.write "" & Sum_Message & "
"
If Sum_LinkType = "window" then
response.write ""
Else
response.write "Continue"
End If
Else
Set RS=Server.CreateObject("ADODB.RecordSet")
If UseSQLServer = "YES" then
RS.Open "SELECT * FROM Cal_Events WHERE Cal_EventUserID = " & Session("Cal_User_ID") & " AND Cal_EventStatus = 'INVITE'", dbc, adOpenDynamic, adLockPessimistic, adCMDText
Else
RS.Open "SELECT * FROM Cal_Events WHERE Cal_EventUserID = " & Session("Cal_User_ID") & " AND Cal_EventStatus = 'INVITE'", dbc, adOpenDynamic, adLockPessimistic, adCMDText
End If
response.write "
"
response.write "
" & Sub14Var5 & "
"
response.write "
"
If NOT RS.EOF then
response.write "
"
response.write "
"
Else
response.write "
"
response.write "
" & Sub14Var7 & "
"
response.write "
"
End If
RS.CLOSE
SET RS=Nothing
response.write ""
response.write "
"
response.write "
"
If Sum_LinkType = "window" then
response.write ""
Else
response.write "" & Sub14Var8 & ""
End If
End If
response.write "
"
response.write "
"
response.write "
"
response.write "
"
response.write "
"
response.write "
"
End Sub
'*********************************************************************************
'******** Must Login *************************************************************
'*********************************************************************************
Sub MustLogin
response.write "
"
End Sub
'*********************************************************************************
'******** Process Invites ********************************************************
'*********************************************************************************
Sub ProcessInvites
If request.form("txtApproveInvites") <> "" then
SendEmailToUsers = split(request.form("txtApproveInvites"))
For I = 0 to Ubound(SendEmailToUsers)
'---- Send Email to Invitees ----------
If UseSQLServer = "YES" then
SQLu = "SELECT * FROM Cal_Events WHERE Cal_EventID = " & int(SendEmailToUsers(I))
Else
SQLu = "SELECT * FROM Cal_Events WHERE Cal_EventID = " & int(SendEmailToUsers(I))
End If
Set RSu = dbc.execute(SQLu)
SendFromUserID = RSu("Cal_EventInviteByID")
Cal_EventTitle = RSu("Cal_EventTitle")
Cal_EventStartDate = RSu("Cal_EventStartDate")
Cal_EventStartTime = RSu("Cal_EventStartTime")
Cal_EventEndTime = RSu("Cal_EventEndTime")
Cal_EventBody = RSu("Cal_EventBody")
RSu.Close
Set RSu=Nothing
If UseSQLServer = "YES" then
SQLe = "SELECT Cal_User_EmailAddress FROM Cal_User WHERE Cal_User_ID = " & SendFromUserID
Else
SQLe = "SELECT Cal_User_EmailAddress FROM Cal_User WHERE Cal_User_ID = " & SendFromUserID
End If
Set RSe=dbc.execute(SQLe)
SendTo = RSe("Cal_User_EmailAddress")
EmailSubject = Sub49Var2
RSe.Close
Set RSe=Nothing
If Cal_EventAllDay <> "TRUE" then
MessageToSend = Session("Cal_User_FirstName") & " " & Session("Cal_User_LastName")& " " & Sub49Var3 & ":
"
End If
If UseEmailFunctions <> "NO" then
Call SendAnEmail(SendTo, EmailSubject, MessageToSend)
End If
'--------------------------------------
Next
If UseSQLServer = "YES" then
SQL = "UPDATE Cal_Events SET Cal_EventStatus = 'APPROVED' WHERE Cal_EventID IN("&request.form("txtApproveInvites")&")"
Else
SQL = "UPDATE Cal_Events SET Cal_EventStatus = 'APPROVED' WHERE Cal_EventID IN("&request.form("txtApproveInvites")&")"
End If
Set RS = dbc.Execute(SQL)
End If
If request.form("txtDeclineInvites") <> "" then
SendEmailToUsers = split(request.form("txtDeclineInvites"))
For I = 0 to Ubound(SendEmailToUsers)
'---- Send Email to Invitees ----------
If UseSQLServer = "YES" then
SQLu = "SELECT * FROM Cal_Events WHERE Cal_EventID = " & int(SendEmailToUsers(I))
Else
SQLu = "SELECT * FROM Cal_Events WHERE Cal_EventID = " & int(SendEmailToUsers(I))
End If
Set RSu = dbc.execute(SQLu)
SendFromUserID = RSu("Cal_EventInviteByID")
Cal_EventTitle = RSu("Cal_EventTitle")
Cal_EventStartDate = RSu("Cal_EventStartDate")
Cal_EventStartTime = RSu("Cal_EventStartTime")
Cal_EventEndTime = RSu("Cal_EventEndTime")
Cal_EventBody = RSu("Cal_EventBody")
RSu.Close
Set RSu=Nothing
If UseSQLServer = "YES" then
SQLe = "SELECT Cal_User_EmailAddress FROM Cal_User WHERE Cal_User_ID = " & SendFromUserID
Else
SQLe = "SELECT Cal_User_EmailAddress FROM Cal_User WHERE Cal_User_ID = " & SendFromUserID
End If
Set RSe=dbc.execute(SQLe)
SendTo = RSe("Cal_User_EmailAddress")
EmailSubject = Sub49Var2
RSe.Close
Set RSe=Nothing
If Cal_EventAllDay <> "TRUE" then
MessageToSend = Session("Cal_User_FirstName") & " " & Session("Cal_User_LastName")& " " & Sub49Var5 & ":
"
End If
If UseEmailFunctions <> "NO" then
Call SendAnEmail(SendTo, EmailSubject, MessageToSend)
End If
'--------------------------------------
Next
If UseSQLServer = "YES" then
SQL = "DELETE FROM Cal_Events WHERE Cal_EventID IN("& request.form("txtDeclineInvites") &")"
Else
SQL = "DELETE FROM Cal_Events WHERE Cal_EventID IN("& request.form("txtDeclineInvites") &")"
End If
Set RS = dbc.Execute(SQL)
End If
response.redirect "calendar.asp?action=summary&message=" & Sub15Var3 & "&linktype=window&from=loginscreen"
End Sub
'*********************************************************************************
'******** Process Filter *********************************************************
'*********************************************************************************
Sub ProcessFilter
Session("Cal_FilterGroups") = request.form("txtGroupFilter")
If UseSQLServer = "YES" then
SQL="UPDATE Cal_User SET "
Else
SQL="UPDATE Cal_User SET "
End If
If Session("Cal_User_ID") <> "" then
SQL = SQL & "Cal_User_LastFilter = '" & Session("Cal_FilterGroups") & "' "
SQL = SQL & " WHERE [Cal_User_ID] ="& Session("Cal_User_ID")
dbc.Execute(SQL)
End If
response.redirect "calendar.asp?date=" & request.querystring("date") & "&caltype=" & request.querystring("caltype")
End Sub
'*********************************************************************************
'******** Send An Email **********************************************************
'*********************************************************************************
Sub SendAnEmail(SendTo, EmailSubject, MessageToSend)
'------ Fill the Variables --------------------------
txtSendTo = SendTo
txtSendFrom = SendFromEmailAddress
txtSubject = EmailSubject
txtBody = MessageToSend
If EmailComponent = "CDONTS" then
Set sMail = Server.CreateObject("CDONTS.NewMail")
sMail.BodyFormat = 0
sMail.MailFormat = 0
sMail.From = txtSendFrom
sMail.To = txtSendTo
sMail.Subject = txtSubject
sMail.Body = txtBody
sMail.Send( )
End If
If EmailComponent = "CDOSYS" then
Set sMail = Server.CreateObject("CDO.Message")
Set sMailCon = Server.CreateObject ("CDO.Configuration")
With sMailCon
.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = EmailHost
.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
.Fields.Update
End With
Set sMail.Configuration = sMailCon
With sMail
.From = txtSendFrom
.To = txtSendTo
.Subject = txtSubject
.HTMLBody = txtBody
.Send
End with
Set sMail = Nothing
End If
If EmailComponent = "ASPEmail" then
Set sMail = Server.CreateObject("Persits.MailSender")
sMail.Host = EmailHost
sMail.From = txtSendFrom
sMail.FromName = txtSendFrom
sMail.AddReplyTo txtSendFrom
sMail.AddAddress txtSendTo 'This needs to be changed to handle multiples!!!
sMail.Subject = txtSubject
sMail.Body = txtBody
sMail.Send
End If
If EmailComponent = "JMail" then
Set sMail = Server.CreateObject("JMail.Message")
sMail.Logging = true
sMail.silent = true
sMail.From = txtSendFrom
sMail.FromName = txtSendFrom
sMail.AddRecipient txtSendTo 'This needs to be changed to handle multiples!!!
sMail.Subject = txtSubject
sMail.Body = txtBody
sMail.Send(EmailHost)
End If
If EmailComponent = "ASPMail" then
Set sMail = Server.CreateObject("SMTPsvg.Mailer")
sMail.RemoteHost = EmailHost
sMail.FromAddress = txtSendFrom
sMail.FromName = txtSendFrom
sMail.AddRecipient txtEmailUser, txtSendTo 'This needs to be changed to handle multiples!!!
sMail.ContentType = "text/html"
sMail.Subject = txtSubject
sMail.BodyText = txtBody
sMail.SendMail
End If
End Sub
'*********************************************************************************
'******** Export To VCAL *********************************************************
'*********************************************************************************
Sub ExportVCal(DateToUse, CalType)
If DateToUse = "" then
DateToUse = Date()
Else
DateToUse = cDate(DateToUse)
End If
If CalType = "" then
NumOfTimes = 31
Else
If CalType = "day" then
NumOfTimes = 1
End If
If CalType = "week" then
NumOfTimes = 7
WeekDayTitleName = Weekday(theDate, 2)
DateToUse = DateAdd("w", 1-WeekDayTitleName, DateToUse)
End If
If CalType = "month" then
NumOfTimes = 31
If Session("DateFormat") = "US" then
DateToUse = Month(DateToUse) & "/1/" & Year(DateToUse)
DateToUse = cDate(DateToUse)
Else
DateToUse = "/1/" & Month(DateToUse) & Year(DateToUse)
DateToUse = cDate(DateToUse)
End If
End If
End If
EventToUse = request.querystring("eventid")
If EventToUse <> "" then
NumOfTimes = 1
End If
VCalTemp = ""
VCalTemp = VCalTemp & "BEGIN:VCALENDAR" & vbCrLF
VCalTemp = VCalTemp & "VERSION:1.0" & vbCrLF
For I = 1 to NumOfTimes
If I > 1 then
DateToUse = DateAdd("d", DateToUse, 1)
End If
If EventToUse = "" then
If Session("Cal_User_ID") = "" then
GroupArray = GetGroupArray("Cal_Group_Type", "PUBLIC")
If UseSQLServer = "YES" then
SQL = "SELECT * FROM Cal_Events WHERE Cal_EventGroupID IN("& GroupArray &") AND Cal_EventStartDate <= '" & CDate(DateToUse) & "' AND Cal_EventEndDate >= '" & CDate(DateToUse) & "' AND Cal_EventStatus = 'APPROVED' ORDER BY Cal_EventStartTime, Cal_EventEndTime"
Else
SQL = "SELECT * FROM Cal_Events WHERE Cal_EventGroupID IN("& GroupArray &") AND Cal_EventStartDate <= #" & CDate(DateToUse) & "# AND Cal_EventEndDate >= #" & CDate(DateToUse) & "# AND Cal_EventStatus = 'APPROVED' ORDER BY Cal_EventStartTime, Cal_EventEndTime"
End If
Set RS=dbc.execute(SQL)
Else
UserGroupArray1 = Session("Cal_User_NormalGroups")
UserGroupArray2 = Session("Cal_User_AdminGroups")
UserGroupArray = Session("Cal_User_AllGroups")
If UseSQLServer = "YES" then
SQL = "SELECT * FROM Cal_Events WHERE Cal_EventGroupID IN("& UserGroupArray &") AND Cal_EventStartDate <= '" & CDate(DateToUse) & "' AND Cal_EventEndDate >= '" & CDate(DateToUse) & "' AND Cal_EventStatus = 'APPROVED' ORDER BY Cal_EventStartTime, Cal_EventEndTime"
Else
SQL = "SELECT * FROM Cal_Events WHERE Cal_EventGroupID IN("& UserGroupArray &") AND Cal_EventStartDate <= #" & CDate(DateToUse) & "# AND Cal_EventEndDate >= #" & CDate(DateToUse) & "# AND Cal_EventStatus = 'APPROVED' ORDER BY Cal_EventStartTime, Cal_EventEndTime"
End If
Set RS=dbc.execute(SQL)
End If
Else
If UseSQLServer = "YES" then
SQL = "SELECT * FROM Cal_Events WHERE Cal_EventID = " & EventToUse
Else
SQL = "SELECT * FROM Cal_Events WHERE Cal_EventID = " & EventToUse
End If
Set RS=dbc.execute(SQL)
End If
Do While NOT RS.EOF
If RS("Cal_EventGroupID") <> 2 OR RS("Cal_EventGroupID") = 2 AND RS("Cal_EventUserID") = Session("Cal_User_ID") then
IsVisible = IsEventVisible(RS("Cal_EventGroupID"))
If IsVisible = "TRUE" then
TimeZoneBias = TimeZoneBias * (-1)
If RS("Cal_EventAllDay") = "TRUE" then
FixStartDay = Day(RS("Cal_EventStartDate"))
If len(FixStartDay) = 1 then
FixStartDay = "0" & FixStartDay
End If
FixStartMonth = Month(RS("Cal_EventStartDate"))
If len(FixStartMonth) = 1 then
FixStartMonth = "0" & FixStartMonth
End If
EndDateToUse = DateAdd("d", 1, RS("Cal_EventEndDate"))
FixEndDay = Day(EndDateToUse)
If len(FixEndDay) = 1 then
FixEndDay = "0" & FixEndDay
End If
FixEndMonth = Month(EndDateToUse)
If len(FixEndMonth) = 1 then
FixEndMonth = "0" & FixEndMonth
End If
EventStartDate = Year(RS("Cal_EventStartDate")) & FixStartMonth & FixStartDay
EventEndDate = Year(EndDateToUse) & FixEndMonth & FixEndDay
SELECT CASE Session("TimeZoneBias")
CASE "-1"
TimeZoneMidnight = "T000000Z"
CASE "-2"
TimeZoneMidnight = "T010000Z"
CASE "-3"
TimeZoneMidnight = "T020000Z"
CASE "-4"
TimeZoneMidnight = "T030000Z"
CASE "-5"
TimeZoneMidnight = "T040000Z"
CASE "-6"
TimeZoneMidnight = "T050000Z"
CASE "-7"
TimeZoneMidnight = "T060000Z"
CASE "-8"
TimeZoneMidnight = "T070000Z"
CASE "-9"
TimeZoneMidnight = "T080000Z"
CASE ELSE
TimeZoneMidnight = "T040000Z"
END SELECT
VCalEventStart = EventStartDate & TimeZoneMidnight
VCalEventEnd = EventEndDate & TimeZoneMidnight
Else
FixStartDay = Day(RS("Cal_EventStartDate"))
If len(FixStartDay) = 1 then
FixStartDay = "0" & FixStartDay
End If
FixStartMonth = Month(RS("Cal_EventStartDate"))
If len(FixStartMonth) = 1 then
FixStartMonth = "0" & FixStartMonth
End If
FixEndDay = Day(RS("Cal_EventEndDate"))
If len(FixEndDay) = 1 then
FixEndDay = "0" & FixEndDay
End If
FixEndMonth = Month(RS("Cal_EventEndDate"))
If len(FixEndMonth) = 1 then
FixEndMonth = "0" & FixEndMonth
End If
EventStartDate = Year(RS("Cal_EventStartDate")) & FixStartMonth & FixStartDay
EventEndDate = Year(RS("Cal_EventEndDate")) & FixEndMonth & FixEndDay
'EventStartDate = Year(RS("Cal_EventStartDate")) & Month(RS("Cal_EventStartDate")) & Day(RS("Cal_EventStartDate"))
'EventEndDate = Year(RS("Cal_EventEndDate")) & Month(RS("Cal_EventEndDate")) & Day(RS("Cal_EventEndDate"))
EventStartTime = FormatDateTime(RS("Cal_EventStartTime"), 4)
EventStartTime = Replace(EventStartTime, ":", "")
EventEndTime = FormatDateTime(RS("Cal_EventEndTime"), 4)
EventEndTime = Replace(EventEndTime, ":", "")
VCalEventStart = EventStartDate & "T" & EventStartTime & "00"
VCalEventEnd = EventEndDate & "T" & EventEndTime & "00"
End If
FixedBody = replace(RS("Cal_EventBody"), " ", "")
FixedBody = replace(FixedBody, vbcrlf, "")
'----- Fix for overnight events ------------------------------------
If AllowOvernightEvents = "YES" then
IsOvernight = "NO"
If RS("Cal_EventStartDate") < RS("Cal_EventEndDate") then
IsOvernight = "YES"
Else
IsOvernight = "NO"
End If
ShowEvent = "YES"
If CDate(DateToUse) <> CDate(RS("Cal_EventStartDate")) then
ShowEvent = "NO"
Else
ShowEvent = "YES"
End If
If ShowEvent = "YES" then
VCalTemp = VCalTemp & "BEGIN: VEVENT" & vbCrLF
VCalTemp = VCalTemp & "DTStart:" & VCalEventStart & vbCrLF
VCalTemp = VCalTemp & "DTEnd:" & VCalEventEnd & vbCrLF
VCalTemp = VCalTemp & "Location;ENCODING=QUOTED-PRINTABLE:" & EventLocation & vbCrLF
'pmg put other things in vcs file
VCalTemp = VCalTemp & "SUMMARY;ENCODING=QUOTED-PRINTABLE:" & RS("Cal_EventTitle") & RS("Cal_EventUser1") & vbCrLF
'VCalTemp = VCalTemp & "SUMMARY;ENCODING=QUOTED-PRINTABLE:" & RS("Cal_EventTitle") & vbCrLF
'end pmg
VCalTemp = VCalTemp & "DESCRIPTION;ENCODING=QUOTED-PRINTABLE:" & FixedBody & vbCrLF
VCalTemp = VCalTemp & "UID:" & VCalEventStart & VCalEventEnd & RS("Cal_EventTitle") & vbCrLF
VCalTemp = VCalTemp & "PRIORITY:3" & vbCrLF
VCalTemp = VCalTemp & "End:VEVENT" & vbCrLF
End If
Else
VCalTemp = VCalTemp & "BEGIN: VEVENT" & vbCrLF
VCalTemp = VCalTemp & "DTStart:" & VCalEventStart & vbCrLF
VCalTemp = VCalTemp & "DTEnd:" & VCalEventEnd & vbCrLF
VCalTemp = VCalTemp & "Location;ENCODING=QUOTED-PRINTABLE:" & EventLocation & vbCrLF
VCalTemp = VCalTemp & "SUMMARY;ENCODING=QUOTED-PRINTABLE:" & RS("Cal_EventTitle") & vbCrLF
VCalTemp = VCalTemp & "DESCRIPTION;ENCODING=QUOTED-PRINTABLE:" & FixedBody & vbCrLF
VCalTemp = VCalTemp & "UID:" & VCalEventStart & VCalEventEnd & RS("Cal_EventTitle") & vbCrLF
VCalTemp = VCalTemp & "PRIORITY:3" & vbCrLF
VCalTemp = VCalTemp & "End:VEVENT" & vbCrLF
End If
'---------------------------------------------------------------------
End If
End If
RS.MoveNext
Loop
Next
VCalTemp = VCalTemp & "End:VCALENDAR" & chr(13)
'------ Write Stream to a file and send it to the browser... then delete the file... ------------------
'Dim objStream
'Set objStream = Server.CreateObject("ADODB.Stream")
'objStream.Open
'objStream.Type = 2
'objStream.Charset = "ascii"
'objStream.WriteText VCalTemp
'objStream.SaveToFile Server.MapPath("calendar\eventimages\vcalexport.vcs"), 2
'objStream.Close
'Set objStream = Nothing
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
Dim objTextStream
Set objTextStream = FSO.OpenTextFile(Server.MapPath("calendar\eventimages\vcalexport.vcs"), 8, True)
objTextStream.Write VCalTemp
objTextStream.Close
Set objTextStream = Nothing
Dim objStream
Set objStream = Server.CreateObject("ADODB.Stream")
Response.ContentType = "application/octet-stream"
Response.AddHeader "Content-Disposition", "attachment;filename=vcalexport.vcs"
objStream.Type = 1
objStream.Open
objStream.LoadFromFile Server.MapPath("calendar\eventimages\vcalexport.vcs")
Response.BinaryWrite objStream.Read
objStream.Close
Set objStream = Nothing
If FSO.FileExists(Server.MapPath("calendar\eventimages\vcalexport.vcs")) then
FSO.DeleteFile(Server.MapPath("calendar\eventimages\vcalexport.vcs"))
Else
response.write "THIS FILE DOESN'T EXISTS"
End If
Set FSO = Nothing
'-------- Old method use this if you cant write to the file for permission reasons ----------------
'response.write "
"
End Sub
'*********************************************************************************
'******** Email A User **********************************************************
'*********************************************************************************
Sub SendUserEmail
response.write "
"
response.write "
"
response.write "
"
response.write "
" & Sub50Var1 & " " & Sub50Var2 & "
"
response.write "
"
response.write "
"
response.write "
"
response.write "
"
response.write ""
response.write "
"
response.write "
"
response.write "
"
End Sub
'*********************************************************************************
'******** Email A User **********************************************************
'*********************************************************************************
Sub SendUserEmailProcess
SendTo = request.form("txtEmailUser")
EmailSubject = request.form("txtEmailSubject")
MessageToSend = request.form("txtEmailBody")
Call SendAnEmail(SendTo, EmailSubject, MessageToSend)
response.redirect "calendar.asp?action=summary&message=" & Sub51Var1 & "&linktype=window&from=emailuser"
End Sub
'*********************************************************************************
'*********************************************************************************
'*********************************************************************************
'************************* Functions Below Here Only *****************************
'*********************************************************************************
'*********************************************************************************
'*********************************************************************************
'*********************************************************************************
'*********************************************************************************
'********* Write the page header or footer **************************************
SUB WriteHeaderOrFooter(FileToRead)
If UsePageTemplate <> "YES" then
HFFile=server.mappath(FileToRead)
Set fs = CreateObject("Scripting.FileSystemObject")
Set thisfile = fs.OpenTextFile(HFFile, 1, False)
tempSTR=thisfile.readall
response.write tempSTR
thisfile.Close
set thisfile=nothing
set fs=nothing
Else
'---------------------------------------------------------------------------------
'----- Pull In the Page Header and Footer ----------------------------------------
'---------------------------------------------------------------------------------
PageTemplate = "calendar.htm"
TemplateFile = Server.MapPath(PageTemplate)
Set fs = CreateObject("Scripting.FileSystemObject")
Set thisfile = fs.OpenTextFile(TemplateFile, 1, False)
tempSTR=thisfile.readall
TemplateContent = tempSTR
thisfile.Close
set thisfile=nothing
set fs=nothing
PageArray = split(TemplateContent, "[CONTENT]")
PageHeader = PageArray(0)
PageFooter = PageArray(1)
If FileToRead = "cal_header.asp" then
response.write PageHeader
Else
response.write PageFooter
End If
End If
END SUB
'******* Can User Modify Event ***************************************************
Function CanUserModify(EventGroup)
CanModify = Split(Session("Cal_User_AdminGroups"))
For I = 0 to Ubound(CanModify)
If cint(EventGroup) = cint(CanModify(I)) then
Return = "TRUE"
End If
Next
CanUserModify = Return
End Function
'******* Should We Show The Event ************************************************
Function IsEventVisible(EventGroup)
EventsVisible = Split(Session("Cal_FilterGroups"))
For I = 0 to Ubound(EventsVisible)
If cint(EventGroup) = cint(EventsVisible(I)) then
Return = "TRUE"
End If
Next
IsEventVisible = Return
End Function
'******* Check Day For Event *****************************************************
Function CheckForEvent(DateToUse)
If Session("Cal_User_ID") = "" then
GroupArray = GetGroupArray("Cal_Group_Type", "PUBLIC")
If UseSQLServer = "YES" then
SQL = "SELECT * FROM Cal_Events WHERE Cal_EventGroupID IN("& GroupArray &") AND Cal_EventStartDate <= '" & FormatDateFix(DateToUse) & "' AND Cal_EventEndDate >= '" & FormatDateFix(DateToUse) & "' AND Cal_EventStatus = 'APPROVED' ORDER BY Cal_EventStartTime, Cal_EventEndTime"
Else
SQL = "SELECT * FROM Cal_Events WHERE Cal_EventGroupID IN("& GroupArray &") AND Cal_EventStartDate <= #" & FormatDateFix(DateToUse) & "# AND Cal_EventEndDate >= #" & FormatDateFix(DateToUse) & "# AND Cal_EventStatus = 'APPROVED' ORDER BY Cal_EventStartTime, Cal_EventEndTime"
End If
Set RS=dbc.execute(SQL)
Else
UserGroupArray1 = Session("Cal_User_NormalGroups")
UserGroupArray2 = Session("Cal_User_AdminGroups")
UserGroupArray = Session("Cal_User_AllGroups")
If UseSQLServer = "YES" then
SQL = "SELECT * FROM Cal_Events WHERE Cal_EventGroupID IN("& UserGroupArray &") AND Cal_EventStartDate <= '" & FormatDateFix(DateToUse) & "' AND Cal_EventEndDate >= '" & FormatDateFix(DateToUse) & "' AND Cal_EventStatus = 'APPROVED' ORDER BY Cal_EventStartTime, Cal_EventEndTime"
Else
SQL = "SELECT * FROM Cal_Events WHERE Cal_EventGroupID IN("& UserGroupArray &") AND Cal_EventStartDate <= #" & FormatDateFix(DateToUse) & "# AND Cal_EventEndDate >= #" & FormatDateFix(DateToUse) & "# AND Cal_EventStatus = 'APPROVED' ORDER BY Cal_EventStartTime, Cal_EventEndTime"
End If
Set RS=dbc.execute(SQL)
'RS.Filter = "Cal_EventUserID = " & Session("Cal_User_ID")
End If
Do While NOT RS.EOF
If RS("Cal_EventGroupID") <> 2 OR RS("Cal_EventGroupID") = 2 AND RS("Cal_EventUserID") = Session("Cal_User_ID") then
If IsEventVisible(RS("Cal_EventGroupID")) = "TRUE" then
Return = "YES"
Exit Do
End If
End If
Return = "NO"
RS.MoveNext
Loop
CheckForEvent = Return
End Function
'******* Get Group Array Function ************************************************
Function GetGroupArray(GroupField, GroupValue)
If UseSQLServer = "YES" then
SQLg = "SELECT Cal_Group_ID FROM Cal_Group WHERE " & GroupField & " = '" & GroupValue & "'"
Else
SQLg = "SELECT Cal_Group_ID FROM Cal_Group WHERE " & GroupField & " = '" & GroupValue & "'"
End If
Set RSg=dbc.execute(SQLg)
Do While NOT RSg.EOF
GroupArray = GroupArray & RSg("Cal_Group_ID")
GroupArray = GroupArray & ", "
RSg.MoveNext
Loop
RSg.Close
Set RSg=Nothing
GroupArray = Left(GroupArray, len(GroupArray) -2)
GetGroupArray = GroupArray
End Function
'******* Get User Group Array Function ********************************************
Function GetUserGroupArray(RightsType)
If UseSQLServer = "YES" then
SQLg = "SELECT Cal_UG_Link_GroupID FROM Cal_UG_Link WHERE Cal_UG_Link_Type = '" & RightsType & "' AND Cal_UG_Link_UserID = " & Session("Cal_User_ID")
Else
SQLg = "SELECT Cal_UG_Link_GroupID FROM Cal_UG_Link WHERE Cal_UG_Link_Type = '" & RightsType & "' AND Cal_UG_Link_UserID = " & Session("Cal_User_ID")
End If
Set RSg=dbc.execute(SQLg)
Do While NOT RSg.EOF
If RSg("Cal_UG_Link_GroupID") = "9999" then
InAll = "YES"
End If
UserGroupArray = UserGroupArray & RSg("Cal_UG_Link_GroupID")
UserGroupArray = UserGroupArray & ", "
RSg.MoveNext
Loop
RSg.Close
Set RSg=Nothing
If InAll = "YES" then
UserGroupArray = ""
If UseSQLServer = "YES" then
SQLg = "SELECT Cal_Group_ID FROM Cal_Group"
Else
SQLg = "SELECT Cal_Group_ID FROM Cal_Group"
End If
Set RSg=dbc.execute(SQLg)
Do While NOT RSg.EOF
UserGroupArray = UserGroupArray & RSg("Cal_Group_ID")
UserGroupArray = UserGroupArray & ", "
RSg.MoveNext
Loop
RSg.Close
Set RSg=Nothing
End If
UserGroupArray = Left(UserGroupArray, len(UserGroupArray) -2)
UserGroupArray = UserGroupArray & ", 2"
GetUserGroupArray = UserGroupArray
End Function
'******* Fix String Function *****************************************************
Function FixString(strSource)
strSource = Replace(strSource, "'", "''")
strSource = Replace(strSource, "''''", "''")
FixString = Replace(strSource, "'''", "''")
End Function
'******* Format Date Function for European Fix ***********************************
Function FormatDateFix(DateValue)
DateValueMonth = Month(DateValue)
DateValueDay = Day(DateValue)
DateValueYear = Year(DateValue)
DateValueFix = DateValueMonth & "/" & DateValueDay & "/" & DateValueYear
FormatDateFix = DateValueFix
End Function
'******* Get the number of events for this time **************************************
Function GetTimeSlot(DateToCheck, EventStart, EventID)
Dim EventArrayA(96)
Dim EventArrayB(96)
Dim EventArrayC(96)
Dim EventArrayD(96)
Dim EventArrayE(96)
Dim EventArrayF(96)
If UseSQLServer = "YES" then
SQLe = "SELECT * FROM Cal_Events WHERE Cal_EventStartDate = '" & FormatDateFix(DateToCheck) & "' ORDER BY Cal_EventStartTime"
Else
SQLe = "SELECT * FROM Cal_Events WHERE Cal_EventStartDate = #" & DateToCheck & "# ORDER BY Cal_EventStartTime"
End If
Set RSe=dbc.execute(SQLe)
StartTimeMin = 0
EndTimeMin = 0
For A = 1 to 96
EventArrayA(A) = 0
Next
For B = 1 to 96
EventArrayB(B) = 0
Next
For C = 1 to 96
EventArrayC(C) = 0
Next
For D = 1 to 96
EventArrayD(D) = 0
Next
For E = 1 to 96
EventArrayE(E) = 0
Next
For F = 1 to 96
EventArrayF(F) = 0
Next
Do While NOT RSe.EOF
'ThisEventSlot = 0
EventSlotA = ""
EventSlotB = ""
EventSlotC = ""
EventSlotD = ""
EventSlotE = ""
EventSlotF = ""
CanISeeIt = IsEventVisible(RSe("Cal_EventGroupID"))
If CanISeeIt = "TRUE" then
If RSe("Cal_EventAllDay") <> "TRUE" then
StartTimeMin = DateDiff("n", "12:00am", RSe("Cal_EventStartTime"))
EndTimeMin = DateDiff("n", "12:00am", RSe("Cal_EventEndTime"))
StartTimeMin = StartTimeMin / 15
EndTimeMin = EndTimeMin / 15
'----- Check and Fill A Time Slot ------------------
For E = StartTimeMin + 1 to EndTimeMin
If EventArrayA(E) <> 0 then
EventSlotA = "NO"
End If
Next
If EventSlotA = "" then
For E = StartTimeMin + 1 to EndTimeMin
EventArrayA(E) = EventArrayA(E) + 1
Next
End If
If RSe("Cal_EventID") = EventID and EventSlotA = "" and ThisEventSlot = 0 then
ThisEventSlot = "1"
End If
If EventSlotA = "NO" then
For E = StartTimeMin + 1 to EndTimeMin
If EventArrayB(E) <> 0 then
EventSlotB = "NO"
End If
Next
If EventSlotB = "" then
For E = StartTimeMin + 1 to EndTimeMin
EventArrayB(E) = EventArrayB(E) + 1
Next
End If
If RSe("Cal_EventID") = EventID and EventSlotB = "" and ThisEventSlot = 0 then
ThisEventSlot = "2"
End If
End If
If EventSlotA = "NO" and EventSlotB = "NO" then
For E = StartTimeMin + 1 to EndTimeMin
If EventArrayC(E) > 0 then
EventSlotC = "NO"
End If
Next
If EventSlotC = "" then
For E = StartTimeMin + 1 to EndTimeMin
EventArrayC(E) = EventArrayC(E) + 1
Next
End If
If RSe("Cal_EventID") = EventID and EventSlotC = "" and ThisEventSlot = 0 then
ThisEventSlot = "3"
End If
End If
If EventSlotA = "NO" and EventSlotB = "NO" and EventSlotC = "NO" then
For E = StartTimeMin + 1 to EndTimeMin
If EventArrayD(E) > 0 then
EventSlotD = "NO"
End If
Next
If EventSlotD = "" then
For E = StartTimeMin + 1 to EndTimeMin
EventArrayD(E) = EventArrayD(E) + 1
Next
End If
If RSe("Cal_EventID") = EventID and EventSlotD = "" and ThisEventSlot = 0 then
ThisEventSlot = "4"
End If
End If
If EventSlotA = "NO" and EventSlotB = "NO" and EventSlotC = "NO" and EventSlotD = "NO" then
For E = StartTimeMin + 1 to EndTimeMin
If EventArraye(E) > 0 then
EventSlotE = "NO"
End If
Next
If EventSlotE = "" then
For E = StartTimeMin + 1 to EndTimeMin
EventArrayE(E) = EventArrayE(E) + 1
Next
End If
If RSe("Cal_EventID") = EventID and EventSlotE = "" and ThisEventSlot = 0 then
ThisEventSlot = "5"
End If
End If
If EventSlotA = "NO" and EventSlotB = "NO" and EventSlotC = "NO" and EventSlotD = "NO" and EventSlotE = "NO" then
For E = StartTimeMin + 1 to EndTimeMin
If EventArraye(E) > 0 then
EventSlotF = "NO"
End If
Next
If EventSlotF = "" then
For E = StartTimeMin + 1 to EndTimeMin
EventArrayF(E) = EventArrayF(E) + 1
Next
End If
If RSe("Cal_EventID") = EventID and EventSlotF = "" and ThisEventSlot = 0 then
ThisEventSlot = "6"
End If
End If
End If
End If
RSe.MoveNext
Loop
EventStartNumber = DateDiff("n", "12:00am", EventStart)
EventStartNumber = EventStartNumber / 15
EventStartNumber = EventStartNumber + 1
'EventBeforeSlot = EventStartNumber - 1
'If EventStartNumber <> 0 then
' EventSlot = EventArray(EventStartNumber)
'Else
' EventSlot = 0
'End If
'If EventSlot = "" then
' EventSlot = 0
'End If
GetTimeSlot = ThisEventSlot
End Function
'*********************************************************************************
'******** Draw Group List ********************************************************
'*********************************************************************************
Sub DrawGroupList
LegendColCounter = 1
FilterGroups = Session("Cal_User_AllGroups")
TempOutput = "
"
If UseSQLServer = "YES" then
SQL = "SELECT * FROM Cal_Group WHERE Cal_Group_ID IN("& FilterGroups &") ORDER BY Cal_Group_Name"
Else
SQL = "SELECT * FROM Cal_Group WHERE Cal_Group_ID IN("& FilterGroups &") ORDER BY Cal_Group_Name"
End If
Set RS=dbc.execute(SQL)
Do While NOT RS.EOF
If RS("Cal_Group_ID") <> 2 then
GroupColor = RS("Cal_Group_Color")
GroupName = RS("Cal_Group_Name")
GroupID = RS("Cal_Group_ID")
Else
GroupColor = Session("Cal_User_EventColor")
GroupName = RS("Cal_Group_Name")
GroupID = RS("Cal_Group_ID")
End If
TempOutput = TempOutput & "
"
TempOutput = Replace(TempOutput, "'", "\'")
%>
function ShowGroupList() {
var tmpStr;
tmpStr = ('<%=TempOutput%>');
document.write(tmpStr);
}
<%
End Sub
'******* Format Time Function 24 or 12 hour **************************************
Function FormatTimeFixOLD(TimeValue, FromArea)
Dim Hour
Dim Minute
Dim ClockTime
If TimeFormatToUse = "12" then
Hour = DatePart("h", TimeValue)
Minute = DatePart("n", TimeValue)
If Minute < 10 then
Minute = "0" & Minute
End If
If cDate(TimeValue) > #11:59am# and cDate(TimeValue) =< #12:59pm# then
If FromArea = "MONTH" then
Clocktime = Hour & ":" & Minute & "PM"
Else
Clocktime = Hour & ":" & Minute & " PM"
End If
Else
If cDate(TimeValue) => #1:00pm# and cDate(TimeValue) =< #11:59pm# then
If FromArea = "MONTH" then
Clocktime = cInt(Hour) - 12 & ":" & Minute & "PM"
Else
Clocktime = cInt(Hour) - 12 & ":" & Minute & " PM"
End If
Else
If cDate(TimeValue) => #12:00am# and cDate(TimeValue) < #1:00am# then
If FromArea = "MONTH" then
Clocktime = cInt(Hour) + 12 & ":" & Minute & "AM"
Else
Clocktime = cInt(Hour) + 12 & ":" & Minute & " AM"
End If
Else
If FromArea = "MONTH" then
Clocktime = Hour & ":" & Minute & "AM"
Else
Clocktime = Hour & ":" & Minute & " AM"
End If
End If
End If
End If
FormatTimeFix = ClockTime
Else
TempTimeValue = left(TimeValue, 5)
FormatTimeFix = TempTimeValue
End If
End Function
'******* Format Time Function ****************************************************
Function FormatTimeOLD(timeValue)
Dim timeReturn
If UseSQLServer = "YES" then
timeReturnAMPM = right(timeValue, 2)
If Len(timeValue) = 6 or Len(timeValue) = 10 then
timeValue = left(timeValue,4)
timeValue = timeValue + timeReturnAMPM
Else
timeValue = left(timeValue,5)
timeValue = timeValue + timeReturnAMPM
End If
FormatTime = timeValue
Else
timeReturnAMPM = right(timeValue, 2)
If Len(timeValue) = 10 then
timeValue = left(timeValue,4)
timeValue = timeValue + timeReturnAMPM
Else
timeValue = left(timeValue,5)
timeValue = timeValue + timeReturnAMPM
End If
FormatTime = timeValue
End If
End Function
'*********************************************************************************
'***** Format Time Function ******************************************************
'*********************************************************************************
Function FormatTime(TimeValue)
If TimeFormatToUse = "12" then
TimeValue = replace(TimeValue," ","")
TimeValue = replace(TimeValue,":","")
TimeValue = replace(TimeValue,".","")
TimeValue = replace(TimeValue,"-","")
TimeValue = replace(TimeValue,"e","")
TimeValue = replace(TimeValue,"E","")
TimeValue = replace(TimeValue,"M","")
TimeValue = replace(TimeValue,"m","")
If NOT ((ucase(right(TimeValue,1))="A") or (ucase(right(TimeValue,1))="P")) then
TimeFormat = "24"
Else
TempAMPM = ucase(right(TimeValue,1) & "M")
End If
TimeLength = len(TimeValue)-1
StripTime = left(TimeValue,TimeLength)
If len(StripTime) > 4 then
StripTime = left(StripTime,len(StripTime)-2)
End If
If len(StripTime) = 3 then
TimePartA = abs(left(StripTime,1))
Else
TimePartA = abs(left(StripTime,2))
TimePartB = abs(left(StripTime,2))
End If
If left(TimePartA, 1) = 0 then
TimePartA = right(TimePartA, len(TimePartA)-1)
End If
TimePartB = right(StripTime,2)
TempTime = TimePartA & ":" & TimePartB & TempAMPM
FormatTime = TempTime
Else
TempTimeValue = left(TimeValue, 5)
FormatTime = TempTimeValue
End If
End Function
'*********************************************************************************
'***** Format Time Fix Function **************************************************
'*********************************************************************************
Function FormatTimeFix(TimeValue, FromArea)
If TimeFormatToUse = "12" then
TimeValue = replace(TimeValue," ","")
TimeValue = replace(TimeValue,":","")
TimeValue = replace(TimeValue,".","")
TimeValue = replace(TimeValue,"-","")
TimeValue = replace(TimeValue,"e","")
TimeValue = replace(TimeValue,"E","")
TimeValue = replace(TimeValue,"M","")
TimeValue = replace(TimeValue,"m","")
If NOT ((ucase(right(TimeValue,1))="A") or (ucase(right(TimeValue,1))="P")) then
TimeFormat = "24"
Else
TempAMPM = ucase(right(TimeValue,1) & "M")
End If
TimeLength = len(TimeValue)-1
StripTime = left(TimeValue,TimeLength)
If len(StripTime) > 4 then
StripTime = left(StripTime,len(StripTime)-2)
End If
If len(StripTime) = 3 then
TimePartA = abs(left(StripTime,1))
Else
TimePartA = abs(left(StripTime,2))
TimePartB = abs(left(StripTime,2))
End If
If left(TimePartA, 1) = "0" then
TimePartA = right(TimePartA, len(TimePartA)-1)
End If
TimePartB = right(StripTime,2)
TempTime = TimePartA & ":" & TimePartB & TempAMPM
FormatTimeFix = TempTime
Else
TempTimeValue = left(TimeValue, 5)
FormatTimeFix = TempTimeValue
End If
End Function
'*********************************************************************************
'******** Draw Print Window ******************************************************
'*********************************************************************************
Sub DrawPrintWindow(theDate)
LightColor = "#EFEFEF"
MidLightColor = "#CFCFCF"
LightMainColor = "#848485"
DarkMainColor = "#525252"
LightLineColor = "#757575"
PrimaryHighlightColor = "#FBE694"
SecondaryHighlightColor = "#EE9515"
%>
Fairton Christian Calendar - Print Calendars
<%
response.write "
"
response.write "
"
response.write "
"
response.write "
Fairton Christian Calendar - Print Calendars Select your printing options...
"
response.write "
"
response.write "
"
response.write "
"
Dim ThisMonthsFirstDay
Dim NextMonthsFirstDay
Dim ThisMonthsLastDay
Dim LastMonthsLastDay
Dim StartDate
Dim Counter
'------- Setup some information about the month -----------------
If Session("DateFormat") = "US" then
ThisMonthsFirstDay = cDate(Month(theDate) & "/1/" & Year(theDate))
Else
ThisMonthsFirstDay = cDate("1/" & Month(theDate) & "/" & Year(theDate))
End If
NextMonthsFirstDay = dateAdd("m",1,ThisMonthsFirstDay)
ThisMonthsLastDay = dateadd("d",-1,NextMonthsFirstDay)
LastMonthsLastDay = dateadd("d",-1,ThisMonthsFirstDay)
StartDate = dateadd("d",1-weekday(ThisMonthsFirstDay),ThisMonthsFirstDay)
SELECT CASE CalendarType
CASE "month"
BeginDate = ThisMonthsFirstDay
EndDate = ThisMonthsLastDay
CASE "week"
WeekDayTitleName = Weekday(theDate, 2)
BeginDate = DateAdd("w", 1-WeekDayTitleName, theDate)
EndDate = DateAdd("d", 6, BeginDate)
CASE "day"
BeginDate = theDate
CASE "eventlisting"
CASE ELSE
END SELECT
response.write "
"
End Sub
'*********************************************************************************
'******** Print Month Calendar ***************************************************
'*********************************************************************************
Sub PrintMonthCalendar(theDate)
%>Fairton Calendar - Print View<%
Dim ThisMonthsFirstDay
Dim NextMonthsFirstDay
Dim ThisMonthsLastDay
Dim LastMonthsLastDay
Dim StartDate
Dim Counter
'------- Setup some information about the month -----------------
If Session("DateFormat") = "US" then
ThisMonthsFirstDay = cDate(Month(theDate) & "/1/" & Year(theDate))
Else
ThisMonthsFirstDay = cDate("1/" & Month(theDate) & "/" & Year(theDate))
End If
NextMonthsFirstDay = dateAdd("m",1,ThisMonthsFirstDay)
ThisMonthsLastDay = dateadd("d",-1,NextMonthsFirstDay)
LastMonthsLastDay = dateadd("d",-1,ThisMonthsFirstDay)
StartDate = dateadd("d",1-weekday(ThisMonthsFirstDay),ThisMonthsFirstDay)
'----- Open a container to hold output -------------------------------------------------
response.write "
"
'------- Draw the beginning of the calendar ----------------------
response.write "
"
response.write "
"
response.write "
" & MonthSundayName & "
"
response.write "
" & MonthMondayName & "
"
response.write "
" & MonthTuesdayName & "
"
response.write "
" & MonthWednesdayName & "
"
response.write "
" & MonthThursdayName & "
"
response.write "
" & MonthFridayName & "
"
response.write "
" & MonthSaturdayName & "
"
response.write "
"
response.write "
"
'-------- Main Calendar Table -------------------------------------
response.write "
"
response.write "
"
'-------- If the first day is not sunday --------------------------
If weekday(ThisMonthsFirstDay) > 1 then
For Counter = day(StartDate) to day(LastMonthsLastDay)
Call PrintOtherMonthDay (Counter)
Next
End if
'-------- Draw normal days after Saturday, start a new row --------
For Counter = 1 to day(ThisMonthsLastDay)
If Session("DateFormat") = "US" then
DateToUse = cDate(Month(theDate) & "/" & Counter & "/" & Year(theDate))
Else
DateToUse = cDate(Counter & "/" & Month(theDate) & "/" & Year(theDate))
End If
Call PrintMonthNormalDay (Counter)
If weekday(DateToUse) = 7 then
response.write "
"
If Counter <> day(ThisMonthsLastDay) then
response.write "
"
End If
End if
Next
'-------- If last day is not saturday -----------------------------
If weekday(ThisMonthsLastDay) < 7 then
For Counter = 1 to 7 - weekday(ThisMonthsLastDay)
Call PrintOtherMonthDay (Counter)
Next
End if
'-------- Draw the last row of the calendar -----------------------
response.write "
"
response.write "
"
'----- Close container to hold output --------------------------------------------------
response.write "
"
'---------------------------------------------------------------------------------------
End Sub
Sub PrintMonthNormalDay(DayNumber) '----------------------------------- Draw a Normal Day
If Session("DateFormat") = "US" then
DateToUse = Month(theDate) & "/" & DayNumber & "/" & Year(theDate)
Else
DateToUse = DayNumber & "/" & Month(theDate) & "/" & Year(theDate)
End If
If Date() = cDate(DateToUse) then
MonthCalDayStyle = "border-style:outset;border-width:1;bborder-color:gray;text-align:left;vertical-align:top;background-color:#CCCCCC;"
Else
MonthCalDayStyle = "border-style:outset;border-width:1;border-color:gray;text-align:left;vertical-align:top;background-color:#FFFFFF;border-collapse:collapse;"
End If
response.write "
"
End Sub
Sub PrintOtherMonthDay(DayNumber) '--------------------------------------- Draw Other Day
response.write "
"
response.write "
"
End Sub
'*********************************************************************************
'******** Print Event Month ******************************************************
'*********************************************************************************
Sub PrintEvent(DateToUse, CalViewType)
If Session("Cal_User_ID") = "" then
GroupArray = GetGroupArray("Cal_Group_Type", "PUBLIC")
If UseSQLServer = "YES" then
SQL = "SELECT * FROM Cal_Events WHERE Cal_EventGroupID IN("& GroupArray &") AND Cal_EventStartDate <= '" & FormatDateFix(DateToUse) & "' AND Cal_EventEndDate >= '" & FormatDateFix(DateToUse) & "' AND Cal_EventStatus = 'APPROVED' ORDER BY Cal_EventStartTime, Cal_EventEndTime"
Else
SQL = "SELECT * FROM Cal_Events WHERE Cal_EventGroupID IN("& GroupArray &") AND Cal_EventStartDate <= #" & FormatDateFix(DateToUse) & "# AND Cal_EventEndDate >= #" & FormatDateFix(DateToUse) & "# AND Cal_EventStatus = 'APPROVED' ORDER BY Cal_EventStartTime, Cal_EventEndTime"
End If
set RS=Server.CreateObject("adodb.Recordset")
RS.Open SQL, dbc, adopenstatic
Else
UserGroupArray1 = Session("Cal_User_NormalGroups")
UserGroupArray2 = Session("Cal_User_AdminGroups")
UserGroupArray = Session("Cal_User_AllGroups")
If UseSQLServer = "YES" then
SQL = "SELECT * FROM Cal_Events WHERE Cal_EventGroupID IN("& UserGroupArray &") AND Cal_EventStartDate <= '" & FormatDateFix(DateToUse) & "' AND Cal_EventEndDate >= '" & FormatDateFix(DateToUse) & "' AND Cal_EventStatus = 'APPROVED' ORDER BY Cal_EventStartTime, Cal_EventEndTime"
Else
SQL = "SELECT * FROM Cal_Events WHERE Cal_EventGroupID IN("& UserGroupArray &") AND Cal_EventStartDate <= #" & FormatDateFix(DateToUse) & "# AND Cal_EventEndDate >= #" & FormatDateFix(DateToUse) & "# AND Cal_EventStatus = 'APPROVED' ORDER BY Cal_EventStartTime, Cal_EventEndTime"
End If
set RS=Server.CreateObject("adodb.Recordset")
RS.Open SQL, dbc, adopenstatic
End If
Do While NOT RS.EOF
If RS("Cal_EventGroupID") = 2 then
If UseSQLServer = "YES" then
SQLc = "SELECT Cal_User_EventColor FROM Cal_User WHERE Cal_User_ID = " & Session("Cal_User_ID")
Else
SQLc = "SELECT Cal_User_EventColor FROM Cal_User WHERE Cal_User_ID = " & Session("Cal_User_ID")
End If
Set RSc=dbc.execute(SQLc)
EventColor = RSc("Cal_User_EventColor")
RSc.Close
Set RSc=Nothing
Else
If UseSQLServer = "YES" then
SQLc = "SELECT Cal_Group_Color, Cal_Group_Icon FROM Cal_Group WHERE Cal_Group_ID = " & RS("Cal_EventGroupID")
Else
SQLc = "SELECT Cal_Group_Color, Cal_Group_Icon FROM Cal_Group WHERE Cal_Group_ID = " & RS("Cal_EventGroupID")
End If
Set RSc=dbc.execute(SQLc)
EventColor = RSc("Cal_Group_Color")
GroupIcon = RSc("Cal_Group_Icon")
RSc.Close
Set RSc=Nothing
End If
If RS("Cal_EventGroupID") <> 2 OR RS("Cal_EventGroupID") = 2 AND RS("Cal_EventUserID") = Session("Cal_User_ID") then
IsVisible = IsEventVisible(RS("Cal_EventGroupID"))
If IsVisible = "TRUE" then
If RS("Cal_EventAllDay") <> "TRUE" then
response.write "
"
response.write "
"
response.write "
"
response.write "
"
response.write "
"
If Session("DateFormat") = "US" then
response.write FormatTime(RS("Cal_EventStartTime"))
Else
TempTime = FormatTime(RS("Cal_EventStartTime"))
response.write FormatTimeFix(TempTime, "MONTH")
End If
response.write "
"
End Sub
'*********************************************************************************
'******** Print Mini Calendar ****************************************************
'*********************************************************************************
Sub PrintMiniCalendar(theDate)
Dim ThisMonthsFirstDay
Dim NextMonthsFirstDay
Dim ThisMonthsLastDay
Dim LastMonthsLastDay
Dim StartDate
Dim Counter
'------- Setup some information about the month -----------------
If Session("DateFormat") = "US" then
ThisMonthsFirstDay = cDate(Month(theDate) & "/1/" & Year(theDate))
Else
ThisMonthsFirstDay = cDate("1/" & Month(theDate) & "/" & Year(theDate))
End If
NextMonthsFirstDay = dateAdd("m",1,ThisMonthsFirstDay)
ThisMonthsLastDay = dateadd("d",-1,NextMonthsFirstDay)
LastMonthsLastDay = dateadd("d",-1,ThisMonthsFirstDay)
StartDate = dateadd("d",1-weekday(ThisMonthsFirstDay),ThisMonthsFirstDay)
'------- Containter for whole mini calendar ----------------------
MiniOutput = "
"
'-------- If the first day is not sunday --------------------------
If weekday(ThisMonthsFirstDay) > 1 then
For Counter = day(StartDate) to day(LastMonthsLastDay)
Call PrintOtherMiniDay (Counter)
Next
End if
'-------- Draw normal days after Saturday, start a new row --------
For Counter = 1 to day(ThisMonthsLastDay)
If Session("DateFormat") = "US" then
DateToUse = cDate(Month(theDate) & "/" & Counter & "/" & Year(theDate))
Else
DateToUse = cDate(Counter & "/" & Month(theDate) & "/" & Year(theDate))
End If
Call PrintMiniNormalDay (Counter, DateToUse)
If weekday(DateToUse) = 7 then
MiniOutput = MiniOutput & "
"
If Counter <> day(ThisMonthsLastDay) then
MiniOutput = MiniOutput & "
"
End If
End if
Next
'-------- If last day is not saturday -----------------------------
If weekday(ThisMonthsLastDay) < 7 then
For Counter = 1 to 7 - weekday(ThisMonthsLastDay)
Call PrintOtherMiniDay (Counter)
Next
End if
'-------- Draw the last row of the calendar -----------------------
MiniOutput = MiniOutput & "
"
MiniOutput = MiniOutput & "
"
'-------- End of Container ----------------------------------------
MiniOutput = MiniOutput & "
"
response.write MiniOutput
End Sub
Sub PrintMiniNormalDay(DayNumber, theDate) '----------------------------------- Draw a Normal Day
If Session("DateFormat") = "US" then
DateToUse = Month(theDate) & "/" & DayNumber & "/" & Year(theDate)
Else
DateToUse = DayNumber & "/" & Month(theDate) & "/" & Year(theDate)
End If
IsThereAnEvent = CheckForEvent(DateToUse)
If IsThereAnEvent = "YES" then
MonthCalDayClass = "TableMiniDayCellWithEvent"
End If
MiniOutput = MiniOutput & "
"
MiniOutput = MiniOutput & ""
If IsThereAnEvent = "YES" then
MiniOutput = MiniOutput & ""
End If
MiniOutput = MiniOutput & DayNumber
If IsThereAnEvent = "YES" then
MiniOutput = MiniOutput & ""
End If
MiniOutput = MiniOutput & ""
MiniOutput = MiniOutput & "
"
End Sub
Sub PrintOtherMiniDay(DayNumber) '--------------------------------------- Draw Other Day
MiniOutput = MiniOutput & "
"
Call PrintAgendaRow("12", "am")
For I = 1 to 11
Call PrintAgendaRow(I,"00")
Next
Call PrintAgendaRow("12", "pm")
For I = 1 to 11
Call PrintAgendaRow(I, "OO")
Next
response.write "
"
Call PrintAgendaRow("00", "00")
For I = 1 to 9
Call PrintAgendaRow("0" & I,"00")
Next
For I = 10 to 23
Call PrintAgendaRow(I,"00")
Next
response.write "
"
Call PrintDayEvent(theDate, "DAY")
End If
response.write "
"
response.write "
"
response.write "
"
'----- Close container to hold output --------------------------------------------------
response.write "
"
'---------------------------------------------------------------------------------------
End Sub
'------ Write Agenda Row --------------------------------------------------------
Sub PrintAgendaRow(TimeToWrite1, TimeToWrite2)
response.write "
"
End Sub
'*********************************************************************************
'******** Print Day Event ********************************************************
'*********************************************************************************
Sub PrintDayEvent(DateToUse, CalViewType)
If Session("Cal_User_ID") = "" then
GroupArray = GetGroupArray("Cal_Group_Type", "PUBLIC")
If UseSQLServer = "YES" then
SQL = "SELECT * FROM Cal_Events WHERE Cal_EventGroupID IN("& GroupArray &") AND Cal_EventStartDate <= '" & FormatDateFix(DateToUse) & "' AND Cal_EventEndDate >= '" & FormatDateFix(DateToUse) & "' AND Cal_EventStatus = 'APPROVED' ORDER BY Cal_EventStartTime, Cal_EventEndTime"
Else
SQL = "SELECT * FROM Cal_Events WHERE Cal_EventGroupID IN("& GroupArray &") AND Cal_EventStartDate <= #" & FormatDateFix(DateToUse) & "# AND Cal_EventEndDate >= #" & FormatDateFix(DateToUse) & "# AND Cal_EventStatus = 'APPROVED' ORDER BY Cal_EventStartTime, Cal_EventEndTime"
End If
set RS=Server.CreateObject("adodb.Recordset")
RS.Open SQL, dbc, adopenstatic
Else
UserGroupArray1 = Session("Cal_User_NormalGroups")
UserGroupArray2 = Session("Cal_User_AdminGroups")
UserGroupArray = Session("Cal_User_AllGroups")
If UseSQLServer = "YES" then
SQL = "SELECT * FROM Cal_Events WHERE Cal_EventGroupID IN("& UserGroupArray &") AND Cal_EventStartDate <= '" & FormatDateFix(DateToUse) & "' AND Cal_EventEndDate >= '" & FormatDateFix(DateToUse) & "' AND Cal_EventStatus = 'APPROVED' ORDER BY Cal_EventStartTime, Cal_EventEndTime"
Else
SQL = "SELECT * FROM Cal_Events WHERE Cal_EventGroupID IN("& UserGroupArray &") AND Cal_EventStartDate <= #" & FormatDateFix(DateToUse) & "# AND Cal_EventEndDate >= #" & FormatDateFix(DateToUse) & "# AND Cal_EventStatus = 'APPROVED' ORDER BY Cal_EventStartTime, Cal_EventEndTime"
End If
set RS=Server.CreateObject("adodb.Recordset")
RS.Open SQL, dbc, adopenstatic
End If
If RS.RecordCount >= 1 then
RS.MoveFirst
EventCounter = 0
End If
Dim SlotArray(20)
AllDayCounter = 0
Do While NOT RS.EOF
If RS("Cal_EventGroupID") <> 2 OR RS("Cal_EventGroupID") = 2 AND RS("Cal_EventUserID") = Session("Cal_User_ID") then
IsVisible = IsEventVisible(RS("Cal_EventGroupID"))
If IsVisible = "TRUE" then
If RS("Cal_EventAllDay") <> "TRUE" then
EventTimeSlot = GetTimeSlot(DateToUse, RS("Cal_EventStartTime"), RS("Cal_EventID"))
If Session("CascadeEvents") = "YES" then
If EventCounter > 0 then
If RS.RecordCount <= 4 then
AddtoLeft = 110
Else
AddtoLeft = (CascadeWidth / RS.RecordCount) + 5
End If
EventLeft = EventLeft + AddtoLeft
Else
EventLeft = 80
End If
If RS.RecordCount <= 4 then
EventWidth = 100
Else
EventWidth = (CascadeWidth / RS.RecordCount)
End If
Else
'----- Stacked Events ---------------------------
EventWidth = 130
AddtoLeft = 140 * EventTimeSlot - 140
EventLeft = AddtoLeft + 65
End If
If Session("DateFormat") = "US" then
StartTime = FormatDateTime(CDate(RS("Cal_EventStartTime")),3)
EndTime = FormatDateTime(CDate(RS("Cal_EventEndTime")),3)
Else
StartTime = FormatDateTime(CDate(RS("Cal_EventStartTime")),3)
EndTime = FormatDateTime(CDate(RS("Cal_EventEndTime")),3)
StartTime = FormatTimeFix(StartTime, "")
EndTime = FormatTimeFix(EndTime, "")
End If
EventHeight = DateDiff("n", StartTime, EndTime)
EventTop = DateDiff("n", "12:00a", StartTime)
EventHeight = (((EventHeight * 16.5) * 2) / 60 + 1)
If EventTop > 720 then
EventTop = ((((EventTop * 16.5) * 2)) / 60) + 189
Else
EventTop = ((((EventTop * 16.5) * 2)) / 60) + 191
End If
If RS("Cal_EventGroupID") = 2 then
If UseSQLServer = "YES" then
SQLc = "SELECT Cal_User_EventColor FROM Cal_User WHERE Cal_User_ID = " & Session("Cal_User_ID")
Else
SQLc = "SELECT Cal_User_EventColor FROM Cal_User WHERE Cal_User_ID = " & Session("Cal_User_ID")
End If
Set RSc=dbc.execute(SQLc)
EventColor = RSc("Cal_User_EventColor")
RSc.Close
Set RSc=Nothing
Else
If UseSQLServer = "YES" then
SQLc = "SELECT Cal_Group_Color FROM Cal_Group WHERE Cal_Group_ID = " & RS("Cal_EventGroupID")
Else
SQLc = "SELECT Cal_Group_Color FROM Cal_Group WHERE Cal_Group_ID = " & RS("Cal_EventGroupID")
End If
Set RSc=dbc.execute(SQLc)
EventColor = RSc("Cal_Group_Color")
RSc.Close
Set RSc=Nothing
End If
response.write "
"
response.write "
"
response.write "
"
response.write "
"
response.write RS("Cal_EventTitle") & "
"
response.write "
"
response.write "
"
EventCounter = EventCounter + 1
Else
EventTop = (AllDayCounter * 11) + 100
EventLeft = 60
If RS("Cal_EventGroupID") = 2 then
If UseSQLServer = "YES" then
SQLc = "SELECT Cal_User_EventColor FROM Cal_User WHERE Cal_User_ID = " & Session("Cal_User_ID")
Else
SQLc = "SELECT Cal_User_EventColor FROM Cal_User WHERE Cal_User_ID = " & Session("Cal_User_ID")
End If
Set RSc=dbc.execute(SQLc)
EventColor = RSc("Cal_User_EventColor")
RSc.Close
Set RSc=Nothing
Else
If UseSQLServer = "YES" then
SQLc = "SELECT Cal_Group_Color FROM Cal_Group WHERE Cal_Group_ID = " & RS("Cal_EventGroupID")
Else
SQLc = "SELECT Cal_Group_Color FROM Cal_Group WHERE Cal_Group_ID = " & RS("Cal_EventGroupID")
End If
Set RSc=dbc.execute(SQLc)
EventColor = RSc("Cal_Group_Color")
RSc.Close
Set RSc=Nothing
End If
response.write "
"
AllDayCounter = AllDayCounter + 1
End If
End If
End If
RS.MoveNext
Loop
End Sub
'*********************************************************************************
'******** Print Event List *******************************************************
'*********************************************************************************
Sub PrintEventList(theDate)
If Session("DateFormat") = "US" then
ThisMonthsFirstDay = cDate(Month(theDate) & "/1/" & Year(theDate))
Else
ThisMonthsFirstDay = cDate("1/" & Month(theDate) & "/" & Year(theDate))
End If
NextMonthsFirstDay = dateAdd("m",1,ThisMonthsFirstDay)
ThisMonthsLastDay = dateadd("d",-1,NextMonthsFirstDay)
LastMonthsLastDay = dateadd("d",-1,ThisMonthsFirstDay)
'StartDate = dateadd("d",1-weekday(ThisMonthsFirstDay),ThisMonthsFirstDay)
If Request.QueryString("date") = "" Then
BeginDateToUse = ThisMonthsFirstDay
Else
BeginDateToUse = Request.QueryString("date")
End If
If Request.QueryString("enddate") = "" Then
EndDateToUse = NextMonthsFirstDay
Else
EndDateToUse = Request.QueryString("enddate")
End If
PageTitle = "Event Listing: " & BeginDateToUse & " - " & EndDateToUse
'----- Open a container to hold output -------------------------------------------------
response.write "
"
'---------------------------------------------------------------------------------------
DateToUse = cdate(BeginDateToUse)
EndDate = cdate(EndDateToUse)
NumOfTimes = DateDiff("d", DateToUse, EndDate)
For I = 1 to NumOfTimes
FinalOutput = ""
TempOutput = ""
FoundEvent = ""
If I > 1 then
DateToUse = DateAdd("d", DateToUse, 1)
End If
If Session("Cal_User_ID") = "" then
GroupArray = GetGroupArray("Cal_Group_Type", "PUBLIC")
If UseSQLServer = "YES" then
SQL = "SELECT * FROM Cal_Events WHERE Cal_EventGroupID IN("& GroupArray &") AND Cal_EventStartDate <= '" & FormatDateFix(DateToUse) & "' AND Cal_EventEndDate >= '" & FormatDateFix(DateToUse) & "' AND Cal_EventStatus = 'APPROVED' ORDER BY Cal_EventStartTime, Cal_EventEndTime"
Else
SQL = "SELECT * FROM Cal_Events WHERE Cal_EventGroupID IN("& GroupArray &") AND Cal_EventStartDate <= #" & FormatDateFix(DateToUse) & "# AND Cal_EventEndDate >= #" & FormatDateFix(DateToUse) & "# AND Cal_EventStatus = 'APPROVED' ORDER BY Cal_EventStartTime, Cal_EventEndTime"
End If
Set RS=dbc.execute(SQL)
Else
UserGroupArray1 = Session("Cal_User_NormalGroups")
UserGroupArray2 = Session("Cal_User_AdminGroups")
UserGroupArray = Session("Cal_User_AllGroups")
If UseSQLServer = "YES" then
SQL = "SELECT * FROM Cal_Events WHERE Cal_EventGroupID IN("& UserGroupArray &") AND Cal_EventStartDate <= '" & FormatDateFix(DateToUse) & "' AND Cal_EventEndDate >= '" & FormatDateFix(DateToUse) & "' AND Cal_EventStatus = 'APPROVED' ORDER BY Cal_EventStartTime, Cal_EventEndTime"
Else
SQL = "SELECT * FROM Cal_Events WHERE Cal_EventGroupID IN("& UserGroupArray &") AND Cal_EventStartDate <= #" & FormatDateFix(DateToUse) & "# AND Cal_EventEndDate >= #" & FormatDateFix(DateToUse) & "# AND Cal_EventStatus = 'APPROVED' ORDER BY Cal_EventStartTime, Cal_EventEndTime"
End If
Set RS=dbc.execute(SQL)
End If
Do While NOT RS.EOF
If RS("Cal_EventGroupID") = 2 then
If UseSQLServer = "YES" then
SQLc = "SELECT Cal_User_EventColor FROM Cal_User WHERE Cal_User_ID = " & Session("Cal_User_ID")
Else
SQLc = "SELECT Cal_User_EventColor FROM Cal_User WHERE Cal_User_ID = " & Session("Cal_User_ID")
End If
Set RSc=dbc.execute(SQLc)
EventColor = RSc("Cal_User_EventColor")
RSc.Close
Set RSc=Nothing
Else
If UseSQLServer = "YES" then
SQLc = "SELECT Cal_Group_Color FROM Cal_Group WHERE Cal_Group_ID = " & RS("Cal_EventGroupID")
Else
SQLc = "SELECT Cal_Group_Color FROM Cal_Group WHERE Cal_Group_ID = " & RS("Cal_EventGroupID")
End If
Set RSc=dbc.execute(SQLc)
EventColor = RSc("Cal_Group_Color")
RSc.Close
Set RSc=Nothing
End If
If RS("Cal_EventGroupID") <> 2 OR RS("Cal_EventGroupID") = 2 AND RS("Cal_EventUserID") = Session("Cal_User_ID") then
IsVisible = IsEventVisible(RS("Cal_EventGroupID"))
If IsVisible = "TRUE" then
FoundEvent = "YES"
TempOutput = "
"
FinalOutput = FinalOutput & TempOutput
End If
End If
RS.MoveNext
Loop
If FoundEvent = "YES" then
DayTitle = "
"
DayTitle = DayTitle & "
" & FormatDateTime(DateToUse,1) & "
"
response.write DayTitle & FinalOutput
End If
Next
'----- Close container to hold output --------------------------------------------------
response.write "
"
'---------------------------------------------------------------------------------------
End Sub
'*********************************************************************************
'******** Determine Browser Type *************************************************
'*********************************************************************************
Function GetBrowserType(BrowserAgent)
If InStr(BrowserAgent, UCASE("MSIE")) then
Browser = "Microsoft Internet Explorer"
Else
Browser = "OTHER"
End If
GetBrowserType = Browser
End Function
'----------------------------------------------------------------
'----- SQL Injection Filter -------------------------------------
'----------------------------------------------------------------
Function SafeSQL(sInput)
TempString = sInput
'sBadChars=array("select", "drop", ";", "--", "insert", "delete", "xp_", "#", "%", "&", "'", "(", ")", "/", "\", ":", ";", "<", ">", "=", "[", "]", "?", "`", "|")
sBadChars=array("select", "drop", ";", "--", "insert", "delete", "xp_", "#", "%", "&", "'", "(", ")", ":", ";", "<", ">", "=", "[", "]", "?", "`", "|")
For iCounter = 0 to uBound(sBadChars)
TempString = replace(TempString,sBadChars(iCounter),"")
Next
SafeSQL = TempString
End function
%>