<%@ Language=VBScript %> <% ' initialize variables dBandOnly = request.querystring("BAND") if dBandOnly = "" then dBandOnly = "Y" elseif left(ucase(dBandOnly),1) = "Y" then dBandOnly = "Y" end if NID = request.querystring("NID") ' open database connection Set dbNewsItems = Server.CreateObject("ADODB.Connection") dbNewsItems.open "DRIVER={MySQL ODBC 3.51 Driver};PORT=3306;SEREVER=localhost;DataBase=sound53_masterdata;UID=sound53_dbuser;PWD=SOSdb2012" SQLStatement = "SELECT * FROM performances WHERE counter = " & NID set rsPerformances = dbNewsItems.Execute(SQLStatement) wEventName = replace(rsPerformances("event_name"), " ", "_") dim strvCalendar strvCalendar = BuildVCalendar(rsPerformances) response.contenttype = "text/x-vCalendar" response.AddHeader "Content-Disposition", "Filename=Event_" & wEventName & ".vcs;" response.write strvCalendar response.end Function BuildVCalendar(byval objRS) ' - configure our Time Zone Factor. Set this to the value ' - that needs to be added/subtracted from the date/time ' - to convert the event date/time to GMT time ' - base it on your Web Server's time zone ' - In my case, Eastern Time is 5.5 hours behind GMT so ' - to get GMT, I need to add 5.5 hours CONST TIMEZ0NE_FACTOR = +5.5 Dim dtStart, dtEnd, dtStartTime, dtEndTime, strSubject, strLocation, strDesc ' -- Assuming Event_Begin_Date and Event_End_Date hold ' -- Date and Time values dtStart = objRS("performance_date") 'DateAdd("h",TIMEZONE_FACTOR, objRS("performance_date") & objRS("start_time")) dtStartTime = DateAdd("h", 6, objRS("start_time")) dtEndTime = DateAdd("h", 6, objRS("duration")) dtDate = Right("0000" & Year(dtStart), 4) & _ Right("00" & Month(dtStart), 2) & _ Right("00" & Day(dtStart), 2) ' -- Format it properly as YYYYMMDDThhmmssZ dtStart = dtDate & _ "T" & _ Right("00" & Hour(dtStartTime), 2) & _ Right("00" & Minute(dtStartTime), 2) & _ Right("00" & Second(dtStartTime), 2) & _ "Z" dtEnd = dtDate & _ "T" & _ Right("00" & Hour(dtEndTime), 2) & _ Right("00" & Minute(dtEndTime), 2) & _ Right("00" & Second(dtEndTime), 2) & _ "Z" ' -- strEventName = objRS("event_name") strDescription = objRS("event_description") strStartTime = objRS("start_time"):if strStartTime = "" then strStartTime = "TBD" if objRS("duration") & "" = "" then ' do nothing else strStartTime = strStartTime & " - " & objRS("duration") end if strSubject = objRS("event_name"):if strSubject = "" then strSubject = "TBD" strLocation = objRS("location"):if strLocation = "" then strLocation = "TBD" strDirections = objRS("directions"):if strDirections = "" then strDirections = "TBD" strDress = objRS("dress"):if strDress = "" then strDress = "TBD" strCallTime = objRS("call_time"):if strCallTime = "" then strCallTime = "TBD" strDescription = "Event: " & strEventName & "=0D=0A Description: " & strDescription & "=0D=0A Start Time: " & strStartTime & "=0D=0A Call Time: " & strCallTime & "=0D=0A Dress: " & strDress & "=0D=0A Call Time: " & strCallTime strDescription = strDescription & "=0A=0D Location: " & strLocation & "=0A=0D Directions: " & strDirections BuildVCalendar = "BEGIN:VCALENDAR" & vbCrlf BuildVCalendar = BuildVCalendar & "VERSION:1.0" & vbCrlf BuildVCalendar = BuildVCalendar & "BEGIN: VEVENT" & vbCrlf BuildVCalendar = BuildVCalendar & "DTStart:" & dtStart & vbCrlf BuildVCalendar = BuildVCalendar & "DTEnd:" & dtEnd & vbCrlf BuildVCalendar = BuildVCalendar & "SUMMARY;ENCODING=QUOTED-PRINTABLE:" & strSubject & vbCrlf BuildVCalendar = BuildVCalendar & "DESCRIPTION;ENCODING=QUOTED-PRINTABLE:" & strDescription & vbCrlf BuildVCalendar = BuildVCalendar & "Location;ENCODING=QUOTED-PRINTABLE:" & strLocation & vbCrlf BuildVCalendar = BuildVCalendar & "UID:" & objRS("counter") & dtStart & strSubject & vbCrlf BuildVCalendar = BuildVCalendar & "PRIORITY:3" & vbCrlf BuildVCalendar = BuildVCalendar & "End:VEVENT" & vbCrlf BuildVCalendar = BuildVCalendar & "End:VCALENDAR" & vbCrlf & vbCrlf End Function %> Calendar Summary Event: <% = wEventName %> Start Time: <% = rsPerformances("start_time") %>
End Time: <% = rsPerformances("duration") %>
Cal Event:
<% = strvCalendar %>