home *** CD-ROM | disk | FTP | other *** search
/ bombers.k12.ar.us / bombers.k12.ar.us.tar / bombers.k12.ar.us / caltest / calendar.asp < prev    next >
Text File  |  2014-02-12  |  144KB  |  2,976 lines

  1. <%@ Language=VBScript %>
  2. <% Response.Buffer = True %>
  3. <% Server.ScriptTimeout = 1000 %>
  4. <%
  5. '_________________________________________________________________________________
  6. '---------------------------------------------------------------------------------
  7.   ' Script Name   : aspWebCalendar FREE - Entire Script
  8.   ' File Name     : calendar.asp
  9.   ' Version       : 1.1
  10.   ' Creation Date : 4/10/2006
  11.   ' Last Update   : 3/25/2007
  12.   ' Copyright      : ⌐ 2002 - 2007 Full Revolution, Inc.
  13. '_________________________________________________________________________________
  14. '---------------------------------------------------------------------------------
  15.   
  16. '*********************************************************************************
  17. '******** Page Opening Code ******************************************************
  18. '*********************************************************************************
  19.  
  20. %>
  21. <!--#include file="calendar/adovbs.asp" -->
  22. <!--#include file="calendar/db.asp" -->
  23. <%
  24.  
  25. '*********************************************************************************
  26. '******** Javascripts ************************************************************
  27. '*********************************************************************************
  28.  
  29. %>
  30. <SCRIPT type="text/javascript">
  31. var win= null;
  32. function NewWindow(mypage,myname,w,h,scroll){
  33.   var winl = (screen.width-w)/2;
  34.   var wint = (screen.height-h)/2;
  35.   var settings  ='height='+h+',';
  36.       settings +='width='+w+',';
  37.       settings +='top='+wint+',';
  38.       settings +='left='+winl+',';
  39.       settings +='scrollbars='+scroll+',';
  40.       settings +='resizable=yes';
  41.   win=window.open(mypage,myname,settings);
  42.   if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
  43. }
  44. </SCRIPT>
  45. <%
  46.  
  47. '*********************************************************************************
  48. '******** Determine the Browser Type *********************************************
  49. '*********************************************************************************
  50.  
  51. ClientBrowser = GetBrowserType(request.ServerVariables("HTTP_USER_AGENT"))
  52.  
  53. '*********************************************************************************
  54. '******** Required Variables *****************************************************
  55. '*********************************************************************************
  56.  
  57. If Session("ConfigLoaded") = "" or Session("ConfigLoaded") = "NO" then
  58.  
  59.   SQL = "SELECT * FROM Cal_Config WHERE Cal_ConfigID = 1"
  60.   Set RS=dbc.execute(SQL)
  61.   
  62.   Session("ScriptTitle") = RS("Cal_ConfigScriptTitle")
  63.   Session("DefaultColorScheme") = RS("Cal_ConfigDefaultColorScheme")
  64.   Session("ImageFolder") = RS("Cal_ConfigImageFolder")
  65.   Session("DateFormat") = RS("Cal_ConfigDateFormat")
  66.   Session("HTMLTemplate") = RS("Cal_ConfigHTMLTemplate")
  67.   Session("MainFontFace") = RS("Cal_ConfigMainFontFace")
  68.   Session("TimeFormatToUse") = RS("Cal_ConfigTimeFormatToUse")
  69.   Session("MonthBlockHeight") = RS("Cal_ConfigMonthBlockHeight")
  70.   Session("MiniCalendarWidth") = RS("Cal_ConfigMiniCalendarWidth")
  71.   Session("DefaultView") = RS("Cal_ConfigDefaultView")
  72.   Session("LCID") = RS("Cal_ConfigLCID")
  73.   Session("ConfigLoaded") = "YES"
  74.   
  75.   SQLc = "SELECT * FROM Cal_ColorSchemes WHERE ColorSchemeID = " & RS("Cal_ConfigDefaultColorScheme")
  76.   Set RSc=dbc.execute(SQLc)
  77.     Session("LightColor") = RSc("LightColor")
  78.     Session("MidLightColor") = RSc("MidLightColor")
  79.     Session("LightMainColor") = RSc("LightMainColor")
  80.     Session("DarkMainColor") = RSc("DarkMainColor")
  81.     Session("LightLineColor") = RSc("LightLineColor")
  82.     Session("PrimaryHighlightColor") = RSc("PrimaryHighlightColor")
  83.     Session("SecondaryHighlightColor") = RSc("SecondaryHighlightColor")
  84.   RSc.Close
  85.   Set RSc=Nothing
  86.   
  87.   RS.Close
  88.   Set RS=Nothing
  89.   
  90. End If
  91.  
  92. ScriptTitle = Session("ScriptTitle")
  93. DefaultColorScheme = Session("DefaultColorScheme")
  94. ImageFolder = Session("ImageFolder")
  95. DateFormat = Session("DateFormat")
  96. HTMLTemplate = Session("HTMLTemplate")
  97. MainFontFace = Session("MainFontFace")
  98. TimeFormatToUse = Session("TimeFormatToUse")
  99. MonthBlockHeight = Session("MonthBlockHeight")
  100. MiniCalendarWidth = Session("MiniCalendarWidth")
  101. DefaultView = Session("DefaultView")
  102. LCID = Session("LCID")
  103.  
  104. LightColor = Session("LightColor")
  105. MidLightColor = Session("MidLightColor")
  106. LightMainColor = Session("LightMainColor")
  107. DarkMainColor = Session("DarkMainColor")
  108. LightLineColor = Session("LightLineColor")
  109. PrimaryHighlightColor = Session("PrimaryHighlightColor")
  110. SecondaryHighlightColor = Session("SecondaryHighlightColor")
  111.  
  112.  
  113. MiniCalendarHeight = 1
  114. Session.LCID = LCID
  115. MonthSundayName = WeekDayName(1)
  116. MonthMondayName = WeekDayName(2)
  117. MonthTuesdayName = WeekDayName(3)
  118. MonthWednesdayName = WeekDayName(4)
  119. MonthThursdayName = WeekDayName(5)
  120. MonthFridayName = WeekDayName(6)
  121. MonthSaturdayName = WeekDayName(7)
  122.  
  123. MiniSundayName = "S"
  124. MiniMondayName = "M"
  125. MiniTuesdayName = "T"
  126. MiniWednesdayName = "W"
  127. MiniThursdayName = "T"
  128. MiniFridayName = "F"
  129. MiniSaturdayName = "S"
  130.  
  131. '*********************************************************************************
  132. '******** Find Out What We Should Be Doing ***************************************
  133. '*********************************************************************************
  134.  
  135. '----- UNCOMMENT THE IF STATEMENT WHEN DONE! -------------------------------------
  136. 'If Session("TemplateLoaded") <> "YES" then
  137.   Call LoadTemplate
  138. 'End If
  139.  
  140. If request.form("txtCalSelector") <> "" then
  141.   Session("CalendarFilter") = request.form("txtCalSelector")
  142. End If
  143. If Session("CalendarFilter") = "" then
  144.   Session("CalendarFilter") = 0
  145. End If
  146. If request.querystring("calendar") <> "" then
  147.   Session("CalendarFilter") = request.querystring("calendar")
  148. End If
  149. Session("CalendarFilter") = cint(Session("CalendarFilter"))
  150.  
  151. If request.querystring("date") <> "" then
  152.   WorkingDate = UniversalDate(request.querystring("date"))
  153. Else
  154.   WorkingDate = UniversalDate(Date())
  155. End If
  156.  
  157. ScriptAction = request.querystring("action")
  158.  
  159. If ScriptAction = "" then
  160.   ScriptAction = DefaultView
  161. End If
  162.  
  163. SELECT CASE ScriptAction
  164.   CASE "month"
  165.     response.write Session("PageHeader")
  166.     CalType = "month"
  167.     Call DrawHeaderBar
  168.     Call DrawMonthView
  169.     response.write Session("PageFooter")
  170.   CASE "day"
  171.     response.write Session("PageHeader")
  172.     CalType = "day"
  173.     Call DrawHeaderBar
  174.     Call DrawDayView
  175.     response.write Session("PageFooter")
  176.   CASE "week"
  177.     response.write Session("PageHeader")
  178.     CalType = "week"
  179.     Call DrawHeaderBar
  180.     Call DrawWeekView
  181.     response.write Session("PageFooter")
  182.   CASE "year"
  183.     response.write Session("PageHeader")
  184.     CalType = "year"
  185.     Call DrawHeaderBar
  186.     Call DrawYearView
  187.     response.write Session("PageFooter")
  188.   CASE "viewevent"
  189.     response.write Session("PageHeader")
  190.     CalType = "day"
  191.     Call DrawHeaderBar
  192.     Call DrawViewEvent
  193.     response.write Session("PageFooter")
  194.   CASE "login"
  195.     Call DrawLogin
  196.   CASE "processlogin"
  197.     Call ProcessLogin
  198.   CASE "logoff"
  199.     Call LogOff
  200.   CASE "modifyconfig"
  201.     Call EditConfig
  202.  
  203.   CASE "addevent"
  204.     Call DrawAddEvent
  205.   CASE "editevent"
  206.     Call DrawEditEvent
  207.   CASE "deleteevent"
  208.     Call DeleteEvent
  209.  
  210.   CASE "managecalendars"
  211.     Call ManageCalendars
  212.   CASE "editcalendar"
  213.     Call ManageCalendars
  214.   CASE "deletecalendar"
  215.     Call DeleteCalendar
  216.     
  217.   CASE "managecolorschemes"
  218.     Call ManageColorSchemes
  219.   CASE "editcolorscheme"
  220.     Call ManageColorSchemes
  221.   CASE "deletecolorscheme"
  222.     Call DeleteColorScheme
  223.  
  224.   CASE "securitycheck"
  225.     Call SecurityCheck
  226.   CASE "summary"
  227.     Call DrawSummary
  228.   CASE "summary2"
  229.     Call DrawSummary2
  230.   CASE "dbaddrecord"
  231.     Call DBAddRecord
  232.   CASE "dbupdaterecord"
  233.     Call DBUpdateRecord
  234.   CASE ELSE
  235. END SELECT
  236.  
  237. '---------------------------------------------------------------------------------
  238. '-- In order to use this software for FREE this line must NOT be removed! --------
  239. '-- removing this line is a violation of the license agreement -------------------
  240. response.write "<center><FONT STYLE='font-family:Tahoma;font-size:7pt'>Powered By: <strong>aspWebCalendar</strong> from <em><A HREF='http://www.fullrevolution.com' TARGET='_blank'>Full Revolution, Inc.</A></em></FONT></center>"
  241. '---------------------------------------------------------------------------------
  242.  
  243. dbc.close
  244. Set dbc=Nothing
  245.  
  246. '*********************************************************************************
  247.  
  248. '*********************************************************************************
  249. '***** Draw Login Screen *********************************************************
  250. '*********************************************************************************
  251.  
  252. Sub DrawLogin
  253.  
  254.   Session.Abandon
  255.   Call BuildStyles
  256.   response.write "<HTML>"
  257.   response.write "<HEAD>"
  258.   response.write "<TITLE>" & ScriptTitle & " - Login</TITLE>"
  259.   response.write "<STYLE>"
  260.   response.write Session("StyleCode")
  261.   response.write "</STYLE>"
  262.   response.write "</HEAD>"
  263.   response.write "<BODY CLASS='PageBody' TOPMARGIN=0 LEFTMARGIN=0>"
  264.   '-------------------------------------------------------------------------
  265.   response.write "<TABLE WIDTH='100%' HEIGHT='100%' CELLPADDING=0 CELLSPACING=0 ALIGN=CENTER><TR><TD VALIGN=CENTER>"  
  266.   response.write "<TABLE WIDTH='550' HEIGHT='400' BGCOLOR='white' STYLE='border:1px solid black;' CELLPADDING=0 CELLSPACING=0 ALIGN=CENTER><TR><TD VALIGN=CENTER>"
  267.   response.write "<TABLE CELLPADDING=0 CELLSPACING=0 HEIGHT='100%'>"
  268.   response.write "<TR>"
  269.   response.write "<TD CLASS='SideBar' HEIGHT='100%' WIDTH=75>"
  270.   response.write "</TD>"
  271.   response.write "<TD HEIGHT='100%' WIDTH=15>"
  272.   response.write "</TD>"
  273.   response.write "<TD WIDTH=460 VALIGN=TOP>"
  274.   response.write "<TABLE CLASS='EditPaneTable' CELLPADDING=4 CELLSPACING=0>"
  275.   response.write "<TR><TD CLASS='EditPaneLeft'> </TD>"
  276.   response.write "<TD ALIGN=RIGHT CLASS='EditPaneRight'><A HREF='http://www.fullrevolution.com' TARGET='_blank'><IMG BORDER=0 SRC='" & ImageFolder & "login_FR.gif'></A></TD></TR>" 
  277.   response.write "</TABLE>"
  278.  
  279.   response.write "<BR><BR><BR><BR>"
  280.   response.write "<IMG BORDER=0 SRC='" & ImageFolder & "logintitle.gif'><HR SIZE=1 BLACK>"
  281.   response.write "<BR>"
  282.   response.write "<FORM STYLE='margin-bottom:0px;' METHOD=POST ACTION='calendar.asp?action=processlogin'>"
  283.   response.write "<TABLE CLASS='EditPaneTable' CELLPADDING=4 CELLSPACING=0>"
  284.   response.write "<TR><TD CLASS='EditPaneLeft'>Password:</TD>"
  285.   response.write "<TD CLASS='EditPaneRight'><INPUT TYPE=PASSWORD CLASS='StandardTextBox' NAME='txtPassword'></TD></TR>"
  286.   response.write "<TR><TD CLASS='EditPaneLeft'> </TD>"
  287.   response.write "<TD ALIGN=RIGHT CLASS='EditPaneRight'><INPUT TYPE=SUBMIT CLASS='StandardTextBox' VALUE='LogOn' STYLE='width:100px;'></TD></TR>"
  288.   response.write "</TABLE>"
  289.   response.write "</FORM>"
  290.  
  291.   If request.querystring("error") = "wrongpassword" then
  292.     response.write "<FONT CLASS='ErrorFont'>Sorry the password you have entered is not correct.</FONT>"
  293.   End If
  294.  
  295.   response.write "</TD>"
  296.   response.write "</TR>"
  297.   response.write "</TD></TR></TABLE>"
  298.   response.write "</TD></TR></TABLE>"
  299.   response.write "</BODY></HTML>"
  300.  
  301. End Sub
  302.  
  303. '*********************************************************************************
  304. '***** Draw Add Event Screen *****************************************************
  305. '*********************************************************************************
  306.  
  307. Sub DrawAddEvent
  308.  
  309.   If Session("Cal_UserID") = "" then
  310.     response.redirect "calendar.asp?action=securitycheck"
  311.   End If
  312.   
  313.   Call BuildStyles
  314.   response.write "<HTML>"
  315.   response.write "<HEAD>"
  316.   response.write "<TITLE>" & ScriptTitle & " - Add An Event</TITLE>"
  317.   response.write "<STYLE>"
  318.   response.write Session("StyleCode")
  319.   response.write "</STYLE>"
  320.   %>
  321.   <SCRIPT LANGUAGE=JAVASCRIPT>
  322.   function goValidate(){
  323.     document.all.colCal_EventBody.value = document.all.divCal_EventBody.innerHTML;
  324.     if (Date.parse(document.all.adminform.colCal_EventDate.value) == "") {
  325.       alert("Your must enter an EVENT DATE");
  326.       return false;
  327.       document.all.adminform.colCal_EventDate.focus();
  328.     }
  329.     if (document.all.adminform.colCal_EventTitle.value == "" ) {
  330.       alert("You must enter and EVENT TITLE");
  331.       return false;
  332.     }
  333.     if (document.all.adminform.colCal_EventBody.value == "" ) {
  334.       alert("You must enter and EVENT DESCRIPTION");
  335.       return false;
  336.     }
  337.     if (document.all.adminform.colCal_EventAllDay.checked == "") {
  338.       StartTime = document.all.adminform.colCal_EventDate.value + " " + document.all.adminform.colCal_EventStartTime.value
  339.       EndTime = document.all.adminform.colCal_EventDate.value + " " + document.all.adminform.colCal_EventEndTime.value
  340.       StartTime = new Date(StartTime)
  341.       EndTime = new Date(EndTime)
  342.       if (Date.parse(StartTime) > Date.parse(EndTime)) {
  343.         alert("You END TIME cannot be before you START TIME");
  344.        return false;
  345.        }
  346.     }
  347.  
  348.     return true;
  349.   }
  350.   function checkedAllDay(){
  351.    if (document.all.adminform.colCal_EventAllDay.checked == true) {
  352.     document.all.colCal_EventStartTime.disabled=true;
  353.     document.all.colCal_EventEndTime.disabled=true;
  354.    }
  355.    if (document.all.adminform.colCal_EventAllDay.checked == false) {
  356.     document.all.colCal_EventStartTime.disabled=false;
  357.     document.all.colCal_EventEndTime.disabled=false;
  358.    }
  359.   }
  360.   // -->
  361.   </SCRIPT>
  362.   <%
  363.   response.write "<script language=""javascript"" src=""calendar/datepicker/popcalendar.js""></script>"
  364.   response.write "</HEAD>"
  365.   response.write "<BODY CLASS='PageBody' TOPMARGIN=0 LEFTMARGIN=0>"
  366.   '-------------------------------------------------------------------------
  367.   response.write "<TABLE WIDTH='100%' HEIGHT='100%' CELLPADDING=0 CELLSPACING=0 ALIGN=CENTER><TR><TD VALIGN=CENTER>"  
  368.   response.write "<TABLE WIDTH='95%' HEIGHT='520' BGCOLOR='white' STYLE='border:1px solid black;' CELLPADDING=0 CELLSPACING=0 ALIGN=CENTER><TR><TD VALIGN=TOP>"
  369.  
  370.   Call DrawTitle2("100%","24","Add An Event","11pt")
  371.   response.write "<FORM NAME='adminform' STYLE='margin-bottom:0px;' METHOD=POST ACTION='calendar.asp?action=dbaddrecord' onSubmit='return goValidate();'>"
  372.   response.write "<INPUT TYPE=HIDDEN NAME='TableName' VALUE='Cal_Events'>"
  373.   response.write "<INPUT TYPE=HIDDEN NAME='RedirURL' VALUE='calendar.asp?action=summary&from=addevent'>"
  374.   response.write "<INPUT TYPE=HIDDEN NAME='from' VALUE='addevent'>"
  375.   
  376.   
  377.   response.write "<TABLE CLASS='EditPaneTable' CELLPADDING=4 CELLSPACING=0>"
  378.   response.write "<TR><TD CLASS='EditPaneLeft'>Event Title:</TD>"
  379.   response.write "<TD CLASS='EditPaneRight'><INPUT TYPE=TEXT CLASS='StandardTextBox' NAME='colCal_EventTitle'></TD></TR>"
  380.  
  381.   response.write "<TR><TD CLASS='EditPaneLeft'>Event Description:</TD>"
  382.   response.write "<TD CLASS='EditPaneRight'>"
  383.   response.write "<TEXTAREA NAME='colCal_EventBody' ROWS=5 CLASS='StandardTextBox' STYLE='display:none;'></TEXTAREA>"
  384.   response.write "<DIV ID='divCal_EventBody' NAME='divCal_EventBody' CONTENTEDITABLE STYLE='font-family:" & MainFontFace & ";font-size:8pt;overflow-x:none; overflow-y:scroll; height:70; background-color:white; width:100%; border:1px solid #AAAAAA'></DIV>"
  385.   response.write "</TD></TR>"
  386.  
  387.   response.write "<TR><TD CLASS='EditPaneLeft'>Event Date:</TD>"
  388.   response.write "<TD CLASS='EditPaneRight'><INPUT TYPE=TEXT CLASS='StandardTextBox' NAME='colCal_EventDate' STYLE='width:100px' VALUE='" & Date() & "'> "
  389.   If Session("DateFormat") = "US" then
  390.     response.write "<IMG SRC='" & ImageFolder & "datepicker.gif' VALUE=PICK onClick=""popUpCalendar(this, colCal_EventDate, 'mm/dd/yyyy')"">"
  391.   Else
  392.     response.write "<IMG SRC='" & ImageFolder & "datepicker.gif' VALUE=PICK onClick=""popUpCalendar(this, colCal_EventDate, 'dd/mm/yyyy')"">"
  393.   End If
  394.   response.write "</TD></TR>"
  395.   
  396.   response.write "<TR><TD CLASS='EditPaneLeft'> </TD>"
  397.   response.write "<TD CLASS='EditPaneRight'><INPUT TYPE=CHECKBOX NAME='colCal_EventAllDay' VALUE='YES' onclick='checkedAllDay();'> All Day Event</TD></TR>"
  398.   
  399.   response.write "<TR><TD CLASS='EditPaneLeft'>Event Start Time:</TD>"
  400.   response.write "<TD CLASS='EditPaneRight'>"
  401.  
  402.   response.write "<SELECT CLASS='StandardTextBox' NAME='colCal_EventStartTime' STYLE='width:80px;'>"
  403.   If TimeFormatToUse = "12" then
  404.     response.write "<OPTION VALUE='12:15 AM'>12:15 AM</OPTION>"
  405.     response.write "<OPTION VALUE='12:30 AM'>12:30 AM</OPTION>"
  406.     response.write "<OPTION VALUE='12:45 AM'>12:45 AM</OPTION>"
  407.     For I = 1 to 12
  408.       Call CreateTimeDropDown(I,"AM", "Start")
  409.     Next
  410.     For I = 1 to 12
  411.       Call CreateTimeDropDown(I,"PM", "Start")
  412.     Next
  413.   Else
  414.     response.write "<OPTION VALUE='12:15 AM'>00:15</OPTION>"
  415.     response.write "<OPTION VALUE='12:30 AM'>00:30</OPTION>"
  416.     response.write "<OPTION VALUE='12:45 AM'>00:45</OPTION>"
  417.     For I = 1 to 12
  418.       Call CreateTimeDropDown(I,"AM", "Start")
  419.     Next
  420.     For I = 1 to 12
  421.       Call CreateTimeDropDown(I,"PM", "Start")
  422.     Next
  423.   End If
  424.   response.write "</SELECT>"
  425.   response.write "</TD></TR>"
  426.   
  427.   response.write "<TR><TD CLASS='EditPaneLeft'>Event End Time:</TD>"
  428.   response.write "<TD CLASS='EditPaneRight'>"
  429.   
  430.   
  431.   response.write "<SELECT CLASS='StandardTextBox' NAME='colCal_EventEndTime' STYLE='width:80px;'>"
  432.   If TimeFormatToUse = "12" then
  433.     response.write "<OPTION VALUE='12:15 AM'>12:15 AM</OPTION>"
  434.     response.write "<OPTION VALUE='12:30 AM'>12:30 AM</OPTION>"
  435.     response.write "<OPTION VALUE='12:45 AM'>12:45 AM</OPTION>"
  436.     For I = 1 to 12
  437.       Call CreateTimeDropDown(I,"AM", "End")
  438.     Next
  439.     For I = 1 to 12
  440.       Call CreateTimeDropDown(I,"PM", "End")
  441.     Next
  442.   Else
  443.     response.write "<OPTION VALUE='12:15 AM'>00:15</OPTION>"
  444.     response.write "<OPTION VALUE='12:30 AM'>00:30</OPTION>"
  445.     response.write "<OPTION VALUE='12:45 AM'>00:45</OPTION>"
  446.     For I = 1 to 12
  447.       Call CreateTimeDropDown(I,"AM", "End")
  448.     Next
  449.     For I = 1 to 12
  450.       Call CreateTimeDropDown(I,"PM", "End")
  451.     Next
  452.   End If
  453.   response.write "</SELECT>"
  454.   response.write "</TD></TR>"
  455.   
  456.   response.write "<TR><TD CLASS='EditPaneLeft'>Event Calendar:</TD>"
  457.   response.write "<TD CLASS='EditPaneRight'>"
  458.   response.write "<SELECT NAME='colCal_EventCalendarID' STYLE='font-family:" & MainFontFace & ";font-size:8pt;'>"
  459.   SQLc = "SELECT * FROM Cal_Calendars ORDER BY Cal_CalendarName"
  460.   Set RSc=dbc.execute(SQLc)
  461.   Do While NOT RSc.EOF
  462.     response.write "<OPTION VALUE='" & RSc("Cal_CalendarID") & "' STYLE='font-family:Arial;font-size:7pt;color:" & RSc("Cal_CalendarColor") & ";'>"
  463.     response.write "█ "
  464.     response.write RSc("Cal_CalendarName") & "</OPTION>"
  465.     RSc.MoveNext
  466.   Loop
  467.   RSc.Close
  468.   Set RSc=Nothing
  469.   response.write "</SELECT>"
  470.   response.write "</TD></TR>"
  471.   
  472.   'response.write "<TR><TD CLASS='EditPaneLeft'>Event Link:</TD>"
  473.   'response.write "<TD CLASS='EditPaneRight'><INPUT TYPE=TEXT CLASS='StandardTextBox' NAME='colCal_EventLink'></TD></TR>"
  474.   
  475.   response.write "<TR><TD CLASS='EditPaneLeft'>Image:</TD>"
  476.   response.write "<TD CLASS='EditPaneRight'>"
  477.   
  478.   response.write "<DIV NAME='ImageDiv' STYLE='overflow-x:none;overflow-y:scroll;width:100%;height:170px;border:1px solid #AAAAAA;'>"
  479.   Set FSO = CreateObject("Scripting.FileSystemObject")
  480.   Set MainFolder = FSO.GetFolder(Server.MapPath("calendar/images/48"))
  481.   Set ImageFiles = MainFolder.Files
  482.   IconsAcross = 4
  483.   Counter = 0
  484.   response.write "<table width='100%' cellpadding=2 cellspacing=0 border=0>"
  485.   response.write "<tr>"
  486.   For Each X In ImageFiles
  487.     If right(UCASE(X.Name),3) = "JPG" OR right(UCASE(X.Name),3) = "GIF" OR right(UCASE(X.Name),3) = "PNG" then
  488.       If Counter = IconsAcross then
  489.         response.write "</tr>"
  490.         response.write "<tr>"
  491.         Counter = 0
  492.       End If
  493.       response.write "<td valign=center><input type=radio name='colCal_EventImage' value='" & X.Name & "'></td><td valign=center><img src='calendar/images/48/" & X.Name & "' border=0></td>"
  494.       Counter = Counter + 1
  495.     End If
  496.   Next
  497.   response.write "</table>"
  498.   
  499.   response.write "</DIV>"
  500.   response.write "</TD></TR>"
  501.   
  502.   response.write "<TR><TD CLASS='EditPaneLeft'> </TD>"
  503.   response.write "<TD ALIGN=RIGHT CLASS='EditPaneRight'><INPUT TYPE=SUBMIT CLASS='StandardTextBox' VALUE='Add Event' STYLE='width:100px;'></TD></TR>"
  504.   response.write "</TABLE>"
  505.   response.write "</FORM>"
  506.  
  507.   response.write "</TD>"
  508.   response.write "</TR>"
  509.   response.write "</TD></TR></TABLE>"
  510.   response.write "</TD></TR></TABLE>"
  511.   response.write "</BODY></HTML>"
  512.  
  513. End Sub
  514.  
  515. '*********************************************************************************
  516. '***** Draw Edit Event Screen ****************************************************
  517. '*********************************************************************************
  518.  
  519. Sub DrawEditEvent
  520.  
  521.   If Session("Cal_UserID") = "" then
  522.     response.redirect "calendar.asp?action=securitycheck"
  523.   End If
  524.  
  525.   SQL = "SELECT * FROM Cal_Events WHERE Cal_EventID = " & SafeSQL(request.querystring("eventID"))
  526.   Set RS=dbc.execute(SQL)
  527.  
  528.   Call BuildStyles
  529.   response.write "<HTML>"
  530.   response.write "<HEAD>"
  531.   response.write "<TITLE>" & ScriptTitle & " - Edit An Event</TITLE>"
  532.   response.write "<STYLE>"
  533.   response.write Session("StyleCode")
  534.   response.write "</STYLE>"
  535.   %>
  536.   <SCRIPT LANGUAGE=JAVASCRIPT>
  537.   function goValidate(){
  538.     document.all.colCal_EventBody.value = document.all.divCal_EventBody.innerHTML;
  539.     if (Date.parse(document.all.adminform.colCal_EventDate.value) == "") {
  540.       alert("Your must enter an EVENT DATE");
  541.       return false;
  542.       document.all.adminform.colCal_EventDate.focus();
  543.     }
  544.     if (document.all.adminform.colCal_EventTitle.value == "" ) {
  545.       alert("You must enter and EVENT TITLE");
  546.       return false;
  547.     }
  548.     if (document.all.adminform.colCal_EventBody.value == "" ) {
  549.       alert("You must enter and EVENT DESCRIPTION");
  550.       return false;
  551.     }
  552.     if (document.all.adminform.colCal_EventAllDay.checked == "") {
  553.       StartTime = document.all.adminform.colCal_EventDate.value + " " + document.all.adminform.colCal_EventStartTime.value
  554.       EndTime = document.all.adminform.colCal_EventDate.value + " " + document.all.adminform.colCal_EventEndTime.value
  555.       StartTime = new Date(StartTime)
  556.       EndTime = new Date(EndTime)
  557.       if (Date.parse(StartTime) > Date.parse(EndTime)) {
  558.         alert("You END TIME cannot be before you START TIME");
  559.        return false;
  560.        }
  561.     }
  562.  
  563.     return true;
  564.   }
  565.   function checkedAllDay(){
  566.    if (document.all.adminform.colCal_EventAllDay.checked == true) {
  567.     document.all.colCal_EventStartTime.disabled=true;
  568.     document.all.colCal_EventEndTime.disabled=true;
  569.    }
  570.    if (document.all.adminform.colCal_EventAllDay.checked == false) {
  571.     document.all.colCal_EventStartTime.disabled=false;
  572.     document.all.colCal_EventEndTime.disabled=false;
  573.    }
  574.   }
  575.   // -->
  576.   </SCRIPT>
  577.   <%
  578.   response.write "<script language=""javascript"" src=""calendar/datepicker/popcalendar.js""></script>"
  579.   response.write "</HEAD>"
  580.   response.write "<BODY CLASS='PageBody' TOPMARGIN=0 LEFTMARGIN=0>"
  581.   '-------------------------------------------------------------------------
  582.   response.write "<TABLE WIDTH='100%' HEIGHT='100%' CELLPADDING=0 CELLSPACING=0 ALIGN=CENTER><TR><TD VALIGN=CENTER>"  
  583.   response.write "<TABLE WIDTH='95%' HEIGHT='520' BGCOLOR='white' STYLE='border:1px solid black;' CELLPADDING=0 CELLSPACING=0 ALIGN=CENTER><TR><TD VALIGN=TOP>"
  584.  
  585.   Call DrawTitle2("100%","24","Add An Event","11pt")
  586.   response.write "<FORM NAME='adminform' STYLE='margin-bottom:0px;' METHOD=POST ACTION='calendar.asp?action=dbupdaterecord' onSubmit='return goValidate();'>"
  587.   response.write "<INPUT TYPE=HIDDEN NAME='TableName' VALUE='Cal_Events'>"
  588.   response.write "<INPUT TYPE=HIDDEN NAME='RedirURL' VALUE='calendar.asp?action=summary&from=editevent'>"
  589.   response.write "<INPUT TYPE=HIDDEN NAME='from' VALUE='editevent'>"
  590.   response.write "<INPUT TYPE=HIDDEN NAME='TableKey' VALUE='Cal_EventID'>"
  591.   response.write "<INPUT TYPE=HIDDEN NAME='RecordID' VALUE='" & SafeSQL(request.querystring("eventID")) & "'>"
  592.   
  593.   
  594.   response.write "<TABLE CLASS='EditPaneTable' CELLPADDING=4 CELLSPACING=0>"
  595.   response.write "<TR><TD CLASS='EditPaneLeft'>Event Title:</TD>"
  596.   response.write "<TD CLASS='EditPaneRight'><INPUT TYPE=TEXT CLASS='StandardTextBox' NAME='colCal_EventTitle' VALUE=""" & RS("Cal_EventTitle") & """></TD></TR>"
  597.  
  598.   response.write "<TR><TD CLASS='EditPaneLeft'>Event Description:</TD>"
  599.   response.write "<TD CLASS='EditPaneRight'>"
  600.   response.write "<TEXTAREA NAME='colCal_EventBody' ROWS=5 CLASS='StandardTextBox' STYLE='display:none;'>" & RS("Cal_EventBody") & "</TEXTAREA>"
  601.   response.write "<DIV ID='divCal_EventBody' NAME='divCal_EventBody' CONTENTEDITABLE STYLE='font-family:" & MainFontFace & ";font-size:8pt;overflow-x:none; overflow-y:scroll; height:70; background-color:white; width:100%; border:1px solid #AAAAAA'>" & RS("Cal_EventBody") & "</DIV>"
  602.   response.write "</TD></TR>"
  603.  
  604.   response.write "<TR><TD CLASS='EditPaneLeft'>Event Date:</TD>"
  605.   response.write "<TD CLASS='EditPaneRight'><INPUT TYPE=TEXT CLASS='StandardTextBox' NAME='colCal_EventDate' STYLE='width:100px' VALUE=""" & RS("Cal_EventDate") & """> "
  606.   response.write "<IMG SRC='" & ImageFolder & "datepicker.gif' VALUE=PICK onClick=""popUpCalendar(this, colCal_EventDate, 'mm/dd/yyyy')"">"
  607.   response.write "</TD></TR>"
  608.   
  609.   response.write "<TR><TD CLASS='EditPaneLeft'> </TD>"
  610.   response.write "<TD CLASS='EditPaneRight'><INPUT TYPE=CHECKBOX NAME='colCal_EventAllDay' VALUE='YES' onclick='checkedAllDay();'> All Day Event</TD></TR>"
  611.   
  612.   response.write "<TR><TD CLASS='EditPaneLeft'>Event Start Time:</TD>"
  613.   response.write "<TD CLASS='EditPaneRight'>"
  614.  
  615.   response.write "<SELECT CLASS='StandardTextBox' NAME='colCal_EventStartTime' STYLE='width:80px;'>"
  616.   If TimeFormatToUse = "12" then
  617.     response.write "<OPTION VALUE='12:15 AM'>12:15 AM</OPTION>"
  618.     response.write "<OPTION VALUE='12:30 AM'>12:30 AM</OPTION>"
  619.     response.write "<OPTION VALUE='12:45 AM'>12:45 AM</OPTION>"
  620.     For I = 1 to 12
  621.       Call CreateTimeDropDown(I,"AM", "Start")
  622.     Next
  623.     For I = 1 to 12
  624.       Call CreateTimeDropDown(I,"PM", "Start")
  625.     Next
  626.   Else
  627.     response.write "<OPTION VALUE='12:15 AM'>00:15</OPTION>"
  628.     response.write "<OPTION VALUE='12:30 AM'>00:30</OPTION>"
  629.     response.write "<OPTION VALUE='12:45 AM'>00:45</OPTION>"
  630.     For I = 1 to 12
  631.       Call CreateTimeDropDown(I,"AM", "Start")
  632.     Next
  633.     For I = 1 to 12
  634.       Call CreateTimeDropDown(I,"PM", "Start")
  635.     Next
  636.   End If
  637.   response.write "</SELECT>"
  638.   response.write "</TD></TR>"
  639.   
  640.   response.write "<TR><TD CLASS='EditPaneLeft'>Event End Time:</TD>"
  641.   response.write "<TD CLASS='EditPaneRight'>"
  642.   
  643.   
  644.   response.write "<SELECT CLASS='StandardTextBox' NAME='colCal_EventEndTime' STYLE='width:80px;'>"
  645.   If TimeFormatToUse = "12" then
  646.     response.write "<OPTION VALUE='12:15 AM'>12:15 AM</OPTION>"
  647.     response.write "<OPTION VALUE='12:30 AM'>12:30 AM</OPTION>"
  648.     response.write "<OPTION VALUE='12:45 AM'>12:45 AM</OPTION>"
  649.     For I = 1 to 12
  650.       Call CreateTimeDropDown(I,"AM", "End")
  651.     Next
  652.     For I = 1 to 12
  653.       Call CreateTimeDropDown(I,"PM", "End")
  654.     Next
  655.   Else
  656.     response.write "<OPTION VALUE='12:15 AM'>00:15</OPTION>"
  657.     response.write "<OPTION VALUE='12:30 AM'>00:30</OPTION>"
  658.     response.write "<OPTION VALUE='12:45 AM'>00:45</OPTION>"
  659.     For I = 1 to 12
  660.       Call CreateTimeDropDown(I,"AM", "End")
  661.     Next
  662.     For I = 1 to 12
  663.       Call CreateTimeDropDown(I,"PM", "End")
  664.     Next
  665.   End If
  666.   response.write "</SELECT>"
  667.   response.write "</TD></TR>"
  668.   
  669.   response.write "<TR><TD CLASS='EditPaneLeft'>Event Calendar:</TD>"
  670.   response.write "<TD CLASS='EditPaneRight'>"
  671.   response.write "<SELECT NAME='colCal_EventCalendarID' STYLE='font-family:" & MainFontFace & ";font-size:8pt;'>"
  672.   SQLc = "SELECT * FROM Cal_Calendars ORDER BY Cal_CalendarName"
  673.   Set RSc=dbc.execute(SQLc)
  674.   Do While NOT RSc.EOF
  675.     response.write "<OPTION VALUE='" & RSc("Cal_CalendarID") & "' STYLE='font-family:Arial;font-size:7pt;color:" & RSc("Cal_CalendarColor") & ";'"
  676.     If RS("Cal_EventCalendarID") = RSc("Cal_CalendarID") then
  677.       response.write " selected"
  678.     End If
  679.     response.write ">"
  680.     response.write "█ "
  681.     response.write RSc("Cal_CalendarName") & "</OPTION>"
  682.     RSc.MoveNext
  683.   Loop
  684.   RSc.Close
  685.   Set RSc=Nothing
  686.   response.write "</SELECT>"
  687.   response.write "</TD></TR>"
  688.   
  689.   'response.write "<TR><TD CLASS='EditPaneLeft'>Event Link:</TD>"
  690.   'response.write "<TD CLASS='EditPaneRight'><INPUT TYPE=TEXT CLASS='StandardTextBox' NAME='colCal_EventLink'></TD></TR>"
  691.   
  692.   response.write "<TR><TD CLASS='EditPaneLeft'>Image:</TD>"
  693.   response.write "<TD CLASS='EditPaneRight'>"
  694.   
  695.   response.write "<DIV NAME='ImageDiv' STYLE='overflow-x:none;overflow-y:scroll;width:100%;height:170px;border:1px solid #AAAAAA;'>"
  696.   Set FSO = CreateObject("Scripting.FileSystemObject")
  697.   Set MainFolder = FSO.GetFolder(Server.MapPath("calendar/images/48"))
  698.   Set ImageFiles = MainFolder.Files
  699.   IconsAcross = 4
  700.   Counter = 0
  701.   response.write "<table width='100%' cellpadding=2 cellspacing=0 border=0>"
  702.   response.write "<tr>"
  703.   For Each X In ImageFiles
  704.     If right(UCASE(X.Name),3) = "JPG" OR right(UCASE(X.Name),3) = "GIF" OR right(UCASE(X.Name),3) = "PNG" then
  705.       If Counter = IconsAcross then
  706.         response.write "</tr>"
  707.         response.write "<tr>"
  708.         Counter = 0
  709.       End If
  710.       response.write "<td valign=center><input type=radio name='colCal_EventImage' value='" & X.Name & "'"
  711.       If RS("Cal_EventImage") = X.Name then
  712.         response.write " checked"
  713.       End If
  714.       response.write "></td><td valign=center><img src='calendar/images/48/" & X.Name & "' border=0></td>"
  715.       Counter = Counter + 1
  716.     End If
  717.   Next
  718.   response.write "</table>"
  719.   
  720.   response.write "</DIV>"
  721.   response.write "</TD></TR>"
  722.   
  723.   response.write "<TR><TD CLASS='EditPaneLeft'> </TD>"
  724.   response.write "<TD ALIGN=RIGHT CLASS='EditPaneRight'><INPUT TYPE=SUBMIT CLASS='StandardTextBox' VALUE='Save Changes' STYLE='width:100px;'></TD></TR>"
  725.   response.write "</TABLE>"
  726.   response.write "</FORM>"
  727.  
  728.   response.write "</TD>"
  729.   response.write "</TR>"
  730.   response.write "</TD></TR></TABLE>"
  731.   response.write "</TD></TR></TABLE>"
  732.   response.write "</BODY></HTML>"
  733.   
  734.   '----- Fill in some items -----------------------------------------------
  735.   If RS("Cal_EventStartTime") <> "" then
  736.   %>
  737.   <IMG SRC="<%=ImageFolder%>blank.gif" BORDER=0 WIDTH=0 HEIGHT=0 
  738.   onLoad="document.all.colCal_EventStartTime.value='<%=FormatTime2(RS("Cal_EventStartTime"))%>'">
  739.   <IMG SRC="<%=ImageFolder%>blank.gif" BORDER=0 WIDTH=0 HEIGHT=0 
  740.   onLoad="document.all.colCal_EventEndTime.value='<%=FormatTime2(RS("Cal_EventEndTime"))%>'">
  741.   <%
  742.   End If
  743.   If RS("Cal_EventAllDay") = "YES" then
  744.     %>
  745.     <IMG SRC="<%=ImageFolder%>blank.gif" BORDER=0 WIDTH=0 HEIGHT=0 
  746.     onLoad="document.all.colCal_EventAllDay.checked='true'">        
  747.     <IMG SRC="<%=ImageFolder%>blank.gif" BORDER=0 WIDTH=0 HEIGHT=0 
  748.     onLoad="document.all.colCal_EventStartTime.disabled=true; document.all.colCal_EventEndTime.disabled=true">
  749.     <%
  750.   End If
  751.   
  752.   RS.Close
  753.   Set RS=Nothing
  754.   
  755. End Sub
  756.  
  757. '*********************************************************************************
  758. '***** Delete Event **************************************************************
  759. '*********************************************************************************
  760.  
  761. Sub DeleteEvent
  762.  
  763.   If Session("Cal_UserID") = "" then
  764.     response.redirect "calendar.asp?action=securitycheck"
  765.   End If
  766.  
  767.   SQL = "DELETE * FROM Cal_Events WHERE Cal_EventID = " & request.querystring("eventID")
  768.   Set RS=dbc.execute(SQL)
  769.   
  770.   response.redirect "calendar.asp?date=" & request.querystring("date")
  771. End Sub
  772.  
  773. '*********************************************************************************
  774. '***** Process Login *************************************************************
  775. '*********************************************************************************
  776.  
  777. Sub ProcessLogin
  778.  
  779.   SQL = "SELECT * FROM Cal_Config"
  780.   Set RS=dbc.execute(SQL)
  781.   
  782.   If NOT RS.EOF then
  783.     If RS("Cal_ConfigAdminPassword") = request.form("txtPassword") then
  784.       Session("Cal_UserID") = 1
  785.       response.redirect "calendar.asp?action=summary&from=login"
  786.     Else
  787.       response.redirect "calendar.asp?action=login&error=wrongpassword"
  788.     End If
  789.   End If
  790.  
  791. End Sub
  792.  
  793. '*********************************************************************************
  794. '******** Process Logoff *********************************************************
  795. '*********************************************************************************
  796.  
  797. Sub Logoff
  798.  
  799.   Session.Abandon
  800.   response.redirect "calendar.asp"
  801.  
  802. End Sub
  803.  
  804. '*********************************************************************************
  805. '******** Draw Header Bar ********************************************************
  806. '*********************************************************************************
  807.  
  808. Sub DrawHeaderBar
  809.   theDate = WorkingDate
  810.   HeaderText = CalType
  811.   SELECT CASE HeaderText
  812.     CASE "month"
  813.       HeaderInfo = MonthName(Month(theDate)) & " " & Year(theDate)
  814.       If Month(theDate) > 1 then
  815.         PrevMonth = Month(theDate) - 1
  816.         PrevYear = Year(theDate)
  817.       Else
  818.         PrevMonth = 12
  819.         PrevYear = Year(theDate) - 1
  820.       End If  
  821.       If Month(theDate) < 12 then
  822.         NextMonth = Month(theDate) + 1
  823.         NextYear = Year(theDate)
  824.       Else
  825.         NextMonth = 1
  826.         NextYear = Year(theDate) + 1
  827.       End If
  828.       PrevDate = PrevYear & "-" & PrevMonth & "-1"
  829.       NextDate = NextYear & "-" & NextMonth & "-1"
  830.     CASE "day"
  831.       HeaderInfo = FormatDateTime(theDate,1)
  832.       PrevDate = cDate(theDate) - 1
  833.       NextDate = cDate(theDate) + 1
  834.     CASE "week"
  835.       WeekDayTitleName = Weekday(theDate, 1)
  836.       WeekDayTitleName = "Week of " & DateAdd("w", 1-WeekDayTitleName, theDate)
  837.       HeaderInfo = WeekDayTitleName
  838.       PrevDate = DateAdd("ww", -1, theDate)
  839.       NextDate = DateAdd("ww", 1, theDate)
  840.     CASE "year"
  841.       PrevDate = DateAdd("yyyy", -1, theDate)
  842.       NextDate = DateAdd("yyyy", 1, theDate)
  843.       HeaderInfo = "Year View of " & Year(theDate)
  844.     CASE "listing"
  845.       PrevDate = DateAdd("m", -1, theDate)
  846.       NextDate = DateAdd("m", 1, theDate)
  847.       HeaderInfo = MonthName(Month(theDate)) & " " & Year(theDate) & " - " & MonthName(Month(DateAdd("m", 2, theDate))) & " " & Year(DateAdd("m", 2, theDate))
  848.   END SELECT
  849.  
  850.   %>
  851.   <SCRIPT LANGUAGE="JavaScript">
  852.   <!--
  853.   function PrintPage() {
  854.     alert("<%=Sub1Var1%>");
  855.     window.print();
  856.   }
  857.   // -->
  858.   </SCRIPT>
  859.   <%
  860.   
  861.   '---------- New Button Bar --------------------------------------------------------
  862.   response.write "<DIV CLASS='ButtonBar' ALIGN=LEFT>"
  863.   response.write "<TABLE CELLPADDING=0 CELLSPACING=0><TR>"
  864.   
  865.   If ClientBrowser <> "OTHER" then
  866.     Call DrawButton("button_back.gif","Back a Month","","window.location.reload('calendar.asp?date=" & PrevDate & "&action=" & CalType & "');",30)
  867.     Call DrawButton("","",HeaderInfo,"",150)
  868.     Call DrawButton("button_forward.gif","Forward a Month","","window.location.reload('calendar.asp?date=" & NextDate & "&action=" & CalType & "');",30)
  869.     Call DrawButtonSep
  870.     Call DrawButton("button_day.gif","Day View","","window.location.reload('calendar.asp?action=day&date=" & theDate & "');",30)
  871.     Call DrawButton("button_week.gif","Week View","","window.location.reload('calendar.asp?action=week&date=" & theDate & "');",30)  
  872.     Call DrawButton("button_month.gif","Month View","","window.location.reload('calendar.asp?action=month&date=" & theDate & "');",30) 
  873.     Call DrawButton("button_year.gif","Year View","","window.location.reload('calendar.asp?action=year&date=" & theDate & "');",30) 
  874.     Call DrawButton("button_gototoday.gif","Goto Today","","window.location.reload('calendar.asp?action=day&date=" & Date() & "');",30)
  875.     Call DrawButtonSep
  876.     Call DrawCalendarSelector
  877.     Call DrawButtonSep
  878.     If Session("Cal_UserID") = 1 then
  879.       Call DrawButton("button_addevent.gif","Add Event","","NewWindow('calendar.asp?action=addevent&date=" & theDate & "','aspWebCalendarADDEVENT','500','540','no');",30)
  880.     End If
  881.     If Session("Cal_UserID") = "" then
  882.       Call DrawButton("button_logon.gif","Login","","NewWindow('calendar.asp?action=login','aspWebCalendarLOGIN','580','430','no');",30)
  883.     End If
  884.     If Session("Cal_UserID") = 1 Then
  885.       Call DrawButtonSep
  886.       Call DrawButton("button_config.gif","Modify Config","","NewWindow('calendar.asp?action=modifyconfig','aspWebCalendarCONFIG','500','430','no');",30)
  887.       Call DrawButton("button_calendars.gif","Manage Calendars","","NewWindow('calendar.asp?action=managecalendars','aspWebCalendarCALENDARS','500','400','no');",30)
  888.       Call DrawButtonSep
  889.       Call DrawButton("button_logoff.gif","Logoff","","window.location.reload('calendar.asp?action=logoff');",30)    
  890.     End If
  891.   Else
  892.   
  893.     Call DrawBadBrowserButton("button_back.gif","Back a Month","","calendar.asp?date=" & PrevDate & "&action=" & CalType,30)
  894.     Call DrawBadBrowserButton("","",HeaderInfo,"",150)
  895.     Call DrawBadBrowserButton("button_forward.gif","Forward a Month","","calendar.asp?date=" & NextDate & "&action=" & CalType,30)
  896.     Call DrawButtonSep
  897.     Call DrawBadBrowserButton("button_day.gif","Day View","","calendar.asp?action=day&date=" & theDate & "",30)
  898.     Call DrawBadBrowserButton("button_week.gif","Week View","","calendar.asp?action=week&date=" & theDate,30)  
  899.     Call DrawBadBrowserButton("button_month.gif","Month View","","calendar.asp?action=month&date=" & theDate,30) 
  900.     Call DrawBadBrowserButton("button_year.gif","Year View","","calendar.asp?action=year&date=" & theDate,30) 
  901.     Call DrawBadBrowserButton("button_gototoday.gif","Goto Today","","calendar.asp?action=day&date=" & Date() & "",30)
  902.     Call DrawButtonSep
  903.     Call DrawCalendarSelector
  904.     Call DrawButtonSep
  905.     If Session("Cal_UserID") = 1 then
  906.       Call DrawButton("button_addevent.gif","Add Event","","NewWindow('calendar.asp?action=addevent&date=" & theDate & "','aspWebCalendarADDEVENT','500','540','no');",30)
  907.     End If
  908.     If Session("Cal_UserID") = "" then
  909.       Call DrawButton("button_logon.gif","Login","","NewWindow('calendar.asp?action=login','aspWebCalendarLOGIN','580','430','no');",30)
  910.     End If     
  911.   
  912.     If Session("Cal_UserID") = 1 Then
  913.       Call DrawButtonSep
  914.       Call DrawBadBrowserButton("button_config.gif","Modify Config","","NewWindow('calendar.asp?action=modifyconfig','aspWebCalendarCONFIG','500','600','yes');",30)
  915.       Call DrawBadBrowserButton("button_calendars.gif","Manage Calendars","","NewWindow('calendar.asp?action=managecalendars','aspWebCalendarCALENDARS','500','400','no');",30)
  916.       Call DrawButtonSep
  917.       Call DrawBadBrowserButton("button_logoff.gif","Logoff","","calendar.asp?action=logoff",30)
  918.     End If
  919.   End If
  920.   
  921.   response.write "</TD></TR></TABLE>"
  922.   response.write "</DIV>"
  923.   
  924.   '-----------------------------------------------------------------------------------
  925.  
  926. End Sub
  927.  
  928. '*********************************************************************************
  929. '******** Draw Month View ********************************************************
  930. '*********************************************************************************
  931.  
  932. Sub DrawMonthView
  933.  
  934.   '------- Setup some information about the month -----------------
  935.   ThisMonthsFirstDay = Year(WorkingDate) & "-" & Month(WorkingDate) & "-1"
  936.   NextMonthsFirstDay = dateAdd("m",1,ThisMonthsFirstDay)
  937.   ThisMonthsLastDay = dateadd("d",-1,NextMonthsFirstDay)
  938.   LastMonthsLastDay = dateadd("d",-1,ThisMonthsFirstDay)
  939.   StartDate = dateadd("d",1-weekday(ThisMonthsFirstDay),ThisMonthsFirstDay)
  940.   '------- Draw the beginning of the calendar ----------------------
  941.   response.write "<TABLE WIDTH='100%' CLASS='TableMonthHeader' CELLPADDING=1 CELLSPACING=0>"
  942.   response.write "<TR>"
  943.   response.write "<TD CLASS='MonthHeadings'>" & MonthSundayName & "</TD>"
  944.   response.write "<TD CLASS='MonthHeadings'>" & MonthMondayName & "</TD>"
  945.   response.write "<TD CLASS='MonthHeadings'>" & MonthTuesdayName & "</TD>"
  946.   response.write "<TD CLASS='MonthHeadings'>" & MonthWednesdayName & "</TD>"
  947.   response.write "<TD CLASS='MonthHeadings'>" & MonthThursdayName & "</TD>"
  948.   response.write "<TD CLASS='MonthHeadings'>" & MonthFridayName & "</TD>"
  949.   response.write "<TD CLASS='MonthHeadings'>" & MonthSaturdayName & "</TD>"
  950.   response.write "</TR>"
  951.   response.write "</TABLE>"
  952.   '-------- Main Calendar Table -------------------------------------
  953.   response.write "<TABLE WIDTH='100%' CLASS='TableMonthCalendar' CELLPADDING=1 CELLSPACING=0>"
  954.   response.write "<TR>"
  955.   '-------- If the first day is not sunday --------------------------
  956.   If weekday(ThisMonthsFirstDay) > 1 then
  957.     For Counter = day(StartDate) to day(LastMonthsLastDay)
  958.       Call DrawOtherMonthDay(Counter)
  959.     Next
  960.   End If
  961.   '-------- Draw normal days after Saturday, start a new row --------
  962.   For Counter = 1 to day(ThisMonthsLastDay)
  963.     DateToUse = Year(WorkingDate) & "-" & Month(WorkingDate) & "-" & Counter
  964.     Call DrawMonthNormalDay(Counter)
  965.     If weekday(DateToUse) = 7 then
  966.       response.write "</TR>"
  967.       If Counter <> day(ThisMonthsLastDay) then
  968.        response.write "<TR>"
  969.       End If
  970.     End if
  971.   Next
  972.   '-------- If last day is not saturday -----------------------------
  973.   If weekday(ThisMonthsLastDay) < 7 then
  974.      For Counter = 1 to 7 - weekday(ThisMonthsLastDay)
  975.        Call DrawOtherMonthDay(Counter)
  976.      Next
  977.   End If
  978.   '-------- Draw the last row of the calendar -----------------------
  979.   response.write "</TR>"
  980.   response.write "</TABLE>"
  981.   
  982. End Sub
  983.  
  984. Sub DrawMonthNormalDay(DayNumber) '----------------------------------- Draw a Normal Day
  985.   DateToUse = Year(WorkingDate) & "-" & Month(WorkingDate) & "-" & DayNumber
  986.   If Date() = cDate(DateToUse) then
  987.     MonthCalDayClass = "TableMonthDayCellToday"
  988.   Else
  989.     MonthCalDayClass = "TableMonthDayCell"
  990.   End If
  991.   response.write "<TD CLASS='" & MonthCalDayClass & "' WIDTH='14%' HEIGHT='" & MonthBlockHeight & "'>"
  992.   response.write "<TABLE WIDTH='100%' CELLPADDING=0 CELLSPACING=0 BORDER=0 STYLE='border:1px solid white'>"
  993.   response.write "<TR>"
  994.   response.write "<TD CLASS='MonthSubHeadings'>"
  995.   response.write "<A HREF='calendar.asp?action=day&date=" & DateToUse & "'>"
  996.   response.write DayNumber
  997.   response.write "</A>  "
  998.   response.write "</TD>"
  999.   response.write "</TR>"
  1000.   response.write "</TABLE>"
  1001.   'response.write "<DIV CLASS='MonthDayDiv'>"
  1002.   Call WriteEvent(DateToUse, "MONTH")
  1003.   'response.write "</DIV>"
  1004.   response.write "</FONT></TD>"
  1005. End Sub
  1006.  
  1007. Sub DrawOtherMonthDay(DayNumber) '--------------------------------------- Draw Other Day
  1008.  
  1009.   response.write "<TD CLASS='TableMonthOtherDayCell' WIDTH='14%'>"
  1010.   response.write "</TD>"
  1011.  
  1012. End Sub
  1013.  
  1014. '*********************************************************************************
  1015. '******** Write Event ************************************************************
  1016. '*********************************************************************************
  1017.  
  1018. Sub WriteEvent(DateToUse, CalViewType)
  1019.  
  1020.   If Session("CalendarFilter") > 0 then
  1021.     SQL = "SELECT * FROM Cal_Events WHERE Cal_EventCalendarID = "& Session("CalendarFilter") &" AND Cal_EventDate = #" & DateToUse & "# ORDER BY Cal_EventStartTime"
  1022.   Else
  1023.     SQL = "SELECT * FROM Cal_Events WHERE Cal_EventDate = #" & DateToUse & "# ORDER BY Cal_EventStartTime"
  1024.   End If
  1025.   Set RS=Server.CreateObject("adodb.Recordset")
  1026.   RS.Open SQL, dbc, adopenstatic
  1027.  
  1028.   Do While NOT RS.EOF
  1029.     SQLc = "SELECT * FROM Cal_Calendars WHERE Cal_CalendarID = " & RS("Cal_EventCalendarID")
  1030.     Set RSc=dbc.execute(SQLc)
  1031.       EventColor = RSc("Cal_CalendarColor")
  1032.     RSc.Close
  1033.     Set RSc=Nothing
  1034.     If RS("Cal_EventAllDay") <> "YES" then
  1035.       response.write "<TABLE CELLPADDING=3 CELLSPACING=0 WIDTH='100%'><TR><TD WIDTH='100%'>"  
  1036.       response.write "<TABLE CLASS='EventTable'>"
  1037.       response.write "<TR>"
  1038.       response.write "<TD WIDTH='10' BGCOLOR='" & EventColor & "'><FONT CLASS='EventTitleFont'>  </FONT></TD>"
  1039.       response.write "<TD CLASS='EventTimeCell'><FONT CLASS='EventTimeFont'>"
  1040.       response.write FormatTime(RS("Cal_EventStartTime"))
  1041.       response.write "</FONT></TD>"
  1042.       If RS("Cal_EventImage") <> "" then
  1043.         response.write "<TD WIDTH=1>"
  1044.         response.write "<IMG SRC='calendar/images/16/" & RS("Cal_EventImage") & "' border=0 width=16 height=16>"
  1045.         response.write "</TD>"
  1046.       End If
  1047.       response.write "<TD CLASS='EventTitleCell'><FONT CLASS='EventTitleFont'>"
  1048.       response.write "<A HREF='calendar.asp?action=viewevent&eventid=" & RS("Cal_EventID") & "'>"
  1049.       response.write RS("Cal_EventTitle") & "</A>"
  1050.       response.write "</FONT></TD>"
  1051.       response.write "</TR>"
  1052.       response.write "</TABLE>"
  1053.       response.write "</TD></TR></TABLE>"
  1054.     Else
  1055.       response.write "<TABLE CELLPADDING=3 CELLSPACING=0 WIDTH='100%'><TR><TD WIDTH='100%'>"
  1056.       response.write "<TABLE CLASS='EventTable'>"
  1057.       response.write "<TR>"
  1058.       response.write "<TD HEIGHT=4 BGCOLOR='" & EventColor & "' WIDTH='100%'"
  1059.       If RS("Cal_EventImage") <> "" then
  1060.         response.write " colspan=2"
  1061.       End If
  1062.       response.write ">"
  1063.       response.write "<FONT CLASS='EventTitleFont'></FONT>"
  1064.       response.write "</TD>"
  1065.       response.write "</TR>"
  1066.       response.write "<TR>"
  1067.       If RS("Cal_EventImage") <> "" then
  1068.         response.write "<TD WIDTH=1>"
  1069.         response.write "<IMG SRC='calendar/images/16/" & RS("Cal_EventImage") & "' border=0 width=16 height=16>"
  1070.         response.write "</TD>"
  1071.       End If
  1072.       response.write "<TD CLASS='EventTitleCellAllDay' style='text-align:left'><FONT CLASS='EventTitleFont'>"
  1073.       response.write "<A HREF='calendar.asp?action=viewevent&eventid=" & RS("Cal_EventID") & "'>"
  1074.       response.write RS("Cal_EventTitle") & "</A>"
  1075.       response.write "</FONT></TD>"
  1076.       response.write "</TR>"
  1077.       response.write "</TABLE>"
  1078.       response.write "</TD></TR></TABLE>"
  1079.     End If
  1080.     RS.MoveNext
  1081.   Loop
  1082.   RS.Close
  1083.   Set RS=Nothing
  1084.  
  1085. End Sub
  1086.  
  1087. '*********************************************************************************
  1088. '******** Draw Mini Calendar *****************************************************
  1089. '*********************************************************************************
  1090.  
  1091. Sub DrawMiniCalendar(theDate)
  1092.   '------- Setup some information about the month -----------------
  1093.   ThisMonthsFirstDay = Year(theDate) & "-" & Month(theDate) & "-1"
  1094.   NextMonthsFirstDay = dateAdd("m",1,ThisMonthsFirstDay)
  1095.   ThisMonthsLastDay = dateadd("d",-1,NextMonthsFirstDay)
  1096.   LastMonthsLastDay = dateadd("d",-1,ThisMonthsFirstDay)
  1097.   StartDate = dateadd("d",1-weekday(ThisMonthsFirstDay),ThisMonthsFirstDay)
  1098.   '------- Containter for whole mini calendar ----------------------
  1099.   response.write "<TABLE WIDTH='" & MiniCalendarWidth & "' HEIGHT='" & MiniCalendarHeight & "' CELLSPACING='0' CELLPADDING='0' BORDER='0'>"
  1100.   response.write "<TR><TD VALIGN=TOP>"
  1101.   '------- Draw the month heading ----------------------------------
  1102.   response.write "<TABLE WIDTH='100%' CELLSPACING='0' CELLPADDING='0' BORDER='0'>"
  1103.   response.write "<TR>"
  1104.   response.write "<TD CLASS='MiniHeadingBar'>" 
  1105.   response.write "<A HREF='calendar.asp?action=month&date=" & Year(theDate) & "-" & Month(theDate) & "-1'>"
  1106.   response.write MonthName(Month(theDate)) & " " & Year(theDate)
  1107.   response.write "</A>"
  1108.   response.write "</TD>"
  1109.   response.write "</TR>"
  1110.   response.write "</TABLE>"  
  1111.  
  1112.   '------- Draw the beginning of the calendar ----------------------
  1113.   response.write "<TABLE WIDTH='100%' CLASS='TableMiniHeader'>"
  1114.   response.write "<TR>"
  1115.   response.write "<TD CLASS='MiniCalHeading' STYLE='width:1;'> </TD>"
  1116.   response.write "<TD CLASS='MiniCalHeading'>" & MiniSundayName & "</TD>"
  1117.   response.write "<TD CLASS='MiniCalHeading'>" & MiniMondayName & "</TD>"
  1118.   response.write "<TD CLASS='MiniCalHeading'>" & MiniTuesdayName & "</TD>"
  1119.   response.write "<TD CLASS='MiniCalHeading'>" & MiniWednesdayName & "</TD>"
  1120.   response.write "<TD CLASS='MiniCalHeading'>" & MiniThursdayName & "</TD>"
  1121.   response.write "<TD CLASS='MiniCalHeading'>" & MiniFridayName & "</TD>"
  1122.   response.write "<TD CLASS='MiniCalHeading'>" & MiniSaturdayName & "</TD>"
  1123.   response.write "</TR>"
  1124.   'response.write "</TABLE>"
  1125.   '-------- Main Calendar Table -------------------------------------
  1126.   'response.write "<TABLE WIDTH='100%' CLASS='TableMiniCalendar'>"
  1127.   response.write "<TR>"
  1128.   '----- Draw the Week button ---------------------------------------
  1129.   response.write "<TD CLASS='TableMiniOtherDayCell' WIDTH='1'><FONT CLASS='FontCalendarDay'><A HREF='calendar.asp?action=week&date=" & Year(theDate) & "-" & Month(theDate) & "-" & Counter + 1 & "'>W</A></FONT></TD>"
  1130.   
  1131.   '-------- If the first day is not sunday --------------------------
  1132.   If weekday(ThisMonthsFirstDay) > 1 then
  1133.     For Counter = day(StartDate) to day(LastMonthsLastDay)
  1134.       Call DrawOtherMiniDay(Counter)
  1135.     Next
  1136.   End If
  1137.   '-------- Draw normal days after Saturday, start a new row --------
  1138.   For Counter = 1 to day(ThisMonthsLastDay)
  1139.     DateToUse = Year(theDate) & "-" & Month(theDate) & "-" & Counter
  1140.     Call DrawMiniNormalDay(Counter, DateToUse)
  1141.     If weekday(DateToUse) = 7 then
  1142.       response.write "</TR>"
  1143.       If Counter <> day(ThisMonthsLastDay) then
  1144.        response.write "<TR>"
  1145.        '----- Draw the Week button ---------------------------------------
  1146.        response.write "<TD CLASS='TableMiniOtherDayCell' WIDTH='1'><FONT CLASS='FontCalendarDay'><A HREF='calendar.asp?action=week&date=" & Year(theDate) & "-" & Month(theDate) & "-" & Counter + 1 & "'>W</A></FONT></TD>"
  1147.       End If
  1148.     End If
  1149.   Next
  1150.   '-------- If last day is not saturday -----------------------------
  1151.   If weekday(ThisMonthsLastDay) < 7 then
  1152.      For Counter = 1 to 7 - weekday(ThisMonthsLastDay)
  1153.        Call DrawOtherMiniDay(Counter)
  1154.      Next
  1155.   End If
  1156.   '-------- Draw the last row of the calendar -----------------------
  1157.   response.write "</TR>"
  1158.   response.write "</TABLE>"
  1159.   '-------- End of Container ----------------------------------------
  1160.   response.write "</TD></TR></TABLE><BR>"
  1161. End Sub 
  1162.  
  1163. Sub DrawMiniNormalDay(DayNumber, theDate) '----------------------------------- Draw a Normal Day
  1164.  
  1165.   DateToUse = Year(theDate) & "-" & Month(theDate) & "-" & DayNumber
  1166.   If Date() = cDate(DateToUse) then
  1167.     MonthCalDayClass = "TableMiniDayCellToday"
  1168.   Else
  1169.     MonthCalDayClass = "TableMiniDayCell"
  1170.   End If
  1171.   IsThereAnEvent = CheckForEvent(DateToUse)
  1172.   If IsThereAnEvent = "YES" then
  1173.     MonthCalDayClass = "TableMiniDayCellWithEvent"
  1174.   End If
  1175.   response.write "<TD WIDTH='14%' CLASS='" & MonthCalDayClass & "' "
  1176.   response.write "onMouseover=" & chr(34) & "this.style.backgroundColor='" & SecondaryHighlightColor & "';" & chr(34) & " "
  1177.   response.write "onMouseout=" & chr(34) & "this.style.backgroundColor='" & TableMiniDayCell & "';" & chr(34) & ">"
  1178.   response.write "<FONT CLASS='FontCalendarDay'>"
  1179.   response.write "<A HREF='calendar.asp?action=day&date=" & DateToUse & "'>"
  1180.   response.write DayNumber
  1181.   response.write "</A>"
  1182.   response.write "</FONT></TD>"
  1183. End Sub
  1184.  
  1185. Sub DrawOtherMiniDay(DayNumber) '--------------------------------------- Draw Other Day
  1186.  
  1187.   response.write "<TD CLASS='TableMiniOtherDayCell' WIDTH='1'>"
  1188.   response.write "<FONT CLASS='FontCalendarDay'> </FONT>"
  1189.   response.write "</TD>"
  1190.  
  1191. End Sub
  1192.  
  1193. '*********************************************************************************
  1194. '******** Draw Day View **********************************************************
  1195. '*********************************************************************************
  1196.  
  1197. Sub DrawDayView
  1198.  
  1199.   %>
  1200.   <SCRIPT LANGUAGE=JAVASCRIPT>
  1201.   function goDeleteEvent(CurrentLink){
  1202.       if (confirm('Are you sure you want to delete the selected event? WARNING! THIS CANNOT BE UNDONE!') == true){
  1203.         window.location.reload(CurrentLink);
  1204.       }else{
  1205.         return false;
  1206.       }
  1207.   } 
  1208.   </SCRIPT>
  1209.   <%
  1210.  
  1211.   response.write "<TABLE WIDTH='100%' CELLPADDING=5 CELLSPACING=0 BORDER=0 STYLE='font-family:" & MainFontFace & ";'>"
  1212.   response.write "<TR>"
  1213.   response.write "<TD VALIGN=TOP>"
  1214.   TitleToWrite = "Events for: <font color=yellow>" & FormatDateTime(WorkingDate,1) & "</font>"
  1215.   Call DrawTitle("100%","24",TitleToWrite,"11pt")
  1216.   Call DrawHLine(2)
  1217.   '----- Draw out the events -----------------------------------------------------
  1218.   If Session("CalendarFilter") > 0 then
  1219.     SQL = "SELECT * FROM Cal_Events WHERE Cal_EventCalendarID = "& Session("CalendarFilter") &" AND Cal_EventDate = #" & WorkingDate & "# ORDER BY Cal_EventStartTime"
  1220.   Else
  1221.     SQL = "SELECT * FROM Cal_Events WHERE Cal_EventDate = #" & WorkingDate & "# ORDER BY Cal_EventStartTime"
  1222.   End If
  1223.   Set RS=dbc.execute(SQL)
  1224.   If RS.EOF then
  1225.     '---- Indent the events ----------------------------------------------------------------------------
  1226.     response.write "<table border=0 cellpadding=0 cellspacing=0 width='100%'><tr><td width=30></td><td>"
  1227.     '---------------------------------------------------------------------------------------------------
  1228.     response.write "<font style='font-family:" & MainFontFace & ";font-size:8pt;'>"
  1229.     response.write "There are no events on this date."
  1230.     response.write "</font>"
  1231.     '---- Indent the events ----------------------------------------------------------------------------
  1232.     response.write "</td></tr></table>"
  1233.     '---------------------------------------------------------------------------------------------------
  1234.   End If
  1235.   Do While NOT RS.EOF
  1236.     '---- Indent the events ----------------------------------------------------------------------------
  1237.     response.write "<table border=0 cellpadding=0 cellspacing=0 width='100%'><tr><td width=30></td><td>"
  1238.     '---------------------------------------------------------------------------------------------------
  1239.     response.write "<table width='100%' cellpadding=3 cellspacing=0 border=0 style='border:1px solid " & LightLineColor & ";'>"
  1240.     response.write "<tr class='EventTitleBar'>"
  1241.     response.write "<td colspan=2>"
  1242.     response.write RS("Cal_EventTitle")
  1243.     response.write "</td>"
  1244.     response.write "</tr>"
  1245.     response.write "<tr>"
  1246.     
  1247.     If RS("Cal_EventImage") <> "" then
  1248.         response.write "<td width=48 valign=top>"
  1249.       response.write "<img src='" & ImageFolder & "48/" & RS("Cal_EventImage") & "' BORDER=0>"
  1250.       response.write "</td>"
  1251.     Else
  1252.         response.write "<td width=48 valign=top>"
  1253.       response.write "<img src='" & ImageFolder & "blank.gif' BORDER=0>"
  1254.       response.write "</td>"
  1255.     End If
  1256.     
  1257.     response.write "<td valign=top style='font-family:" & MainFontFace & ";font-size:8pt;'>"
  1258.     
  1259.     response.write "<table width='100%' cellpadding=2 cellspacing=0 border=1 bordercolor=white style='border-collapse:collapse;'>"
  1260.     response.write "<tr><td valign=top class='EventLeftTD'>Date:</td><td valign=top class='EventRightTD'>" & FormatDateTime(RS("Cal_EventDate"),1) & "</td></tr>"
  1261.     response.write "<tr><td valign=top class='EventLeftTD'>Title:</td><td valign=top class='EventRightTD'>" & RS("Cal_EventTitle") & "</td></tr>"
  1262.     response.write "<tr><td valign=top class='EventLeftTD'>Description:</td><td valign=top class='EventRightTD'>" & RS("Cal_EventBody") & "</td></tr>"
  1263.     If RS("Cal_EventAllDay") = "YES" then
  1264.       response.write "<tr><td valign=top class='EventLeftTD'>Times:</td><td valign=top class='EventRightTD'>ALL DAY EVENT</td></tr>"
  1265.     Else
  1266.       response.write "<tr><td valign=top class='EventLeftTD'>Times:</td><td valign=top class='EventRightTD'>" & FormatTime(RS("Cal_EventStartTime")) & " - " & FormatTime(RS("Cal_EventEndTime")) & "</td></tr>"
  1267.     End If
  1268.     If Session("Cal_UserID") = 1 then
  1269.       response.write "<tr><td valign=top class='EventLeftTD'>ADMIN:</td><td valign=top class='EventRightTD'>"
  1270.       response.write "<A HREF='calendar.asp?action=editevent&eventID=" & RS("Cal_EventID") & "' onclick=""NewWindow(this.href,'aspWebCalendarADDEVENT','500','540','no');return false;"">EDIT</a> | "
  1271.       response.write "<A HREF='calendar.asp?action=deleteevent&eventID=" & RS("Cal_EventID") & "&prevaction=" & request.querystring("action") & "&date=" & request.querystring("date") & "' onclick='goDeleteEvent(this.href);return false;'>DELETE</A>"
  1272.       response.write "</td></tr>"
  1273.     End If
  1274.     'If RS("Cal_EventLink") <> "" then
  1275.     '  response.write "<tr><td valign=top class='EventLeftTD'>Link:</td><td valign=top class='EventRightTD'>" & RS("Cal_EventLink") & "</td></tr>"
  1276.     'Else
  1277.     '  response.write "<tr><td valign=top class='EventLeftTD'>Link:</td><td valign=top class='EventRightTD'>NONE</td></tr>"
  1278.     'End If
  1279.     response.write "</table>"
  1280.     
  1281.     response.write "</td>"
  1282.     response.write "</tr>"
  1283.     
  1284.     response.write "</table><font style='font-size:6pt;'><br></font>"
  1285.   
  1286.     RS.MoveNext
  1287.     '---- Indent the events ----------------------------------------------------------------------------
  1288.     response.write "</td></tr></table>"
  1289.     '---------------------------------------------------------------------------------------------------
  1290.   Loop
  1291.   RS.Close
  1292.   Set RS=Nothing
  1293.   
  1294.   response.write "</TD>"
  1295.   
  1296.   response.write "<TD WIDTH='" & MiniCalendarWidth & "' ALIGN=RIGHT VALIGN=TOP>"
  1297.   PreviousMonth = DateAdd("m",-1,WorkingDate)
  1298.   NextMonth = DateAdd("m",1,WorkingDate)
  1299.   Call DrawMiniCalendar(PreviousMonth)
  1300.   Call DrawMiniCalendar(WorkingDate)
  1301.   Call DrawMiniCalendar(NextMonth)
  1302.   response.write "</TD>"
  1303.   
  1304.   response.write "</TR>"
  1305.   response.write "</TABLE>"
  1306.  
  1307. End Sub
  1308.  
  1309. '*********************************************************************************
  1310. '******** Draw Week View *********************************************************
  1311. '*********************************************************************************
  1312.  
  1313. Sub DrawWeekView
  1314.  
  1315.   %>
  1316.   <SCRIPT LANGUAGE=JAVASCRIPT>
  1317.   function goDeleteEvent(CurrentLink){
  1318.       if (confirm('Are you sure you want to delete the selected event? WARNING! THIS CANNOT BE UNDONE!') == true){
  1319.         window.location.reload(CurrentLink);
  1320.       }else{
  1321.         return false;
  1322.       }
  1323.   } 
  1324.   </SCRIPT>
  1325.   <%
  1326.  
  1327.   '----- Change the working date to the first day of the current week -----------
  1328.   WeekDayTitleName = Weekday(WorkingDate, 1)
  1329.   WorkingDate = DateAdd("w", 1-WeekDayTitleName, WorkingDate)
  1330.  
  1331.   response.write "<TABLE WIDTH='100%' CELLPADDING=5 CELLSPACING=0 BORDER=0 STYLE='font-family:" & MainFontFace & ";'>"
  1332.   response.write "<TR>"
  1333.   response.write "<TD VALIGN=TOP>"
  1334.   TitleToWrite = "Events between: <font color=yellow>" & FormatDateTime(WorkingDate,1) & "</font> and <font color=yellow>" & FormatDateTime(DateAdd("d",6,WorkingDate),1) & "</font>"
  1335.   Call DrawTitle("100%","24",TitleToWrite,"11pt")
  1336.   Call DrawHLine(2)
  1337.  
  1338.   For I = 1 to 7
  1339.     If I > 1 then
  1340.       WorkingDate = DateAdd("d",1,WorkingDate)
  1341.     End If
  1342.     TitleToWrite = "Events for: <font color=yellow>" & FormatDateTime(WorkingDate,1) & "</font>"
  1343.     Call DrawSmallTitle("100%","18",TitleToWrite,"9pt")
  1344.  
  1345.     '----- Draw out the events -----------------------------------------------------
  1346.     If Session("CalendarFilter") > 0 then
  1347.       SQL = "SELECT * FROM Cal_Events WHERE Cal_EventCalendarID = "& Session("CalendarFilter") &" AND Cal_EventDate = #" & WorkingDate & "# ORDER BY Cal_EventStartTime"
  1348.     Else
  1349.       SQL = "SELECT * FROM Cal_Events WHERE Cal_EventDate = #" & WorkingDate & "# ORDER BY Cal_EventStartTime"
  1350.     End If
  1351.     Set RS=dbc.execute(SQL)
  1352.     If RS.EOF then
  1353.       '---- Indent the events ----------------------------------------------------------------------------
  1354.       response.write "<table border=0 cellpadding=0 cellspacing=0 width='100%'><tr><td width=30></td><td>"
  1355.       '---------------------------------------------------------------------------------------------------
  1356.       response.write "<font style='font-family:" & MainFontFace & ";font-size:8pt;'>" 
  1357.       response.write "There are no events on this date."
  1358.       response.write "</font>"
  1359.       '---- Indent the events ----------------------------------------------------------------------------
  1360.       response.write "</td></tr></table>"
  1361.       '---------------------------------------------------------------------------------------------------
  1362.     End If
  1363.     Do While NOT RS.EOF
  1364.       '---- Indent the events ----------------------------------------------------------------------------
  1365.       response.write "<table border=0 cellpadding=0 cellspacing=0 width='100%'><tr><td width=30></td><td>"
  1366.       '---------------------------------------------------------------------------------------------------
  1367.       response.write "<table width='100%' cellpadding=3 cellspacing=0 border=0 style='border:1px solid " & LightLineColor & ";'>"
  1368.       response.write "<tr class='EventTitleBar'>"
  1369.       response.write "<td colspan=2>"
  1370.       response.write RS("Cal_EventTitle")
  1371.       response.write "</td>"
  1372.       response.write "</tr>"
  1373.       response.write "<tr>"
  1374.     
  1375.       If RS("Cal_EventImage") <> "" then
  1376.           response.write "<td width=48 valign=top>"
  1377.         response.write "<img src='" & ImageFolder & "48/" & RS("Cal_EventImage") & "' BORDER=0>"
  1378.         response.write "</td>"
  1379.       Else
  1380.           response.write "<td width=48 valign=top>"
  1381.         response.write "<img src='" & ImageFolder & "blank.gif' BORDER=0>"
  1382.         response.write "</td>"
  1383.       End If
  1384.     
  1385.       response.write "<td valign=top style='font-family:" & MainFontFace & ";font-size:8pt;'>"
  1386.     
  1387.       response.write "<table width='100%' cellpadding=2 cellspacing=0 border=1 bordercolor=white style='border-collapse:collapse;'>"
  1388.       response.write "<tr><td valign=top class='EventLeftTD'>Date:</td><td valign=top class='EventRightTD'>" & FormatDateTime(RS("Cal_EventDate"),1) & "</td></tr>"
  1389.       response.write "<tr><td valign=top class='EventLeftTD'>Title:</td><td valign=top class='EventRightTD'>" & RS("Cal_EventTitle") & "</td></tr>"
  1390.       response.write "<tr><td valign=top class='EventLeftTD'>Description:</td><td valign=top class='EventRightTD'>" & RS("Cal_EventBody") & "</td></tr>"
  1391.       If RS("Cal_EventAllDay") = "YES" then
  1392.         response.write "<tr><td valign=top class='EventLeftTD'>Times:</td><td valign=top class='EventRightTD'>ALL DAY EVENT</td></tr>"
  1393.       Else
  1394.         response.write "<tr><td valign=top class='EventLeftTD'>Times:</td><td valign=top class='EventRightTD'>" & FormatTime(RS("Cal_EventStartTime")) & " - " & FormatTime(RS("Cal_EventEndTime")) & "</td></tr>"
  1395.       End If
  1396.       If Session("Cal_UserID") = 1 then
  1397.         response.write "<tr><td valign=top class='EventLeftTD'>ADMIN:</td><td valign=top class='EventRightTD'>"
  1398.         response.write "<A HREF='calendar.asp?action=editevent&eventID=" & RS("Cal_EventID") & "' onclick=""NewWindow(this.href,'aspWebCalendarADDEVENT','500','540','no');return false;"">EDIT</a> | "
  1399.         response.write "<A HREF='calendar.asp?action=deleteevent&eventID=" & RS("Cal_EventID") & "&prevaction=" & request.querystring("action") & "&date=" & request.querystring("date") & "' onclick='goDeleteEvent(this.href);return false;'>DELETE</A>"
  1400.         response.write "</td></tr>"
  1401.       End If
  1402.       'If RS("Cal_EventLink") <> "" then
  1403.       '  response.write "<tr><td valign=top class='EventLeftTD'>Link:</td><td valign=top class='EventRightTD'>" & RS("Cal_EventLink") & "</td></tr>"
  1404.       'Else
  1405.       '  response.write "<tr><td valign=top class='EventLeftTD'>Link:</td><td valign=top class='EventRightTD'>NONE</td></tr>"
  1406.       'End If
  1407.       response.write "</table>"
  1408.     
  1409.       response.write "</td>"
  1410.       response.write "</tr>"
  1411.     
  1412.       response.write "</table><font style='font-size:6pt;'><br></font>"
  1413.       '---- Indent the events ----------------------------------------------------------------------------
  1414.       response.write "</td></tr></table>"
  1415.       '---------------------------------------------------------------------------------------------------
  1416.       RS.MoveNext
  1417.     Loop
  1418.     RS.Close
  1419.     Set RS=Nothing
  1420.   
  1421.   Next
  1422.   
  1423.  
  1424.   
  1425.   response.write "</TD>"
  1426.   
  1427.   response.write "<TD WIDTH='" & MiniCalendarWidth & "' ALIGN=RIGHT VALIGN=TOP>"
  1428.   PreviousMonth = DateAdd("m",-1,WorkingDate)
  1429.   NextMonth = DateAdd("m",1,WorkingDate)
  1430.   Call DrawMiniCalendar(PreviousMonth)
  1431.   Call DrawMiniCalendar(WorkingDate)
  1432.   Call DrawMiniCalendar(NextMonth)
  1433.   response.write "</TD>"
  1434.   
  1435.   response.write "</TR>"
  1436.   response.write "</TABLE>"
  1437.  
  1438. End Sub
  1439.  
  1440. '*********************************************************************************
  1441. '******** Draw Year View *********************************************************
  1442. '*********************************************************************************
  1443.  
  1444. Sub DrawYearView
  1445.  
  1446.   %>
  1447.   <SCRIPT LANGUAGE=JAVASCRIPT>
  1448.   function goDeleteEvent(CurrentLink){
  1449.       if (confirm('Are you sure you want to delete the selected event? WARNING! THIS CANNOT BE UNDONE!') == true){
  1450.         window.location.reload(CurrentLink);
  1451.       }else{
  1452.         return false;
  1453.       }
  1454.   } 
  1455.   </SCRIPT>
  1456.   <%
  1457.  
  1458.     response.write "<TABLE WIDTH='100%' CELLPADDING=5 CELLSPACING=0 BORDER=0 STYLE='font-family:" & MainFontFace & ";'>"
  1459.     response.write "<TR>"
  1460.     response.write "<TD VALIGN=TOP>"
  1461.     TitleToWrite = "Events between: <font color=yellow>" & FormatDateTime(WorkingDate,1) & "</font> and <font color=yellow>" & FormatDateTime(DateAdd("y",1,WorkingDate),1) & "</font>"
  1462.     Call DrawTitle("100%","24",TitleToWrite,"11pt")
  1463.     Call DrawHLine(2)
  1464.  
  1465.   For I = 1 to 12
  1466.     If I > 1 then
  1467.       WorkingDate = DateAdd("m",1,WorkingDate)
  1468.     End If
  1469.  
  1470.     '------- Setup some information about the month -----------------
  1471.     ThisMonthsFirstDay = Year(WorkingDate) & "-" & Month(WorkingDate) & "-1"
  1472.     NextMonthsFirstDay = dateAdd("m",1,ThisMonthsFirstDay)
  1473.     ThisMonthsLastDay = dateadd("d",-1,NextMonthsFirstDay)
  1474.     LastMonthsLastDay = dateadd("d",-1,ThisMonthsFirstDay)
  1475.  
  1476.     TitleToWrite = "Events for: <font color=yellow>" & MonthName(Month(WorkingDate)) & " " & Year(WorkingDate) & "</font>"
  1477.     Call DrawSmallTitle("100%","18",TitleToWrite,"9pt")
  1478.     '----- Draw out the events -----------------------------------------------------
  1479.     If Session("CalendarFilter") > 0 then
  1480.       SQL = "SELECT * FROM Cal_Events WHERE Cal_EventCalendarID = "& Session("CalendarFilter") &" AND Cal_EventDate >= #" & ThisMonthsFirstDay & "# AND Cal_EventDate <= #" & ThisMonthsLastDay & "# ORDER BY Cal_EventDate, Cal_EventStartTime, Cal_EventEndTime"
  1481.     Else
  1482.       SQL = "SELECT * FROM Cal_Events WHERE Cal_EventDate >= #" & ThisMonthsFirstDay & "# AND Cal_EventDate <= #" & ThisMonthsLastDay & "# ORDER BY Cal_EventDate, Cal_EventStartTime, Cal_EventEndTime"
  1483.     End If
  1484.     Set RS=dbc.execute(SQL)
  1485.     If RS.EOF then
  1486.       '---- Indent the events ----------------------------------------------------------------------------
  1487.       response.write "<table border=0 cellpadding=0 cellspacing=0 width='100%'><tr><td width=30></td><td>"
  1488.       '---------------------------------------------------------------------------------------------------
  1489.       response.write "<font style='font-family:" & MainFontFace & ";font-size:8pt;'>" 
  1490.       response.write "There are no events on this date."
  1491.       response.write "</font>"
  1492.       '---- Indent the events ----------------------------------------------------------------------------
  1493.       response.write "</td></tr></table>"
  1494.       '---------------------------------------------------------------------------------------------------
  1495.     End If
  1496.     Do While NOT RS.EOF
  1497.       '---- Indent the events ----------------------------------------------------------------------------
  1498.       response.write "<table border=0 cellpadding=0 cellspacing=0 width='100%'><tr><td width=30></td><td>"
  1499.       '---------------------------------------------------------------------------------------------------
  1500.       response.write "<table width='100%' cellpadding=3 cellspacing=0 border=0 style='border:1px solid " & LightLineColor & ";'>"
  1501.       response.write "<tr class='EventTitleBar'>"
  1502.       response.write "<td colspan=2>"
  1503.       response.write RS("Cal_EventTitle")
  1504.       response.write "</td>"
  1505.       response.write "</tr>"
  1506.       response.write "<tr>"
  1507.     
  1508.       If RS("Cal_EventImage") <> "" then
  1509.           response.write "<td width=48 valign=top>"
  1510.         response.write "<img src='" & ImageFolder & "48/" & RS("Cal_EventImage") & "' BORDER=0>"
  1511.         response.write "</td>"
  1512.       Else
  1513.           response.write "<td width=48 valign=top>"
  1514.         response.write "<img src='" & ImageFolder & "blank.gif' BORDER=0>"
  1515.         response.write "</td>"
  1516.       End If
  1517.       response.write "<td valign=top style='font-family:" & MainFontFace & ";font-size:8pt;'>"
  1518.     
  1519.       response.write "<table width='100%' cellpadding=2 cellspacing=0 border=1 bordercolor=white style='border-collapse:collapse;'>"
  1520.       response.write "<tr><td valign=top class='EventLeftTD'>Date:</td><td valign=top class='EventRightTD'>" & FormatDateTime(RS("Cal_EventDate"),1) & "</td></tr>"
  1521.       response.write "<tr><td valign=top class='EventLeftTD'>Title:</td><td valign=top class='EventRightTD'>" & RS("Cal_EventTitle") & "</td></tr>"
  1522.       response.write "<tr><td valign=top class='EventLeftTD'>Description:</td><td valign=top class='EventRightTD'>" & RS("Cal_EventBody") & "</td></tr>"
  1523.       If RS("Cal_EventAllDay") = "YES" then
  1524.         response.write "<tr><td valign=top class='EventLeftTD'>Times:</td><td valign=top class='EventRightTD'>ALL DAY EVENT</td></tr>"
  1525.       Else
  1526.         response.write "<tr><td valign=top class='EventLeftTD'>Times:</td><td valign=top class='EventRightTD'>" & FormatTime(RS("Cal_EventStartTime")) & " - " & FormatTime(RS("Cal_EventEndTime")) & "</td></tr>"
  1527.       End If
  1528.       If Session("Cal_UserID") = 1 then
  1529.         response.write "<tr><td valign=top class='EventLeftTD'>ADMIN:</td><td valign=top class='EventRightTD'>"
  1530.         response.write "<A HREF='calendar.asp?action=editevent&eventID=" & RS("Cal_EventID") & "' onclick=""NewWindow(this.href,'aspWebCalendarADDEVENT','500','540','no');return false;"">EDIT</a> | "
  1531.         response.write "<A HREF='calendar.asp?action=deleteevent&eventID=" & RS("Cal_EventID") & "&prevaction=" & request.querystring("action") & "&date=" & request.querystring("date") & "' onclick='goDeleteEvent(this.href);return false;'>DELETE</A>"
  1532.         response.write "</td></tr>"
  1533.       End If
  1534.       'If RS("Cal_EventLink") <> "" then
  1535.       '  response.write "<tr><td valign=top class='EventLeftTD'>Link:</td><td valign=top class='EventRightTD'>" & RS("Cal_EventLink") & "</td></tr>"
  1536.       'Else
  1537.       '  response.write "<tr><td valign=top class='EventLeftTD'>Link:</td><td valign=top class='EventRightTD'>NONE</td></tr>"
  1538.       'End If
  1539.       response.write "</table>"
  1540.     
  1541.       response.write "</td>"
  1542.       response.write "</tr>"
  1543.     
  1544.       response.write "</table><font style='font-size:6pt;'><br></font>"
  1545.       RS.MoveNext
  1546.       '---- Indent the events ----------------------------------------------------------------------------
  1547.       response.write "</td></tr></table>"
  1548.       '---------------------------------------------------------------------------------------------------
  1549.     Loop
  1550.     RS.Close
  1551.     Set RS=Nothing
  1552.   
  1553.   Next
  1554.   
  1555.   
  1556.   response.write "</TD>"
  1557.   
  1558.   response.write "<TD WIDTH='" & MiniCalendarWidth & "' ALIGN=RIGHT VALIGN=TOP>"
  1559.   PreviousMonth = DateAdd("m",-1,WorkingDate)
  1560.   NextMonth = DateAdd("m",1,WorkingDate)
  1561.   Call DrawMiniCalendar(PreviousMonth)
  1562.   Call DrawMiniCalendar(WorkingDate)
  1563.   Call DrawMiniCalendar(NextMonth)
  1564.   response.write "</TD>"
  1565.   
  1566.   response.write "</TR>"
  1567.   response.write "</TABLE>"
  1568.   
  1569. End Sub
  1570.  
  1571. '*********************************************************************************
  1572. '******** Draw View Event ********************************************************
  1573. '*********************************************************************************
  1574.  
  1575. Sub DrawViewEvent
  1576.  
  1577.   %>
  1578.   <SCRIPT LANGUAGE=JAVASCRIPT>
  1579.   function goDeleteEvent(CurrentLink){
  1580.       if (confirm('Are you sure you want to delete the selected event? WARNING! THIS CANNOT BE UNDONE!') == true){
  1581.         window.location.reload(CurrentLink);
  1582.       }else{
  1583.         return false;
  1584.       }
  1585.   } 
  1586.   </SCRIPT>
  1587.   <%
  1588.  
  1589.   response.write "<TABLE WIDTH='100%' CELLPADDING=5 CELLSPACING=0 BORDER=0 STYLE='font-family:" & MainFontFace & ";'>"
  1590.   response.write "<TR>"
  1591.   response.write "<TD VALIGN=TOP>"
  1592.   TitleToWrite = "Event View: "
  1593.   Call DrawTitle("100%","24",TitleToWrite,"11pt")
  1594.   Call DrawHLine(2)
  1595.  
  1596.   SQL = "SELECT * FROM Cal_Events WHERE Cal_EventID = " & SafeSQL(request.querystring("eventid"))
  1597.   Set RS=dbc.execute(SQL)
  1598.   
  1599.   If NOT RS.EOF then
  1600.     '---- Indent the events ----------------------------------------------------------------------------
  1601.     response.write "<table border=0 cellpadding=0 cellspacing=0 width='100%'><tr><td width=30></td><td>"
  1602.     '---------------------------------------------------------------------------------------------------
  1603.     response.write "<table width='100%' cellpadding=3 cellspacing=0 border=0 style='border:1px solid " & LightLineColor & ";'>"
  1604.     response.write "<tr class='EventTitleBar'>"
  1605.     response.write "<td colspan=2>"
  1606.     response.write RS("Cal_EventTitle")
  1607.     response.write "</td>"
  1608.     response.write "</tr>"
  1609.     response.write "<tr>"
  1610.     
  1611.     If RS("Cal_EventImage") <> "" then
  1612.         response.write "<td width=48 valign=top>"
  1613.       response.write "<img src='" & ImageFolder & "48/" & RS("Cal_EventImage") & "' BORDER=0>"
  1614.       response.write "</td>"
  1615.     Else
  1616.         response.write "<td width=48 valign=top>"
  1617.       response.write "<img src='" & ImageFolder & "blank.gif' BORDER=0>"
  1618.       response.write "</td>"
  1619.     End If
  1620.     
  1621.     response.write "<td valign=top style='font-family:" & MainFontFace & ";font-size:8pt;'>"
  1622.     
  1623.     response.write "<table width='100%' cellpadding=2 cellspacing=0 border=1 bordercolor=white style='border-collapse:collapse;'>"
  1624.     response.write "<tr><td valign=top class='EventLeftTD'>Date:</td><td valign=top class='EventRightTD'>" & FormatDateTime(RS("Cal_EventDate"),1) & "</td></tr>"
  1625.     response.write "<tr><td valign=top class='EventLeftTD'>Title:</td><td valign=top class='EventRightTD'>" & RS("Cal_EventTitle") & "</td></tr>"
  1626.     response.write "<tr><td valign=top class='EventLeftTD'>Description:</td><td valign=top class='EventRightTD'>" & RS("Cal_EventBody") & "</td></tr>"
  1627.     If RS("Cal_EventAllDay") = "YES" then
  1628.       response.write "<tr><td valign=top class='EventLeftTD'>Times:</td><td valign=top class='EventRightTD'>ALL DAY EVENT</td></tr>"
  1629.     Else
  1630.       response.write "<tr><td valign=top class='EventLeftTD'>Times:</td><td valign=top class='EventRightTD'>" & FormatTime(RS("Cal_EventStartTime")) & " - " & FormatTime(RS("Cal_EventEndTime")) & "</td></tr>"
  1631.     End If
  1632.     If Session("Cal_UserID") = 1 then
  1633.       response.write "<tr><td valign=top class='EventLeftTD'>ADMIN:</td><td valign=top class='EventRightTD'>"
  1634.       response.write "<A HREF='calendar.asp?action=editevent&eventID=" & RS("Cal_EventID") & "' onclick=""NewWindow(this.href,'aspWebCalendarADDEVENT','500','540','no');return false;"">EDIT</a> | "
  1635.       response.write "<A HREF='calendar.asp?action=deleteevent&eventID=" & RS("Cal_EventID") & "&prevaction=" & request.querystring("action") & "&date=" & request.querystring("date") & "' onclick='goDeleteEvent(this.href);return false;'>DELETE</A>"
  1636.       response.write "</td></tr>"
  1637.     End If
  1638.     'If RS("Cal_EventLink") <> "" then
  1639.     '  response.write "<tr><td valign=top class='EventLeftTD'>Link:</td><td valign=top class='EventRightTD'>" & RS("Cal_EventLink") & "</td></tr>"
  1640.     'Else
  1641.     '  response.write "<tr><td valign=top class='EventLeftTD'>Link:</td><td valign=top class='EventRightTD'>NONE</td></tr>"
  1642.     'End If
  1643.     response.write "</table>"
  1644.     
  1645.     response.write "</td>"
  1646.     response.write "</tr>"
  1647.     
  1648.     response.write "</table><font style='font-size:6pt;'><br></font>"
  1649.     '---- Indent the events ----------------------------------------------------------------------------
  1650.     response.write "</td></tr></table>"
  1651.     '---------------------------------------------------------------------------------------------------
  1652.   End If
  1653.   RS.Close
  1654.   Set RS=Nothing
  1655.   
  1656.   response.write "</TD>"
  1657.   
  1658.   response.write "<TD WIDTH='" & MiniCalendarWidth & "' ALIGN=RIGHT VALIGN=TOP>"
  1659.   PreviousMonth = DateAdd("m",-1,WorkingDate)
  1660.   NextMonth = DateAdd("m",1,WorkingDate)
  1661.   Call DrawMiniCalendar(PreviousMonth)
  1662.   Call DrawMiniCalendar(WorkingDate)
  1663.   Call DrawMiniCalendar(NextMonth)
  1664.   response.write "</TD>"
  1665.   
  1666.   response.write "</TR>"
  1667.   response.write "</TABLE>"
  1668.  
  1669. End Sub
  1670.  
  1671. '*********************************************************************************
  1672. '***** Draw Manage Calendars Screen **********************************************
  1673. '*********************************************************************************
  1674.  
  1675. Sub ManageCalendars
  1676.  
  1677.   If Session("Cal_UserID") = "" then
  1678.     response.redirect "calendar.asp?action=securitycheck"
  1679.   End If
  1680.  
  1681.   %>
  1682.   <SCRIPT LANGUAGE=JAVASCRIPT>
  1683.   function goDeleteCalendar(CurrentLink){
  1684.       if (confirm('Are you sure you want to delete this calendar? ALL THE EVENTS IN THIS CALENDAR WILL BE DELETED! WARNING! THIS CANNOT BE UNDONE!') == true){
  1685.         window.location.reload(CurrentLink);
  1686.       }else{
  1687.         return false;
  1688.       }
  1689.   } 
  1690.   </SCRIPT>
  1691.   <%
  1692.  
  1693.   Call BuildStyles
  1694.   response.write "<HTML>"
  1695.   response.write "<HEAD>"
  1696.   response.write "<TITLE>" & ScriptTitle & " - Manage Calendars</TITLE>"
  1697.   response.write "<STYLE>"
  1698.   response.write Session("StyleCode")
  1699.   response.write "</STYLE>"
  1700.   %>
  1701.   <SCRIPT LANGUAGE="javascript"> 
  1702.   function calpopup(lnk, winHeight, winWidth, winTop, winLeft) { 
  1703.   windowSpecs = "fullscreen=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,height=" + winHeight + ",width=" + winWidth + ",scrollbars=no,top=" + winTop + ",left=" + winLeft
  1704.   window.open(lnk, "calendar",windowSpecs) 
  1705.   } 
  1706.   </SCRIPT> 
  1707.   <%
  1708.   response.write "</HEAD>"
  1709.   response.write "<BODY CLASS='PageBody' TOPMARGIN=0 LEFTMARGIN=0>"
  1710.   '-------------------------------------------------------------------------
  1711.   response.write "<TABLE WIDTH='100%' HEIGHT='100%' CELLPADDING=0 CELLSPACING=0 ALIGN=CENTER><TR><TD VALIGN=CENTER>"  
  1712.   response.write "<TABLE WIDTH='95%' HEIGHT='380' BGCOLOR='white' STYLE='border:1px solid black;' CELLPADDING=0 CELLSPACING=0 ALIGN=CENTER><TR><TD VALIGN=TOP>"
  1713.  
  1714.   Call DrawTitle2("100%","24","Manage Calendars","11pt")
  1715.  
  1716.   response.write "<TABLE CLASS='EditPaneTable' CELLPADDING=4 CELLSPACING=0 style='font-family:" & MainFontFace & ";font-size:8pt;'>"
  1717.  
  1718.   response.write "<TR>"
  1719.   response.write "<TD>"
  1720.   
  1721.   response.write "<DIV NAME='ImageDiv' STYLE='overflow-x:none;overflow-y:scroll;width:100%;height:220px;border:1px solid #AAAAAA;'>"
  1722.   ColorCounter = 0
  1723.   response.write "<table width='100%' cellpadding=2 cellspacing=0 border=0 style='font-family:" & MainFontFace & ";font-size:8pt;'>"
  1724.   response.write "<tr bgcolor=gray style='color:white;font-weight:bold;'>"
  1725.   response.write "<td>Calendar Name</td>"
  1726.   response.write "<td>Color</td>"
  1727.   response.write "<td>Actions</td>"
  1728.   response.write "</tr>"
  1729.   SQL = "SELECT * FROM Cal_Calendars ORDER BY Cal_CalendarName"
  1730.   Set RS=dbc.execute(SQL)
  1731.   Do While NOT RS.EOF
  1732.     If ColorCounter = 0 then
  1733.       BackColor = "white"
  1734.       ColorCounter = 1
  1735.     Else
  1736.       BackColor = "#EEEEEE"
  1737.       ColorCounter = 0
  1738.     End If
  1739.     response.write "<tr bgcolor='" & BackColor & "'>"
  1740.     response.write "<td>" & RS("Cal_CalendarName") & "</td>"
  1741.     response.write "<td>" 
  1742.     response.write "<FONT STYLE='font-family:Arial;font-size:8pt;color:" & RS("Cal_CalendarColor") & ";'>"
  1743.     response.write "█ </FONT>"
  1744.     response.write RS("Cal_CalendarColor") & "</td>"
  1745.     response.write "<td><A HREF='calendar.asp?action=editcalendar&calendarID=" & RS("Cal_CalendarID") & "'>EDIT</A> | <A HREF='calendar.asp?action=deletecalendar&calendarID=" & RS("Cal_CalendarID") & "' onclick='goDeleteCalendar(this.href);return false;'>DELETE</A></td>"
  1746.     response.write "</tr>"
  1747.     RS.MoveNext
  1748.   Loop
  1749.   response.write "</table>"
  1750.   
  1751.   response.write "</DIV>"
  1752.   response.write "</TD></TR>"
  1753.  
  1754.   If request.querystring("action") = "managecalendars" then
  1755.     response.write "<TR>"
  1756.     response.write "<TD>"
  1757.     response.write "<fieldset><legend>Add A Calendar</legend>"
  1758.     '-------------------------------------------------------------------------------
  1759.     response.write "<TABLE WIDTH='95%' CELLPADDING=0 CELLSPACING=0 ALIGN=CENTER><TR><TD VALIGN=TOP>"
  1760.     response.write "<FORM NAME='adminform' STYLE='margin-bottom:0px;' METHOD=POST ACTION='calendar.asp?action=dbaddrecord'>"
  1761.     response.write "<INPUT TYPE=HIDDEN NAME='TableName' VALUE='Cal_Calendars'>"
  1762.     response.write "<INPUT TYPE=HIDDEN NAME='RedirURL' VALUE='calendar.asp?action=managecalendars'>"
  1763.     response.write "<TABLE CLASS='EditPaneTable' CELLPADDING=2 CELLSPACING=0>"
  1764.     response.write "<TR><TD CLASS='EditPaneLeft'>Calendar Name:</TD>"
  1765.     response.write "<TD CLASS='EditPaneRight'><INPUT TYPE=TEXT CLASS='StandardTextBox' NAME='colCal_CalendarName'></TD></TR>"
  1766.     response.write "<TR><TD CLASS='EditPaneLeft'>Calendar Color:</TD>"
  1767.     response.write "<TD CLASS='EditPaneRight'><INPUT TYPE=TEXT CLASS='StandardTextBox' NAME='colCal_CalendarColor' STYLE='width:100px'> "
  1768.     response.write "<IMG SRC='" & ImageFolder & "colorpicker.gif' VALUE=PICK onClick=""calpopup('calendar/color_picker.asp?form=adminform&element=colCal_CalendarColor', 220, 220, window.event.screenY , window.event.screenX)"">"
  1769.     response.write "</TD></TR>"
  1770.     response.write "<TR><TD CLASS='EditPaneLeft'> </TD>"
  1771.     response.write "<TD ALIGN=RIGHT CLASS='EditPaneRight'><INPUT TYPE=SUBMIT CLASS='StandardTextBox' VALUE='Add Calendar' STYLE='width:100px;'></TD></TR>"
  1772.     response.write "</TABLE>"
  1773.     response.write "</FORM>"
  1774.     response.write "</TD>"
  1775.     response.write "</TR>"
  1776.     response.write "</TD></TR></TABLE>"
  1777.     '-------------------------------------------------------------------------------
  1778.     response.write "</fieldset>"
  1779.     response.write "</TD></TR>"
  1780.   Else
  1781.     SQLc = "SELECT * FROM Cal_Calendars WHERE Cal_CalendarID = " & SafeSQL(request.querystring("calendarID"))
  1782.     Set RSc=dbc.execute(SQLc)
  1783.     response.write "<TR>"
  1784.     response.write "<TD>"
  1785.     response.write "<fieldset><legend>Edit Calendar</legend>"
  1786.     '-------------------------------------------------------------------------------
  1787.     response.write "<TABLE WIDTH='95%' CELLPADDING=0 CELLSPACING=0 ALIGN=CENTER><TR><TD VALIGN=TOP>"
  1788.     response.write "<FORM NAME='adminform' STYLE='margin-bottom:0px;' METHOD=POST ACTION='calendar.asp?action=dbupdaterecord'>"
  1789.     response.write "<INPUT TYPE=HIDDEN NAME='TableName' VALUE='Cal_Calendars'>"
  1790.     response.write "<INPUT TYPE=HIDDEN NAME='RedirURL' VALUE='calendar.asp?action=managecalendars'>"
  1791.     response.write "<INPUT TYPE=HIDDEN NAME='TableKey' VALUE='Cal_CalendarID'>"
  1792.     response.write "<INPUT TYPE=HIDDEN NAME='RecordID' VALUE='" & SafeSQL(request.querystring("calendarID")) & "'>"
  1793.     response.write "<TABLE CLASS='EditPaneTable' CELLPADDING=2 CELLSPACING=0>"
  1794.     response.write "<TR><TD CLASS='EditPaneLeft'>Calendar Name:</TD>"
  1795.     response.write "<TD CLASS='EditPaneRight'><INPUT TYPE=TEXT CLASS='StandardTextBox' NAME='colCal_CalendarName' VALUE=""" & RSc("Cal_CalendarName") & """></TD></TR>"
  1796.     response.write "<TR><TD CLASS='EditPaneLeft'>Calendar Color:</TD>"
  1797.     response.write "<TD CLASS='EditPaneRight'><INPUT TYPE=TEXT CLASS='StandardTextBox' NAME='colCal_CalendarColor' STYLE='width:100px' VALUE=""" & RSc("Cal_CalendarColor") & """> "
  1798.     response.write "<IMG SRC='" & ImageFolder & "colorpicker.gif' VALUE=PICK onClick=""calpopup('calendar/color_picker.asp?form=adminform&element=colCal_CalendarColor', 220, 220, window.event.screenY , window.event.screenX)"">"
  1799.     response.write "</TD></TR>"
  1800.     response.write "<TR><TD CLASS='EditPaneLeft'> </TD>"
  1801.     response.write "<TD ALIGN=RIGHT CLASS='EditPaneRight'><INPUT TYPE=SUBMIT CLASS='StandardTextBox' VALUE='Save Changes' STYLE='width:100px;'></TD></TR>"
  1802.     response.write "</TABLE>"
  1803.     response.write "</FORM>"
  1804.     response.write "</TD>"
  1805.     response.write "</TR>"
  1806.     response.write "</TD></TR></TABLE>"
  1807.     '-------------------------------------------------------------------------------
  1808.     response.write "</fieldset>"
  1809.     response.write "</TD></TR>"
  1810.     RSc.Close
  1811.     Set RSc=Nothing
  1812.   End If
  1813.  
  1814.   
  1815.   response.write "</TABLE>"
  1816.  
  1817.   response.write "</TD>"
  1818.   response.write "</TR>"
  1819.   response.write "</TD></TR></TABLE>"
  1820.   response.write "</TD></TR></TABLE>"
  1821.   response.write "</BODY></HTML>"
  1822.  
  1823. End Sub
  1824.  
  1825. '*********************************************************************************
  1826. '***** Delete Calendar ***********************************************************
  1827. '*********************************************************************************
  1828.  
  1829. Sub DeleteCalendar
  1830.  
  1831.   If Session("Cal_UserID") = "" then
  1832.     response.redirect "calendar.asp?action=securitycheck"
  1833.   End If
  1834.  
  1835.   SQL = "DELETE * FROM Cal_Events WHERE Cal_EventCalendarID = " & SafeSQL(request.querystring("calendarID"))
  1836.   Set RS=dbc.execute(SQL)
  1837.   
  1838.   SQL = "DELETE * FROM Cal_Calendars WHERE Cal_CalendarID = " & SafeSQL(request.querystring("calendarID"))
  1839.   Set RS=dbc.execute(SQL)
  1840.  
  1841.   response.redirect "calendar.asp?action=managecalendars"
  1842.  
  1843. End Sub
  1844.  
  1845. '*********************************************************************************
  1846. '***** Draw Edit Config Screen ***************************************************
  1847. '*********************************************************************************
  1848.  
  1849. Sub EditConfig
  1850.  
  1851.   If Session("Cal_UserID") = "" then
  1852.     response.redirect "calendar.asp?action=securitycheck"
  1853.   End If
  1854.  
  1855.   SQL = "SELECT * FROM Cal_Config WHERE Cal_ConfigID = 1"
  1856.   Set RS=dbc.execute(SQL)
  1857.  
  1858.   Call BuildStyles
  1859.   response.write "<HTML>"
  1860.   response.write "<HEAD>"
  1861.   response.write "<TITLE>" & ScriptTitle & " - Edit Configuration</TITLE>"
  1862.   response.write "<STYLE>"
  1863.   response.write Session("StyleCode")
  1864.   response.write "</STYLE>"
  1865.  
  1866.   response.write "</HEAD>"
  1867.   response.write "<BODY CLASS='PageBody' TOPMARGIN=0 LEFTMARGIN=0>"
  1868.   '-------------------------------------------------------------------------
  1869.     response.write "<FORM NAME='adminform' STYLE='margin-bottom:0px;' METHOD=POST ACTION='calendar.asp?action=dbupdaterecord'>"
  1870.     response.write "<INPUT TYPE=HIDDEN NAME='TableName' VALUE='Cal_Config'>"
  1871.     response.write "<INPUT TYPE=HIDDEN NAME='RedirURL' VALUE='calendar.asp?action=summary&from=editconfig'>"
  1872.     response.write "<INPUT TYPE=HIDDEN NAME='TableKey' VALUE='Cal_ConfigID'>"
  1873.     response.write "<INPUT TYPE=HIDDEN NAME='RecordID' VALUE='1'>"
  1874.     response.write "<INPUT TYPE=HIDDEN NAME='from' VALUE='editconfig'>"
  1875.  
  1876.   response.write "<TABLE WIDTH='100%' HEIGHT='100%' CELLPADDING=0 CELLSPACING=0 ALIGN=CENTER><TR><TD VALIGN=CENTER>"  
  1877.   response.write "<TABLE WIDTH='95%' HEIGHT='300' BGCOLOR='white' STYLE='border:1px solid black;' CELLPADDING=0 CELLSPACING=0 ALIGN=CENTER><TR><TD VALIGN=TOP>"
  1878.  
  1879.   Call DrawTitle2("100%","24","Edit Configuration","11pt")
  1880.  
  1881.   response.write "<TABLE CLASS='EditPaneTable' CELLPADDING=4 CELLSPACING=0 style='font-family:" & MainFontFace & ";font-size:8pt;'>"
  1882.  
  1883.   response.write "<TR>"
  1884.   response.write "<TD>"
  1885.   
  1886.   response.write "<DIV NAME='ImageDiv' STYLE='overflow-x:none;overflow-y:scroll;width:100%;height:320px;border:1px solid #AAAAAA;'>"
  1887.  
  1888.     response.write "<TABLE WIDTH='95%' CELLPADDING=0 CELLSPACING=0 ALIGN=CENTER><TR><TD VALIGN=TOP>"
  1889.     response.write "<TABLE CLASS='EditPaneTable' CELLPADDING=2 CELLSPACING=0>"
  1890.     
  1891.     response.write "<TR><TD CLASS='EditPaneLeft'>Script Title:</TD>"
  1892.     response.write "<TD CLASS='EditPaneRight'><INPUT TYPE=TEXT CLASS='StandardTextBox' NAME='colCal_ConfigScriptTitle' VALUE=""" & RS("Cal_ConfigScriptTitle") & """></TD></TR>"
  1893.     
  1894.     response.write "<TR><TD CLASS='EditPaneLeft'>Admin Password:</TD>"
  1895.     response.write "<TD CLASS='EditPaneRight'><INPUT TYPE=TEXT CLASS='StandardTextBox' NAME='colCal_ConfigAdminPassword' VALUE=""" & RS("Cal_ConfigAdminPassword") & """></TD></TR>"
  1896.     
  1897.     response.write "<TR><TD CLASS='EditPaneLeft'>Default Color Scheme:</TD>"
  1898.     response.write "<TD CLASS='EditPaneRight'>"
  1899.     response.write "<SELECT NAME='colCal_ConfigDefaultColorScheme' CLASS='StandardTextBox' STYLE='width:50%'>"
  1900.     SQLc = "SELECT * FROM Cal_ColorSchemes ORDER BY ColorSchemeName"
  1901.     Set RSc=dbc.execute(SQLc)
  1902.     Do While NOT RSc.EOF
  1903.       response.write "<OPTION VALUE='" & RSc("ColorSchemeID") & "'"
  1904.       If RSc("ColorSchemeID") = RS("Cal_ConfigDefaultColorScheme") then
  1905.         response.write " selected"
  1906.       End If
  1907.       response.write ">" & RSc("ColorSchemeName") & "</OPTION>"
  1908.       RSc.MoveNext
  1909.     Loop
  1910.     RSc.Close
  1911.     Set RSc=Nothing
  1912.     response.write "</SELECT> <INPUT TYPE=BUTTON STYLE='font-family:" & MainFontFace & ";font-size:7pt;' VALUE='Manage Color Schemes' onclick=""NewWindow('calendar.asp?action=managecolorschemes','aspWebCalendarCOLORS','520','500','no');""></TD></TR>"
  1913.     
  1914.     response.write "<TR><TD CLASS='EditPaneLeft'>Image Folder:</TD>"
  1915.     response.write "<TD CLASS='EditPaneRight'><INPUT TYPE=TEXT CLASS='StandardTextBox' NAME='colCal_ConfigImageFolder' VALUE=""" & RS("Cal_ConfigImageFolder") & """></TD></TR>"
  1916.     
  1917.     response.write "<TR><TD CLASS='EditPaneLeft'>Date Format:</TD>"
  1918.     response.write "<TD CLASS='EditPaneRight'>"
  1919.     response.write "<INPUT TYPE=RADIO NAME='colCal_ConfigDateFormat' VALUE='US'"
  1920.     If RS("Cal_ConfigDateFormat") = "US" then
  1921.       response.write " checked"
  1922.     End If
  1923.     response.write "> US (mm/dd/yyyy) "
  1924.     response.write "<INPUT TYPE=RADIO NAME='colCal_ConfigDateFormat' VALUE='EURO'"
  1925.     If RS("Cal_ConfigDateFormat") = "EURO" then
  1926.       response.write " checked"
  1927.     End If
  1928.     response.write "> EURO (dd/mm/yyyy) "
  1929.     
  1930.     response.write "</TD></TR>"
  1931.     
  1932.     response.write "<TR><TD CLASS='EditPaneLeft'>LCID:</TD>"
  1933.     response.write "<TD CLASS='EditPaneRight'>"
  1934.     
  1935.     response.write "<SELECT CLASS='StandardTextBox' NAME='colCal_ConfigLCID'>"
  1936.     strFileName = Server.MapPath("calendar/lcids.asp")
  1937.     Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
  1938.     Set TS = objFSO.OpenTextFile(strFileName, 1, False)
  1939.     If Not TS.AtEndOfStream then   
  1940.       Do While Not TS.AtendOfStream  
  1941.         strLine = TS.ReadLine
  1942.         LocA = InStr(strLine, "(")
  1943.         LocB = InStr(strLine, ")")
  1944.         LocC = (LocB - LocA) - 1
  1945.         LCIDValue = Mid(strLine, (LocA + 1), LocC)
  1946.         response.write "<OPTION VALUE='" & LCIDValue & "'"
  1947.         If RS("Cal_ConfigLCID") = LCIDValue then
  1948.           response.write "SELECTED"
  1949.         End If
  1950.         response.write ">" & strLine & "</OPTION>"
  1951.       Loop
  1952.     End If
  1953.     TS.Close 
  1954.     Set TS = Nothing
  1955.     Set objFSO = Nothing
  1956.     response.write "</SELECT>"
  1957.     
  1958.     response.write "</TD></TR>"
  1959.     
  1960.     response.write "<TR><TD CLASS='EditPaneLeft'>TimeFormatToUse:</TD>"
  1961.     response.write "<TD CLASS='EditPaneRight'>"
  1962.     response.write "<INPUT TYPE=RADIO NAME='colCal_ConfigTimeFormatToUse' VALUE='12'"
  1963.     If RS("Cal_ConfigTimeFormatToUse") = "12" then
  1964.       response.write " checked"
  1965.     End If
  1966.     response.write "> 12 Hour (AM/PM) "
  1967.     response.write "<INPUT TYPE=RADIO NAME='colCal_ConfigTimeFormatToUse' VALUE='24'"
  1968.     If RS("Cal_ConfigTimeFormatToUse") = "24" then
  1969.       response.write " checked"
  1970.     End If
  1971.     response.write "> 24 Hour (Military Time) "
  1972.     response.write "</TD></TR>"
  1973.     
  1974.     response.write "<TR><TD CLASS='EditPaneLeft'>HTML Template:</TD>"
  1975.     response.write "<TD CLASS='EditPaneRight'><INPUT TYPE=TEXT CLASS='StandardTextBox' NAME='colCal_ConfigHTMLTemplate' VALUE=""" & RS("Cal_ConfigHTMLTemplate") & """></TD></TR>"
  1976.     
  1977.     response.write "<TR><TD CLASS='EditPaneLeft'>Main Font Face:</TD>"
  1978.     response.write "<TD CLASS='EditPaneRight'><INPUT TYPE=TEXT CLASS='StandardTextBox' NAME='colCal_ConfigMainFontFace' VALUE=""" & RS("Cal_ConfigMainFontFace") & """></TD></TR>"
  1979.     
  1980.     response.write "<TR><TD CLASS='EditPaneLeft'>Month Block Height:</TD>"
  1981.     response.write "<TD CLASS='EditPaneRight'><INPUT TYPE=TEXT CLASS='StandardTextBox' NAME='colCal_ConfigMonthBlockHeight' VALUE=""" & RS("Cal_ConfigMonthBlockHeight") & """></TD></TR>"
  1982.     
  1983.     response.write "<TR><TD CLASS='EditPaneLeft'>MiniCalendarWidth:</TD>"
  1984.     response.write "<TD CLASS='EditPaneRight'><INPUT TYPE=TEXT CLASS='StandardTextBox' NAME='colCal_ConfigMiniCalendarWidth' VALUE=""" & RS("Cal_ConfigMiniCalendarWidth") & """></TD></TR>"
  1985.     
  1986.     response.write "<TR><TD CLASS='EditPaneLeft'>DefaultView:</TD>"
  1987.     response.write "<TD CLASS='EditPaneRight'>"
  1988.     response.write "<INPUT TYPE=RADIO NAME='colCal_ConfigDefaultView' VALUE='day'"
  1989.     If RS("Cal_ConfigDefaultView") = "day" then
  1990.       response.write " checked"
  1991.     End If
  1992.     response.write "> Day "
  1993.     response.write "<INPUT TYPE=RADIO NAME='colCal_ConfigDefaultView' VALUE='week'"
  1994.     If RS("Cal_ConfigDefaultView") = "week" then
  1995.       response.write " checked"
  1996.     End If
  1997.     response.write "> Week "
  1998.     response.write "<INPUT TYPE=RADIO NAME='colCal_ConfigDefaultView' VALUE='month'"
  1999.     If RS("Cal_ConfigDefaultView") = "month" then
  2000.       response.write " checked"
  2001.     End If
  2002.     response.write "> Month "
  2003.     response.write "<INPUT TYPE=RADIO NAME='colCal_ConfigDefaultView' VALUE='year'"
  2004.     If RS("Cal_ConfigDefaultView") = "year" then
  2005.       response.write " checked"
  2006.     End If
  2007.     response.write "> Year "
  2008.     response.write "</TD></TR>"
  2009.     
  2010.     response.write "</TABLE>"
  2011.     response.write "</TD>"
  2012.     response.write "</TR>"
  2013.     response.write "</TD></TR></TABLE>"
  2014.  
  2015.   response.write "</DIV>"
  2016.   response.write "</TD></TR>"
  2017.   
  2018.   response.write "<TR>"
  2019.   response.write "<TD>"
  2020.     response.write "<TABLE WIDTH='95%' CELLPADDING=0 CELLSPACING=0 ALIGN=CENTER><TR><TD VALIGN=TOP>"
  2021.     response.write "<TR><TD CLASS='EditPaneLeft'> </TD>"
  2022.     response.write "<TD ALIGN=RIGHT CLASS='EditPaneRight'><INPUT TYPE=SUBMIT CLASS='StandardTextBox' VALUE='Save Changes' STYLE='width:100px;'></TD></TR>"
  2023.     response.write "</table>"
  2024.   response.write "</TD></TR>"
  2025.   
  2026.   response.write "</TABLE>"
  2027.  
  2028.   response.write "</TD>"
  2029.   response.write "</TR>"
  2030.   response.write "</TD></TR></TABLE>"
  2031.   response.write "</TD></TR></TABLE>"
  2032.   response.write "</FORM>"
  2033.   response.write "</BODY></HTML>"
  2034.   
  2035.   RS.Close
  2036.   Set RS=Nothing
  2037.  
  2038. End Sub
  2039.  
  2040. '*********************************************************************************
  2041. '***** Security Check ************************************************************
  2042. '*********************************************************************************
  2043.  
  2044. Sub SecurityCheck
  2045.  
  2046.   Call BuildStyles
  2047.   response.write "<HTML>"
  2048.   response.write "<HEAD>"
  2049.   response.write "<TITLE>" & ScriptTitle & " - SECURITY CHECK</TITLE>"
  2050.   response.write "<STYLE>"
  2051.   response.write Session("StyleCode")
  2052.   response.write "</STYLE>"
  2053.   %>
  2054.   <SCRIPT LANGUAGE="javascript"> 
  2055.   function calpopup(lnk, winHeight, winWidth, winTop, winLeft) { 
  2056.   windowSpecs = "fullscreen=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,height=" + winHeight + ",width=" + winWidth + ",scrollbars=no,top=" + winTop + ",left=" + winLeft
  2057.   window.open(lnk, "calendar",windowSpecs) 
  2058.   } 
  2059.   </SCRIPT> 
  2060.   <%
  2061.   response.write "</HEAD>"
  2062.   response.write "<BODY CLASS='PageBody' TOPMARGIN=0 LEFTMARGIN=0>"
  2063.   '-------------------------------------------------------------------------
  2064.   response.write "<TABLE WIDTH='100%' HEIGHT='100%' CELLPADDING=0 CELLSPACING=0 ALIGN=CENTER><TR><TD VALIGN=CENTER>"  
  2065.   response.write "<TABLE WIDTH='95%' HEIGHT='380' BGCOLOR='white' STYLE='border:1px solid black;' CELLPADDING=0 CELLSPACING=0 ALIGN=CENTER><TR><TD VALIGN=TOP>"
  2066.  
  2067.   Call DrawTitle2("100%","24","SECURITY CHECK","11pt")
  2068.  
  2069.   response.write "<TABLE CLASS='EditPaneTable' CELLPADDING=4 CELLSPACING=0 style='font-family:" & MainFontFace & ";font-size:8pt;'>"
  2070.  
  2071.   response.write "<TR>"
  2072.   response.write "<TD>"
  2073.   
  2074.   response.write "SORRY! YOU DON'T HAVE ACCESS TO THIS FUNCTION!"
  2075.   
  2076.   response.write "</TD></TR>"
  2077.   response.write "</TABLE>"
  2078.  
  2079.   response.write "</TD>"
  2080.   response.write "</TR>"
  2081.   response.write "</TD></TR></TABLE>"
  2082.   response.write "</TD></TR></TABLE>"
  2083.   response.write "</BODY></HTML>"
  2084.  
  2085. End Sub
  2086.  
  2087. '*********************************************************************************
  2088. '***** Draw Manage Color Schemes Screen ******************************************
  2089. '*********************************************************************************
  2090.  
  2091. Sub ManageColorSchemes
  2092.  
  2093.   If Session("Cal_UserID") = "" then
  2094.     response.redirect "calendar.asp?action=securitycheck"
  2095.   End If
  2096.  
  2097.   %>
  2098.   <SCRIPT LANGUAGE=JAVASCRIPT>
  2099.   function goDeleteColorScheme(CurrentLink){
  2100.       if (confirm('Are you sure you want to delete this Color Scheme? THIS CANNOT BE UNDONE!') == true){
  2101.         window.location.reload(CurrentLink);
  2102.       }else{
  2103.         return false;
  2104.       }
  2105.   } 
  2106.   </SCRIPT>
  2107.   <%
  2108.  
  2109.   Call BuildStyles
  2110.   response.write "<HTML>"
  2111.   response.write "<HEAD>"
  2112.   response.write "<TITLE>" & ScriptTitle & " - Manage ColorSchemes</TITLE>"
  2113.   response.write "<STYLE>"
  2114.   response.write Session("StyleCode")
  2115.   response.write "</STYLE>"
  2116.   %>
  2117.   <SCRIPT LANGUAGE="javascript"> 
  2118.   function calpopup(lnk, winHeight, winWidth, winTop, winLeft) { 
  2119.   windowSpecs = "fullscreen=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,height=" + winHeight + ",width=" + winWidth + ",scrollbars=no,top=" + winTop + ",left=" + winLeft
  2120.   window.open(lnk, "calendar",windowSpecs) 
  2121.   } 
  2122.   </SCRIPT> 
  2123.   <%
  2124.   response.write "</HEAD>"
  2125.   response.write "<BODY CLASS='PageBody' TOPMARGIN=0 LEFTMARGIN=0>"
  2126.   '-------------------------------------------------------------------------
  2127.   response.write "<TABLE WIDTH='100%' HEIGHT='100%' CELLPADDING=0 CELLSPACING=0 ALIGN=CENTER><TR><TD VALIGN=CENTER>"  
  2128.   response.write "<TABLE WIDTH='95%' HEIGHT='450' BGCOLOR='white' STYLE='border:1px solid black;' CELLPADDING=0 CELLSPACING=0 ALIGN=CENTER><TR><TD VALIGN=TOP>"
  2129.  
  2130.   Call DrawTitle2("100%","24","Manage Color Schemes","11pt")
  2131.  
  2132.   response.write "<TABLE CLASS='EditPaneTable' CELLPADDING=4 CELLSPACING=0 style='font-family:" & MainFontFace & ";font-size:8pt;'>"
  2133.  
  2134.   response.write "<TR>"
  2135.   response.write "<TD>"
  2136.   
  2137.   response.write "<DIV NAME='ImageDiv' STYLE='overflow-x:none;overflow-y:scroll;width:100%;height:120px;border:1px solid #AAAAAA;'>"
  2138.   ColorCounter = 0
  2139.   response.write "<table width='100%' cellpadding=2 cellspacing=0 border=0 style='font-family:" & MainFontFace & ";font-size:8pt;'>"
  2140.   response.write "<tr bgcolor=gray style='color:white;font-weight:bold;'>"
  2141.   response.write "<td>Color Scheme Name</td>"
  2142.   response.write "<td>Actions</td>"
  2143.   response.write "</tr>"
  2144.   SQL = "SELECT * FROM Cal_ColorSchemes ORDER BY ColorSchemeName"
  2145.   Set RS=dbc.execute(SQL)
  2146.   Do While NOT RS.EOF
  2147.     If ColorCounter = 0 then
  2148.       BackColor = "white"
  2149.       ColorCounter = 1
  2150.     Else
  2151.       BackColor = "#EEEEEE"
  2152.       ColorCounter = 0
  2153.     End If
  2154.     response.write "<tr bgcolor='" & BackColor & "'>"
  2155.     response.write "<td>" & RS("ColorSchemeName") & "</td>"
  2156.     response.write "<td><A HREF='calendar.asp?action=editcolorscheme&colorschemeID=" & RS("ColorSchemeID") & "'>EDIT</A> | "
  2157.     If RS("ColorSchemeID") <> cint(Session("DefaultColorScheme")) then
  2158.         response.write "<A HREF='calendar.asp?action=deletecolorscheme&colorschemeID=" & RS("ColorSchemeID") & "' onclick='goDeleteColorScheme(this.href);return false;'>DELETE</A></td>"
  2159.     Else
  2160.       response.write "CURRENT</td>"
  2161.     End If
  2162.     response.write "</tr>"
  2163.     RS.MoveNext
  2164.   Loop
  2165.   response.write "</table>"
  2166.   
  2167.   response.write "</DIV>"
  2168.   response.write "</TD></TR>"
  2169.  
  2170.   If request.querystring("action") = "managecolorschemes" then
  2171.     response.write "<TR>"
  2172.     response.write "<TD>"
  2173.     response.write "<fieldset><legend>Add A Color Scheme</legend>"
  2174.     '-------------------------------------------------------------------------------
  2175.     response.write "<TABLE WIDTH='95%' CELLPADDING=0 CELLSPACING=0 ALIGN=CENTER><TR><TD VALIGN=TOP>"
  2176.     response.write "<FORM NAME='adminform' STYLE='margin-bottom:0px;' METHOD=POST ACTION='calendar.asp?action=dbaddrecord'>"
  2177.     response.write "<INPUT TYPE=HIDDEN NAME='TableName' VALUE='Cal_ColorSchemes'>"
  2178.     response.write "<INPUT TYPE=HIDDEN NAME='RedirURL' VALUE='calendar.asp?action=managecolorschemes'>"
  2179.     response.write "<TABLE CLASS='EditPaneTable' CELLPADDING=2 CELLSPACING=0>"
  2180.     response.write "<TR><TD CLASS='EditPaneLeft'>Color Scheme Name:</TD>"
  2181.     response.write "<TD CLASS='EditPaneRight'><INPUT TYPE=TEXT CLASS='StandardTextBox' NAME='colColorSchemeName'></TD></TR>"
  2182.     
  2183.     response.write "<TR><TD CLASS='EditPaneLeft'>Light Color:</TD>"
  2184.     response.write "<TD CLASS='EditPaneRight'><INPUT TYPE=TEXT CLASS='StandardTextBox' NAME='colLightColor' STYLE='width:100px'> "
  2185.     response.write "<IMG SRC='" & ImageFolder & "colorpicker.gif' VALUE=PICK onClick=""calpopup('calendar/color_picker.asp?form=adminform&element=colLightColor', 220, 220, window.event.screenY , window.event.screenX)"">"
  2186.     response.write "</TD></TR>"
  2187.     
  2188.     response.write "<TR><TD CLASS='EditPaneLeft'>Mid Light Color:</TD>"
  2189.     response.write "<TD CLASS='EditPaneRight'><INPUT TYPE=TEXT CLASS='StandardTextBox' NAME='colMidLightColor' STYLE='width:100px'> "
  2190.     response.write "<IMG SRC='" & ImageFolder & "colorpicker.gif' VALUE=PICK onClick=""calpopup('calendar/color_picker.asp?form=adminform&element=colMidLightColor', 220, 220, window.event.screenY , window.event.screenX)"">"
  2191.     response.write "</TD></TR>"
  2192.     
  2193.     response.write "<TR><TD CLASS='EditPaneLeft'>Light Main Color:</TD>"
  2194.     response.write "<TD CLASS='EditPaneRight'><INPUT TYPE=TEXT CLASS='StandardTextBox' NAME='colLightMainColor' STYLE='width:100px'> "
  2195.     response.write "<IMG SRC='" & ImageFolder & "colorpicker.gif' VALUE=PICK onClick=""calpopup('calendar/color_picker.asp?form=adminform&element=colLightMainColor', 220, 220, window.event.screenY , window.event.screenX)"">"
  2196.     response.write "</TD></TR>"
  2197.     
  2198.     response.write "<TR><TD CLASS='EditPaneLeft'>Dark Main Color:</TD>"
  2199.     response.write "<TD CLASS='EditPaneRight'><INPUT TYPE=TEXT CLASS='StandardTextBox' NAME='colDarkMainColor' STYLE='width:100px'> "
  2200.     response.write "<IMG SRC='" & ImageFolder & "colorpicker.gif' VALUE=PICK onClick=""calpopup('calendar/color_picker.asp?form=adminform&element=colDarkMainColor', 220, 220, window.event.screenY , window.event.screenX)"">"
  2201.     response.write "</TD></TR>"
  2202.     
  2203.     response.write "<TR><TD CLASS='EditPaneLeft'>Light Line Color:</TD>"
  2204.     response.write "<TD CLASS='EditPaneRight'><INPUT TYPE=TEXT CLASS='StandardTextBox' NAME='colLightLineColor' STYLE='width:100px'> "
  2205.     response.write "<IMG SRC='" & ImageFolder & "colorpicker.gif' VALUE=PICK onClick=""calpopup('calendar/color_picker.asp?form=adminform&element=colLightLineColor', 220, 220, window.event.screenY , window.event.screenX)"">"
  2206.     response.write "</TD></TR>"
  2207.     
  2208.     response.write "<TR><TD CLASS='EditPaneLeft'>Primary Highlight Color:</TD>"
  2209.     response.write "<TD CLASS='EditPaneRight'><INPUT TYPE=TEXT CLASS='StandardTextBox' NAME='colPrimaryHighlightColor' STYLE='width:100px'> "
  2210.     response.write "<IMG SRC='" & ImageFolder & "colorpicker.gif' VALUE=PICK onClick=""calpopup('calendar/color_picker.asp?form=adminform&element=colPrimaryHighlightColor', 220, 220, window.event.screenY , window.event.screenX)"">"
  2211.     response.write "</TD></TR>"
  2212.     
  2213.     response.write "<TR><TD CLASS='EditPaneLeft'>Secondary Highlight Color:</TD>"
  2214.     response.write "<TD CLASS='EditPaneRight'><INPUT TYPE=TEXT CLASS='StandardTextBox' NAME='colSecondaryHighlightColor' STYLE='width:100px'> "
  2215.     response.write "<IMG SRC='" & ImageFolder & "colorpicker.gif' VALUE=PICK onClick=""calpopup('calendar/color_picker.asp?form=adminform&element=colSecondaryHighlightColor', 220, 220, window.event.screenY , window.event.screenX)"">"
  2216.     response.write "</TD></TR>"
  2217.     
  2218.     response.write "<TR><TD CLASS='EditPaneLeft'> </TD>"
  2219.     response.write "<TD ALIGN=RIGHT CLASS='EditPaneRight'><INPUT TYPE=SUBMIT CLASS='StandardTextBox' VALUE='Add Color Scheme' STYLE='width:100px;'></TD></TR>"
  2220.     response.write "</TABLE>"
  2221.     response.write "</FORM>"
  2222.     response.write "</TD>"
  2223.     response.write "</TR>"
  2224.     response.write "</TD></TR></TABLE>"
  2225.     '-------------------------------------------------------------------------------
  2226.     response.write "</fieldset>"
  2227.     response.write "</TD></TR>"
  2228.   Else
  2229.     SQLc = "SELECT * FROM Cal_ColorSchemes WHERE ColorSchemeID = " & SafeSQL(request.querystring("colorschemeID"))
  2230.     Set RSc=dbc.execute(SQLc)
  2231.     response.write "<TR>"
  2232.     response.write "<TD>"
  2233.     response.write "<fieldset><legend>Add A Color Scheme</legend>"
  2234.     '-------------------------------------------------------------------------------
  2235.     response.write "<TABLE WIDTH='95%' CELLPADDING=0 CELLSPACING=0 ALIGN=CENTER><TR><TD VALIGN=TOP>"
  2236.     response.write "<FORM NAME='adminform' STYLE='margin-bottom:0px;' METHOD=POST ACTION='calendar.asp?action=dbupdaterecord'>"
  2237.     response.write "<INPUT TYPE=HIDDEN NAME='TableName' VALUE='Cal_ColorSchemes'>"
  2238.     response.write "<INPUT TYPE=HIDDEN NAME='RedirURL' VALUE='calendar.asp?action=managecolorschemes'>"
  2239.     response.write "<INPUT TYPE=HIDDEN NAME='TableKey' VALUE='ColorSchemeID'>"
  2240.     response.write "<INPUT TYPE=HIDDEN NAME='RecordID' VALUE='" & SafeSQL(request.querystring("colorschemeID")) & "'>"
  2241.     response.write "<TABLE CLASS='EditPaneTable' CELLPADDING=2 CELLSPACING=0>"
  2242.     response.write "<TR><TD CLASS='EditPaneLeft'>Color Scheme Name:</TD>"
  2243.     response.write "<TD CLASS='EditPaneRight'><INPUT TYPE=TEXT CLASS='StandardTextBox' NAME='colColorSchemeName' VALUE=""" & RSc("ColorSchemeName") & """></TD></TR>"
  2244.     
  2245.     response.write "<TR><TD CLASS='EditPaneLeft'>Light Color:</TD>"
  2246.     response.write "<TD CLASS='EditPaneRight'><INPUT TYPE=TEXT CLASS='StandardTextBox' NAME='colLightColor' STYLE='width:100px' VALUE=""" & RSc("LightColor") & """> "
  2247.     response.write "<IMG SRC='" & ImageFolder & "colorpicker.gif' VALUE=PICK onClick=""calpopup('calendar/color_picker.asp?form=adminform&element=colLightColor', 220, 220, window.event.screenY , window.event.screenX)"">"
  2248.     response.write "</TD></TR>"
  2249.     
  2250.     response.write "<TR><TD CLASS='EditPaneLeft'>Mid Light Color:</TD>"
  2251.     response.write "<TD CLASS='EditPaneRight'><INPUT TYPE=TEXT CLASS='StandardTextBox' NAME='colMidLightColor' STYLE='width:100px' VALUE=""" & RSc("MidLightColor") & """> "
  2252.     response.write "<IMG SRC='" & ImageFolder & "colorpicker.gif' VALUE=PICK onClick=""calpopup('calendar/color_picker.asp?form=adminform&element=colMidLightColor', 220, 220, window.event.screenY , window.event.screenX)"">"
  2253.     response.write "</TD></TR>"
  2254.     
  2255.     response.write "<TR><TD CLASS='EditPaneLeft'>Light Main Color:</TD>"
  2256.     response.write "<TD CLASS='EditPaneRight'><INPUT TYPE=TEXT CLASS='StandardTextBox' NAME='colLightMainColor' STYLE='width:100px' VALUE=""" & RSc("LightMainColor") & """> "
  2257.     response.write "<IMG SRC='" & ImageFolder & "colorpicker.gif' VALUE=PICK onClick=""calpopup('calendar/color_picker.asp?form=adminform&element=colLightMainColor', 220, 220, window.event.screenY , window.event.screenX)"">"
  2258.     response.write "</TD></TR>"
  2259.     
  2260.     response.write "<TR><TD CLASS='EditPaneLeft'>Dark Main Color:</TD>"
  2261.     response.write "<TD CLASS='EditPaneRight'><INPUT TYPE=TEXT CLASS='StandardTextBox' NAME='colDarkMainColor' STYLE='width:100px' VALUE=""" & RSc("DarkMainColor") & """> "
  2262.     response.write "<IMG SRC='" & ImageFolder & "colorpicker.gif' VALUE=PICK onClick=""calpopup('calendar/color_picker.asp?form=adminform&element=colDarkMainColor', 220, 220, window.event.screenY , window.event.screenX)"">"
  2263.     response.write "</TD></TR>"
  2264.     
  2265.     response.write "<TR><TD CLASS='EditPaneLeft'>Light Line Color:</TD>"
  2266.     response.write "<TD CLASS='EditPaneRight'><INPUT TYPE=TEXT CLASS='StandardTextBox' NAME='colLightLineColor' STYLE='width:100px' VALUE=""" & RSc("LightLineColor") & """> "
  2267.     response.write "<IMG SRC='" & ImageFolder & "colorpicker.gif' VALUE=PICK onClick=""calpopup('calendar/color_picker.asp?form=adminform&element=colLightLineColor', 220, 220, window.event.screenY , window.event.screenX)"">"
  2268.     response.write "</TD></TR>"
  2269.     
  2270.     response.write "<TR><TD CLASS='EditPaneLeft'>Primary Highlight Color:</TD>"
  2271.     response.write "<TD CLASS='EditPaneRight'><INPUT TYPE=TEXT CLASS='StandardTextBox' NAME='colPrimaryHighlightColor' STYLE='width:100px' VALUE=""" & RSc("PrimaryHighlightColor") & """> "
  2272.     response.write "<IMG SRC='" & ImageFolder & "colorpicker.gif' VALUE=PICK onClick=""calpopup('calendar/color_picker.asp?form=adminform&element=colPrimaryHighlightColor', 220, 220, window.event.screenY , window.event.screenX)"">"
  2273.     response.write "</TD></TR>"
  2274.     
  2275.     response.write "<TR><TD CLASS='EditPaneLeft'>Secondary Highlight Color:</TD>"
  2276.     response.write "<TD CLASS='EditPaneRight'><INPUT TYPE=TEXT CLASS='StandardTextBox' NAME='colSecondaryHighlightColor' STYLE='width:100px' VALUE=""" & RSc("SecondaryHighlightColor") & """> "
  2277.     response.write "<IMG SRC='" & ImageFolder & "colorpicker.gif' VALUE=PICK onClick=""calpopup('calendar/color_picker.asp?form=adminform&element=colSecondaryHighlightColor', 220, 220, window.event.screenY , window.event.screenX)"">"
  2278.     response.write "</TD></TR>"
  2279.     
  2280.     response.write "<TR><TD CLASS='EditPaneLeft'> </TD>"
  2281.     response.write "<TD ALIGN=RIGHT CLASS='EditPaneRight'><INPUT TYPE=SUBMIT CLASS='StandardTextBox' VALUE='Save Changes' STYLE='width:100px;'></TD></TR>"
  2282.     response.write "</TABLE>"
  2283.     response.write "</FORM>"
  2284.     response.write "</TD>"
  2285.     response.write "</TR>"
  2286.     response.write "</TD></TR></TABLE>"
  2287.     '-------------------------------------------------------------------------------
  2288.     response.write "</fieldset>"
  2289.     response.write "</TD></TR>"
  2290.     RSc.Close
  2291.     Set RSc=Nothing
  2292.   End If
  2293.  
  2294.   response.write "</TABLE>"
  2295.  
  2296.   response.write "</TD>"
  2297.   response.write "</TR>"
  2298.   response.write "</TD></TR></TABLE>"
  2299.   response.write "</TD></TR></TABLE>"
  2300.   response.write "</BODY></HTML>"
  2301.  
  2302. End Sub
  2303.  
  2304. '*********************************************************************************
  2305. '***** Delete ColorScheme ********************************************************
  2306. '*********************************************************************************
  2307.  
  2308. Sub DeleteColorScheme
  2309.  
  2310.   If Session("Cal_UserID") = "" then
  2311.     response.redirect "calendar.asp?action=securitycheck"
  2312.   End If
  2313.  
  2314.   SQL = "DELETE * FROM Cal_ColorSchemes WHERE ColorSchemeID = " & SafeSQL(request.querystring("colorschemeID"))
  2315.   Set RS=dbc.execute(SQL)
  2316.  
  2317.   response.redirect "calendar.asp?action=managecolorschemes"
  2318.  
  2319. End Sub
  2320.  
  2321.  
  2322.  
  2323.  
  2324.  
  2325.  
  2326.  
  2327.  
  2328.  
  2329. '************************************************************************************
  2330. '************************************************************************************
  2331. '************************************************************************************
  2332. '************************************************************************************
  2333. '************************************************************************************
  2334. '************************************************************************************
  2335. '************************************************************************************
  2336. '******** FUNCTIONS ONLY BELOW HERE *************************************************
  2337. '************************************************************************************
  2338. '************************************************************************************
  2339. '************************************************************************************
  2340. '************************************************************************************
  2341. '************************************************************************************
  2342. '************************************************************************************
  2343. '************************************************************************************
  2344.  
  2345. '*********************************************************************************
  2346. '******** Build Style Tags *******************************************************
  2347. '*********************************************************************************
  2348.  
  2349. Sub BuildStyles
  2350.  
  2351.   StyleCode = ""
  2352.   StyleCode = StyleCode & ".TableMonthHeader{font-family:" & MainFontFace & ";font-size:9pt;font-weight:bold;color:black}" & vbcrlf
  2353.   StyleCode = StyleCode & ".MonthHeadings{width:14%;text-align:center;font-size:9pt;font-family:" & MainFontFace & ";background-color:" & DarkMainColor & ";border-top:1px solid " & LightLineColor & ";border-bottom:1px solid " & LightLineColor & ";color:white;font-weight:bold;filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='" & LightMainColor & "', EndColorStr='" & DarkMainColor & "')}" & vbcrlf
  2354.   StyleCode = StyleCode & ".TableMonthCalendar{font-family:" & MainFontFace & ";height:95%;padding:0;background-color:white;border-collapse:collapse;border-style:none;border-color:" & LightLineColor & ";}" & vbcrlf
  2355.   StyleCode = StyleCode & ".TableMonthDayCellToday{font-family:" & MainFontFace & ";border-style:solid;border-width:1;border-color:" & LightLineColor & ";text-align:left;vertical-align:top;background-color:#CCCCCC;}" & vbcrlf
  2356.   StyleCode = StyleCode & ".TableMonthDayCell{font-family:" & MainFontFace & ";border-style:solid;border-width:1;border-color:" & LightLineColor & ";text-align:left;vertical-align:top;background-color:#FFFFFF;border-collapse:collapse;}" & vbcrlf
  2357.   StyleCode = StyleCode & ".MonthSubHeadings{font-family:" & MainFontFace & ";font-size:8pt;background-color:" & MidLightColor & ";color:black;font-weight:normal;filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='" & LightColor & "', EndColorStr='" & MidLightColor & "')}" & vbcrlf
  2358.   StyleCode = StyleCode & ".TableMonthOtherDayCell{font-family:" & MainFontFace & ";border-style:solid;border-width:1;border-color:" & LightLineColor & ";text-align:center;vertical-align:top;background-color:" & MidLightColor & ";border-collapse:collapse;}" & vbcrlf
  2359.   StyleCode = StyleCode & ".EventTable{font-family:" & MainFontFace & ";border-style:solid;border-width:1;border-color:black;border-collapse:collapse;border-width:1;text-align:left;background-color:white;padding:1;width:100%;}" & vbcrlf
  2360.   StyleCode = StyleCode & ".EventTitleFont{font-family:" & MainFontFace & ";font-size:7pt;}" & vbcrlf
  2361.   StyleCode = StyleCode & ".EventTimeCell{font-family:" & MainFontFace & ";font-size:7pt;width:10%;text-align:left;background-color:#DDDDDD;}" & vbcrlf
  2362.   StyleCode = StyleCode & ".EventTimeFont{font-family:" & MainFontFace & ";font-size:7pt;}" & vbcrlf
  2363.   StyleCode = StyleCode & ".EventTitleCell{font-family:" & MainFontFace & ";font-size:7pt;width:90%;text-align:left;background-color:white;}" & vbcrlf
  2364.   StyleCode = StyleCode & ".EventTitleFont{font-family:" & MainFontFace & ";font-size:7pt;}" & vbcrlf
  2365.   StyleCode = StyleCode & ".EventTitleCellAllDay{font-family:" & MainFontFace & ";font-size:7pt;text-align:center}" & vbcrlf
  2366.   
  2367.   StyleCode = StyleCode & ".MonthDayDiv{width:100%;height:85%;overflow:visible;}" & vbcrlf
  2368.   
  2369.   StyleCode = StyleCode & ".MiniHeadingBar{background-color:" & LightMainColor & ";height:19px;text-align:center;border-top:1px solid " & LightLineColor & ";border-bottom:1px solid " & LightLineColor & ";font-family:" & MainFontFace & ";font-size:8pt;color:black;font-weight:bold;filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='" & LightColor & "', EndColorStr='" & MidLightColor & "')}" & vbcrlf
  2370.   
  2371.   
  2372.   StyleCode = StyleCode & ".TableMiniHeader{height:1;padding:0;background-color:white;border-style:solid;border-color:" & LightLineColor & ";border-width:0;border-collapse:collapse;}" & vbcrlf
  2373.   StyleCode = StyleCode & ".MiniCalHeading{width:14%;font-family:" & MainFontFace & ";font-size:8pt;color:black;font-weight:normal;background-color:" & LightColor & ";text-align:center;}" & vbcrlf
  2374.   StyleCode = StyleCode & ".TableMiniCalendar{padding:0;background-color:white;border-collapse:collapse;border-width:0;border-style:none;}" & vbcrlf
  2375.   StyleCode = StyleCode & ".TableMiniDayCellToday{border-style:solid;border-width:1;border-color:white;text-align:center;vertical-align:top;background-color:silver;padding:0;}" & vbcrlf
  2376.   StyleCode = StyleCode & ".TableMiniDayCell{border-style:solid;border-width:1;border-color:white;text-align:center;vertical-align:center;background-color:white;padding:0;border-collapse:collapse;cursor:hand;}" & vbcrlf
  2377.   StyleCode = StyleCode & ".TableMiniDayCellWithEvent{border-style:solid;border-width:1;border-color:white;text-align:center;vertical-align:center;background-color:" & PrimaryHighlightColor & ";padding:0;border-collapse:collapse;cursor:hand}" & vbcrlf
  2378.   StyleCode = StyleCode & ".FontCalendarDay{font-family:" & MainFontFace & ";font-size:7pt;}" & vbcrlf
  2379.   StyleCode = StyleCode & ".TableMiniOtherDayCell{border-style:solid;border-width:1;border-color:white;text-align:center;vertical-align:center;background-color:" & MidLightColor & ";padding:0;border-collapse:collapse;}" & vbcrlf
  2380.  
  2381.   StyleCode = StyleCode & ".EventLeftTD{width:20%;font-family:" & MainFontFace & ";font-size:8pt;font-weight:bold;background-color:" & LightColor & ";}" & vbcrlf
  2382.   StyleCode = StyleCode & ".EventRightTD{width:80%;font-family:" & MainFontFace & ";font-size:8pt;}" & vbcrlf
  2383.   
  2384.   StyleCode = StyleCode & ".EventTitleBar{background-color:" & MidLightColor & ";height:19px;text-align:left;border-top:1px solid " & LightLineColor & ";border-bottom:1px solid " & LightLineColor & ";font-family:" & MainFontFace & ";font-size:10pt;color:black;font-weight:bold;filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='" & LightMainColor & "', EndColorStr='" & MidLightColor & "')}" & vbcrlf
  2385.   
  2386.   
  2387.   StyleCode = StyleCode & ".ButtonBar{background-color:" & LightColor & ";padding-top:1px;width:100%;height:30px;filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='" & LightColor & "', EndColorStr='" & MidLightColor & "')}" & vbcrlf
  2388.   StyleCode = StyleCode & ".Button{background-color:" & LightColor & ";cursor:hand;padding:1px 1px 1px 1px;height:27px;filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='" & LightColor & "', EndColorStr='" & MidLightColor & "')}" & vbcrlf
  2389.   StyleCode = StyleCode & ".ButtonOver{background-color:" & MidLightColor & ";cursor:hand;border: 1px solid " & LightLineColor & ";height:27px;filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='" & PrimaryHighlightColor & "', EndColorStr='" & SecondaryHighlightColor & "')}" & vbcrlf
  2390.   StyleCode = StyleCode & ".ButtonFont{font-family:" & MainFontFace & ";font-size:9pt;font-weight:bold;}" & vbcrlf
  2391.   
  2392.   StyleCode = StyleCode & ".PageBody{background-color:" & DarkMainColor & ";filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=1, StartColorStr='" & LightMainColor & "', EndColorStr='" & DarkMainColor & "')}" & vbcrlf
  2393.   StyleCode = StyleCode & ".SideBar{background-color:" & DarkMainColor & ";filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=1, StartColorStr='" & LightMainColor & "', EndColorStr='" & DarkMainColor & "')}" & vbcrlf
  2394.   StyleCode = StyleCode & ".StandardFont{font-family:" & MainFontFace &  ";font-size:8pt;color:black;font-weight:bold;}" & vbcrlf
  2395.   StyleCode = StyleCode & ".StandardTextBox{font-family:" & MainFontFace & ";font-size:8pt;color:black;font-weight:normal;width:100%;}" & vbcrlf
  2396.   StyleCode = StyleCode & ".DescriptionHeadingFont{font-family:" & MainFontFace & ";font-size:13pt;color:yellow;font-weight:bold;}" & vbcrlf
  2397.   StyleCode = StyleCode & ".DescriptionFont{font-family:" & MainFontFace & ";font-size:8pt;color:white;font-weight:normal;}" & vbcrlf
  2398.   StyleCode = StyleCode & ".EditPaneTable{width:99%; border:0px;}" & vbcrlf
  2399.   StyleCode = StyleCode & ".EditPaneLeft{width:25%;font-family:Arial;font-size:8pt;}" & vbcrlf
  2400.   StyleCode = StyleCode & ".EditPaneRight{width:75%;font-family:Arial;font-size:8pt;}" & vbcrlf
  2401.   StyleCode = StyleCode & ".ErrorFont{font-family:" & MainFontFace & ";font-size:8pt;color:red;font-weight:bold;}" & vbcrlf
  2402.  
  2403.   Session("StyleCode") = StyleCode
  2404.  
  2405.  
  2406.  
  2407.  
  2408.  
  2409.  
  2410. End Sub
  2411.  
  2412. '*********************************************************************************
  2413. '******** Load the Template File We are Using ************************************
  2414. '*********************************************************************************
  2415.  
  2416. Sub LoadTemplate
  2417.  
  2418.   Call BuildStyles
  2419.  
  2420.   TemplateFile = Server.MapPath(HTMLTemplate)
  2421.   Set fs = CreateObject("Scripting.FileSystemObject")
  2422.   Set thisfile = fs.OpenTextFile(TemplateFile, 1, False)
  2423.   tempSTR=thisfile.readall
  2424.   TemplateContent = tempSTR
  2425.   thisfile.Close
  2426.   set thisfile=nothing
  2427.   set fs=nothing
  2428.  
  2429.   TemplateContent = replace(TemplateContent,"%%STYLES%%",Session("StyleCode"))
  2430.   TemplateArray = split(TemplateContent,"%%CONTENT%%")
  2431.   Session("PageHeader") = TemplateArray(0)
  2432.   Session("PageFooter") = TemplateArray(1)
  2433.   Session("TemplateLoaded") = "YES"
  2434.   
  2435. End Sub
  2436.  
  2437. '*********************************************************************************
  2438. '******** Draw Summary Window ****************************************************
  2439. '*********************************************************************************
  2440.  
  2441. Sub DrawSummary
  2442.  
  2443.   %>
  2444.   <SCRIPT LANGUAGE=JAVASCRIPT>
  2445.     window.onunload = function(){
  2446.       window.opener.top.location.reload();
  2447.     }
  2448.   </SCRIPT>
  2449.   <BODY onload='window.close();'>
  2450.   <%
  2451.  
  2452. End Sub
  2453.  
  2454. '*********************************************************************************
  2455. '******** Draw Summary Window ****************************************************
  2456. '*********************************************************************************
  2457.  
  2458. Sub DrawSummary2
  2459.  
  2460.   %>
  2461.   <SCRIPT LANGUAGE=JAVASCRIPT>
  2462.     window.onunload = function(){
  2463.       window.opener.location.reload();
  2464.     }
  2465.   </SCRIPT>
  2466.   <BODY onload='window.close();'>
  2467.   <%
  2468.  
  2469. End Sub
  2470.  
  2471. '************************************************************************************
  2472. '***** Universal Date Format Function ***********************************************
  2473. '************************************************************************************
  2474.  
  2475. Function UniversalDate(dteDate)
  2476.    If IsDate(dteDate) = True Then
  2477.       dteDay = Day(dteDate)
  2478.       dteMonth = Month(dteDate)
  2479.       dteYear   = Year(dteDate)
  2480.       UniversalDate = dteYear & "-" & Right(Cstr(dteMonth + 100),2) & "-" & Right(Cstr(dteDay + 100),2)
  2481.    Else
  2482.       UniversalDate = Null
  2483.    End If
  2484. End Function
  2485.  
  2486. '************************************************************************************
  2487. '***** Display Date Format Function *************************************************
  2488. '************************************************************************************
  2489.  
  2490. Function FormatDisplayDate(aDate)
  2491.    aDate = cdate(aDate)
  2492.    aDay = Day(aDate)
  2493.    aMonth = Month(aDate)
  2494.    aYear   = Year(aDate)
  2495.    SELECT CASE DateDisplayFormat
  2496.      CASE "US"
  2497.        FormatDisplayDate = Right(Cstr(aMonth + 100),2) & "/" & Right(Cstr(aDay + 100),2) & "/" & aYear
  2498.      CASE "EURO"
  2499.      
  2500.      CASE "UNIVERSAL"
  2501.      
  2502.      CASE ELSE
  2503.        FormatDisplayDate = Right(Cstr(aMonth + 100),2) & "-" & Right(Cstr(aDay + 100),2) & "-" & aYear
  2504.    END SELECT
  2505.  
  2506. End Function
  2507.  
  2508. '*********************************************************************************
  2509. '******** Determine Browser Type *************************************************
  2510. '*********************************************************************************
  2511.  
  2512. Function GetBrowserType(BrowserAgent)
  2513.  
  2514.   If InStr(BrowserAgent, UCASE("MSIE")) then
  2515.     Browser = "Microsoft Internet Explorer"
  2516.   Else
  2517.     Browser = "OTHER"
  2518.   End If
  2519.   GetBrowserType = Browser
  2520.  
  2521. End Function
  2522.  
  2523. '***************************************************************************************
  2524. '****** Generic DB Record Add **********************************************************
  2525. '***************************************************************************************
  2526.  
  2527. Sub DBAddRecord
  2528.  
  2529.   TableName = Request("TableName")
  2530.   RedirURL = Request("RedirURL")
  2531.  
  2532.   Set RS = Server.CreateObject("ADODB.Recordset")
  2533.   RS.MaxRecords = 1
  2534.   RS.Open "SELECT * FROM " & TableName , dbc, adOpenDynamic, adLockPessimistic, adCMDText    
  2535.  
  2536.   RS.AddNew
  2537.  
  2538.   For Each strColumnName in Request.Form
  2539.     If UCase(Left(strColumnName,3)) = "COL" then
  2540.       If Len(Request(strColumnName)) > 0 Then
  2541.         RS(Mid(strColumnName,4,Len(strColumnName))) = Request(strColumnName)
  2542.         'response.write (Mid(strColumnName,4,Len(strColumnName))) & " = " & Request(strColumnName) & "<BR>"
  2543.       End If
  2544.     End If
  2545.   Next
  2546.   RS.Update
  2547.   RS.Close
  2548.   Set RS = Nothing
  2549.  
  2550.   response.redirect RedirURL
  2551.  
  2552. End Sub
  2553.  
  2554. '***************************************************************************************
  2555. '****** Generic DB Record Update *******************************************************
  2556. '***************************************************************************************
  2557.  
  2558. Sub DBUpdateRecord
  2559.  
  2560.   TableKey = Request("TableKey")
  2561.   RecordID = Request("RecordID")
  2562.   TableName = Request("TableName")
  2563.   RedirURL = Request("RedirURL")
  2564.  
  2565.   SQL="UPDATE " & TableName & " SET "
  2566.   For Each strColumnName in Request.Form
  2567.     If UCase(Left(strColumnName,3)) = "COL" then
  2568.       'If Len(Request(strColumnName)) > 0 Then
  2569.         SQL = SQL & Mid(strColumnName,4,Len(strColumnName)) & " = '" & FixString(Request(strColumnName)) & "',"
  2570.       'End If
  2571.     End If
  2572.   Next
  2573.   SQL = Left(SQL, len(SQL)-1)
  2574.   SQL = SQL & " WHERE [" & TableKey & "] = " & RecordID
  2575.   dbc.execute(SQL)
  2576.   'response.write SQL
  2577.   
  2578.   If request.form("from") = "editconfig" then
  2579.     Session("ConfigLoaded") = "NO"
  2580.   End If
  2581.  
  2582.   response.redirect RedirURL
  2583.  
  2584. End Sub
  2585.  
  2586. '*********************************************************************************
  2587. '***** Format Time Function ******************************************************
  2588. '*********************************************************************************
  2589.  
  2590. Function FormatTime(TimeValue)
  2591.  
  2592.   If TimeFormatToUse = "12" then
  2593.     TimeValue = replace(TimeValue," ","")  
  2594.     TimeValue = replace(TimeValue,":","")
  2595.     TimeValue = replace(TimeValue,".","")
  2596.     TimeValue = replace(TimeValue,"-","")
  2597.     TimeValue = replace(TimeValue,"e","")
  2598.     TimeValue = replace(TimeValue,"E","")
  2599.     TimeValue = replace(TimeValue,"M","")
  2600.     TimeValue = replace(TimeValue,"m","")
  2601.     If NOT ((ucase(right(TimeValue,1))="A") or (ucase(right(TimeValue,1))="P")) then
  2602.       TimeFormat = "24"
  2603.     Else
  2604.       TempAMPM = ucase(right(TimeValue,1) & "M")
  2605.     End If
  2606.     TimeLength = len(TimeValue)-1
  2607.     StripTime = left(TimeValue,TimeLength)
  2608.     If len(StripTime) > 4 then 
  2609.       StripTime = left(StripTime,len(StripTime)-2)
  2610.     End If
  2611.     If len(StripTime) = 3 then
  2612.       TimePartA = abs(left(StripTime,1))
  2613.     Else
  2614.       TimePartA = abs(left(StripTime,2))
  2615.       TimePartB = abs(left(StripTime,2))
  2616.     End If
  2617.     If left(TimePartA, 1) = 0 then
  2618.       TimePartA = right(TimePartA, len(TimePartA)-1)
  2619.     End If
  2620.     TimePartB = right(StripTime,2)
  2621.     TempTime = TimePartA & ":" & TimePartB & TempAMPM
  2622.     FormatTime = TempTime
  2623.   Else
  2624.     TempTimeValue = left(TimeValue, 5)
  2625.     FormatTime = TempTimeValue  
  2626.   End If
  2627.  
  2628. End Function
  2629.  
  2630. '*********************************************************************************
  2631. '***** Format Time Function ******************************************************
  2632. '*********************************************************************************
  2633.  
  2634. Function FormatTime2(TimeValue)
  2635.  
  2636.   If TimeFormatToUse = "12" then
  2637.     TimeValue = replace(TimeValue," ","")
  2638.     TimeValue = replace(TimeValue,":","")
  2639.     TimeValue = replace(TimeValue,".","")
  2640.     TimeValue = replace(TimeValue,"-","")
  2641.     TimeValue = replace(TimeValue,"e","")
  2642.     TimeValue = replace(TimeValue,"E","")
  2643.     TimeValue = replace(TimeValue,"M","")
  2644.     TimeValue = replace(TimeValue,"m","")
  2645.     If NOT ((ucase(right(TimeValue,1))="A") or (ucase(right(TimeValue,1))="P")) then
  2646.       TimeFormat = "24"
  2647.     Else
  2648.       TempAMPM = ucase(right(TimeValue,1) & "M")
  2649.     End If
  2650.     TimeLength = len(TimeValue)-1
  2651.     StripTime = left(TimeValue,TimeLength)
  2652.     If len(StripTime) > 4 then 
  2653.       StripTime = left(StripTime,len(StripTime)-2)
  2654.     End If
  2655.     If len(StripTime) = 3 then
  2656.       TimePartA = abs(left(StripTime,1))
  2657.     Else
  2658.       TimePartA = abs(left(StripTime,2))
  2659.       TimePartB = abs(left(StripTime,2))
  2660.     End If
  2661.     If left(TimePartA, 1) = 0 then
  2662.       TimePartA = right(TimePartA, len(TimePartA)-1)
  2663.     End If
  2664.     TimePartB = right(StripTime,2)
  2665.     TempTime = TimePartA & ":" & TimePartB & " " & TempAMPM
  2666.     FormatTime2 = TempTime
  2667.   Else
  2668.     Dim hour,minute
  2669.       hour = left(TimeValue, 2)
  2670.       minute = left(TimeValue, 5)
  2671.       minute = right(minute, 2)
  2672.       If right(hour, 1) = ":" then
  2673.         hour = left(hour, 1)
  2674.       End If  
  2675.       If left(hour, 1) = "0" then
  2676.         hour = right(hour, 1)
  2677.       End If
  2678.       If right(minute,1) = ":" then
  2679.         minute = left(minute,1) & "0"
  2680.       End If
  2681.  
  2682.       If hour < 12 then
  2683.         clocktime = hour & ":" & minute & " AM"
  2684.       Else
  2685.         If hour <> 12 then
  2686.           hour = hour - 12
  2687.         End If
  2688.         clocktime =  hour & ":" & minute & " PM"
  2689.       End If
  2690.     StandardTime = clocktime
  2691.     
  2692.     TempTimeValue = StandardTime
  2693.     FormatTime2 = TempTimeValue
  2694.   End If
  2695.  
  2696. End Function
  2697.  
  2698.  
  2699. '*********************************************************************************
  2700. '******* Check Day For Event *****************************************************
  2701. '*********************************************************************************
  2702.  
  2703. Function CheckForEvent(DateToUse)
  2704.  
  2705.   If Session("CalendarFilter") > 0 then
  2706.     SQL = "SELECT * FROM Cal_Events WHERE Cal_EventCalendarID = "& Session("CalendarFilter") &" AND Cal_EventDate = #" & DateToUse & "# ORDER BY Cal_EventStartTime"
  2707.   Else
  2708.     SQL = "SELECT * FROM Cal_Events WHERE Cal_EventDate = #" & DateToUse & "# ORDER BY Cal_EventStartTime"
  2709.   End If
  2710.   Set RS=dbc.execute(SQL)
  2711.   Return = "NO"
  2712.   Do While NOT RS.EOF
  2713.     Return = "YES"
  2714.     Exit Do
  2715.     RS.MoveNext
  2716.   Loop
  2717.   RS.Close
  2718.   Set RS=Nothing
  2719.  
  2720.   CheckForEvent = Return
  2721.  
  2722. End Function
  2723.  
  2724. '*********************************************************************************
  2725. '******** Draw Horizontal Line ***************************************************
  2726. '*********************************************************************************
  2727.  
  2728. Sub DrawHLine(LineWidth)
  2729.  
  2730.   response.write "<TABLE WIDTH=100% CELLPADDING=0 CELLSPACING=0 BORDER=0 STYLE='margin-top:5px;margin-bottom:5px;'><TR><TD STYLE='height:" & LineWidth & ";background-color:" & DarkMainColor & ";filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=1, StartColorStr=" & DarkMainColor & ", EndColorStr=" & LightMainColor & ")'>"
  2731.   response.write "</TD></TR></TABLE>"
  2732.  
  2733. End Sub
  2734.  
  2735. '*********************************************************************************
  2736. '******** Draw Title *************************************************************
  2737. '*********************************************************************************
  2738.  
  2739. Sub DrawTitle(TitleWidth,TitleHeight,TitleToWrite,FontPoint)
  2740.  
  2741.   response.write "<TABLE WIDTH=100% CELLPADDING=0 CELLSPACING=0 BORDER=0 STYLE='padding:3px 3px 3px 3px;margin-top:5px;margin-bottom:5px;'><TR><TD STYLE='width:" & TitleWidth & ";height:" & TitleHeight & ";background-color:" & DarkMainColor & ";filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=1, StartColorStr=" & DarkMainColor & ", EndColorStr=" & LightMainColor & ")'>"
  2742.   response.write "<FONT STYLE='font-family:Tahoma;font-size:" & FontPoint & ";font-weight:bold;color:white;'>" & TitleToWrite & "</FONT>"
  2743.   response.write "</TD></TR></TABLE>"
  2744.  
  2745. End Sub
  2746.  
  2747. '*********************************************************************************
  2748. '******** Draw Title 2 ***********************************************************
  2749. '*********************************************************************************
  2750.  
  2751. Sub DrawTitle2(TitleWidth,TitleHeight,TitleToWrite,FontPoint)
  2752.  
  2753.   response.write "<TABLE WIDTH=100% CELLPADDING=0 CELLSPACING=0 BORDER=0 STYLE='padding:3px 3px 3px 3px;margin-top:0px;margin-bottom:5px;'><TR><TD STYLE='width:" & TitleWidth & ";height:" & TitleHeight & ";background-color:" & DarkMainColor & ";text-align:center;filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=1, StartColorStr=" & DarkMainColor & ", EndColorStr=" & LightMainColor & ")'>"
  2754.   response.write "<FONT STYLE='font-family:Tahoma;font-size:" & FontPoint & ";font-weight:bold;color:white;'>" & TitleToWrite & "</FONT>"
  2755.   response.write "</TD></TR></TABLE>"
  2756.  
  2757. End Sub
  2758.  
  2759. '*********************************************************************************
  2760. '******** Draw Title *************************************************************
  2761. '*********************************************************************************
  2762.  
  2763. Sub DrawSmallTitle(TitleWidth,TitleHeight,TitleToWrite,FontPoint)
  2764.  
  2765.   response.write "<TABLE WIDTH=100% CELLPADDING=0 CELLSPACING=0 BORDER=0 STYLE='padding:3px 3px 3px 3px;margin-top:5px;margin-bottom:5px;'><TR><TD STYLE='width:" & TitleWidth & ";height:" & TitleHeight & ";background-color:" & LightMainColor & ";filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=1, StartColorStr=" & LightMainColor & ", EndColorStr=" & MidLightColor & ")'>"
  2766.   response.write "<FONT STYLE='font-family:Tahoma;font-size:" & FontPoint & ";font-weight:bold;color:white;'>" & TitleToWrite & "</FONT>"
  2767.   response.write "</TD></TR></TABLE>"
  2768.  
  2769. End Sub
  2770.  
  2771. '*********************************************************************************
  2772. '******** Draw Button ************************************************************
  2773. '*********************************************************************************
  2774.  
  2775. Sub DrawButton(ButtonImage, ButtonAlt, ButtonText, ButtonAction, ButtonWidth)
  2776.  
  2777.   response.write "<TD ALIGN=CENTER WIDTH='" & ButtonWidth & "'>"
  2778.   If ButtonAction <> "" then
  2779.     response.write "<DIV CLASS='Button' onMouseOver=""this.className='ButtonOver'"" onMouseOut=""this.className='Button'"" onclick=""" & ButtonAction & """>"
  2780.   Else
  2781.     response.write "<DIV CLASS='Button'>"
  2782.   End If
  2783.   response.write "<TABLE HEIGHT='26' CELLPADDING=0 CELLSPACING=0><TR>"
  2784.   response.write "<TD WIDTH='3'></TD>"
  2785.   If ButtonImage <> "" then
  2786.     response.write "<TD VALIGN=CENTER><IMG ALT='" & ButtonAlt & "' BORDER=0 SRC='" & ImageFolder & ButtonImage & "'></TD>"
  2787.   End If
  2788.   If ButtonText <> "" then
  2789.     response.write "<TD VALIGN=CENTER NOWRAP><FONT CLASS='ButtonFont'> " & ButtonText & "</FONT></TD>"
  2790.   End If
  2791.   response.write "<TD WIDTH='3'></TD>"
  2792.   response.write "</TR></TABLE>"
  2793.   response.write "</DIV>"
  2794.   response.write "</TD>"
  2795.  
  2796. End Sub
  2797.  
  2798. '*********************************************************************************
  2799. '******** Draw Bad Browser Button ************************************************
  2800. '*********************************************************************************
  2801.  
  2802. Sub DrawBadBrowserButton(ButtonImage, ButtonAlt, ButtonText, ButtonAction, ButtonWidth)
  2803.  
  2804.   response.write "<TD ALIGN=CENTER WIDTH='" & ButtonWidth & "'>"
  2805.   If ButtonAction <> "" then
  2806.     response.write "<DIV CLASS='Button' onMouseOver=""this.className='ButtonOver'"" onMouseOut=""this.className='Button'"">"
  2807.     response.write "<A HREF=""" & ButtonAction & """>"
  2808.   End If
  2809.   response.write "<TABLE HEIGHT='26' CELLPADDING=0 CELLSPACING=0><TR>"
  2810.   response.write "<TD WIDTH='3'></TD>"
  2811.   If ButtonImage <> "" then
  2812.     response.write "<TD VALIGN=CENTER><IMG ALT='" & ButtonAlt & "' BORDER=0 SRC='" & ImageFolder & ButtonImage & "'></TD>"
  2813.   End If
  2814.   If ButtonText <> "" then
  2815.     response.write "<TD VALIGN=CENTER NOWRAP><FONT CLASS='ButtonFont'> " & ButtonText & "</FONT></TD>"
  2816.   End If
  2817.   response.write "<TD WIDTH='3'></TD>"
  2818.   response.write "</TR></TABLE>"
  2819.   If ButtonAction <> "" then
  2820.     response.write "</A>"
  2821.   End If
  2822.   response.write "</DIV>"
  2823.   response.write "</TD>"
  2824.  
  2825. End Sub
  2826.  
  2827. '*********************************************************************************
  2828. '******** Draw Button Seperator **************************************************
  2829. '*********************************************************************************
  2830.  
  2831. Sub DrawButtonSep
  2832.  
  2833.   response.write "<TD>"
  2834.   response.write "<DIV CLASS='Button'>"
  2835.   response.write "<TABLE HEIGHT='26' CELLPADDING=0 CELLSPACING=0><TR>"
  2836.   response.write "<TD WIDTH='3'></TD>"
  2837.   response.write "<TD WIDTH='1' BGCOLOR='" & LightMainColor & "'></TD>"
  2838.   response.write "<TD WIDTH='1' BGCOLOR='" & DarkMainColor & "'></TD>"
  2839.   response.write "<TD WIDTH='3'></TD>"
  2840.   response.write "</TR></TABLE>"
  2841.   response.write "</DIV>"
  2842.   response.write "</TD>"
  2843.  
  2844. End Sub
  2845.  
  2846. '*********************************************************************************
  2847. '******** Draw Calendar Selector *************************************************
  2848. '*********************************************************************************
  2849.  
  2850. Sub DrawCalendarSelector
  2851.  
  2852.   response.write "<TD>"
  2853.   response.write "<FORM METHOD=POST NAME='CalendarForm' ACTION='calendar.asp?action=" & request.querystring("action") & "&date=" & request.querystring("date") & "' STYLE='margin-bottom:0px;'>"
  2854.   response.write "<SELECT NAME='txtCalSelector' onChange='CalendarForm.submit();' STYLE='font-family:Arial;font-size:7pt;'>"
  2855.   response.write "<OPTION VALUE='0'"
  2856.   If cint(Session("CalendarFilter")) = 0 then
  2857.     response.write " SELECTED"
  2858.   End If
  2859.   response.write ">ALL CALENDARS</OPTION>"
  2860.   SQLc = "SELECT * FROM Cal_Calendars ORDER BY Cal_CalendarName"
  2861.   Set RSc=dbc.execute(SQLc)
  2862.   Do While NOT RSc.EOF
  2863.     response.write "<OPTION VALUE='" & RSc("Cal_CalendarID") & "' STYLE='font-family:Arial;font-size:7pt;color:" & RSc("Cal_CalendarColor") & ";'"
  2864.     If cint(Session("CalendarFilter")) = RSc("Cal_CalendarID") then
  2865.       response.write " SELECTED"
  2866.     End If
  2867.     response.write ">"
  2868.     response.write "█ "
  2869.     response.write RSc("Cal_CalendarName") & "</OPTION>"
  2870.     RSc.MoveNext
  2871.   Loop
  2872.   RSc.Close
  2873.   Set RSc=Nothing
  2874.   response.write "</SELECT>"
  2875.   response.write "</FORM>"
  2876.   response.write "</TD>"
  2877.  
  2878. End Sub
  2879.  
  2880. '*********************************************************************************
  2881. '******** Draw Time Drop Down ****************************************************
  2882. '*********************************************************************************
  2883.  
  2884. Sub CreateTimeDropDown(TimeToWrite, PartOfDay, WhichField)
  2885.  
  2886. If TimeFormatToUse = "12" then
  2887.   If TimeToWrite <> "12" then
  2888.     response.write "<OPTION VALUE='" & TimeToWrite & ":00 " & PartOfDay & "'"
  2889.     If TimeToWrite = "9" AND PartOfDay = "AM" AND WhichField = "Start" then
  2890.       response.write " SELECTED"
  2891.     End If
  2892.     If TimeToWrite = "10" AND PartOfDay = "AM" AND WhichField = "End" then
  2893.       response.write " SELECTED"
  2894.     End If
  2895.     response.write ">" & TimeToWrite & ":00 " & PartOfDay & "</OPTION>"
  2896.     response.write "<OPTION VALUE='" & TimeToWrite & ":15 " & PartOfDay & "'>" & TimeToWrite & ":15 " & PartOfDay & "</OPTION>"
  2897.     response.write "<OPTION VALUE='" & TimeToWrite & ":30 " & PartOfDay & "'>" & TimeToWrite & ":30 " & PartOfDay & "</OPTION>"
  2898.     response.write "<OPTION VALUE='" & TimeToWrite & ":45 " & PartOfDay & "'>" & TimeToWrite & ":45 " & PartOfDay & "</OPTION>"
  2899.   Else
  2900.     If PartOfDay = "AM" then 
  2901.       response.write "<OPTION VALUE='" & TimeToWrite & ":00 PM'>Noon</OPTION>"
  2902.       response.write "<OPTION VALUE='" & TimeToWrite & ":15 PM'>" & TimeToWrite & ":15 PM</OPTION>"
  2903.       response.write "<OPTION VALUE='" & TimeToWrite & ":30 PM'>" & TimeToWrite & ":30 PM</OPTION>"
  2904.       response.write "<OPTION VALUE='" & TimeToWrite & ":45 PM'>" & TimeToWrite & ":45 PM</OPTION>"
  2905.     Else
  2906.       response.write "<OPTION VALUE='11:59 PM'>Midnight</OPTION>"
  2907.     End If
  2908.   End If
  2909. Else
  2910.   If TimeToWrite <> "12" then
  2911.     response.write "<OPTION VALUE='" & TimeToWrite & ":00 " & PartOfDay & "'"
  2912.     If TimeToWrite = "9" AND PartOfDay = "AM" AND WhichField = "Start" then
  2913.       response.write " SELECTED"
  2914.     End If
  2915.     If TimeToWrite = "10" AND PartOfDay = "AM" AND WhichField = "End" then
  2916.       response.write " SELECTED"
  2917.     End If
  2918.     If PartOfDay = "AM" then
  2919.       If TimeToWrite < 10 then
  2920.         response.write ">" & "0" & TimeToWrite & ":00 </OPTION>"
  2921.         response.write "<OPTION VALUE='" & TimeToWrite & ":15 " & PartOfDay & "'>" & "0" & TimeToWrite & ":15</OPTION>"
  2922.         response.write "<OPTION VALUE='" & TimeToWrite & ":30 " & PartOfDay & "'>" & "0" & TimeToWrite & ":30</OPTION>"
  2923.         response.write "<OPTION VALUE='" & TimeToWrite & ":45 " & PartOfDay & "'>" & "0" & TimeToWrite & ":45</OPTION>"
  2924.       Else
  2925.         response.write ">" & TimeToWrite & ":00 </OPTION>"
  2926.         response.write "<OPTION VALUE='" & TimeToWrite & ":15 " & PartOfDay & "'>" & TimeToWrite & ":15</OPTION>"
  2927.         response.write "<OPTION VALUE='" & TimeToWrite & ":30 " & PartOfDay & "'>" & TimeToWrite & ":30</OPTION>"
  2928.         response.write "<OPTION VALUE='" & TimeToWrite & ":45 " & PartOfDay & "'>" & TimeToWrite & ":45</OPTION>"
  2929.       End If
  2930.     Else
  2931.       response.write ">" & cint(TimeToWrite) + 12 & ":00 </OPTION>"
  2932.       response.write "<OPTION VALUE='" & TimeToWrite & ":15 " & PartOfDay & "'>" & cint(TimeToWrite) + 12 & ":15</OPTION>"
  2933.       response.write "<OPTION VALUE='" & TimeToWrite & ":30 " & PartOfDay & "'>" & cint(TimeToWrite) + 12 & ":30</OPTION>"
  2934.       response.write "<OPTION VALUE='" & TimeToWrite & ":45 " & PartOfDay & "'>" & cint(TimeToWrite) + 12 & ":45</OPTION>"
  2935.     End If
  2936.   Else
  2937.     If PartOfDay = "AM" then 
  2938.       response.write "<OPTION VALUE='" & TimeToWrite & ":00 PM'>Noon</OPTION>"
  2939.       response.write "<OPTION VALUE='" & TimeToWrite & ":15 PM'>" & TimeToWrite & ":15</OPTION>"
  2940.       response.write "<OPTION VALUE='" & TimeToWrite & ":30 PM'>" & TimeToWrite & ":30</OPTION>"
  2941.       response.write "<OPTION VALUE='" & TimeToWrite & ":45 PM'>" & TimeToWrite & ":45</OPTION>"
  2942.     Else
  2943.       response.write "<OPTION VALUE='11:59 PM'>Midnight</OPTION>"
  2944.     End If
  2945.   End If
  2946. End If
  2947.  
  2948. End Sub
  2949.  
  2950. '*********************************************************************************
  2951. '******** SQL Injection Filter ***************************************************
  2952. '*********************************************************************************
  2953.  
  2954. Function SafeSQL(sInput)
  2955.   TempString = sInput
  2956.   'sBadChars=array("select", "drop", ";", "--", "insert", "delete", "xp_", "#", "%", "&", "'", "(", ")", "/", "\", ":", ";", "<", ">", "=", "[", "]", "?", "`", "|") 
  2957.   sBadChars=array("select", "drop", ";", "--", "insert", "delete", "xp_", "#", "%", "&", "'", "(", ")", ":", ";", "<", ">", "=", "[", "]", "?", "`", "|") 
  2958.   For iCounter = 0 to uBound(sBadChars)
  2959.     TempString = replace(TempString,sBadChars(iCounter),"")
  2960.   Next
  2961.   SafeSQL = TempString
  2962. End function
  2963.  
  2964. '*********************************************************************************
  2965. '******** FixString Function *****************************************************
  2966. '*********************************************************************************
  2967.  
  2968. Function FixString(strSource)
  2969.     strSource = Replace(strSource, "'", "''")
  2970.     strSource = Replace(strSource, "''''", "''")
  2971.     FixString = Replace(strSource, "'''", "''")
  2972. End Function
  2973.  
  2974.  
  2975.  
  2976. %>