// This script MUST remain dynamic since the data and the generated HTML is modified with a URL parameters request.element.isStatic = 0; request.element.hasData = 1; // Set the Event Cache status from the configuration element useEventsCache = application.ptCalendar.getEventCacheStatus(); rssFeedPageID = request.page.id; rssFeedPageURL = application.ptCalendar.csData.getCSPageURL(rssFeedPageID); // RSS Link and Feed Display default showRSSFeedorLink = true; // Check to see if we are in a single veiw displaying the day list or event details... if so... do NOT show the RSS Link viewParamName = application.ptCalendar.viewParamName; if ( application.ptCalendar.viewPageMode EQ "Single" ) { if ( StructKeyExists(request.params,viewParamName) AND ListFindNoCase("daylist,eventdetails",request.params[viewParamName]) ) showRSSFeedorLink = false; } pastdaysFilter = 0; //Use 0 to only go back to the current day's events. if (structKeyExists(request.params,"pastdays") AND IsNumeric(request.params.pastdays) AND request.params.pastdays GTE 0 ) pastdaysFilter = request.params.pastdays; daysFilter = 30; if (structKeyExists(request.params,"days") AND IsNumeric(request.params.days) AND request.params.days NEQ 0 ) daysFilter = request.params.days; maxRecordsFilter = 0; //Use 0 for unlimited. if (structKeyExists(request.params,"maxevents") AND IsNumeric(request.params.maxevents) AND request.params.maxevents GTE 0 ) maxRecordsFilter = request.params.maxevents; //TODO: allow a link to pass in filter criteria //orgsFilter = ""; //if (structKeyExists(request.params,"orgs") AND LEN(TRIM(request.params.orgs)) ) // orgsFilter = request.params.orgs; //catsFilter = ""; //if (structKeyExists(request.params,"cats") AND LEN(TRIM(request.params.cats)) ) // catsFilter = request.params.cats; //activeFilter = ""; //if (structKeyExists(request.params,"active") AND IsBoolean(request.params.active) ) // activeFilter = request.params.active; showFeedData = false; if (structKeyExists(request.params,"feeddata") AND IsBoolean(request.params.feeddata) ) showFeedData = request.params.feeddata; renderLink = false; if ( StructKeyExists(request.params,"rss") AND (!IsBoolean(request.params.rss) OR request.params.rss EQ 0) ) renderLink = true; outputRSS = false; if ( StructKeyExists(request.params,"rss") AND IsBoolean(request.params.rss) AND request.params.rss EQ 1 ) outputRSS = true; subscribeLabel = "Subscribe to this Calendar"; pastDaysRange = 0; //Use 0 to only go back to the current day's events. futureDaysRange = 30; // must be greater than 0; maxEventRecords = 0; //Use 0 for unlimited organization = ""; category = ""; eventApproved = ""; linkedCalendarPage = ""; linkedCalendarSubsite = ""; // Get the items from the Display Properties Custom Element items = attributes.elementInfo.elementData.propertyValues; if ( ArrayLen(items) AND StructKeyExists(items[1],"values") ) { if ( StructKeyExists(items[1].values,"subscribeLabel") AND LEN(TRIM(items[1].values.subscribeLabel)) ) subscribeLabel = items[1].values.subscribeLabel; if ( StructKeyExists(items[1].values,"pastDaysRange") AND IsNumeric(items[1].values.pastDaysRange) ) pastDaysRange = items[1].values.pastDaysRange; if ( StructKeyExists(items[1].values,"futureDaysRange") AND IsNumeric(items[1].values.futureDaysRange) ) futureDaysRange = items[1].values.futureDaysRange; if ( StructKeyExists(items[1].values,"maxEventRecords") AND IsNumeric(items[1].values.maxEventRecords) ) maxEventRecords = items[1].values.maxEventRecords; //TODO: allow a link to pass filter criteria // Event Filters //if ( StructKeyExists(items[1].values,"organization") AND LEN(TRIM(items[1].values.organization)) ) // organization = items[1].values.organization; //if ( StructKeyExists(items[1].values,"category") AND LEN(TRIM(items[1].values.category)) ) // category = items[1].values.category; //if ( StructKeyExists(items[1].values,"eventApproved") AND IsBoolean(items[1].values.eventApproved) ) // eventApproved = items[1].values.eventApproved; if ( StructKeyExists(items[1].values,"linkedCalendarPage") ) linkedCalendarPage = application.ptCalendar.csData.parseCSURL(str=items[1].values.linkedCalendarPage); if ( StructKeyExists(items[1].values,"linkedCalendarSubsite") ) linkedCalendarSubsite = items[1].values.linkedCalendarSubsite; } propsData = StructNew(); // Rebuild the props array if URL values are passed in if ( IsNumeric(pastdaysFilter) AND pastdaysFilter NEQ pastDaysRange ) propsData.pastDaysRange = pastdaysFilter; if ( IsNumeric(daysFilter) AND daysFilter NEQ futureDaysRange ) propsData.futureDaysRange = daysFilter; if ( IsNumeric(maxRecordsFilter) AND maxRecordsFilter NEQ maxEventRecords ) propsData.maxEventRecords = maxRecordsFilter; // Add the new propsData is defined ADD the data to the Values struct if ( !StructIsEmpty(propsData) ) { if ( !StructKeyExists(items[1],"values") ) items[1].values = StructNew(); StructAppend(items[1].values, propsData, true); } if ( outputRSS OR showFeedData ) { // - ptCalendar EventsCache designation (generally this will be true. May need to set to false for debugging) // useEventsCache = false; // (true/false) - Use this as an override for the Global setting that is managed via the Configuration element /* ** getRenderUpcomingEventsData *** */ // ptCalendar date and data processing returned as CF query object // -- THIS MUST BE INCLUDED AT THE TOP OF THE ptCalendar EVENTS RSS Render Handler (after the displayPropsArray Settings) eventData = application.ptCalendar.calRenderController.getRenderUpcomingEventsData( displayPropsArray=items ,useEventsCache=useEventsCache ); } if ( outputRSS OR showFeedData ) { feedData = application.ptCalendar.calEventsRssService.generateEventFeedData(eventsDataArray=eventData,linkedPage=linkedCalendarPage,linkedSubsite=linkedCalendarSubsite,renderFeedData=showFeedData); if ( outputRSS AND !showFeedData ) application.ptCalendar.calEventsRssService.renderEventRSS(rssEventStruct=feedData,killPageOutput=true); }