variables.logApp = 'ptProfile'; variables.logComponent = 'profileDAO'; variables.enableDebugLogging = false; var retData = StructNew(); var dataValues = StructNew(); var elementData = getElementData(arguments.elementName, arguments.fieldName, arguments.fieldValue); // store the CE page id retData.pageid = elementData.pageid; retData.formid = elementData.formid; // get the default data structure for this element type dataValues = application.ptProfile.cedata.defaultFieldStruct(arguments.elementName); // get the data for this instance retData.values = loadInstanceData(dataValues, arguments.validationFields, elementData.Values); return retData; var retValue = StructNew(); var dataValues = application.ptProfile.cedata.getCEData(arguments.elementName, arguments.fieldName, arguments.fieldValue); if ( ArrayLen(dataValues) ) retValue = dataValues[1]; else { retValue.pageid = 0; retValue.formid = 0; retValue.Values = StructNew(); } return retValue; var itm = 1; var keyList = ""; var dataValue = arguments.valueStruct; // get the data for this element from the ceData function var elementValues = arguments.elementValuesStruct; // loop through the array and overwrite the default data if( StructCount(elementValues) ) { keyList = structKeyList(elementValues); // loop through the fields and reset any persisted data for( itm=1; itm LTE listLen(keyList); itm=itm+1 ) { // get this key thisKey = listGetAt(keyList, itm); // if there is length in this field from CS then overwrite defaults if( len(elementValues[thisKey]) and structKeyExists(dataValue, thisKey) ) { // does this field need some additional validation if( listFindNoCase(arguments.validationFields, thisKey) ) structUpdate(dataValue, thisKey, fieldValidation(thisKey, elementValues[thisKey])); else structUpdate(dataValue, thisKey, elementValues[thisKey]); } } } return dataValue; switch( arguments.fieldName ) { case "photo": { if( not len(arguments.fieldData) ) arguments.fieldData = ""; break; } } return arguments.fieldData; var pageName = application.ptProfile.ProfileService.buildProfilePageName(userid=arguments.userid); SELECT SitePages.ID FROM SitePages INNER JOIN SubSites ON SitePages.SubSiteID = SubSites.ID WHERE SubSites.ID = #arguments.subsiteID# AND SitePages.filename = '#pageName#.cfm' or SitePages.filename = '#replacenocase(pageName,"_","-","ONE")#.cfm' var pageResult = StructNew(); var disableRemoteCmdAPI = getCmdApiRemoteCallsStatus(); pageResult.pageDeleted = false; if ( StructKeyExists(arguments.sparams,"pageid") AND IsNumeric(arguments.sparams.pageid) AND arguments.sparams.pageid GT 0 ) { if ( disableRemoteCmdAPI ) pageResult = application.ADF.apiPage.delete(csPageID=arguments.sparams.pageid, ignoreWarnings = 1, removeRedirects = 1); else pageResult = application.ADF.apiPage.deleteRemote(csPageID=arguments.sparams.pageid, ignoreWarnings = 1, removeRedirects = 1); pageResult.pageDeleted = pageResult.CMDSTATUS; } return pageResult; var retStatusStruct = "failed"; // Create the page retStatusStruct = application.ptProfile.csContent.populateContent("Profile", arguments.dataValues); return retStatusStruct; var pageResult = "failed"; var logMethod = 'profilePageCreateCCAPI'; var logMsg = ''; var logData = StructNew(); // create the page try { pageResult = application.ptProfile.csPage.createPage(arguments.stdMetadata, arguments.custMetadata); } catch (any ex) { logMsg = 'csPage.createPage Error!'; logData = ex; application.ptprofile.log.doTextLogging(variables.logComponent,logMethod,variables.logApp,logMsg,logData); } return pageResult; var retResult = StructNew(); var pageResult = StructNew(); var activatePage = 1; var pageData = StructNew(); var appConfig = getAppConfig(); var disableRemoteCmdAPI = getCmdApiRemoteCallsStatus(); var logMethod = 'profilePageCreateCMDAPI'; var logMsg = ''; var logData = StructNew(); retResult.pageCreated = false; retResult.newPageID = 0; // NEW - arguments.stdMetaData.showInList = "PageIndex,SearchResults"; // OLD - arguments.stdMetaData.INCLUDEININDEX = "1,8"; // Parse showInList values from INCLUDEININDEX list if ( NOT StructKeyExists(arguments.stdMetaData,"showInList") ) { if ( StructKeyExists(arguments.stdMetaData,"INCLUDEININDEX") ) { arguments.stdMetaData.showInList = ""; if ( ListFind(arguments.stdMetaData.INCLUDEININDEX, 1, ',') ) arguments.stdMetaData.showInList = ListAppend(arguments.stdMetaData.showInList,"PageIndex",','); if ( ListFind(arguments.stdMetaData.INCLUDEININDEX, 8, ',') ) arguments.stdMetaData.showInList = ListAppend(arguments.stdMetaData.showInList,"SearchResults",','); // REMOVE the 'includeinindex' from the stdMetaData struct StructDelete(pageData,'INCLUDEININDEX'); } else arguments.stdMetaData.showInList = "PageIndex,SearchResults"; } arguments.stdMetaData.confidentialityID = 2; // 2=Public // Build the Other Optional Fields //arguments.stdMetaData.targetedAudienceID = ''; //arguments.stdMetaData.expirationDate = ''; //arguments.stdMetaData.expirationAction = ''; //arguments.stdMetaData.expirationRedirectURL = ''; //arguments.stdMetaData.expirationWarningMsg = ''; arguments.stdMetaData = handleProfileStandardMetadata(stdMetaData=arguments.stdMetaData); arguments.custMetaData = handleProfileCustomMetadata(custMetaData=arguments.custMetaData); //WriteDump(var=arguments.stdMetaData,expand=false,label="arguments.stdMetaData"); //WriteDump(var=arguments.custMetaData ,expand=false,label=" arguments.custMetaData "); // Copy stdMetaData to pageData pageData = duplicate(arguments.stdMetaData); // Metadata Array pageData.metadata = ArrayNew(1); if ( NOT StructIsEmpty(arguments.custMetaData) ) { // Format the metadata as required by the apiPage.createRemote function. pageData.metadata = application.ADF.csData.metadataStructToArray(metadata=arguments.custMetaData); } //WriteDump(var=pageData,expand=false,label="pageData"); // Build Log file with pageData struct // logPageMetadata(pageData=pageData,buildScriptFile=false); if ( variables.enableDebugLogging ) { logMsg = 'createRemote pageData:'; logData = pageData; application.ptprofile.log.doTextLogging(variables.logComponent,logMethod,variables.logApp,logMsg,logData); } try { // create the page if ( disableRemoteCmdAPI ) pageResult = application.ptProfile.apiPage.create(pageData=pageData,activatePage=activatePage); else pageResult = application.ptProfile.apiPage.createRemote(pageData=pageData,activatePage=activatePage); //WriteDump(var=pageResult,expand=false,label="pageResult"); if ( variables.enableDebugLogging ) { logMsg = 'createRemote called!'; logData = pageResult; application.ptprofile.log.doTextLogging(variables.logComponent,logMethod,variables.logApp,logMsg,logData); } if ( StructKeyExists(pageResult,"CMDSTATUS") ) retResult.pageCreated = pageResult.CMDSTATUS; if ( StructKeyExists(pageResult,"CMDRESULTS") AND IsNumeric(pageResult.CMDRESULTS) ) retResult.newPageID = pageResult.CMDRESULTS; } catch (any ex) { logMsg = 'createRemote Error!'; logData = ex; application.ptprofile.log.doTextLogging(variables.logComponent,logMethod,variables.logApp,logMsg,logData); } return retResult; var retData = Duplicate(arguments.stdMetaData); // CUSTOM OVERRIDE - MOVE TO SITE LEVEL to Customize return retData; var retData = Duplicate(arguments.custMetaData); // CUSTOM OVERRIDE - MOVE TO SITE LEVEL to customize /* if ( StructKeyExists(retData,"Layout") AND StructKeyExists(retData.Layout,"bannerimage") ) { StructDelete(retData.Layout,"bannerimage"); }*/ return retData; var logFile = 'profile_page_metadata.html'; var scriptStr = ''; var scriptFilePath = Server.CommonSpot.logDir & 'create-page-metadata.txt'; application.ptProfile.utils.logAppend(msg=arguments.pageData,logFile=logFile,label="Profile Create/Update Page Metadata:"); // Write CFScript Data file if ( arguments.buildScriptFile ) { scriptStr = formatDataForCF(data=arguments.pageData); application.ADF.utils.writeDataFile(filePath=scriptFilePath,dataString=scriptStr,overwrite=1); } var pageResult = StructNew(); // Use the CS 6.0 Command API to CREATE the new profile account var csApiObj = server.ADF.objectFactory.getBean("csapi_1_0"); var pageCmd = ""; /* commands = ' Page create #arguments.stdMetadata.subsiteID# #arguments.stdMetadata.name# #arguments.stdMetadata.title# #arguments.stdMetadata.description# #request.formattedtimestamp# 1 #arguments.stdMetadata.templateID# PageIndex,SearchResults "#arguments.custMetaData#" '; csapiObj.initCSAPI(subsiteID=arguments.stdMetadata.subsiteID); pageCmd = csapiObj.run(commands); csapiObj.logout(); if ( pageCmd[1].status.code EQ 200 ) { pageResult.pageCreated = true; pageResult.newPageID = pageCmd[1].data; } else { // Set the errors to return pageResult.pageCreated = false; pageResult.newPageID = 0; pageResult.msg = "Error: CS API page creation failed."; } */ csApiObj = Server.CommonSpot.api.getObject('Page'); pageCmd = csApiObj.create( subsiteIDOrURL=arguments.stdMetadata.subsiteID, name=arguments.stdMetadata.name, title=arguments.stdMetadata.title, caption=arguments.stdMetadata.description, publicationDate=request.formattedtimestamp, categoryID=1, templateID=arguments.stdMetadata.templateID, showInList='PageIndex,SearchResults', metadata=arguments.custMetaData ); if ( LEN(pageCmd) ) { pageResult.pageCreated = true; pageResult.newPageID = pageCmd; } else { // Set the errors to return pageResult.pageCreated = false; pageResult.newPageID = 0; pageResult.msg = "Error: CS API page creation failed."; } return pageResult;