variables.version = "4.6"; variables.svnBuild = "477"; // 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()); if ( getEventCacheStatus() ) { // 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(); } // 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(); // Set the version information application.ptCalendar.version = variables.version; application.ptCalendar.svnBuild = variables.svnBuild; 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']; 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 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 = StructNew(); // Get column information from the View Table var viewQry = getViewColumnFormat(ceName=arguments.ceName,viewName=arguments.viewName); var colMetaData = ArrayNew(1); var colName = ""; var dataType = ""; 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 viewQry = QueryNew("temp"); SELECT * FROM #arguments.viewName# WHERE 1=0 return application.ptCalendar.calCeViewsDAO.buildView(ceName=arguments.ceName,viewName=arguments.viewName); 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 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; var logFileName = stepLogFileName(processName=arguments.processName,appName=arguments.appName); var logPrefix = arguments.processName & ": "; // Prepend the processName and if exists the methodName if ( LEN(TRIM(arguments.methodName)) ) logPrefix = logPrefix & arguments.methodName & ": "; if ( LEN(TRIM(arguments.logMsg)) ) application.ptCalendar.utils.logAppend( msg=logPrefix & arguments.logMsg, logfile=logFileName ); doStepLogData(logFilename=logFileName,logPrefix=logPrefix,logData=arguments.logData); if ( arguments.addBreak ) application.ptCalendar.utils.logAppend( msg='#RepeatString("-",arguments.size)#', logfile=logFileName ); var logMsg = ""; if ( !IsSimpleValue(arguments.logData) ) { logMsg = arguments.logPrefix & "Data Output: "; application.ptCalendar.utils.logAppend( msg=logMsg, logfile=arguments.logFileName ); } if ( IsArray(arguments.logData) AND ArrayLen(arguments.logData) ) { doStepLogArray(logFilename=arguments.logFileName,logPrefix=arguments.logPrefix,logData=arguments.logData); } else if ( IsStruct(arguments.logData) AND !StructIsEmpty(arguments.logData) ) { doStepLogStruct(logFilename=arguments.logFileName,logPrefix=arguments.logPrefix,logData=arguments.logData); } else if ( IsQuery(arguments.logData) AND arguments.logData.RecordCount ) { doStepLogQuery(logFilename=arguments.logFileName,logPrefix=arguments.logPrefix,logData=arguments.logData); } else if ( IsSimpleValue(arguments.logData) AND LEN(TRIM(arguments.logData)) ) application.ptCalendar.utils.logAppend( msg=arguments.logPrefix & "Value = " & arguments.logData, logfile=arguments.logFileName ); if ( !IsSimpleValue(arguments.logData) ) application.ptCalendar.utils.logAppend( msg=arguments.logPrefix & "------", logfile=arguments.logFileName ); var i = 1; var logMsg = ""; var dataName = ""; var dataValue = ""; for ( i=1; i LTE ArrayLen(arguments.logData); i=i+1 ) { dataName = i; dataValue = arguments.logData[i]; if ( IsSimpleValue(dataValue) ) { logMsg = arguments.logPrefix & "[" & dataName & "]: " & dataValue; application.ptCalendar.utils.logAppend( msg=logMsg, logfile=arguments.logFileName ); } else { logMsg = arguments.logPrefix & "[" & dataName & "]: "; doStepLogData(logFilename=arguments.logFileName,logPrefix=logMsg,logData=dataValue); } } var key = ""; var logMsg = ""; var dataName = ""; var dataValue = ""; for ( key IN arguments.logData ) { dataName = key; dataValue = arguments.logData[key]; if ( dataName NEQ "FieldNames" ) { if ( IsSimpleValue(dataValue) ) { logMsg = arguments.logPrefix & "[" & dataName & "]: " & dataValue; application.ptCalendar.utils.logAppend( msg=logMsg, logfile=arguments.logFileName ); } else { logMsg = arguments.logPrefix & "[" & dataName & "]: "; doStepLogData(logFilename=arguments.logFileName,logPrefix=logMsg,logData=dataValue); } } } var i = 1; var logMsg = ""; var dataName = ""; var dataValue = StructNew(); application.ptCalendar.utils.logAppend( msg="#logPrefix#: Query", logfile=arguments.logFileName ); for ( i=1; i LTE arguments.logData.RecordCount; i=i+1 ) { dataName = "Row " & i; dataValue = application.ptCalendar.data.queryRowToStruct(query=arguments.logData,rowNum=i); logMsg = arguments.logPrefix & "--" & dataName & "-- "; doStepLogStruct(logFilename=arguments.logFileName,logPrefix=logMsg,logData=dataValue); } var logFileName = dateFormat(now(), "yyyymmdd") & "." & request.site.name & "." & arguments.appName & "." & arguments.processName & ".step.log"; return logFileName;