var retMsg = "";
var newDataStruct = StructNew();
var addEditStatus = StructNew();
var formResultFooterJS = "";
// STEP 1: Parse the data from the recurrence form in the request.params into a standard structure
// that matches the fields in the recurrence global custom element
newDataStruct = application.ptCalendar.recurrenceBuilderService.parseRecurrenceFormData(request.params);
// STEP 2: save data from the recurrence form to the global custom element via the CCAPI
addEditStatus = application.ptCalendar.recurrenceBuilderDAO.saveRecurrence(uniqueID=arguments.recurrenceID,calEventID=arguments.eventID,recurrenceData=newDataStruct); //application.ptCalendar.recurrenceBuilderDAO.saveRecurrence()
// STEP 3: Return a message to the LB window with a closeLB link and trigger the callback
// OR just do a closeLB an trigger the callback
application.ptCalendar.scripts.loadJquery();
application.ptCalendar.scripts.loadADFLightbox(force=true);
// Load the inline JavaScript after the libraries have loaded
application.ptCalendar.scripts.addFooterJS(formResultFooterJS, "TERTIARY"); // PRIMARY, SECONDARY, TERTIARY
#renderRecurrenceFormProcessingMsg()#
var retMsgHTML = "";
var processStatusHTML = " Processing...";
#processStatusHTML#
Please wait while this event is being processed!!
(This window will close when the process has completed.)
// Set the default text for no records.
var retHTML = "";
// Get the data for the link builder data
var rbDataArray = ArrayNew(1);
var i = 1;
var currText = "";
var currURL = "";
var currEditLink = "";
var currRemoveLink = "";
var editDeleteLinks = "";
var rbHeaderText = "Schedule:";
// check that we have a UUID List values
if ( ListLen(arguments.uuidList) )
{
rbDataArray = buildRecurrenceRenderData(arguments.uuidlist);
// Check that we have linkDataArray
if ( ArrayLen(rbDataArray) )
{
// Loop over the linkDataArray records
for ( i = 1; i LTE ArrayLen(rbDataArray); i = i + 1 )
{
// Build the Edit and Delete Links for each DateTime block
editDeleteLinks = " ";
editDeleteLinks = editDeleteLinks & "
";
}
// Check if we have built data
if ( LEN(retHTML) )
{
// Prepend and Append the div block for the styles
retHTML = "
#rbHeaderText#
" & retHTML & "
";
}
}
}
return retHTML;
var recurrenceArray = ArrayNew(1);
var itm=1;
var d=1;
var retArray = ArrayNew(1);
var tmpData = StructNew();
var currData = StructNew();
var ordinalSuffix = "";
var cfDateDisplayMask = getDisplayCFdateMask();
var cfTimeDisplayMask = getDisplayCFtimeMask();
// Make sure we have RecurrenceIDs before going to get records... or we will get them all
if ( LEN(TRIM(arguments.uuidList)) )
recurrenceArray = application.ptCalendar.recurrenceBuilderDAO.getRecurrence(uniqueID=arguments.uuidList);
for (itm=1; itm LTE ArrayLen(recurrenceArray); itm=itm+1) {
currData = StructNew();
tmpData = StructNew();
if ( StructKeyExists(recurrenceArray[itm],"Values") )
currData = recurrenceArray[itm].Values;
// Build a clean tmpData struct from currData values
tmpData = application.ptCalendar.recurrenceBuilderService.buildCleanRecurrenceData(currData);
// Build the render string
tmpData.RenderString = "";
// Build the render string with
tmpData.RenderStringNBSP = "";
// Determine if all day event or has start and end time
tmpData.RenderStringTime = "Time:";
if ( tmpData.recurAllDay EQ 1 ) {
tmpData.RenderStringTime = tmpData.RenderStringTime & " #tmpData.recurAllDayString#";
}
else if ( LEN(tmpData.recurStartTime) )
{
if ( LEN(tmpData.recurEndTime) )
tmpData.RenderStringTime = tmpData.RenderStringTime & " " & TimeFormat(tmpData.recurStartTime,cfTimeDisplayMask) & " - " & TimeFormat(tmpData.recurEndTime,cfTimeDisplayMask); // TIME FORMAT FOR DISPLAY
else
tmpData.RenderStringTime = tmpData.RenderStringTime & " " & TimeFormat(tmpData.recurStartTime,cfTimeDisplayMask); // TIME FORMAT FOR DISPLAY
}
else {
tmpData.RenderStringTime = tmpData.RenderStringTime & " {Time Undefined}";
}
// Add to RenderString
tmpData.RenderString = tmpData.RenderString & tmpData.RenderStringTime;
// Replace all the spaces with a and add to RenderStringNBSP
tmpData.RenderStringNBSP = tmpData.RenderStringNBSP & REREPLACE(tmpData.RenderStringTime,"[\s]"," ","all");
//patternOptionList = "EveryXDays,EveryWeekday,MonthlyDayX,MonthlyXY,YearlyXY,YearlyXYofZ";
if ( LEN(TRIM(tmpData.patternType)) ) {
tmpData.RenderStringPattern = "Recur:";
if ( tmpData.patternType EQ "Daily")
{
// daily - pattern options
if ( tmpData.patternOption EQ "EveryXDays" )
{
if ( tmpData.patternDayQty GT 1 )
tmpData.RenderStringPattern = tmpData.RenderStringPattern & " Every #tmpData.patternDayQty# days";
else
tmpData.RenderStringPattern = tmpData.RenderStringPattern & " Every day";
}
else if ( tmpData.patternOption EQ "EveryWeekday" )
{
tmpData.RenderStringPattern = tmpData.RenderStringPattern & " Every weekday";
}
}
else if ( tmpData.patternType EQ "Weekly" )
{
if ( tmpData.patternWeekQty GT 1 )
tmpData.RenderStringPattern = tmpData.RenderStringPattern & " Every #tmpData.patternWeekQty# weeks";
else
tmpData.RenderStringPattern = tmpData.RenderStringPattern & " Every week";
if ( LEN(TRIM(tmpData.patternDOWstring)) )
tmpData.RenderStringPattern = tmpData.RenderStringPattern & " on #tmpData.patternDOWstring#";
}
else if ( tmpData.patternType EQ "Monthly" )
{
if ( tmpData.patternMonthQty GT 1 )
tmpData.RenderStringPattern = tmpData.RenderStringPattern & " Every #tmpData.patternMonthQty# months";
else
tmpData.RenderStringPattern = tmpData.RenderStringPattern & " Every month";
// monthly - pattern options
if ( tmpData.patternOption EQ "MonthlyDayX" )
{
if ( IsNumeric(tmpData.patternMonthlyDayNumber) )
{
ordinalSuffix = application.ptCalendar.data.getOrdinalSuffixforNumber(number=tmpData.patternMonthlyDayNumber);
tmpData.RenderStringPattern = tmpData.RenderStringPattern & " on the #tmpData.patternMonthlyDayNumber##ordinalSuffix#"; //day of the month
}
}
else if ( tmpData.patternOption EQ "MonthlyXY" )
{
if ( LEN(TRIM(tmpData.patternMonthlyDayOrdinal)) AND LEN(TRIM(tmpData.patternMonthlyWeekDay)) )
tmpData.RenderStringPattern = tmpData.RenderStringPattern & " on the #tmpData.patternMonthlyDayOrdinal# #tmpData.patternMonthlyWeekDay#"; //of the month
}
}
else if ( tmpData.patternType EQ "Yearly" )
{
if ( tmpData.patternYearQty GT 1 )
tmpData.RenderStringPattern = tmpData.RenderStringPattern & " Every #tmpData.patternYearQty# years";
else
tmpData.RenderStringPattern = tmpData.RenderStringPattern & " Every year";
// yearly - pattern options
if ( tmpData.patternOption EQ "YearlyXY" )
{
if ( LEN(TRIM(tmpData.patternYearlyMonthString)) AND IsNumeric(tmpData.patternYearlyDayNumber) )
{
ordinalSuffix = application.ptCalendar.data.getOrdinalSuffixforNumber(number=tmpData.patternYearlyDayNumber);
tmpData.RenderStringPattern = tmpData.RenderStringPattern & " on #tmpData.patternYearlyMonthString# #tmpData.patternYearlyDayNumber##ordinalSuffix#";
}
}
else if ( tmpData.patternOption EQ "YearlyXYofZ" )
{
if ( LEN(TRIM(tmpData.patternYearlyDayOrdinal)) AND LEN(TRIM(tmpData.patternYearlyWeekDay)) AND LEN(TRIM(tmpData.patternYearlyWeekDayMonthString)) )
tmpData.RenderStringPattern = tmpData.RenderStringPattern & " on the #tmpData.patternYearlyDayOrdinal# #tmpData.patternYearlyWeekDay# of #tmpData.patternYearlyWeekDayMonthString#";
}
}
// Add to RenderString
tmpData.RenderString = tmpData.RenderString & " " & tmpData.RenderStringPattern;
// Replace all the spaces with a and add to RenderStringNBSP
tmpData.RenderStringNBSP = tmpData.RenderStringNBSP & " " & REREPLACE(tmpData.RenderStringPattern,"[\s]"," ","all");
}
// Date Render String
tmpData.RenderStringDate = "Range:";
if ( LEN(TRIM(tmpData.rangeStartDate)) ) {
tmpData.RenderStringDate = tmpData.RenderStringDate & " Start on #tmpData.rangeStartDate#";
// Determine Range End Type: NoEnd, EndQuantity or EndDate
if ( tmpData.rangeEndType EQ "EndDate" AND LEN(TRIM(tmpData.rangeEndDate)) )
{
tmpData.RenderStringDate = tmpData.RenderStringDate & " and end by #tmpData.rangeEndDate#";
}
else if ( tmpData.rangeEndType EQ "EndQuantity" AND LEN(TRIM(tmpData.rangeQuantity)) )
{
tmpData.RenderStringDate = tmpData.RenderStringDate & " and end after #tmpData.rangeQuantity# occurrences";
}
else
{
tmpData.RenderStringDate = tmpData.RenderStringDate & " with no end date";
}
// Add to RenderString
tmpData.RenderString = tmpData.RenderString & " " & tmpData.RenderStringDate;
// Replace all the spaces with a and add to RenderStringNBSP
tmpData.RenderStringNBSP = tmpData.RenderStringNBSP & " " & REREPLACE(tmpData.RenderStringDate,"[\s]"," ","all");
}
// Add the tmpData structure to the retrun Array
ArrayAppend(retArray,tmpData);
}
// Check if we have more than one record, if so sort them
if ( ArrayLen(retArray) GT 1 )
{
// Sort the retArray
retArray = application.ptCalendar.data.arrayOfStructsSortMultiKeys(
aOfS=retArray,
orderByKeyList="recurAllDay DESC, recurStartTime");
}
return retArray;
var reHTML = "";
var deleteItemsList = application.ptCalendar.recurrenceBuilderService.deleteRecurrenceByParentID(parentID=arguments.parentID);
// Check to see if any Recurrence records were deleted
if ( ListLen(deleteItemsList) )
reHTML = "Recurrence properties have been deleted for this event!";
return reHTML;