variables.ElementName = getEventDetailsCEName();
variables.ElementIDfield = "uniqueID";
variables.CCAPIName = getCCAPIName(variables.elementName);
variables.elementViewName = getCEViewName(variables.elementName);
variables.eventDateTimeCEName = getEventDateTimeCEName();
variables.eventDateTimeViewName = getCEViewName(variables.eventDateTimeCEName);
variables.ElementFieldList = "";
var qry = "";
var fieldList = "";
SELECT * FROM #variables.elementViewName# WHERE 1= 0
fieldList = variables.ElementFieldList;
if (arguments.tableName neq "")
fieldList = arguments.tableName & "." & replaceNoCase(fieldList, ",", ",#arguments.tableName#.", "ALL");
return fieldList;
if ( LEN(TRIM(arguments.uniqueID)) )
return getEventDetailsByIDfieldName(IDfieldName=variables.ElementIDfield,IDfieldValue=TRIM(arguments.uniqueID));
else
return application.ptCalendar.ceData.getCEData(variables.ElementName);
var retArray = ArrayNew(1);
if ( LEN(TRIM(arguments.IDfieldName)) )
retArray = application.ptCalendar.ceData.getCEData(variables.ElementName,arguments.IDfieldName,arguments.IDfieldValue);
return retArray;
var calendarStruct = StructNew();
var calendarArray = getEventDetails(uniqueID=TRIM(arguments.uniqueID));
if ( ArrayLen(calendarArray) )
calendarStruct = calendarArray[1];
return calendarStruct;
var ElementIDfield = "seriesParentID";
return application.ptCalendar.ceData.getCEData(variables.ElementName,ElementIDfield,TRIM(arguments.seriesParentID));
var retArray = ArrayNew(1);
var eventQry = QueryNew("tmp");
var filterDataQry = QueryNew("tmp");
var currData = StructNew();
var eventTitle = "";
var eventDate = "";
var eventStartDate = "";
var eventEndDate = "";
var eventStartTime = "";
var eventEndTime = "";
var eventAllDay = "";
var dummyDate = application.ptCalendar.getTimeDummyDate();
var dummyDayBeginTime = application.ptCalendar.getDayBeginTime();
var dummyDayEndTime = application.ptCalendar.getDayEndTime();
// Search Fields
if ( StructKeyExists(arguments.eventData,"values") ) {
currData = arguments.eventData.values;
if ( StructKeyExists(currData,"title") )
eventTitle = currData.title;
if ( StructKeyExists(currData,"eventDate") ) {
eventDate = currData.eventDate;
eventStartDate = application.ptCalendar.date.csDateFormat(eventDate,dummyDayBeginTime);
eventEndDate = application.ptCalendar.date.csDateFormat(eventDate,dummyDayBeginTime);
}
if ( StructKeyExists(currData,"starttime") AND LEN(TRIM(currData.starttime)) ) {
eventStartTime = application.ptCalendar.date.csDateFormat(dummyDate,currData.starttime);
if ( StructKeyExists(currData,"endtime") AND LEN(TRIM(currData.endtime)) ) {
eventEndTime = application.ptCalendar.date.csDateFormat(dummyDate,currData.endtime);
}
}
else {
eventAllDay = 1;
}
}
// Get the Event Details and DateTime join query
if ( LEN(TRIM(eventDate)) )
eventQry = getEventDetailsDateTimeJoinQuery(startDate=eventStartDate,endDate=eventEndDate);
SELECT *
FROM eventQry
WHERE title =
AND CAST(startTime AS VARCHAR) = CAST( AS VARCHAR)
AND CAST(endTime AS VARCHAR ) = CAST( AS VARCHAR)
AND allDay =
if ( eventQry.RecordCount )
retArray = Application.ptCalendar.ceData.buildCEDataArrayFromQuery(eventQry);
return retArray;
// Create the page
var retStatusStruct = application.ptCalendar.csContent.populateContent(variables.CCAPIName, arguments.dataValues);
/* retStatusStruct RETURNS: CONTENTUPDATED : true/false & CONTENTUPDATERESPONSE: Success:1 */
return retStatusStruct;
var dataQry = QueryNew("temp");
SELECT #getElementFieldList()#, uniqueID AS calEventID
FROM #variables.elementViewName#
WHERE #variables.ElementIDfield# =
var dataQry = QueryNew("temp");
var filterDataQry = QueryNew("temp");
var extraStandardFieldsList = "recurrenceID";
var xfld = "";
SELECT #getElementFieldList("eventdetail")#, eventdetail.uniqueID AS calEventID
,datetime.dtHashID, datetime.parentRecurrenceID
,datetime.uniqueID AS dateTimeID
,datetime.eventDate
,datetime.startTime
,datetime.endTime
,datetime.allDay
,'' AS #xfld#
FROM #variables.elementViewName# eventdetail, #variables.eventDateTimeViewName# datetime
WHERE eventdetail.uniqueID = datetime.calEventID
ORDER BY datetime.eventDate, datetime.AllDay DESC, datetime.StartTime
SELECT *
FROM dataQry
WHERE 1 = 1
AND calEventID =
AND CAST( eventDate AS DATE )
BETWEEN CAST( AS DATE )
AND CAST( AS DATE )
AND CAST( eventDate AS DATE ) >= CAST( AS DATE )
AND dateTimeID =
AND dtHashID =
ORDER BY eventDate, AllDay DESC, StartTime
var dataQry = QueryNew("temp");
var eventDetailsQry = application.ptCalendar.calEventDetailsDAO.getEventDetailsQuery(eventID=arguments.eventID);
var dateTimeQry = application.ptCalendar.calEventRecurrenceService.getRecurrenceDateTimeQuery(eventID=arguments.eventID,startDate=arguments.startDate,enddate=arguments.enddate);
SELECT eventDetailsQry.*
,dateTimeQry.dtHashID, dateTimeQry.parentRecurrenceID
,dateTimeQry.dateTimeID, CAST(dateTimeQry.eventDate AS VARCHAR) AS eventDate
,CAST(dateTimeQry.startTime AS VARCHAR) AS startTime, CAST(dateTimeQry.endTime AS VARCHAR) AS endTime
,dateTimeQry.allDay, dateTimeQry.recurrenceID
FROM eventDetailsQry, dateTimeQry
WHERE eventDetailsQry.uniqueID = dateTimeQry.calEventID
AND dateTimeQry.calEventID =
AND CAST( dateTimeQry.eventDate AS DATE )
BETWEEN CAST( AS DATE )
AND CAST( AS DATE )
AND CAST( dateTimeQry.eventDate AS DATE ) >= CAST( AS DATE )
AND dateTimeID =
AND dtHashID =
ORDER BY eventDate, AllDay DESC, StartTime
var dataQry = QueryNew("temp");
var approvedValue = 1;
SELECT DISTINCT location
FROM #variables.elementViewName#
WHERE 1=1
AND approved =
var dataQry = QueryNew("temp");
SELECT *
FROM #variables.elementViewName#
WHERE seriesParentID =
var formID = getCalEventDetailsFormID();
var elementFields = application.ptCalendar.ceData.getElementFieldsByFormID(formID);
var currPageID = 0;
var i = 1;
var j = 1;
var retStruct = StructNew();
var fieldStruct = application.ptCalendar.getViewColumnStruct(ceName=variables.ElementName,useQueryDataTypes=arguments.useQueryDatatypes);
var colNameStruct = StructNew();
var key = "";
var keyVal = "";
var x = 1;
var xFld = "";
var xVal = "";
var extraFields = "";
var extraDataTypes = ""; // ntext, nvarchar, varchar
var fieldExceptionList = "pageID,controlID,formID";
// Make sure we have at least one valid column from the dateTime VIEW
if ( StructKeyExists(fieldStruct,"uniqueID") )
{
// Add the dateTimeFieldStruct fields to the colNameStruct
for (key in fieldStruct) {
if ( !ListFindNoCase(fieldExceptionList,key) )
{
// if needed convert the values to CF Query DataTypes
if ( arguments.useQueryDatatypes )
keyVal = application.ptCalendar.convertSQLDataTypeToQueryDataType(fieldStruct[key]);
else
keyVal = fieldStruct[key];
// Add to the retStruct
retStruct[key] = keyVal;
}
}
// Loop over the extra fields and dataTypes to be used for the Query Columns
if ( ListLen(extraFields) EQ ListLEN(extraDataTypes) )
{
for ( x=1;x LTE ListLen(extraFields);x=x+1 ) {
xFld = ListGetAt(extraFields,x);
// if needed convert the values to CF Query DataTypes
if ( arguments.useQueryDatatypes )
xVal = application.ptCalendar.convertSQLDataTypeToQueryDataType(ListGetAt(extraDataTypes,x));
else
xVal = ListGetAt(extraDataTypes,x);
// Add to the retStruct
retStruct[xFld] = xVal;
}
}
}
return retStruct;
return getEventDetailsColumnStruct(useQueryDataTypes=false);
var retStruct = StructNew();
var fieldStruct = csFieldsDataTypeStructByCEName(ceName=variables.ElementName);
var dbType = getCSDBType();
var validOverrideDBTypes = "Oracle,MySQL,SQLServer";
var key = "";
var fieldExceptionList = "";
var typeExceptionList = "section_text";
var intType = "";
var vcharType = "";
var textType = "";
var bitType = "";
var longTextType = "";
var maxLenType = "";
var csTextFieldTypeList = "Custom Text Area Field,large_textarea,formatted_text_block";
var csLongTextTypeFieldList = "";
/*Custom Types*/
var uuidType = "varchar(35)";
var hashType = "varchar(64)";
var smallTextType = "varchar(50)";
var bitFieldNameList = "";
var UUIDFieldNameList = "eventrecurrenceid,parentid,seriesparentid,sourceparentid,uniqueid,organization";
var hashFieldNameList = "";
var smallTextFieldNameList = "eventapproved,approvaldatetime,approvaluserid,linkedcspageid,contactphone"; //eventapproved
var textFieldNameList = "category,eventdatetimeidlist,location";
var midFieldNameList = "contactemail,contactname,title";
// Check if an override DBtype was passed in
if ( LEN(TRIM(arguments.overRideDBtype)) AND ListFindNoCase(validOverrideDBTypes,arguments.overRideDBtype) )
dbType = arguments.overRideDBtype;
// Convert the Fields DataTypes for the dbType
switch (dbtype) {
case 'Oracle':
intType = 'number(12)';
vcharType = "varchar2(850)"; //850 - matches the Data_FieldValue CS DB column size
textType = "varchar2(2000)";
bitType = "bit";
longTextType = "long"; //clob?
/*Custom Types*/
midTextType = "varchar(255)";
smallTextType = "varchar2(50)";
uuidType = "varchar2(35)";
hashType = "varchar2(64)";
/* Dyanmic Types */
maxLenType = "varchar2"; // Add the (x) based on the maxlength in the loop below
break;
case 'MySQL':
intType = 'int UNSIGNED';
vcharType = "varchar(850)"; //850 - matches the Data_FieldValue CS DB column size
textType = "mediumtext";
bitType = "bit";
longTextType = "longtext";
/*Custom Types*/
midTextType = "varchar(255)";
smallTextType = "varchar(50)";
uuidType = "varchar(35)";
hashType = "varchar(64)";
/* Dyanmic Types */
maxLenType = "varchar"; // Add the (x) based on the maxlength in the loop below
break;
case 'SQLServer':
intType = 'int';
vcharType = "varchar(max)"; //max to fix table char limit - 850 - matches the Data_FieldValue CS DB column size
textType = "varchar(max)"; //nvarchar(4000)
bitType = "bit";
longTextType = "text";
/*Custom Types*/
midTextType = "varchar(255)";
smallTextType = "varchar(50)";
uuidType = "varchar(35)";
hashType = "varchar(64)";
/* Dyanmic Types */
maxLenType = "varchar"; // Add the (x) based on the maxlength in the loop below
break;
}
if ( dbtype NEQ "MySQL" and application.ptCalendar.ceData.siteDBIsUnicode() )
{
vcharType = replaceNoCase(vcharType, "varchar", "nvarchar");
textType = replaceNoCase(textType, "varchar", "nvarchar");
longTextType = replaceNoCase(longTextType, "text", "ntext");
/*Custom Types*/
midTextType = replaceNoCase(midTextType, "varchar", "nvarchar");
smallTextType = replaceNoCase(smallTextType, "varchar", "nvarchar");
uuidType = replaceNoCase(uuidType, "varchar", "nvarchar");
hashType = replaceNoCase(hashType, "varchar", "nvarchar");
/* Dyanmic Types */
maxLenType = replaceNoCase(maxLenType, "varchar", "nvarchar");
}
// Make sure we have at least one valid field from the element
if ( StructKeyExists(fieldStruct,"uniqueID") )
{
// Add the dateTimeFieldStruct fields to the colNameStruct
for (key in fieldStruct) {
// Add Custom Fields to the Exception list of these types
// - DO NOT USE -- Causes Cache Table populate to crash ( calEventsCacheDatabaseDAO.addDataRow() )
/* if ( StructKeyExists(fieldStruct[key],"type") )
{
if ( ListFindNoCase(typeExceptionList,fieldStruct[key].type) )
fieldExceptionList = ListAppend(fieldExceptionList,key);
}*/
if ( !ListFindNoCase(fieldExceptionList,key) )
{
/* Custom Types */
if ( ListFindNoCase(bitFieldNameList,key) )
retStruct[lcase(key)] = lcase(bitType);
else if ( ListFindNoCase(UUIDFieldNameList,key) )
retStruct[lcase(key)]= lcase(uuidType);
else if ( ListFindNoCase(hashFieldNameList,key) )
retStruct[lcase(key)]= lcase(hashType);
else if ( ListFindNoCase(midFieldNameList,key) )
retStruct[lcase(key)]= lcase(midTextType);
else if ( ListFindNoCase(smallTextFieldNameList,key) )
retStruct[lcase(key)]= lcase(smallTextType);
else if ( ListFindNoCase(textFieldNameList,key) )
retStruct[lcase(key)]= lcase(textType);
// convert the field type to a DB Datatype text if the field type is this list
else if ( ListFindNoCase(csTextFieldTypeList,fieldStruct[key]["type"]) )
retStruct[lcase(key)] = lcase(textType);
else if ( ListFindNoCase(csLongTextTypeFieldList,fieldStruct[key]["type"]) )
retStruct[lcase(key)] = lcase(longTextType);
/* Dyanmic Types */
else if ( StructKeyExists(fieldStruct[key],"maxlength") )
retStruct[lcase(key)] = lcase(maxLenType) & "(" & fieldStruct[key]["maxlength"] & ")";
else if ( StructKeyExists(fieldStruct[key],"type") AND fieldStruct[key].type EQ "checkbox" )
retStruct[lcase(key)] = lcase(bitType);
// Make these typeExceptionList fields very small (workaround for Cache Table populate issue)
else if ( StructKeyExists(fieldStruct[key],"type") AND ListFindNoCase(typeExceptionList,fieldStruct[key].type) )
retStruct[lcase(key)] = lcase(bitType);
/* All Others */
else
retStruct[lcase(key)] = lcase(vcharType);
}
}
}
return retStruct;
var IDfield = "linkedCSPageID";
var filterDataQry = QueryNew("temp");
var dataQry = getEventDetailsDateTimeJoinQuery();
SELECT *
FROM dataQry
WHERE 1 = 1
AND #IDfield# =
ORDER BY eventDate, AllDay DESC, StartTime
var IDfield = "linkedCSPageID";
return getEventDetailsByIDfieldName(IDfieldName=IDfield,IDfieldValue=TRIM(arguments.csPageID));