|
|
[an error occurred while processing this directive]
[an error occurred while processing this directive]
[an error occurred while processing this directive]
[an error occurred while processing this directive]
<%
'
'EzEvents - Version 1.1
'
'Written By: George Chastain
' Huntsville, Alabama
' Website: http://home.hiwaay.net/~georgech/
'
' You are free to use this code for any purpose but please retain the author and copyright
' information. If you make any enhancements to this code, I would like to know about them.
' You can reach me through my website address above.
'
' Thank you.
'
'SOURCE FILE: DisplayCalendar.inc
'DESCRIPTION: This file supplies the code to generate the calendar for the current month.
'
'Modifications:
'
'25 June 2001 Initial Creation
'24 August 2001 Modified code to prevent display of left arrow (previous month) control
' if the calendar is displaying the first month of the current year.
' I never designed the application to support dates before that because I
' planned to use this application to display events scheduled in the future
' along with those that recently expired for reference.
' ***************************************************************************************
' ***************************************************************************************
' Begin declarations
' ***************************************************************************************
' ***************************************************************************************
Dim strPageTitle ' The title of this page.
Dim objConn ' Database connection object
Dim objRecordset ' Database recordset object
Dim strPath ' Path to database
Dim strSQL ' SQL string
Dim dDate ' Date we're displaying calendar for
Dim todaydate ' Today's date
Dim today ' The day portion of today's date.
Dim todaymonth ' The month portion of today's date.
Dim dtTempDate ' Used during calculations
Dim dtExpireDate ' For cleaning old events.
Dim strReturnPage ' The current Calendar View
Dim strReturnMonth ' The month last viewed in the calendar
Dim strReturnYear ' The year last viewed in the calendar
Dim dtDay 'Stores the day for the date stored in dDate
Dim dtMonth 'Stores the month for the date stored in dDate
Dim dtYear 'Stores the year for the date stored in dDate
Dim strReturnYearTmpArray
Dim passedval 'passed category number
strPageTitle=""
strReturnPage=""
strReturnYear=""
strReturnMonth = Request.QueryString("ReturnMonth")
strReturnYear = Request.QueryString("ReturnYear")
passedval = Request.QueryString("cat")
'response.write "Passedval= " & passedval
if passedval = "" then
passedval = "1"
end if
dim objRS, strConnection,strq, caltitle
Set objConn = Server.CreateObject("ADODB.Connection")
'strConnection = "DSN=users1"
strConnection="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("/Database/users.mdb")
objConn.Open strConnection
Set objRS = Server.Createobject("ADODB.Recordset")
Set objRS.ActiveConnection= objConn
strq = "select * from categories where CategoryID='" & passedval & "'"
'strq = "select * from usertable where username='newuser1'"
'response.write "strq = " & strq & " "
objRS.Open strq
if objRS.EOF then
caltitle="Invalid Category"
else
caltitle=objRS("CategoryName")
'response.write "invalid password "
'response.write "userpassword = " & objRS("userpw") & " "
end if
objConn.close
Set objRS=Nothing
Set objConn = Nothing
'Current design allows for the possibility that the ReturnYear query string is undefined,
'contains a number (the year), or it may contain a number with a "#" followed by a tag name
'to jump to within the page. However, although the browser interprets the "#..." as a tag
'to jump to, it does NOT remove that text from the end of the URL. So, when calling
'Request.QueryString() to obtain the value of ReturnYear, you may get the "#..." tacked on to
'the end. As a result, we have to have code to remove this from the value.
'
if Len(strReturnYear & "") <> 0 then
if InStr(1,strReturnYear,"#",1) > 0 then
strReturnYearTmpArray = Split(strReturnYear,"#",-1,1)
strReturnYear = strReturnYearTmpArray(0)
end if
end if
strReturnPage="schoolcalendar.asp" ' The current Calendar View is the default (current month) view
'Find event database and connect.
strPath = Server.MapPath(DATABASE)
DBConnect(strPath )
'Get all events.
Set objRecordset = Server.CreateObject("ADODB.Recordset")
'objRecordset.Open "calendar", objConn, adOpenKeyset, adLockPessimistic , adCmdTable
Set objRecordset.ActiveConnection= objConn
strq = "select * from calendar order by Subject"
'strq = "select * from usertable where username='newuser1'"
'response.write "strq = " & strq & " "
objRecordset.Open strq
' *************************************************************************************************
' *************************************************************************************************
' Begin main body of Event Calendar APP
' *************************************************************************************************
' *************************************************************************************************
' Get today's date.
todaydate = Date
today= Day(todaydate )
todaymonth = Month(todaydate)
' See if the Month and Year passed into this page is a valid month/year.
If IsDate(strReturnMonth & " " & "1, " & strReturnYear ) Then
dDate = CDate(strReturnMonth & " " & "1, " & strReturnYear)
Else
' Either there was not a month/year passed in or it was invalid. Set dDate to the current
' date.
dDate = Date()
End If
' Get the Day, Month and Year for the date stored in dDate.
dtDay = Day(dDate)
dtMonth = Month(dDate)
dtYear = Year(dDate)
strReturnYear = dtYear
strReturnMonth = dtMonth
'Begin generating Event Calendar App Main Table
Response.Write("" & vbCrLf)
'[an error occurred while processing this directive]
%>
<%
'Begin Event Calendar App Main Table 2nd Row. This is the row that contains the output of the app.
Response.Write(" " & vbCrLf)
Response.Write(" " & vbCrLf)
Response.Write("" & vbCrLf)
' We want the padding/spacing the same for the content row as for the header row so it will look nice.
Response.Write("" & vbCrLf)
Response.Write("" & vbCrLf)
Response.Write("" & vbCrLf)
'Response.Write("" & vbCrLf)
'Response.Write("All past events will be deleted after " & -(EVENTEXPIRATIONPERIOD) & " days! " & vbCrLf)
'Response.Write("" & vbCrLf)
Response.Write("" & vbCrLf)
Response.Write("" & vbCrLf)
%>
[an error occurred while processing this directive]
<%
'Begin generating month for the calendar.
' ********************************************************************************
' ********************************************************************************
' *********************************************************************************************
Dim iDaysInMonth ' How many days are in the month that is being generated?
Dim iWeekdayMonthStartsOn ' What weekday does the month being generated start on?
Dim iDayOfMonthIndex ' What Day of the Month are we on?
Dim iColumnPosition ' What weekday column in the week row are we on?
Dim iColWidth ' The width for each column. Variable according to day of week
'Get the number of days in the month stored in dDate.
iDaysInMonth = GetDaysInMonth(Month(dDate), Year(dDate))
'What weekday does the month stored in dDate start on?
iWeekdayMonthStartsOn = GetWeekdayMonthStartsOn(Month(dDate), Year(dDate))
'Generate client-side javascript to operate the pull-down selection boxes for the month
'and year that will be displayed in the month's calendar.
Response.Write("" & vbCrLf)
Response.Write("" & vbCrLf)
' End generating Month
' ********************************************************************************
' ********************************************************************************
' ********************************************************************************
' Check to see if autodelete of expired events is turned on.
if ENABLEAUTODELETE = true then
'Prepare to clean old events from database
dtExpireDate = DateAdd("d",EVENTEXPIRATIONPERIOD,todaydate)
'We must check the End Date of the event agains the current date to see if the event
'has technically expired and therefore must be deleted.
strSQL = "DELETE FROM " & "calendar" & " WHERE DateVal2 < " & CDbl(dtExpireDate)
end if
'Close and destroy connection and recordset objects.
objConn.Execute(strSQL)
objRecordset.Close
Set objRecordset = Nothing
DBClose
Response.Write("" & vbCrLf)
if ALLOWADD = true then
Response.Write("| " & vbCrLf)
Response.Write("")
Response.Write(" | " & vbCrLf)
end if
'Response.Write(" | " & vbCrLf)
Response.Write(" | "& vbCrLf)
'Response.Write(" | " & vbCrLf)
Response.Write(" | " & vbCrLf)
Response.Write("" & vbCrLf)
Response.Write("All past events will be deleted after " & -(EVENTEXPIRATIONPERIOD) & " days! " & vbCrLf)
Response.Write(" | " & vbCrLf)
Response.Write(" " & vbCrLf)
Response.Write(" " & vbCrLf)
%>
[an error occurred while processing this directive]
|
|