request.element.isStatic = 0;
// Get the Configuration and Page Map Values
appConfig = application.ptCalendar.getAppConfig();
cfDateDisplayMask = application.ptCalendar.getDisplayCFdateMask(); // "M/D/YYYY" - DATE FORMAT FOR DISPLAY
cfDateLongDisplayMask = application.ptCalendar.getDisplayCFdateLongMask(); // "dddd mmmm d, yyyy" - DATE FORMAT FOR DISPLAY
cfTimeDisplayMask = application.ptCalendar.getDisplayCFtimeMask(); // "h:mm tt" - TIME FORMAT FOR DISPLAY
// - Get the ViewPageMode from the config
viewPageMode = application.ptCalendar.getViewPageMode();
// - Set the Event Cache status from the configuration element
useEventsCache = application.ptCalendar.getEventCacheStatus();
// - Verbose Output flag
useVerboseOutput = application.ptCalendar.getVerboseOutputStatus();
searchFilterName = "eventsSearch";
if ( viewPageMode EQ "Single" )
searchFilterName = searchFilterName & "-" & request.page.id;
else
searchFilterName = searchFilterName & "-" & request.subsite.id;
// Set a Dummy UUID so the DataSheet filter doesn't fail
dummyEventID = "XXXXXXXX-AAAA-YYYY-ZZZZZZZZZZZZZZZZ";
// Set the filterIDlist if Event Filter form passes a value
filterIDList = "";
if ( StructKeyExists(request,"ptCalendar")
AND StructKeyExists(request.ptCalendar,searchFilterName)
AND StructKeyExists(request.ptCalendar[searchFilterName],"eventIDlist")
AND LEN(TRIM(request.ptCalendar[searchFilterName].eventIDlist)) )
filterIDList = request.ptCalendar[searchFilterName].eventIDlist;
selectedStartDateValue = "";
selectedEndDateValue = "";
selectedFilterAction = "";
if ( StructKeyExists(request.params,"dsFilterStartDate") )
selectedStartDateValue = request.params.dsFilterStartDate;
if ( StructKeyExists(request.params,"dsFilterEndDate") )
selectedEndDateValue = request.params.dsFilterEndDate;
if ( StructKeyExists(request.params,"dsFilterAction") )
selectedFilterAction = request.params.dsFilterAction;
/* ** getSearchResultsEventData SETTINGS *** */
// ptCalendar eventID processing for the calendar renderhandler returns as array of structs
// -- THIS MUST BE INCLUDED ABOVE THE SEARCH RESULTS LIST
eventData = application.ptCalendar.calRenderController.getSearchResultsEventData(
eventIDList=filterIDList
,startDate=selectedStartDateValue
,endDate=selectedEndDateValue
,useEventsCache=useEventsCache
);
// Reset the filter ID List if no Events are found
if ( filterIDList EQ dummyEventID )
filterIDList = "";
linkedCalendarPageID = request.page.id;
linkedCalendarSubsiteID = request.subsite.id;
calendarViewTemplateID = 2;
// Get the Custom Calendar View Page Template from the config element
if ( structKeyExists(appConfig, "calendarViewPageTemplate") and IsNumeric(appConfig['calendarViewPageTemplate']) )
calendarViewTemplateID = appConfig['calendarViewPageTemplate'];
calendarPageIDArray = application.ptCalendar.csData.getPageIdsUsingTemplateID(calendarViewTemplateID,linkedCalendarSubsiteID);
// Set the matching page returned from the template/subsite lookup to the results page
if ( ArrayLen(calendarPageIDArray) AND IsNumeric(calendarPageIDArray[1]) AND calendarPageIDArray[1] GT 0 )
linkedCalendarPageID = calendarPageIDArray[1];
else {
// if no region calendar page is found then use the one up in the site root (subsiteid: 1)
calendarPageIDArray = application.ptCalendar.csData.getPageIdsUsingTemplateID(calendarViewTemplateID,1);
if ( ArrayLen(calendarPageIDArray) AND IsNumeric(calendarPageIDArray[1]) AND calendarPageIDArray[1] GT 0 )
linkedCalendarPageID = calendarPageIDArray[1];
}
linkedCalendarSubsiteID = application.ptCalendar.csData.getSubsiteIDByPageID(pageid=linkedCalendarPageID);
// Get the values from the attributes passed in from the Custom Script Properties field
if ( StructKeyExists(attributes,"calenderPageID") )
linkedCalendarPageID = attributes.calenderPageID; // use this value if overridden from the custom script params tab
if ( StructKeyExists(attributes,"calenderSubsiteID") )
linkedCalendarSubsiteID = attributes.calenderSubsiteID; // use this value if overridden from the custom script params tab
// Get the view link data structure
if ( application.ptCalendar.viewPageMode EQ "Single" ) {
if ( LEN(TRIM(linkedCalendarPageID)) )
viewLinkData = application.ptCalendar.calRenderViewService.getCalViewPageStruct(pageURL=linkedCalendarPageID);
else
viewLinkData = application.ptCalendar.calRenderViewService.getCalViewPageStruct();
qParamDelimiter = "&";
}
else {
if ( LEN(TRIM(linkedCalendarSubsiteID)) AND IsNumeric(linkedCalendarSubsiteID) )
viewLinkData = application.ptCalendar.calPageMapDAO.getCalPageMapStruct(subsiteID=linkedCalendarSubsiteID);
else
viewLinkData = application.ptCalendar.calPageMapDAO.getCalPageMapStruct();
qParamDelimiter = "?";
}
detailLink = "";
dailyLink = "";
weeklyListLink = "";
weeklyGridLink = "";
monthlyListLink = "";
monthlyGridLink = "";
if( structKeyExists(viewLinkData, "detailPage") and len(trim(viewLinkData.detailPage)) )
detailLink = viewLinkData.detailPage;
if( structKeyExists(viewLinkData, "dailyPage") and len(trim(viewLinkData.dailyPage)) )
dailyLink = viewLinkData.dailyPage;
if( structKeyExists(viewLinkData, "weeklyListPage") and len(viewLinkData.weeklyListPage) )
weeklyListLink = viewLinkData.weeklyListPage;
if( structKeyExists(viewLinkData, "weeklyGridPage") and len(viewLinkData.weeklyGridPage) )
weeklyGridLink = viewLinkData.weeklyGridPage;
if( structKeyExists(viewLinkData, "monthlyListPage") and len(viewLinkData.monthlyListPage) )
monthlyListLink = viewLinkData.monthlyListPage;
if( structKeyExists(viewLinkData, "monthlyGridPage") and len(viewLinkData.monthlyGridPage) )
monthlyGridLink = viewLinkData.monthlyGridPage;
defaultDisplayVeiw = application.ptCalendar.getDefaultDisplayView();
defaultViewPageVar = application.ptCalendar.calRenderViewDAO.getCalendarDefaultViewPageVar();
defaultViewLink = "##";
if ( structKeyExists(viewLinkData, defaultViewPageVar) and len(viewLinkData[defaultViewPageVar]) )
defaultViewLink = viewLinkData[defaultViewPageVar];
// Output Cache Status (if verbose output is turned on)
if ( useVerboseOutput )
application.ptCalendar.calEventsCacheService.renderCalendarCacheStatusHTML(eventsCacheStatusOverride=useEventsCache);