var rtnString = ""; if ( arguments.rangeType EQ "month" ) { if ( arguments.displayType EQ "small" ) rtnString = application.ptCalendar.calRenderService.createMonthAsGridSmall(arguments.curMonth, arguments.curYear, arguments.calendarData, arguments.eventField, arguments.linkedPage, arguments.linkedSubsite, arguments.linkedParams); else if ( arguments.displayType EQ "grid" ) { // Grid passes an additional parameter for showAdminTools=false rtnString = application.ptCalendar.calRenderService.createMonthAsGrid(arguments.curMonth, arguments.curYear, arguments.calendarData, arguments.eventField, false, arguments.linkedPage, arguments.linkedSubsite, arguments.linkedParams); } else if ( arguments.displayType EQ "list" ) rtnString = application.ptCalendar.calRenderService.createMonthAsList(arguments.curMonth, arguments.curYear, arguments.calendarData, arguments.eventField, arguments.linkedPage, arguments.linkedSubsite, arguments.linkedParams); } else if ( arguments.rangeType EQ "week" ) { if ( arguments.displayType EQ "grid" ) rtnString = application.ptCalendar.calRenderService.createWeekAsGrid(arguments.curDay, arguments.curMonth, arguments.curYear, arguments.calendarData, arguments.eventField, arguments.linkedPage, arguments.linkedSubsite, arguments.linkedParams); else if ( arguments.displayType EQ "list" ) rtnString = application.ptCalendar.calRenderService.createWeekAsList(arguments.curDay, arguments.curMonth, arguments.curYear, arguments.calendarData, arguments.eventField, arguments.linkedPage, arguments.linkedSubsite, arguments.linkedParams); } else if ( arguments.rangeType EQ "day" ) { rtnString = application.ptCalendar.calRenderService.createDayList(arguments.curDay, arguments.curMonth, arguments.curYear, arguments.calendarData, arguments.eventField, arguments.linkedPage, arguments.linkedSubsite, arguments.linkedParams); } return rtnString; // default date strings var clickedDay = day(now()); var clickedMonth = month(now()); var clickedYear = year(now()); if ( !StructKeyExists(request.params,"clicked") OR !IsBoolean(request.params.clicked) ) request.params.clicked = "0"; if ( !StructKeyExists(request.params,"day") OR !IsNumeric(request.params.day) OR !IsValid("range",request.params.day,1,31) ) request.params.day = ""; if ( !StructKeyExists(request.params,"month") OR !IsNumeric(request.params.month) OR !IsValid("range",request.params.month,1,12) ) request.params.month = ""; if ( !StructKeyExists(request.params,"year") OR !IsNumeric(request.params.year) OR !IsValid("range",request.params.year,1900,3000) ) request.params.year = ""; if ( !structKeyExists(request,"ptCalendar") or !structKeyExists(request.ptCalendar, "thisDay") or !structKeyExists(request.ptCalendar, "thisMonth") or !structKeyExists(request.ptCalendar, "thisYear") ) { // determine which date to display if ( len(request.params.day) and isNumeric(request.params.day) ) clickedDay = request.params.day; if ( len(request.params.month) and isNumeric(request.params.month) ) clickedMonth = request.params.month; if ( len(request.params.year) and isNumeric(request.params.year) ) clickedYear = request.params.year; request.ptCalendar = buildDateStructFromDateParts( theYear = clickedYear ,theMonth = clickedMonth ,theDay = clickedDay ); } var dates = structNew(); var selectedYear = val(arguments.theYear); var selectedMonth = val(arguments.theMonth); var selectedDay = val(arguments.theDay); // Create Date from values passed in accounting for non-valid dates var selectedDate = application.ptCalendar.date.createValidDate(selectedYear, selectedMonth, selectedDay); // var selectedDate = createDate(selectedYear, selectedMonth, selectedDay); // Begin and End times for a day var dayBeginTime = getDayBeginTime(); var dayEndTime = getDayEndTime(); // initialize "Week" variables var firstOfThisWeek = application.ptCalendar.date.firstDayOfWeek(selectedDate); var lastOfThisWeek = application.ptCalendar.date.lastDayOfWeek(selectedDate); var firstOfLastWeek = dateAdd("d", -7, firstOfThisWeek); var firstOfNextWeek = dateAdd("d", 7, firstOfThisWeek); // initialize "Month" variables var firstDayofSelectedMonth = application.ptCalendar.date.firstOfMonth(inMonth=selectedMonth,inYear=selectedYear); var lastDayofSelectedMonth = application.ptCalendar.date.lastOfMonth(inMonth=selectedMonth,inYear=selectedYear); // initialize "Quarter" variables var firstDayofSelectedQuarter = application.ptCalendar.date.firstDayOfQuarter(inMonth=selectedMonth,inYear=selectedYear); var lastDayofSelectedQuarter = application.ptCalendar.date.lastDayOfQuarter(inMonth=selectedMonth,inYear=selectedYear); dates["thisDay"] = selectedDay; dates["thisMonth"] = selectedMonth; dates["thisYear"] = selectedYear; dates["thisDate"] = DateFormat(selectedDate); dates["thisDateTimeStamp"] = selectedDate; dates["fullDate"] = selectedDate; dates["csformattedDateTime"] = application.ptCalendar.date.csDateFormat(selectedDate,dayBeginTime); dates["csformattedDateEndofDay"] = application.ptCalendar.date.csDateFormat(selectedDate,dayEndTime); dates["formattedDate"] = dateFormat(selectedDate, "ddd, mmm d, yyyy"); // TODO: add formatted date mask to config element dates["formattedFullDate"] = dateFormat(selectedDate, "dddd, mmmm d, yyyy"); // TODO: add formatted full date mask to config element dates["yesterday"] = dateAdd('d', -1, selectedDate); dates["tomorrow"] = dateAdd('d', 1, selectedDate); // set the next and previous weeks dates["firstOfThisWeek"] = firstOfThisWeek; dates["lastOfThisWeek"] = lastOfThisWeek; dates["firstOfLastWeek"] = firstOfLastWeek; dates["firstOfNextWeek"] = firstOfNextWeek; dates["firstOfThisMonth"] = firstDayofSelectedMonth; dates["lastOfThisMonth"] = lastDayofSelectedMonth; dates["firstOfThisQuarter"] = firstDayofSelectedQuarter; dates["lastOfThisQuarter"] = lastDayofSelectedQuarter; dates["thisQuarter"] = Quarter(selectedDate); dates["formattedThisWeek"] = dateFormat(firstOfThisWeek, 'mmmm dd, yyyy'); dates["formattedLastWeek"] = dateFormat(firstOfLastWeek, 'mmmm dd'); dates["formattedNextWeek"] = dateFormat(firstOfNextWeek, 'mmmm dd'); return dates; var appConfig = getAppConfig(); var retQry = QueryNew("temp"); var dateRangeStruct = StructNew(); var filterData = StructNew(); var startDate = ""; var endDate = ""; var useVerboseOutput = false; // Process the selected dates from the request.params and setup the request.ptCalendar date struct var selectedDates = processSelectedDate(); if ( structKeyExists(appConfig,"enableVerboseOutput") AND LEN(TRIM(appConfig['enableVerboseOutput'])) ) useVerboseOutput = appConfig['enableVerboseOutput']; // Get dateRange based on viewRangeType dateRangeStruct = application.ptCalendar.calEventsService.getDateRangefromRangeType(dateRangeType=arguments.viewRangeType); if ( StructKeyExists(dateRangeStruct,"startDate") ) startDate = dateRangeStruct.startDate; if ( StructKeyExists(dateRangeStruct,"endDate") ) endDate = dateRangeStruct.endDate; // Display dates used to filter the events query (if verbose output is turned on) if ( useVerboseOutput ) { WriteOutput("
(Start Date: #startDate#) (End Date: #endDate#)
"); } // Get the Events from the getEvents methohd (either cached or uncached) retQry = application.ptCalendar.calEventsDAO.getEvents( startDate = startDate ,endDate = endDate ,useCache = useEventsCache ); // Output Cache Status (if verbose output is turned on) if ( useVerboseOutput ) { application.ptCalendar.calEventsCacheService.renderCalendarCacheStatusHTML(); } // Filtering from the Display Properties Local Custom Element if ( ArrayLen(arguments.displayPropsArray) AND StructKeyExists(arguments.displayPropsArray[1],"values") ) { // Get Filter Fields and Values to be used in the filterEvents method filterData = application.ptCalendar.calEventsService.buildCleanFilterStruct(arguments.displayPropsArray[1].values); if ( !StructIsEmpty(filterData) ) { // Filter the query by fields and values from the display properties element retQry = application.ptCalendar.calEventsService.filterEvents(eventsQuery=retQry,filterStruct=filterData); if ( retQry.RecordCount AND useVerboseOutput ) { WriteOutput("
(Filtered: 1)
"); } } } return retQry;
var retArray = ArrayNew(1); var dataQry = getRenderEventQuery( displayPropsArray=arguments.displayPropsArray ,viewRangeType=arguments.viewRangeType ,useEventsCache=arguments.useEventsCache ); // Convert the Event Query data to and Array of Structs if ( dataQry.RecordCount ) retArray = application.ptCalendar.data.queryToArrayOfStructures(queryData=dataQry); return retArray; var retArray = ArrayNew(1); var dataQry = QueryNew("temp"); var filterPropsData = StructNew(); var startDateTime = ""; var endDateTime = ""; var pastDays = 0; var futureDays = 0; var defaultStartTime = getDayBeginTime(); var defaultEndTime = getDayEndTime(); var currentDateTime = Now(); var todayBeginDateTime = application.ptCalendar.date.csDateFormat(currentDateTime,defaultStartTime); var todayEndDateTime = application.ptCalendar.date.csDateFormat(currentDateTime,defaultEndTime); // Get the filters and calculate the Start and End dates from the Display Properties local custom element if ( ArrayLen(arguments.displayPropsArray) AND StructKeyExists(arguments.displayPropsArray[1],"values") ) { // Get Filter Fields and Values to be used in the filterEvents method filterPropsData = application.ptCalendar.calEventsService.buildCleanFilterStruct(arguments.displayPropsArray[1].values); // Calculate the startDateTime from the past Days supplied in the display properties element if ( StructKeyExists(filterPropsData,"pastDaysRange") AND IsNumeric(filterPropsData.pastDaysRange) ) { pastDays = ABS(filterPropsData.pastDaysRange); if ( pastDays GT 0 ) pastDays = -(filterPropsData.pastDaysRange); } startDateTime = DateAdd("d",pastDays,todayBeginDateTime); // Convert DateTime Stamp back to CS DateTime String so the value work in the queries startDateTime = application.ptCalendar.date.csDateFormat(DateFormat(startDateTime),TimeFormat(defaultStartTime)); // Calculate the endDateTime from the futureDays supplied in the display properties element if ( StructKeyExists(filterPropsData,"futureDaysRange") AND IsNumeric(filterPropsData.futureDaysRange) ) { futureDays = ABS(filterPropsData.futureDaysRange); if ( futureDays LT 1 ) futureDays = 0; else if ( futureDays GTE 1 ) futureDays = futureDays - 1; } endDateTime = DateAdd("d",futureDays,todayEndDateTime); // Convert DateTime Stamp back to CS DateTime String so the value work in the queries endDateTime = application.ptCalendar.date.csDateFormat(DateFormat(endDateTime),TimeFormat(defaultEndTime)); } // Get the Events from the getEvents method (either cached or uncached) dataQry = application.ptCalendar.calEventsDAO.getEvents( startDate = startDateTime ,endDate = endDateTime ,useCache = arguments.useEventsCache ); // Filter the query by fields and values from the display properties element if ( !StructIsEmpty(filterPropsData) ) dataQry = application.ptCalendar.calEventsService.filterEvents(eventsQuery=dataQry,filterStruct=filterPropsData); // Convert the Event Query data to and Array of Structs if ( dataQry.RecordCount ) retArray = application.ptCalendar.data.queryToArrayOfStructures(queryData=dataQry); return retArray; var retArray = ArrayNew(1); var dataQry = QueryNew("temp"); var filterPropsData = StructNew(); var startDateTime = ""; var endDateTime = ""; var defaultStartTime = getDayBeginTime(); var defaultEndTime = getDayEndTime(); var strEscUtils = createObject("java", "org.apache.commons.lang.StringEscapeUtils"); // Get the filters and calculate the Start and End dates from the Display Properties local custom element if ( ArrayLen(arguments.displayPropsArray) AND StructKeyExists(arguments.displayPropsArray[1],"values") ) { // Get Filter Fields and Values to be used in the filterEvents method filterPropsData = application.ptCalendar.calEventsService.buildCleanFilterStruct(arguments.displayPropsArray[1].values); // Calculate the startDateTime from the display properties element if ( StructKeyExists(filterPropsData,"startDateType") ) { // Date Field Types: Picker,Value,Expression if ( filterPropsData.startDateType EQ 'Expression' ) { if ( StructKeyExists(filterPropsData,"startDateExpression") AND LEN(TRIM(filterPropsData.startDateExpression)) ) { try { startDateTime = strEscUtils.unescapeHTML(filterPropsData.startDateExpression); startDateTime = Evaluate(startDateTime); } catch(any e) { startDateTime = filterPropsData.startDateExpression; } } } else if ( filterPropsData.startDateType EQ 'Value' ) { startDateTime = filterPropsData.startDateValue; } else { startDateTime = filterPropsData.startDatePicker; } } // Create a date time object if ( LEN(TRIM(startDateTime)) ) startDateTime = parseDateTime( startDateTime ); // Convert DateTime Stamp back to CS DateTime String so the value work in the queries startDateTime = application.ptCalendar.date.csDateFormat(DateFormat(startDateTime),TimeFormat(defaultStartTime)); // Calculate the endDateTime from the display properties element if ( StructKeyExists(filterPropsData,"endDateType") ) { // Date Field Types: Picker,Value,Expression if ( filterPropsData.endDateType EQ "Expression" ) { if ( StructKeyExists(filterPropsData,"endDateExpression") AND LEN(TRIM(filterPropsData.endDateExpression)) ) { try { endDateTime = strEscUtils.unescapeHTML(filterPropsData.endDateExpression); endDateTime = Evaluate(endDateTime); } catch(any e) { endDateTime = filterPropsData.endDateExpression; } } } else if ( filterPropsData.endDateType EQ 'Value' ) { endDateTime = filterPropsData.endDateValue; } else { endDateTime = filterPropsData.endDatePicker; } } // Create a date time object if ( LEN(TRIM(endDateTime)) ) endDateTime = parseDateTime( endDateTime ); // Convert DateTime Stamp back to CS DateTime String so the value work in the queries endDateTime = application.ptCalendar.date.csDateFormat(DateFormat(endDateTime),TimeFormat(defaultEndTime)); } // Get the Events from the getEvents method (either cached or uncached) dataQry = application.ptCalendar.calEventsDAO.getEvents( startDate = startDateTime ,endDate = endDateTime ,useCache = arguments.useEventsCache ); // Filter the query by fields and values from the display properties element if ( !StructIsEmpty(filterPropsData) ) dataQry = application.ptCalendar.calEventsService.filterEvents(eventsQuery=dataQry,filterStruct=filterPropsData); // Convert the Event Query data to and Array of Structs if ( dataQry.RecordCount ) retArray = application.ptCalendar.data.queryToArrayOfStructures(queryData=dataQry); return retArray; var retArray = ArrayNew(1); var dataQry = QueryNew("temp"); var filterDataQry = QueryNew("temp"); var dateRangeStruct = StructNew(); // Process the selected dates from the request.params and setup the request.ptCalendar date struct var selectedDates = processSelectedDate(); // Get dateRange based on viewRangeType dateRangeStruct = application.ptCalendar.calEventsService.getDateRangefromRangeType(dateRangeType=arguments.viewRangeType); if ( StructKeyExists(dateRangeStruct,"startDate") ) startDate = dateRangeStruct.startDate; if ( StructKeyExists(dateRangeStruct,"endDate") ) endDate = dateRangeStruct.endDate; // Get the Events from the getEvents methohd (either cached or uncached) dataQry = application.ptCalendar.calEventsDAO.getEvents( startDate = startDate ,endDate = endDate ,useCache = arguments.useEventsCache ); SELECT * FROM dataQry WHERE // Convert the Event Query data to and Array of Structs if ( dataQry.RecordCount ) retArray = application.ptCalendar.data.queryToArrayOfStructures(queryData=dataQry); return retArray; var retArray = ArrayNew(1); var dataQry = QueryNew("temp"); var filterDataQry = QueryNew("temp"); // Get the Events from the getEvents methohd (either cached or uncached) dataQry = application.ptCalendar.calEventsDAO.getEvents( startDate = startDate ,endDate = endDate ,useCache = arguments.useEventsCache ); SELECT * FROM dataQry WHERE // Convert the Event Query data to and Array of Structs if ( dataQry.RecordCount ) retArray = application.ptCalendar.data.queryToArrayOfStructures(queryData=dataQry); return retArray; var retArray = ArrayNew(1); var qItm = 1; var categoryItems = ""; var i = 1; var catItm = ""; var catItmArray = ArrayNew(1); var catIconData = StructNew(); var catIDlist = ""; var activefield = "Active"; var activeValue = 1; var sortField = getCatsDisplaySortField(); // Get the Sort field from the App Config settings var dataQry = getRenderEventQuery( displayPropsArray=arguments.displayPropsArray ,viewRangeType=arguments.viewRangeType ,useEventsCache=arguments.useEventsCache ); // Loop over the records from the Events query for ( qItm=1; qItm LTE dataQry.RecordCount; qItm=qItm+1 ) { // Get the Event categories id list categoryItems = dataQry["category"][qItm]; if ( LEN(TRIM(categoryItems)) ) { // loop over the Categories found for each event record for ( i=1; i LTE ListLen(categoryItems); i=i+1 ) { catItm = ListGetAt(categoryItems,i); if ( ListFindNoCase(catIDlist,catItm) EQ 0 ) { catItmArray = application.ptCalendar.calEventCategoriesDAO.getEventCategories(uniqueID=catItm); if ( ArrayLen(catItmArray) AND StructKeyExists(catItmArray[1],"values") AND StructKeyExists(catItmArray[1].values,activefield) AND catItmArray[1].values[activefield] EQ activeValue ) { // Get the CategoryIcon Struct if ( StructKeyExists(catItmArray[1].values,"categoryIcon") AND NOT IsStruct(catItmArray[1].values.categoryIcon) AND LEN(TRIM(catItmArray[1].values.categoryIcon)) AND FindNoCase("CPIMAGE",catItmArray[1].values.categoryIcon,1) ) { catIconData = application.ptCalendar.csData.decipherCPIMAGE(cpimage=catItmArray[1].values.categoryIcon); catItmArray[1].values.categoryIcon = catIconData; } // Build the Data Array ArrayAppend(retArray,catItmArray[1]); // Build list of unique CategoryIDs so categories do not get repeated catIDlist = ListAppend(catIDlist,catItm); } } } } } // Convert the Event Query data to and Array of Structs if ( ArrayLen(retArray) ) retArray = application.ptCalendar.ceData.arrayOfCEDataSort(aOfS=retArray,key=sortField,sortOrder="asc",sortType="textnocase"); return retArray;