variables.AppBeanName = "ptCalendar"; variables.version = "5.0"; variables.svnBuild = "631"; // Registered App ceRecordApi Config Elements variables.appElements = "Calendar Event Details,Calendar Event DateTime,Calendar Event Recurrence,Calendar Event Categories,Calendar Organizations,Calendar Page Mapping"; variables.useCeRecordAPI = true; variables.ceRecordApiAppConfig = {}; variables.useCeRecordApiMap = {}; // init the farDates defaults variables.farDateDefaults = {}; variables.farDateDefaults.yearPad = 2; // Set the version information application.ptCalendar.version = variables.version; application.ptCalendar.svnBuild = variables.svnBuild; // Load the app config into the apps space application.ptCalendar.appConfig = getAppConfig(); // Rebuild Views for the primary App Custom Elements if requested or they don't exist buildView(ceName=getEventDetailsCEName()); buildView(ceName=getEventDateTimeCEName()); buildView(ceName=getEventRecurrenceCEName()); buildView(ceName=getEventCategoriesCEName()); buildView(ceName=getCalOrganizationsCEName()); // Clear the view specs Cache clearviewSpecsCache(); if ( getEventCacheStatus() OR getEventsManagementEventCacheStatus() ) { // Build out the static and recurring events and load them into the eventsCache if ( !StructKeyExists(application,"ptCalendarCache") OR ( StructKeyExists(request.params,"rebuildCalendarCache") AND request.params.rebuildCalendarCache EQ 1) ) application.ptCalendar.calEventsCacheController.initCalendarCache(); } else { application.ptCalendar.calEventsCacheController.removeEventCache(); } // Set the FarDates for the Prev/Next navigation (defaults) application.ptCalendar['farDates'] = initFarDatesStruct(); // Call the setFarEventDates process (via CFTHREAD using the reset method) application.ptCalendar.calEventsService.resetFarEventDates(useCache=getEventCacheStatus()); // Build out the render handler file paths for the calender display views application.ptCalendar.viewRHfilePaths = application.ptCalendar.calRenderViewDAO.getCalendarDisplayViewPathData(); application.ptCalendar.viewPageMode = getViewPageMode(); application.ptCalendar.defaultView = getDefaultDisplayView(); application.ptCalendar.viewParamName = getViewParamName(); // Init and set the ceRecordAPI config settings initCeRecordApiAppConfig(variables.AppBeanName); setUseCeRecordAPI(); setUseCeRecordApiMap(); // Set the Application variables for the ceRecordAPI application.ptCalendar.ceRecordApiAppConfig = getCeRecordApiAppConfig(); application.ptCalendar.useCeRecordAPI = getUseCeRecordAPI(); application.ptCalendar.useCeRecordApiMap = getUseCeRecordApiMap(); var retStruct = { // minPastEvent 'minPastEventDate': '', 'minPastEventYear': '', 'minPastEventMonth': '', 'minPastEventMonthDate': '', 'minPastEventWeekDate': '', // maxFutureEvent 'maxFutureEventDate': '', 'maxFutureEventYear': '', 'maxFutureEventMonth': '', 'maxFutureEventMonthDate': '', 'maxFutureEventWeekDate': '' }; return retStruct; var retStruct = {}; var yearPad = variables.farDateDefaults.yearPad; var defaultMinYear = Year(DateAdd('yyyy',-(ABS(yearPad)),Now())); var defaultMinMonth = Month(Now()); // Set the Default minPastEventDate as the first day for the month for the calcuated year (Now() + yearPad) retStruct['minPastEventDate'] = application.ptCalendar.date.firstOfMonth(inMonth=defaultMinMonth,inYear=defaultMinYear); retStruct['minPastEventYear'] = defaultMinYear; retStruct['minPastEventMonth'] = defaultMinMonth; retStruct['minPastEventMonthDate'] = retStruct.minPastEventDate; retStruct['minPastEventWeekDate'] = DateFormat(application.ptCalendar.date.firstDayOfWeek(inDate=retStruct.minPastEventDate),'yyyy-mm-dd') & ' 00:00:00'; return retStruct; var retStruct = {}; var yearPad = variables.farDateDefaults.yearPad; var defaultMaxYear = Year(DateAdd('yyyy',ABS(yearPad),Now())); var defaultMaxMonth = Month(Now()); // Set the Default maxFutureEventDate as the last day for the month for the calcuated year (Now() + yearPad) retStruct['maxFutureEventDate'] = application.ptCalendar.date.lastOfMonth(inMonth=defaultMaxMonth,inYear=defaultMaxYear); retStruct['maxFutureEventYear'] = defaultMaxYear; retStruct['maxFutureEventMonth'] = defaultMaxMonth; retStruct['maxFutureEventMonthDate'] = retStruct.maxFutureEventDate; retStruct['maxFutureEventWeekDate'] = DateFormat(application.ptCalendar.date.lastDayOfWeek(inDate=retStruct.maxFutureEventDate),'yyyy-mm-dd') & ' 23:59:59'; return retStruct; if ( !StructKeyExists(application.ptCalendar,'farDates') ) application.ptCalendar.farDates = {}; if ( !StructKeyExists(application.ptCalendar.farDates,'minPastEventDate') OR !IsDate(application.ptCalendar.farDates.minPastEventDate) ) application.ptCalendar.farDates = getFarDatesMinPastDefaults(); return application.ptCalendar.farDates.minPastEventDate; if ( !StructKeyExists(application.ptCalendar,'farDates') ) application.ptCalendar.farDates = {}; if ( !StructKeyExists(application.ptCalendar.farDates,'maxFutureEventDate') OR !IsDate(application.ptCalendar.farDates.maxFutureEventDate) ) application.ptCalendar.farDates = getFarDatesMaxFutureDefaults(); return application.ptCalendar.farDates.maxFutureEventDate; if ( !StructKeyExists(application.ptCalendar,'farDates') ) application.ptCalendar.farDates = {}; if ( !StructKeyExists(application.ptCalendar.farDates,'minPastEventYear') OR !IsNumeric(application.ptCalendar.farDates.minPastEventYear) OR application.ptCalendar.farDates.minPastEventYear LT 1900 ) application.ptCalendar.farDates = getFarDatesMinPastDefaults(); return application.ptCalendar.farDates.minPastEventYear; if ( !StructKeyExists(application.ptCalendar,'farDates') ) application.ptCalendar.farDates = {}; if ( !StructKeyExists(application.ptCalendar.farDates,'maxFutureEventYear') OR !IsNumeric(application.ptCalendar.farDates.maxFutureEventYear) OR application.ptCalendar.farDates.maxFutureEventYear LT 1900 ) application.ptCalendar.farDates = getFarDatesMaxFutureDefaults(); return application.ptCalendar.farDates.maxFutureEventYear; if ( !StructKeyExists(application.ptCalendar,'farDates') ) application.ptCalendar.farDates = {}; if ( !StructKeyExists(application.ptCalendar.farDates,'minPastEventMonthDate') OR !IsDate(application.ptCalendar.farDates.minPastEventMonthDate) ) application.ptCalendar.farDates = getFarDatesMinPastDefaults(); return application.ptCalendar.farDates.minPastEventMonthDate; if ( !StructKeyExists(application.ptCalendar,'farDates') ) application.ptCalendar.farDates = {}; if ( !StructKeyExists(application.ptCalendar.farDates,'maxFutureEventMonthDate') OR !IsDate(application.ptCalendar.farDates.maxFutureEventMonthDate) ) application.ptCalendar.farDates = getFarDatesMaxFutureDefaults(); return application.ptCalendar.farDates.maxFutureEventMonthDate; if ( !StructKeyExists(application.ptCalendar,'farDates') ) application.ptCalendar.farDates = {}; if ( !StructKeyExists(application.ptCalendar.farDates,'minPastEventWeekDate') OR !IsDate(application.ptCalendar.farDates.minPastEventWeekDate) ) application.ptCalendar.farDates = getFarDatesMinPastDefaults(); return application.ptCalendar.farDates.minPastEventWeekDate; if ( !StructKeyExists(application.ptCalendar,'farDates') ) application.ptCalendar.farDates = {}; if ( !StructKeyExists(application.ptCalendar.farDates,'maxFutureEventWeekDate') OR !IsDate(application.ptCalendar.farDates.maxFutureEventWeekDate) ) application.ptCalendar.farDates = getFarDatesMaxFutureDefaults(); return application.ptCalendar.farDates.maxFutureEventWeekDate; if ( !StructKeyExists(application.ptCalendar,'farDates') ) application.ptCalendar.farDates = {}; if ( !StructKeyExists(application.ptCalendar.farDates,'minPastEventDate') OR !IsDate(application.ptCalendar.farDates.minPastEventDate) ) application.ptCalendar.farDates = getFarDatesMinPastDefaults(); return application.ptCalendar.farDates.minPastEventDate; if ( !StructKeyExists(application.ptCalendar,'farDates') ) application.ptCalendar.farDates = {}; if ( !StructKeyExists(application.ptCalendar.farDates,'maxFutureEventDate') OR !IsDate(application.ptCalendar.farDates.maxFutureEventDate) ) application.ptCalendar.farDates = getFarDatesMinPastDefaults(); return application.ptCalendar.farDates.maxFutureEventDate; var retValue = "ui-lightness"; var appConfig = getAppConfig(); // Set the CFdateMask from the Config Element if ( StructKeyExists(appConfig,'ui_theme') AND LEN(TRIM(appConfig['ui_theme'])) ) retValue = appConfig['ui_theme']; return retValue; var retValue = false; var appConfig = getAppConfig(); // Get useEventToolTip option from Config Element if ( StructKeyExists(appConfig,"calendar_app_use_event_tooltip") AND IsBoolean(appConfig['calendar_app_use_event_tooltip']) ) retValue = appConfig['calendar_app_use_event_tooltip']; return retValue; var retValue = "cream"; var appConfig = getAppConfig(); // Get ToolTip Style from Config Element if ( StructKeyExists(appConfig,"calendar_app_tooltip_theme") AND LEN(TRIM(appConfig['calendar_app_tooltip_theme'])) ) retValue = appConfig['calendar_app_tooltip_theme']; return retValue; var retValue = "Single"; var appConfig = getAppConfig(); // Set the CFdateMask from the Config Element if ( structKeyExists(appConfig,'calendarViewPageMode') AND LEN(TRIM(appConfig['calendarViewPageMode'])) ) retValue = appConfig['calendarViewPageMode']; return retValue; var retValue = "MonthGrid"; var viewName = ""; var viewTypeID = ""; var appConfig = getAppConfig(); // Set the defaultCalendarView from the Config Element if ( structKeyExists(appConfig,'defaultCalendarView') AND LEN(TRIM(appConfig['defaultCalendarView'])) ) { viewName = appConfig['defaultCalendarView']; viewTypeID = application.ptCalendar.calRenderViewDAO.getCalendarViewTypeIDbyName(viewName); if ( LEN(TRIM(viewTypeID)) ) retValue = viewTypeID; } return retValue; var retValue = application.ptCalendar.calRenderViewService.getCalendarViewNameList(); var appConfig = getAppConfig(); // Set the calenderViews list from the Config Element if ( structKeyExists(appConfig,'calenderViews') AND LEN(TRIM(appConfig['calenderViews'])) ) retValue = appConfig['calenderViews']; // TODO: For now just strip out the spaces out... should get the TypeID values by Type name retValue = REREPLACE(retValue,"[\s]","","all"); return retValue; var retValue = "calview"; var appConfig = getAppConfig(); //Set the CFdateMask from the Config Element if ( structKeyExists(appConfig,'calendarViewParamName') AND LEN(TRIM(appConfig['calendarViewParamName'])) ) retValue = appConfig['calendarViewParamName']; return retValue; var retValue = "m/d/yyyy"; var appConfig = getAppConfig(); // Set the CFdateMask from the Config Element if ( structKeyExists(appConfig,"CFdateMask") AND LEN(TRIM(appConfig['CFdateMask'])) ) retValue = appConfig['CFdateMask']; // FIX for case-senstive date format masks (eg. ACF 2021) // Limits the use of masks that require CAPS ... but should not be a problem except in an extreme case // TODO: the mask value coming from the Config Element should be updated to be lower case retValue = LCASE(retValue); return retValue; var retValue = "dddd mmmm d, yyyy"; var appConfig = getAppConfig(); // Set the CFdateMask from the Config Element if ( structKeyExists(appConfig,"CFdateLongMask") AND LEN(TRIM(appConfig['CFdateLongMask'])) ) retValue = appConfig['CFdateLongMask']; return retValue; var retValue = "h:mm tt"; var appConfig = getAppConfig(); // Set the CFtimeMask from the Config Element if ( structKeyExists(appConfig,"CFtimeMask") AND LEN(TRIM(appConfig['CFtimeMask'])) ) retValue = appConfig['CFtimeMask']; return retValue; var appConfig = getAppConfig(); // Get the cache type from the config element if ( structKeyExists(appConfig,"sortFieldOrganizations") AND LEN(TRIM(appConfig['sortFieldOrganizations'])) ) return appConfig['sortFieldOrganizations']; else return "Name"; var appConfig = getAppConfig(); // Get the cache type from the config element if ( structKeyExists(appConfig,"sortFieldCategories") AND LEN(TRIM(appConfig['sortFieldCategories'])) ) return appConfig['sortFieldCategories']; else return "Name"; var appConfig = getAppConfig(); // Get the EventApprovedLabel from the config element if ( structKeyExists(appConfig,"EventApprovedLabel") AND LEN(TRIM(appConfig['EventApprovedLabel'])) ) return appConfig['EventApprovedLabel']; else return "Approved"; var appConfig = getAppConfig(); // Get the EventApprovedLabel from the config element if ( structKeyExists(appConfig,"EventDeniedLabel") AND LEN(TRIM(appConfig['EventDeniedLabel'])) ) return appConfig['EventDeniedLabel']; else return "Denied"; var appConfig = getAppConfig(); // Get the EventApprovedLabel from the config element if ( structKeyExists(appConfig,"EventPendingLabel") AND LEN(TRIM(appConfig['EventPendingLabel'])) ) return appConfig['EventPendingLabel']; else return "Not Reviewed"; var appConfig = getAppConfig(); // Get the cache type from the config element if ( structKeyExists(appConfig,"enableEventCache") AND isBoolean(appConfig['enableEventCache']) ) return appConfig['enableEventCache']; else return false; var appConfig = getAppConfig(); // Get the cache type from the config element if ( structKeyExists(appConfig,"calendarCacheType") AND LEN(TRIM(appConfig['calendarCacheType'])) ) return appConfig['calendarCacheType']; else return "NA"; var appConfig = getAppConfig(); // Get the cache datasource from the config element if ( structKeyExists(appConfig,"calendarCacheDSN") AND LEN(TRIM(appConfig['calendarCacheDSN'])) ) return appConfig['calendarCacheDSN']; else return request.site.datasource; var appConfig = getAppConfig(); // Get the cache datasource from the config element if ( structKeyExists(appConfig,"calendarCacheMaxPastEvents") AND IsNumeric(appConfig['calendarCacheMaxPastEvents']) AND appConfig['calendarCacheMaxPastEvents'] GT 0 ) return appConfig['calendarCacheMaxPastEvents']; else return 0; // in Years - 0 is disabled var appConfig = getAppConfig(); // Get the cache datasource from the config element if ( structKeyExists(appConfig,"calendarCacheMaxFutureYears") AND IsNumeric(appConfig['calendarCacheMaxFutureYears']) AND appConfig['calendarCacheMaxFutureYears'] GT 0 ) return appConfig['calendarCacheMaxFutureYears']; else return 0; // in Years - 0 is disabled var appConfig = getAppConfig(); // Get the cache type from the config element if ( structKeyExists(appConfig,"enableEventCacheForManagement") AND isBoolean(appConfig['enableEventCacheForManagement']) ) return appConfig['enableEventCacheForManagement']; else return false; var appConfig = getAppConfig(); // Get the cache datasource from the config element if ( structKeyExists(appConfig,"copyEventSuffix") AND LEN(TRIM(appConfig['copyEventSuffix'])) ) return appConfig['copyEventSuffix']; else return ""; var appConfig = getAppConfig(); // Get the cache datasource from the config element if ( structKeyExists(appConfig,"brokenRecurrenceEventSuffix") AND LEN(TRIM(appConfig['brokenRecurrenceEventSuffix'])) ) return appConfig['brokenRecurrenceEventSuffix']; else return ""; var appConfig = getAppConfig(); // Get the cache datasource from the config element if ( structKeyExists(appConfig,"enableVerboseOutput") AND IsBoolean(appConfig['enableVerboseOutput']) ) return appConfig['enableVerboseOutput']; else return false; var appConfig = getAppConfig(); // Get the cache datasource from the config element if ( structKeyExists(appConfig,"enableDebugOutput") AND IsBoolean(appConfig['enableDebugOutput']) ) return appConfig['enableDebugOutput']; else return false; var appConfig = getAppConfig(); // Get the cache datasource from the config element if ( structKeyExists(appConfig,"enableEventStepLogging") AND IsBoolean(appConfig['enableEventStepLogging']) ) return appConfig['enableEventStepLogging']; else return true; // default should be false var appConfig = getAppConfig(); // Get the cache datasource from the config element if ( structKeyExists(appConfig,"AllOrganizationsLabel") AND LEN(TRIM(appConfig['AllOrganizationsLabel'])) ) return appConfig['AllOrganizationsLabel']; else return "All Organizations"; return "--[all-orgs]--"; return getAllOrganizationsValue(); var appConfig = getAppConfig(); // Get the cache datasource from the config element if ( structKeyExists(appConfig,"toolTipsDescriptionMaxWordCount") AND LEN(TRIM(appConfig['toolTipsDescriptionMaxWordCount'])) ) return appConfig['toolTipsDescriptionMaxWordCount']; else return 50; var appConfig = getAppConfig(); // Get the cache datasource from the config element if ( structKeyExists(appConfig,"iCalDescriptionMaxWordCount") AND LEN(TRIM(appConfig['iCalDescriptionMaxWordCount'])) ) return appConfig['iCalDescriptionMaxWordCount']; else return 50; var appConfig = getAppConfig(); // Get the cache datasource from the config element if ( structKeyExists(appConfig,"collapseCurrentMonthsPastEvents") AND IsBoolean(appConfig['collapseCurrentMonthsPastEvents']) ) return appConfig['collapseCurrentMonthsPastEvents']; else return false; var appConfig = getAppConfig(); // Get the cache datasource from the config element if ( structKeyExists(appConfig,"CS_USERS_DSN") AND LEN(TRIM(appConfig['CS_USERS_DSN'])) ) return appConfig['CS_USERS_DSN']; else return request.site.USERSDATASOURCE; var appConfig = getAppConfig(); // Get the cache datasource from the config element if ( structKeyExists(appConfig,"FilterDefaultRangeType") AND Len(Trim(appConfig['FilterDefaultRangeType'])) ) return appConfig['FilterDefaultRangeType']; else return "m"; var appConfig = getAppConfig(); // Get the cache datasource from the config element if ( structKeyExists(appConfig,"FilterDefaultRangeQty") AND IsNumeric(appConfig['FilterDefaultRangeQty']) ) return appConfig['FilterDefaultRangeQty']; else return 1; var appConfig = getAppConfig(); // Get the cache datasource from the config element if ( structKeyExists(appConfig,"ManagementFilterDefaultRangeType") AND Len(Trim(appConfig['ManagementFilterDefaultRangeType'])) ) return appConfig['ManagementFilterDefaultRangeType']; else return "m"; var appConfig = getAppConfig(); // Get the cache datasource from the config element if ( structKeyExists(appConfig,"ManagementFilterDefaultRangeQty") AND IsNUmeric(appConfig['ManagementFilterDefaultRangeQty']) ) return appConfig['ManagementFilterDefaultRangeQty']; else return 1; var appConfig = getAppConfig(); var retStr = "(This event occurred in the past.)"; // Get the cache datasource from the config element if ( structKeyExists(appConfig,"PastEventDisplayText") AND LEN(TRIM(appConfig['PastEventDisplayText'])) ) retStr = appConfig['PastEventDisplayText']; return retStr; return application.ptCalendar.calCeViewsDAO.getCEViewSpecs(ceName=arguments.ceName); var dbType = getCSDBType(); var cacheDataSource = getCacheDatasource(); var cacheDSNExists = verifyDSNExists(dataSource=cacheDataSource); var dbInfoQry = QueryNew('tmp'); if ( dbInfoQry.RecordCount ) { if ( StructKeyExists(dbInfoQry,"DATABASE_PRODUCTNAME") ) dbType = dbInfoQry.DATABASE_PRODUCTNAME[1]; // For MS SQL use the Driver Name for the DbType if ( FindNoCase("Microsoft SQL",dbType) AND StructKeyExists(dbInfoQry,"DRIVER_NAME") ) dbType = dbInfoQry.DRIVER_NAME[1]; } return dbType; // Get the DB Server Type var dbType = getCSDBType(); var charType = "VARCHAR"; // Set the specific DB dataTypes // NOTE: switch statement below is apparently not needed for SQL Server, Oracle, or MySQL 5.1 or 5.5 on ACF 9 /* switch (dbType) { case 'Oracle': charType = 'VARCHAR'; break; case 'MySQL': charType = 'CHAR'; break; case 'SQLServer': charType = 'VARCHAR'; break; } */ if (dbtype neq "MySQL" and siteDBIsUnicode()) charType = replaceNoCase(charType, "varchar", "nvarchar"); return charType; var retStruct = {}; var type = ''; var cacheUnit = 'd'; var cacheExpiresValue = 1; try { lock timeout="10" name="ptCal_app_viewSpecsCache" type="exclusive" { if ( NOT structKeyExists(application.ptCalendar, "viewSpecsCache") ) application.ptCalendar.viewSpecsCache = {}; if ( NOT structKeyExists(application.ptCalendar.viewSpecsCache, arguments.viewName) ) application.ptCalendar.viewSpecsCache[arguments.viewName] = {}; if ( NOT structKeyExists(application.ptCalendar.viewSpecsCache[arguments.viewName], 'columnTypes') OR arguments.rebuildViewColumnCache ) application.ptCalendar.viewSpecsCache[arguments.viewName].columnTypes = {}; // events query Caching if ( isStruct(application.ptCalendar.viewSpecsCache[arguments.viewName].columnTypes) AND NOT StructIsEmpty(application.ptCalendar.viewSpecsCache[arguments.viewName].columnTypes) AND structKeyExists(application.ptCalendar.viewSpecsCache[arguments.viewName].columnTypes, 'struct') AND IsStruct(application.ptCalendar.viewSpecsCache[arguments.viewName].columnTypes.struct) AND structKeyExists(application.ptCalendar.viewSpecsCache[arguments.viewName].columnTypes, 'expires') AND dateCompare(now(),application.ptCalendar.viewSpecsCache[arguments.viewName].columnTypes.expires) EQ -1) { retStruct = application.ptCalendar.viewSpecsCache[arguments.viewName].columnTypes.struct; } else { // Get View Column Format based on and element name/view name // ----------------------------------------------------------------- retStruct = getViewColumnStructDirect(argumentCollection=arguments); application.ptCalendar.viewSpecsCache[arguments.viewName].columnTypes = {}; application.ptCalendar.viewSpecsCache[arguments.viewName].columnTypes.struct = retStruct; application.ptCalendar.viewSpecsCache[arguments.viewName].columnTypes.expires = createODBCDateTime(DateAdd(cacheUnit,cacheExpiresValue,now())); application.ptCalendar.viewSpecsCache[arguments.viewName].columnTypes.recordCount = structCount(retStruct); } } // END: cflock } catch ( any ex ) { errorMsg = "Error getting the #arguments.viewName# view column datatype struct:"; errorMsg = errorMsg & "#chr(10)##Server.CommonSpot.UDF.util.structToText(arguments)#"; application.ADF.log.addLogEntry(message=errorMsg,CFCatch=ex,useDatePrefix=true,wantAllStacks=false); } return retStruct; var retStruct = {}; // Get columns from the View Table var viewQry = getViewColumnFormat(ceName=arguments.ceName,viewName=arguments.viewName,rebuildViewColumnCache=arguments.rebuildViewColumnCache); var colMetaData = []; var colName = ""; var dataType = ""; var i = 1; // Can not build the structure if we have no ViewName or if the view doesn't exist if ( !StructKeyExists(viewQry,"tmp") AND TRIM(arguments.viewName) GT 0 ) { // Get dataType information from query object metaData colMetaData = GetMetaData(viewQry); // Loop over the Meta Data to build the column name/datatype struct for ( i=1; i <= ArrayLen(colMetaData); i++ ) { colName = colMetaData[i].Name; // convert the dataTypes to ones needed for CF QueryNew() retStruct[colName] = convertSQLDataTypeToQueryDataType(dataType=colMetaData[i].TypeName); } } else { // do what besides log it?? if we get here we are hosed... doErrorLogging(methodName="getViewColumnStruct", errorMsg="View name or column form format unavailable, can't continue."); } return retStruct; // Clear the viewSpecsCache Structure lock timeout="5" name="ptCal_app_viewSpecsCache" type="exclusive" { application.ptCalendar.viewSpecsCache = {}; } // Clear the viewSpecsCache Structure lock timeout="5" name="ptCal_app_viewSpecsCache" type="exclusive" { application.ptCalendar.viewSpecsCache[arguments.viewName] = {}; } var retStr = ""; // convert the SQL dataTypes to valid dataTypes for second parameter of the CF QueryNew() function // - Feel free add additional datatypes from other DBs to the comma-delimited CASEs switch(arguments.dataType) { case "int": case "tinyint": retStr="integer"; break; case "bigint": retStr="bigint"; break; case "decimal": case "double": retStr="decimal"; break; case "bit": retStr="bit"; break; case "time": case "timestamp": retStr="time"; break; case "date": case "datetime2": case "smalldatetime": case "datetime": retStr="date"; break; // In most cases QueryNew columns from a CE View table just needs to be "varchar" // VARCHAR, CHAR, LONGVARCHAR, etc. default: retStr="varchar"; } return retStr; var retQry = QueryNew("tmp"); var cacheUnit = 'd'; var cacheExpiresValue = 1; try { lock timeout="10" name="ptCal_app_viewSpecsCache" type="exclusive" { if ( NOT structKeyExists(application.ptCalendar, "viewSpecsCache") ) application.ptCalendar.viewSpecsCache = {}; if ( NOT structKeyExists(application.ptCalendar.viewSpecsCache, arguments.viewName) ) application.ptCalendar.viewSpecsCache[arguments.viewName].columnFormat = {}; if ( NOT structKeyExists(application.ptCalendar.viewSpecsCache[arguments.viewName], 'columnFormat') OR arguments.rebuildViewColumnCache ) application.ptCalendar.viewSpecsCache[arguments.viewName].columnFormat = {}; // events query Caching if ( isStruct(application.ptCalendar.viewSpecsCache[arguments.viewName].columnFormat) AND NOT StructIsEmpty(application.ptCalendar.viewSpecsCache[arguments.viewName].columnFormat) AND structKeyExists(application.ptCalendar.viewSpecsCache[arguments.viewName].columnFormat, 'query') AND IsQuery(application.ptCalendar.viewSpecsCache[arguments.viewName].columnFormat.query) AND structKeyExists(application.ptCalendar.viewSpecsCache[arguments.viewName].columnFormat, 'expires') AND dateCompare(now(),application.ptCalendar.viewSpecsCache[arguments.viewName].columnFormat.expires) EQ -1) { retQry = application.ptCalendar.viewSpecsCache[arguments.viewName].columnFormat.query; } else { // Get View Column Format based on and element name/view name // ----------------------------------------------------------------- retQry = getViewColumnFormatDirect(argumentCollection=arguments); application.ptCalendar.viewSpecsCache[arguments.viewName].columnFormat = {}; application.ptCalendar.viewSpecsCache[arguments.viewName].columnFormat.query = retQry; application.ptCalendar.viewSpecsCache[arguments.viewName].columnFormat.expires = createODBCDateTime(DateAdd(cacheUnit,cacheExpiresValue,now())); application.ptCalendar.viewSpecsCache[arguments.viewName].columnFormat.recordCount = retQry.recordCount; } } // END: cflock } catch ( any ex ) { errorMsg = "Error getting the #arguments.viewName# view column format query:"; errorMsg = errorMsg & "#chr(10)##Server.CommonSpot.UDF.util.structToText(arguments)#"; application.ADF.log.addLogEntry(message=errorMsg,CFCatch=ex,useDatePrefix=true,wantAllStacks=false); } return retQry; var viewQry = QueryNew("tmp"); SELECT * FROM #arguments.viewName# WHERE 1=0 var result = application.ptCalendar.calCeViewsDAO.buildView(ceName=arguments.ceName,viewName=arguments.viewName); // Clear the View Cache for this view clearViewSpecsCacheByName(argumentCollection=arguments); return result; var fieldQuery = queryNew("temp"); var rtnStruct = structNew(); var itm = 1; var thisFieldKey = ""; var thisField = ""; var thisFieldID = 0; var thisFieldName = ""; //var thisFieldType = ""; var extrafieldData = StructNew(); // Get the Element Query by the formID if( arguments.formID GT 0 ) { // get the field query for this element fieldQuery = application.ptCalendar.ceData.getElementFieldsByFormID(arguments.formID); // loop through the query and build the default structure for( itm=1; itm lte fieldQuery.recordCount; itm=itm+1 ) { thisFieldID = fieldQuery.fieldID[itm]; thisField = fieldQuery.fieldName[itm]; // Replace the FIC_ from the beginning thisFieldName = ReplaceNoCase(thisField, "FIC_", "", "all"); //thisFieldType = fieldQuery.type[itm]; extrafieldData = application.ptCalendar.ceData.getFieldDefaultValueFromID(thisFieldID); // add this field into the return struct // rtnStruct[thisFieldName] = thisFieldType; // add this field and its properties to thee return struct rtnStruct[thisFieldName] = StructNew(); if ( StructKeyExists(extrafieldData ,"type") ) rtnStruct[thisFieldName]["type"] = extrafieldData.type; if ( StructKeyExists(extrafieldData,"label") ) rtnStruct[thisFieldName]["label"] = extrafieldData.label; if ( StructKeyExists(extrafieldData,"required") ) rtnStruct[thisFieldName]["required"] = extrafieldData.required; if ( StructKeyExists(extrafieldData,"maxlength") ) rtnStruct[thisFieldName]["maxlength"] = extrafieldData.maxlength; } } return rtnStruct; var formID = 0; var rtnStruct = structNew(); if ( LEN(TRIM(arguments.ceName)) ) formID = application.ptCalendar.ceData.getFormIDByCEName(arguments.ceName); if ( IsNumeric(formID) AND formID GT 0 ) rtnStruct = csFieldsDataTypeStruct(formID=formID); return rtnStruct; var retStruct = application.ptCalendar.date.calculateMonthsYears(inDate=arguments.inDate); if ( NOT StructKeyExists(retStruct,'baseDate') ) retStruct.baseDate = DateFormat(arguments.inDate,'yyyy/mm/dd'); if ( NOT StructKeyExists(retStruct,'baseYear') ) retStruct.baseYear = Year(arguments.inDate); if ( NOT StructKeyExists(retStruct,'baseMonth') ) retStruct.baseMonth = Month(arguments.inDate); // Add alternate prev (last) month and year retStruct.prevMonth = retStruct.lastMonth; retStruct.prevYear = retStruct.lastYear; return retStruct; var retStruct = application.ptCalendar.date.calculateWeekDates(inDate=arguments.inDate); if ( NOT StructKeyExists(retStruct,'baseDate') ) retStruct['baseDate'] = DateFormat(arguments.inDate,'yyyy/mm/dd'); return retStruct; return application.ptCalendar.data.sanitizeHtmlStr(htmlStr=htmlStr); return application.ptCalendar.data.trimStringByWordCount(str=arguments.str,words=75,useEllipsis=1,stripHTML=1,stripTagsList=""); var inputStr = ""; for ( key in arguments ) { if ( key NEQ "makeUnique" AND key NEQ "delimiter" ) { if ( LEN(TRIM(arguments.delimiter)) ) inputStr = ListAppend(inputStr,TRIM(arguments[key]),arguments.delimiter); else inputStr = inputStr & TRIM(arguments[key]); } } return generateHashedString(str=inputStr,makeUnique=arguments.makeUnique); var isValidUniqueID = false; var hashedStrParts = buildHashID(arguments.strA,arguments.strB,arguments.strC,arguments.strD,arguments.strE,arguments.strF,arguments.strG,false,arguments.delimiter); if ( TRIM(arguments.hashedID) EQ TRIM(hashedStrParts) ) isValidUniqueID = true; return isValidUniqueID; if ( arguments.makeUnique ) arguments.str = arguments.str & "-" & CreateUUID(); return generateEncryptedString(str=arguments.str,algorithm=arguments.algorithm,oneway=true); var encString = ""; // Additional Algorithms can be added // - hash: CFMX_COMPAT (default), MD5, SHA, SHA-256, SHA-384,SHA-512 // - encrypt: CFMX_COMPAT (default), AES (standard edition CF), BLOWFISH, DES, and DESEDE var validHashAlgorithms = "CFMX_COMPAT,MD5,SHA,SHA-256,SHA-384,SHA-512"; var validEncryptAlgorithms = "CFMX_COMPAT, AES, BLOWFISH, DES, DESEDE"; // Additional Encodings can be added var validHashEncoding = "UTF-8"; var validEncryptEncoding = "Base64,hex,UU"; var algr = TRIM(arguments.algorithm); var encd = TRIM(arguments.encoding); if ( arguments.oneway ) { if ( ListFindNoCase(validHashAlgorithms,algr) EQ 0 ) algr = "SHA-256"; if ( ListFindNoCase(validHashEncoding,encd) EQ 0 ) encd = "UTF-8"; encString = hash(arguments.str, algr, encd); } else { if ( ListFindNoCase(validEncryptAlgorithms,alg) EQ 0 ) algr = "AES"; if ( ListFindNoCase(validEncryptEncoding,encd) EQ 0 ) encd = "UU"; encString = encrypt(arguments.str, arguments.key, algr, encd); } return encString; var verifyDSN = QueryNew('tmp'); var oracleVerifyDSN = QueryNew('tmp'); var errStruct = StructNew(); var sqlFromTable = "INFORMATION_SCHEMA.TABLES"; // SQLServer and MySQL schema table name var oracleFromTable = "USER_TAB_COLUMNS"; // Oracle schema table name var dataSourceExists = false; select * from #sqlFromTable# where 1 = 2 select * from #oracleFromTable# where 1 = 2 var errorDump = ""; var logFileName = errorLogFileName(processName=arguments.processName,appName=arguments.appName); var errorStruct = StructNew(); // Add the errorDetails to the errorStruct errorStruct.Details = arguments.errorDetails; // Add the processName to the errorStruct if ( LEN(TRIM(arguments.processName)) ) errorStruct.processName = arguments.processName; // Add the methodName to the errorStruct data if ( LEN(TRIM(arguments.methodName)) ) errorStruct.methodName = arguments.methodName; Server.CommonSpot.addLogEntry(arguments.errorMsg,errorStruct,false,logFileName,true,false); var logFileName = arguments.appName & "." & arguments.processName & ".errors.log"; //var logFileName = dateFormat(now(), "yyyymmdd") & "." & request.site.name & "." & arguments.appName & "_" & arguments.processName & "_Errors.htm"; return logFileName; ---> if ( StructKeyExists(arguments,'size') AND IsNumeric(arguments.size) ) arguments.breakSize = arguments.size; if ( TRIM(arguments.fileNameOverride) EQ '' ) arguments.fileNameOverride = buildStepLogFileName(processName=arguments.processName,appName=arguments.appName); application.ptCalendar.log.doTextLogging(argumentCollection=arguments); return dateFormat(now(), "yyyymmdd") & "." & request.site.name & "." & arguments.appName & "." & arguments.processName & ".step.log";