var newDataStruct = arguments.eventData;
var elementName = application.ptCalendar.getEventDetailsCEName();
var fieldStruct = application.ptCalendar.ceData.defaultFieldStruct(elementName);
var retStatusStruct = StructNew();
var dataValues = StructNew();
var newEventSuffix = getBrokenRecurrenceEventSuffix();
var exceptionFieldList = "uniqueID,seriesParentID,eventApproved,ApprovalDateTime,ApprovalUserID,EventDateTimeIDList,EventRecurrenceID";
var key = "";
retStatusStruct["msg"] = "failed";
retStatusStruct["CONTENTUPDATED"] = false;
retStatusStruct["newEventID"] = "";
retStatusStruct["parentEventID"] = "";
retStatusStruct["parentRecurrenceID"] = "";
// Use the data from the newDataStruct to populate the fields from the fieldStruct
for (key in fieldStruct) {
// Do Not Copy any of the Data from the fields in the exceptionFieldList
if ( StructKeyExists(newDataStruct,key) AND ListFindNoCase(exceptionFieldList,key) EQ 0 ) {
dataValues[key] = newDataStruct[key];
}
}
// Create a New UniqueID for the new Destination Record
dataValues.uniqueID = CreateUUID();
dataValues.seriesParentID = "";
// Update the ParentID of the Destination record with UniqueID from the source Record
if ( StructKeyExists(newDataStruct,"calEventID") )
dataValues.seriesParentID = newDataStruct.calEventID;
// If provided add the suffix to the title
if ( LEN(TRIM(newEventSuffix)) )
dataValues.title = newDataStruct.title & " " & newEventSuffix;
// If provided and the suffix to the title
/* if ( LEN(TRIM(newEventSuffix)) )
dataValues.title = newDataStruct.title & newEventSuffix;
else
dataValues.title = newDataStruct.title; */
// Clear the approval tracking details (This is handled by the exceptionFieldList above)
//dataValues.eventApproved = "";
//dataValues.approvalUserID = "";
//dataValues.approvalDateTime = "";
// Clear the Values from the new RecurrenceIDs field
//dataValues.EventRecurrenceID = ""; (This is handled by the exceptionFieldList above))
// Clear the Values from the new dateTimeIDs field
//dataValues.EventDateTimeIDList = ""; (This is handled by the exceptionFieldList above))
// Process the CCAPI call to create the NEW record
retStatusStruct = application.ptCalendar.calEventDetailsDAO.eventDetailsCCAPI(dataValues);
// If the CCAPI create the newEvent record set the newEventID in the return struct
if ( retStatusStruct["CONTENTUPDATED"] IS true )
retStatusStruct["newEventID"] = dataValues.uniqueID;
if ( StructKeyExists(newDataStruct,"calEventID") )
retStatusStruct["parentEventID"] = dataValues.seriesParentID;
if ( StructKeyExists(newDataStruct,"eventRecurrenceID") )
retStatusStruct["parentRecurrenceID"] = newDataStruct.eventRecurrenceID;
return retStatusStruct;
var calendarStruct = StructNew();
var retStatusStruct = StructNew();
var dataValues = StructNew();
var newData = "";
var newCopySuffix = getCopyEventSuffix();
retStatusStruct["msg"] = "failed";
retStatusStruct["CONTENTUPDATED"] = false;
eventStruct = application.ptCalendar.calEventDetailsDAO.getEventDetailsDataByUniqueID(uniqueID=TRIM(arguments.srcEventID));
if ( StructKeyExists(eventStruct,"values") ) {
// Copy all the values of the existing source record to the destination struct
dataValues = eventStruct.values;
// Update the ParentID of the Destination record with UniqueID from the source Record
dataValues.parentID = dataValues.uniqueID;
// Create a New UniqueID for the new Destination Record
dataValues.uniqueID = CreateUUID();
// if a nen event Title is passed in then use the new value
if ( LEN(TRIM(arguments.newTitle)) )
dataValues.title = TRIM(arguments.newTitle);
// if the newCopySuffix has a value then append it to the end of the value
if ( LEN(TRIM(newCopySuffix)) )
dataValues.title = dataValues.title & " " & newCopySuffix;
// Clear the source Values from the new dateTimeIDs and RecurrenceIDs fields
dataValues.EventDateTimeIDList = "";
dataValues.EventRecurrenceID = "";
// Clear the approved status
dataValues.eventApproved = "";
// Process the CCAPI call to create the NEW record
retStatusStruct = application.ptCalendar.calEventDetailsDAO.eventDetailsCCAPI(dataValues);
}
retStatusStruct["srcEventID"] = arguments.srcEventID;
// If the CCAPI create the newEvent record set the newEventID in the return struct
if ( retStatusStruct["CONTENTUPDATED"] IS true ) {
retStatusStruct["newEventID"] = dataValues.uniqueID;
}
else {
retStatusStruct["newUniqueID"] = "";
}
return retStatusStruct;
var calendarStruct = StructNew();
var retStatusStruct = StructNew();
var dataValues = StructNew();
var newData = "";
retStatusStruct["msg"] = "failed";
retStatusStruct["CONTENTUPDATED"] = false;
retStatusStruct["dataPageID"] = "";
eventStruct = application.ptCalendar.calEventDetailsDAO.getEventDetailsDataByUniqueID(uniqueID=TRIM(arguments.uniqueID));
if ( StructKeyExists(eventStruct,"values") )
{
// Copy all the values of the existing source record to the destination struct
dataValues = eventStruct.values;
// Update the dateTime IDs
if ( LEN(TRIM(arguments.dateTimeIDlist)) )
dataValues.EventDateTimeIDList = arguments.dateTimeIDlist;
// Update the Recurrence ID
if ( LEN(TRIM(arguments.recurrenceIDlist )) )
dataValues.EventRecurrenceID = arguments.recurrenceIDlist;
// Set the dataPageID for updating the existing record
dataValues.dataPageID = eventStruct.PageID;
// Process the CCAPI call to update the existing record
retStatusStruct = application.ptCalendar.calEventDetailsDAO.eventDetailsCCAPI(dataValues);
}
// If the CCAPI create the newEvent record set the newEventID in the return struct
if ( retStatusStruct["CONTENTUPDATED"] IS true ) {
// Set the EventID in the return struct
retStatusStruct["eventID"] = arguments.uniqueID;
retStatusStruct["dataPageID"] = dataValues.dataPageID;
}
else {
retStatusStruct["eventID"] = "";
}
return retStatusStruct;
var reHTML = "";
var deleteItemsList = application.ptCalendar.calEventDetailsService.deleteEventDetailsByEventID(eventID=arguments.eventID);
// Check to see if any Recurrence records were deleted
if ( ListLen(deleteItemsList) )
reHTML = "Event Details have been deleted!";
return reHTML;
var edData = application.ptCalendar.calEventDetailsDAO.getEventDetails(uniqueID=arguments.eventID);
var deletedItemStatus = false;
var deletedItemsList = "";
var itm = 1;
for ( itm=1; itm LTE ArrayLen(edData); itm=itm+1 )
{
if ( IsNumeric(edData[itm].pageID) AND edData[itm].pageID GT 0 )
{
deletedItemStatus = application.ptCalendar.calEventDetailsDAO.deleteEventDetailsData(edData[itm].pageID);
if ( deletedItemStatus )
{
deletedItemsList = ListAppend(deletedItemsList,edData[itm].values.uniqueID);
}
}
}
return deletedItemsList;
var reHTML = "";
var retStruct = StructNew();
var updateEvent = StructNew();
var newDateTimeIDList = application.ptCalendar.dateTimeBuilderService.buildDateTimeIDListByParentID(parentID=arguments.eventID);
if ( LEN(TRIM(newDateTimeIDList)) ) {
// Update the Event Details record with the new DateTimeIDs
updateEvent = application.ptCalendar.calEventDetailsService.updateCalEventDetailsDateTimeRecurrence(
uniqueID=arguments.eventID
,dateTimeIDlist=newDateTimeIDList
);
}
if ( StructKeyExists(updateEvent,"CONTENTUPDATED") AND updateEvent.CONTENTUPDATED EQ true ) {
reHTML = reHTML & 'The Event was Updated.';
retStruct.eventUpdated = true;
}
else {
reHTML = reHTML & 'The Event could NOT be updated.';
retStruct.eventUpdated = false;
}
return reHTML;