Guest User

Untitled

a guest
Sep 2nd, 2018
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <cfsilent>
  2. <!---
  3. BEGIN:VCALENDAR
  4. PRODID:-//Microsoft Corporation//Outlook MIMEDIR//EN
  5. VERSION:1.0
  6. BEGIN:VEVENT
  7. DTSTART:19980114T210000Z
  8. DTEND:19980114T230000Z
  9. LOCATION:My office
  10. CATEGORIES:Business
  11. DESCRIPTION;ENCODING=QUOTED-PRINTABLE:This is a note associated with the
  12. meeting=0D=0A
  13. SUMMARY:Meeting to discuss salaries
  14. PRIORITY:3
  15. END:VEVENT
  16. END:VCALENDAR
  17.  
  18. NOTE: The DTSTART and DTEND entries are a combination of the date and time
  19. in the format, YYYYMMDDThhmmssZ, where YYYY=year, MM=month, DD=day of the
  20. month, T=start time character, hh=hour, mm=minutes, ss=seconds, Z=end
  21. character. This string expresses the time as Greenwich Mean Time (GMT), on
  22. a 24-hour clock so must be adjusted to your time zone.
  23. --->
  24. <cfscript>
  25.     // assure handler passed in necessary params
  26.     obj = getRCData(name="obj", throw="No record present.");
  27.    
  28.     // default id
  29.     id = getRCID(override=obj);
  30.    
  31.     course = obj.getCourse();
  32.    
  33.     startdate = parseDateTime(obj.getStartDate() & " " & obj.getStartTime());
  34.     enddate = parseDateTime(obj.getEndDate() & " " & obj.getEndTime());
  35.     startGMT = DateAdd("s",GetTimeZoneInfo().UTCTotalOffset,startdate);
  36.     endGMT = DateAdd("s",GetTimeZoneInfo().UTCTotalOffset,enddate);
  37. </cfscript>
  38. <cfset CRLF = Chr(13) & Chr(10)>
  39. <cfset name="#course.getName()# [#course.getCourseNumber()#]">
  40. <cfif course.getName() neq obj.getName()>
  41.     <cfset name = name & " - " & obj.getName()>
  42. </cfif>
  43. <cfset filename = replace(obj.getName()," ", "_", "all")>
  44.  
  45. <cfset vcard = "BEGIN:VCALENDAR#CRLF#PRODID:-//Microsoft Corporation//Outlook MIMEDIR//EN#CRLF#VERSION:1.0#CRLF#BEGIN:VEVENT" & CRLF>
  46. <cfset vcard = vcard & "DTSTART:#dateFormat(startGMT,"yyyymmdd")#T#timeFormat(startGMT,'HHmmss')#Z" & CRLF>
  47. <cfset vcard = vcard & "DTEND:#dateFormat(endGMT,"yyyymmdd")#T#timeFormat(endGMT,'HHmmss')#Z" & CRLF>
  48. <!---<cfset vcard = vcard & "LOCATION:" & CRLF>--->
  49. <!---<cfset vcard = vcard & "CATEGORIES:">
  50. <cfloop array="#obj.getTags(activeOnly=true)#" index="tag_obj">
  51.     <cfset vcard = vcard & tab_obj.getName() & ",">
  52. </cfloop>
  53. <cfset vcard = vcard & CRLF>
  54. --->
  55. <cfset vcard = vcard & "DESCRIPTION;ENCODING=QUOTED-PRINTABLE:">
  56. <cfset vcard = vcard & obj.getDescription()>
  57. <cfset vcard = vcard & CRLF>
  58. <cfset vcard = vcard & "SUMMARY:#name#" & CRLF>
  59.  
  60. <cfset vcard = vcard & "PRIORITY:3#CRLF#END:VEVENT#CRLF#END:VCALENDAR">
  61. <cffile action="write" file="/home/vhosts/tmp/vcalendar_#id#.vcf" output="#vcard#" addNewLine="no">
  62. </cfsilent>
  63. <cfheader name="Content-Disposition" value="inline; filename=#filename#.vcs">
  64. <cfcontent type="text/x-vCalendar"
  65.     file = "/home/vhosts/tmp/vcalendar_#id#.vcf"
  66.     deleteFile = "yes">
Add Comment
Please, Sign In to add comment