Gentlemen:
Thank you for your feedback. Below is the code I'm currently
developing/editing. I must apologize for the mess, some of the items we're not
using and I haven't cleaned things up yet. the myquery is an array coming from
a cffunction
--------------------------------- BEGIN MESSY CODE
---------------------------------
function iCalBuild(myquery) {
var currentRow = 1;
var vCalAll = '';
var vCal = "";
var dtstart = "";
var dtend = "";
for (; currentRow lte myquery.RecordCount; currentRow = currentRow + 1)
{
if (NOT IsDefined("myquery.starttime"))
myquery.starttime[currentRow] = DateConvert('local2Utc', Now());
if (NOT IsDefined("myquery.EndTime"))
myquery.EndTime[currentRow] = DateConvert('local2Utc', Now());
if (NOT IsDefined("myquery.location"))
myquery.location[currentRow] = "N/A";
if (NOT IsDefined("myquery.title"))
myquery.title[currentRow] = "Auto vCalendar Generated";
if (NOT IsDefined("myquery.description"))
myquery.description[currentRow] = "Autobot VCalendar Generated";
if (NOT IsDefined("stEvent.importance"))
myquery.importance[currentRow] = "1";
vCal = vCal & "BEGIN:VEVENT" & CRLF;
vCal = vCal & "UID:" & myquery.pkid_event[currentRow] & CRLF;
if (NOT IsDefined("myquery.datecreated"))
myquery.datecreated[currentRow] =
DateConvert('local2Utc',myquery.datecreated[currentRow]);
//myquery.datecreated[currentRow] = myquery.datecreated[currentRow];
vCal = vCal & "DTSTAMP:" &
DateFormat(myquery.datecreated[currentRow],"yyyymmdd") & "T" &
TimeFormat(myquery.datecreated[currentRow], "HHmmss") & "Z" & CRLF;
vCal = vCal & "ORGANIZER:MAILTO:[email protected]" & CRLF;
dtstart = CreateDateTime(
DateFormat(myquery.StartTime[currentRow], 'yyyy'),
DateFormat(myquery.StartTime[currentRow], 'mm'),
DateFormat(myquery.StartTime[currentRow], 'dd'),
TimeFormat(myquery.StartTime[currentRow], 'HH'),
TimeFormat(myquery.StartTime[currentRow], 'mm'),
TimeFormat(myquery.StartTime[currentRow], 'ss'));
dtend = CreateDateTime(
DateFormat(myquery.EndTime[currentRow], 'yyyy'),
DateFormat(myquery.EndTime[currentRow], 'mm'),
DateFormat(myquery.EndTime[currentRow], 'dd'),
TimeFormat(myquery.EndTime[currentRow], 'HH'),
TimeFormat(myquery.EndTime[currentRow], 'mm'),
TimeFormat(myquery.EndTime[currentRow],
'ss'));
dtstart =
DateConvert('local2Utc',dtstart);
//dtstart =
myquery.starttime[currentRow];
/*if
(myquery.allday[currentRow] NEQ 1) {
vCal =
vCal & "DTSTART:" & DateFormat(dtstart,"yyyymmdd") & "T" & TimeFormat(dtstart,
"HHmmss") & "Z";
} else {*/
vCal = vCal & "DTSTART:" &
DateFormat(dtstart,"yyyymmdd") & "T" & TimeFormat(dtstart,"HHmmss") & "Z" &
CRLF;
//if
(myquery.EndTime[currentRow] NEQ ''){
dtend =
DateConvert('local2Utc',dtend);
/*if
(myquery.allday[currentRow] NEQ 1){
vCal =
vCal & "DTEND:";
vCal =
vCal & DateFormat(dtend,"yyyymmdd") & "T" & TimeFormat(dtend, "HHmmss") & "Z" &
CRLF;
} else {*/
vCal = vCal & "DTEND:" &
DateFormat(dtend,"yyyymmdd") & "T" & TimeFormat(dtend,"HHmmss") & "Z" & CRLF;
//}
/*} else {
vCal = vCal &
"DTEND;VALUE=DATE:" & "" & CRLF;
vCal = vCal &
"TEND;VALUE=DATE:" & "" & CRLF;
} */
location =
replace(myquery.location[currentRow],",","\,","ALL");
location = replace(location,'"','','ALL');
location = replace(location,':','-','ALL');
vCal = vCal & "LOCATION:" & location & CRLF;
/*vCal = vCal & "PARTSTAT:ACCEPTED" & CRLF;
doesn't work... */
vCal = vCal & "TRANSP:OPAQUE" & CRLF;
vCal = vCal & "SEQUENCE:0" & CRLF;
vCal = vCal & "DESCRIPTION:";
// Convert CF_CRLF (13_10) into =0D=0A with
CR/LF and indent sequences
description =
REReplace(myquery.description[currentRow],"[#Chr(13)##Chr(10)#]",
"=0D=0A=#Chr(13)##Chr(10)# ", "ALL");
description =
replace(description,",","\,","ALL");
description = replace(description,'"','','ALL');
description =
replace(description,':','-','ALL');
/*if(myquery.room_name[currentRow] != ""){
room_name = '\nROOM: '&
myquery.room_name[currentRow];
}else{
room_name = '\nROOM: N/A';
}*/
vCal = vCal & description /*& room_name*/ &
CRLF;
if(myquery.track[currentRow] != ""){
track = ' (Track '&
myquery.track[currentRow] & ')';
}else{
track = ' (All Tracks)';
}
if(myquery.course_abbr[currentRow] != ""){
course_abbr =
myquery.course_abbr[currentRow] & ' - ';
}else{
course_abbr = '';
}
summary =
replace(myquery.title[currentRow],",","\,","ALL");
summary = replace(summary,'"','','ALL');
summary = replace(summary,':','-','ALL');
if(myquery.fkid_calendar[currentRow] == 21 ||
myquery.fkid_calendar[currentRow] == 22){
vCal = vCal & "SUMMARY:" & course_abbr
& summary & track & CRLF;
}else{
vCal = vCal & "SUMMARY:" & course_abbr
& summary & CRLF;
}
//vCal = vCal & "PRIORITY:" &
myquery.importance[currentRow] & CRLF;
vCal = vCal & "CLASS:PUBLIC" & CRLF;
vCal = vCal & "END:VEVENT" & CRLF;
}
vCalAll = "BEGIN:VCALENDAR" & CRLF;
vCalAll = vCalAll & "PRODID:-//Microsoft
Corporation//Outlook 10.0 MIMEDIR//EN" & CRLF;
vCalAll = vCalAll & "VERSION:2.0" & CRLF;
vCalAll = vCalAll & "METHOD:PUBLISH" & CRLF;
vCalAll = vCalAll & vCal;
vCalAll = vCalAll & "END:VCALENDAR" & CRLF;
Return vCalAll;
}
//
// function iCalRange(myquery) {
// var currentRow = 1;
// for (; currentRow lte myquery.RecordCount;
// currentRow = currentRow + 1)
// {
// var curEvent = iCalEvent(currentrow);
// vCalRange = vCalRange & curEvent;
// }
// Return "";
// }
// function icalformat(){
// var eventdata = iCalRange(events);
// }
// icalformat();
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340608
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm