Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <cfsilent>
- <!---
- BEGIN:VCALENDAR
- PRODID:-//Microsoft Corporation//Outlook MIMEDIR//EN
- VERSION:1.0
- BEGIN:VEVENT
- DTSTART:19980114T210000Z
- DTEND:19980114T230000Z
- LOCATION:My office
- CATEGORIES:Business
- DESCRIPTION;ENCODING=QUOTED-PRINTABLE:This is a note associated with the
- meeting=0D=0A
- SUMMARY:Meeting to discuss salaries
- PRIORITY:3
- END:VEVENT
- END:VCALENDAR
- NOTE: The DTSTART and DTEND entries are a combination of the date and time
- in the format, YYYYMMDDThhmmssZ, where YYYY=year, MM=month, DD=day of the
- month, T=start time character, hh=hour, mm=minutes, ss=seconds, Z=end
- character. This string expresses the time as Greenwich Mean Time (GMT), on
- a 24-hour clock so must be adjusted to your time zone.
- --->
- <cfscript>
- // assure handler passed in necessary params
- obj = getRCData(name="obj", throw="No record present.");
- // default id
- id = getRCID(override=obj);
- course = obj.getCourse();
- startdate = parseDateTime(obj.getStartDate() & " " & obj.getStartTime());
- enddate = parseDateTime(obj.getEndDate() & " " & obj.getEndTime());
- startGMT = DateAdd("s",GetTimeZoneInfo().UTCTotalOffset,startdate);
- endGMT = DateAdd("s",GetTimeZoneInfo().UTCTotalOffset,enddate);
- </cfscript>
- <cfset CRLF = Chr(13) & Chr(10)>
- <cfset name="#course.getName()# [#course.getCourseNumber()#]">
- <cfif course.getName() neq obj.getName()>
- <cfset name = name & " - " & obj.getName()>
- </cfif>
- <cfset filename = replace(obj.getName()," ", "_", "all")>
- <cfset vcard = "BEGIN:VCALENDAR#CRLF#PRODID:-//Microsoft Corporation//Outlook MIMEDIR//EN#CRLF#VERSION:1.0#CRLF#BEGIN:VEVENT" & CRLF>
- <cfset vcard = vcard & "DTSTART:#dateFormat(startGMT,"yyyymmdd")#T#timeFormat(startGMT,'HHmmss')#Z" & CRLF>
- <cfset vcard = vcard & "DTEND:#dateFormat(endGMT,"yyyymmdd")#T#timeFormat(endGMT,'HHmmss')#Z" & CRLF>
- <!---<cfset vcard = vcard & "LOCATION:" & CRLF>--->
- <!---<cfset vcard = vcard & "CATEGORIES:">
- <cfloop array="#obj.getTags(activeOnly=true)#" index="tag_obj">
- <cfset vcard = vcard & tab_obj.getName() & ",">
- </cfloop>
- <cfset vcard = vcard & CRLF>
- --->
- <cfset vcard = vcard & "DESCRIPTION;ENCODING=QUOTED-PRINTABLE:">
- <cfset vcard = vcard & obj.getDescription()>
- <cfset vcard = vcard & CRLF>
- <cfset vcard = vcard & "SUMMARY:#name#" & CRLF>
- <cfset vcard = vcard & "PRIORITY:3#CRLF#END:VEVENT#CRLF#END:VCALENDAR">
- <cffile action="write" file="/home/vhosts/tmp/vcalendar_#id#.vcf" output="#vcard#" addNewLine="no">
- </cfsilent>
- <cfheader name="Content-Disposition" value="inline; filename=#filename#.vcs">
- <cfcontent type="text/x-vCalendar"
- file = "/home/vhosts/tmp/vcalendar_#id#.vcf"
- deleteFile = "yes">
Add Comment
Please, Sign In to add comment