var retHTML = "";
var icalData = StructNew();
var appConfig = getAppConfig();
var dayBeginTime = getDayBeginTime();
var dayEndTime = getDayEndTime();
//var sTime = arguments.startTime;
///var eTime = arguments.endTime;
var contactEmail = "noreply@organization.org";
var startDateTime = "";
var endDateTime = "";
var alldayEvent = 0;
var actionApp = getAppBeanName();
var actionBean = "calEventsiCalService";
var actionMethod = "iCalProxy";
var actionURL = "#application.ADF.ajaxProxy#?app=#actionApp#&bean=#actionBean#&method=#actionMethod#";
//var actionURL = "#request.subsiteCache[1].url#_cs_apps/pt_calendar/customcf/icalProxy.cfm";
if ( LEN(TRIM(arguments.allDay)) AND arguments.allDay ) {
//sTime = dayBeginTime;
//sTime = dayEndTime;
startDateTime = DateFormat(arguments.eventDate);
// For all day events add 1 date with out a time
endDateTime = DateFormat(DateAdd("d",1,arguments.eventDate));
alldayEvent = 1;
}
else {
alldayEvent = 0;
startDateTime = application.ptCalendar.date.formatDateTimeISO8601(
date=arguments.eventDate
,time=arguments.startTime
);
if ( LEN(TRIM(arguments.endTime)) EQ 0 )
arguments.endTime = dayEndTime;
endDateTime = application.ptCalendar.date.formatDateTimeISO8601(
date=arguments.eventDate
,time=arguments.endTime
);
}
if ( LEN(TRIM(arguments.organizerEmail)) )
contactEmail=arguments.organizerEmail;
else if ( StructKeyExists(appConfig,"iCalFromEmail") AND LEN(TRIM(appConfig.iCalFromEmail)) )
contactEmail=appConfig.iCalFromEmail; // TODO: get from a default setting in the App config or use the event organizer
// load jQuery headers
application.ptCalendar.scripts.loadJQuery();
// Load the DateJS Plugin Headers
application.ptCalendar.scripts.loadDateJS();
// load header for jQuery iCalendar
application.ptCalendar.scripts.loadJQueryiCalendar();
#arguments.downloadText#
var iCalOutput = "";
#arguments.content#
// Convert the supplied parameters into formated variables structure with
var eventStruct = arguments;
eventStruct.startDateTime = ParseDateTime(DateFormat(arguments.eventDate) & " " & TimeFormat(arguments.startTime));
eventStruct.endDateTime = ParseDateTime(DateFormat(arguments.eventDate) & " " & TimeFormat(arguments.endTime));
#formatDataForiCal(eventStruct)#
#icaloutput#
var retStr = "";
var text = arguments.textStr;
while ( len(text) > arguments.lineLength ) {
retStr = retStr & Mid(text, 1, arguments.lineLength) & arguments.lineBreak;
text = Mid(text, arguments.lineLength+1, Len(text));
}
retStr = retStr & text;
return retStr;
var vCal = "";
var CRLF=chr(13)&chr(10);
var date_now = Now();
if (NOT StructKeyExists(stEvent,"organizerName"))
stEvent.organizerName = "";
if (NOT StructKeyExists(stEvent,"organizerEmail"))
stEvent.organizerEmail = "calendar@organization.org"; //FIX
if (NOT StructKeyExists(stEvent,"eventURL"))
stEvent.eventURL = "";
if (NOT StructKeyExists(stEvent,"title"))
stEvent.title = "";
if (NOT StructKeyExists(stEvent,"subject"))
stEvent.subject = "";
if (NOT StructKeyExists(stEvent,"location"))
stEvent.location = "";
// Event Description\n---------------------------\nProvide the complete event details\n\nUse backslash+n sequences for newlines.
if (NOT StructKeyExists(stEvent,"description"))
stEvent.description = "";
if (NOT StructKeyExists(stEvent,"startDateTime"))
stEvent.startDateTime = DateConvert('local2Utc', date_now);
else
stEvent.startDateTime = DateConvert('local2Utc', stEvent.startDateTime);
if (NOT StructKeyExists(stEvent,"endDateTime"))
stEvent.endDateTime = DateConvert('local2Utc', date_now);
else
stEvent.endDateTime = DateConvert('local2Utc', stEvent.endDateTime);
if (NOT StructKeyExists(stEvent,"priority"))
stEvent.priority = "1";
if (NOT StructKeyExists(stEvent,"AlarmTrigger")) // '-PT30M' - alert user 30 minutes before meeting begins
stEvent.AlarmTrigger = "";
vCal = 'BEGIN:VCALENDAR' & CRLF;
vCal = vCal & 'PRODID: -//CFLIB.ORG//iCalUS()//EN' & CRLF;
vCal = vCal & 'VERSION:2.0' & CRLF;
vCal = vCal & 'METHOD:PUBLISH' & CRLF;
vCal = vCal & 'BEGIN:VEVENT' & CRLF;
vCal = vCal & 'UID:#date_now.getTime()#.ptCalendar' & CRLF; // creates a unique identifier
if ( LEN(TRIM(stEvent.eventURL)) )
vCal = vCal & 'URL:#stEvent.eventURL#' & CRLF;
if ( LEN(TRIM(stEvent.organizerName)) AND LEN(TRIM(stEvent.organizerEmail)) )
vCal = vCal & 'ORGANIZER;CN="#stEvent.organizerName#":MAILTO:#stEvent.organizerEmail#' & CRLF;
else if ( LEN(TRIM(stEvent.organizerEmail)) )
vCal = vCal & 'MAILTO:#stEvent.organizerEmail#' & CRLF;
vCal = vCal & 'DTSTAMP:' &
DateFormat(date_now, 'yyyymmdd') & 'T' &
TimeFormat(date_now, 'HHmmss') & 'Z' & CRLF;
if ( LEN(TRIM(stEvent.title)) )
vCal = vCal & 'TITLE:#iCalTextWrap(stEvent.title)#' & CRLF;
vCal = vCal & 'DTSTART:' &
DateFormat(stEvent.startDateTime,'yyyymmdd') & 'T' &
TimeFormat(stEvent.startDateTime, 'HHmmss') & 'Z' & CRLF;
vCal = vCal & 'DTEND:' &
DateFormat(stEvent.endDateTime,'yyyymmdd') & 'T' &
TimeFormat(stEvent.endDateTime, 'HHmmss') & 'Z' & CRLF;
if ( LEN(TRIM(stEvent.subject)) )
vCal = vCal & 'SUMMARY:#iCalTextWrap(stEvent.subject)#' & CRLF;
if ( LEN(TRIM(stEvent.location)) )
vCal = vCal & 'LOCATION:#iCalTextWrap(stEvent.location)#' & CRLF;
if ( LEN(TRIM(stEvent.description)) )
vCal = vCal & 'DESCRIPTION:#iCalTextWrap(stEvent.description)#' & CRLF;
vCal = vCal & 'PRIORITY:#stEvent.priority#' & CRLF;
vCal = vCal & 'TRANSP:OPAQUE' & CRLF;
vCal = vCal & 'CLASS:PUBLIC' & CRLF;
if ( LEN(TRIM(stEvent.AlarmTrigger)) )
{
vCal = vCal & 'BEGIN:VALARM' & CRLF;
vCal = vCal & 'TRIGGER:#stEvent.AlarmTrigger#' & CRLF;
vCal = vCal & 'ACTION:DISPLAY' & CRLF;
vCal = vCal & 'DESCRIPTION:Reminder' & CRLF;
vCal = vCal & 'END:VALARM' & CRLF;
}
vCal = vCal & 'END:VEVENT' & CRLF;
vCal = vCal & 'END:VCALENDAR';
// Return the concantinated string
return Trim(vCal);
var vCal = "";
var CRLF=chr(13)&chr(10);
var date_now = Now();
if (NOT StructKeyExists(stEvent,"organizerName"))
stEvent.organizerName = "";
if (NOT StructKeyExists(stEvent,"organizerEmail"))
stEvent.organizerEmail = "noreply@organization.org"; //FIX
if (NOT StructKeyExists(stEvent,"eventURL"))
stEvent.eventURL = "";
if (NOT StructKeyExists(stEvent,"title"))
stEvent.title = "";
// Event subject
if (NOT StructKeyExists(stEvent,"subject"))
stEvent.subject = "";
//Event location
if (NOT StructKeyExists(stEvent,"location"))
stEvent.location = "";
// Event description\n---------------------------\nProvide the complete event details\n\nUse backslash+n sequences for newlines.
if (NOT StructKeyExists(stEvent,"description"))
stEvent.description = "";
if (NOT StructKeyExists(stEvent,"startDateTime")) // This value must be in Eastern time!!!
stEvent.startDateTime = ParseDateTime(date_now);
if (NOT StructKeyExists(stEvent,"endDateTime")) // This value must be in Eastern time!!!
stEvent.endDateTime = ParseDateTime(date_now);
if (NOT StructKeyExists(stEvent,"priority"))
stEvent.priority = "1";
if (NOT StructKeyExists(stEvent,"AlarmTrigger")) // '-PT30M' - alert user 30 minutes before meeting begins
stEvent.AlarmTrigger = "";
vCal = 'BEGIN:VCALENDAR' & CRLF;
vCal = vCal & 'PRODID: -//CFLIB.ORG//iCalUS()//EN' & CRLF;
vCal = vCal & 'VERSION:2.0' & CRLF;
vCal = vCal & 'METHOD:REQUEST' & CRLF;
vCal = vCal & 'BEGIN:VTIMEZONE' & CRLF;
vCal = vCal & 'TZID:US-Eastern' & CRLF;
vCal = vCal & 'BEGIN:STANDARD' & CRLF;
vCal = vCal & 'DTSTART:20061101T020000' & CRLF;
vCal = vCal & 'RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11' & CRLF;
vCal = vCal & 'TZOFFSETFROM:-0400' & CRLF;
vCal = vCal & 'TZOFFSETTO:-0500' & CRLF;
vCal = vCal & 'TZNAME:Standard Time' & CRLF;
vCal = vCal & 'END:STANDARD' & CRLF;
vCal = vCal & 'BEGIN:DAYLIGHT' & CRLF;
vCal = vCal & 'DTSTART:20060301T020000' & CRLF;
vCal = vCal & 'RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3' & CRLF;
vCal = vCal & 'TZOFFSETFROM:-0500' & CRLF;
vCal = vCal & 'TZOFFSETTO:-0400' & CRLF;
vCal = vCal & 'TZNAME:Daylight Savings Time' & CRLF;
vCal = vCal & 'END:DAYLIGHT' & CRLF;
vCal = vCal & 'END:VTIMEZONE' & CRLF;
vCal = vCal & 'BEGIN:VEVENT' & CRLF;
vCal = vCal & 'UID:#date_now.getTime()#.ptCalendar' & CRLF; // creates a unique identifier
if ( LEN(TRIM(stEvent.eventURL)) )
vCal = vCal & 'URL:#stEvent.eventURL#' & CRLF;
if ( LEN(TRIM(stEvent.organizerName)) AND LEN(TRIM(stEvent.organizerEmail)) )
vCal = vCal & 'ORGANIZER;CN="#stEvent.organizerName#":MAILTO:#stEvent.organizerEmail#' & CRLF;
else if ( LEN(TRIM(stEvent.organizerEmail)) )
vCal = vCal & 'MAILTO:#stEvent.organizerEmail#' & CRLF;
vCal = vCal & 'DTSTAMP:' &
DateFormat(date_now, 'yyyymmdd') & 'T' &
TimeFormat(date_now, 'HHmmss') & CRLF;
if ( LEN(TRIM(stEvent.title)) )
vCal = vCal & 'TITLE:#iCalTextWrap(stEvent.title)#' & CRLF;
vCal = vCal & 'DTSTART;TZID=US-Eastern:' &
DateFormat(stEvent.startDateTime,'yyyymmdd') & 'T' &
TimeFormat(stEvent.startDateTime, 'HHmmss') & CRLF;
vCal = vCal & 'DTEND;TZID=US-Eastern:' &
DateFormat(stEvent.endDateTime,'yyyymmdd') & 'T' &
TimeFormat(stEvent.endDateTime, 'HHmmss') & CRLF;
if ( LEN(TRIM(stEvent.subject)) )
vCal = vCal & 'SUMMARY:#iCalTextWrap(stEvent.subject)#' & CRLF;
if ( LEN(TRIM(stEvent.location)) )
vCal = vCal & 'LOCATION:#iCalTextWrap(stEvent.location)#' & CRLF;
if ( LEN(TRIM(stEvent.description)) )
vCal = vCal & 'DESCRIPTION:#iCalTextWrap(stEvent.description)#' & CRLF;
vCal = vCal & 'PRIORITY:#stEvent.priority#' & CRLF;
vCal = vCal & 'TRANSP:OPAQUE' & CRLF;
vCal = vCal & 'CLASS:PUBLIC' & CRLF;
if ( LEN(TRIM(stEvent.AlarmTrigger)) )
{
vCal = vCal & 'BEGIN:VALARM' & CRLF;
vCal = vCal & 'TRIGGER:#stEvent.AlarmTrigger#' & CRLF;
vCal = vCal & 'ACTION:DISPLAY' & CRLF;
vCal = vCal & 'DESCRIPTION:Reminder' & CRLF;
vCal = vCal & 'END:VALARM' & CRLF;
}
vCal = vCal & 'END:VEVENT' & CRLF;
vCal = vCal & 'END:VCALENDAR';
return Trim(vCal);
var retStruct = StructNew();
return retStruct;
var retString = "";
var dataStruct = StructNew();
var currData = arguments.recurrenceData;
/* DEV */
return retString;