var retSiteDataStruct = StructNew(); // Check if Multi Server is enabled if ( application.ptSync.appConfig.multiserver EQ TRUE ){ // Call the multi server site data function to return the formatted data retSiteDataStruct.source = getMultiServerSiteData(msSiteID=application.ptSync.appConfig.sourceSite); retSiteDataStruct.dest = getMultiServerSiteData(msSiteID=application.ptSync.appConfig.destinationSite); } else { // Get the CS site data for the source site retSiteDataStruct.source = application.ptSync.syncService.getCSSiteData(siteID=application.ptSync.appConfig.sourceSite); // Get the CS site data for the destination site retSiteDataStruct.dest = application.ptSync.syncService.getCSSiteData(siteID=application.ptSync.appConfig.destinationSite); } return retSiteDataStruct; var retCSDataStruct = StructNew(); // Get the CS Site query data var csSiteQry = application.ptSync.csData.getCommonSpotSites(siteID=arguments.siteID); // Check that we returned data if ( csSiteQry.RecordCount ) retCSDataStruct = application.ptSync.data.queryRowToStruct(query=csSiteQry, rowNum=1); return retCSDataStruct; // Default the sync to always run var retStatus = true; /* TODO - ADD CUSTOMIZATIONS FOR LOGIC TO VERIFY ROLES. * * Can put logic in here to check the custom element * and then verify any field data before running the sync. */ return retStatus; // Default the sync to always run var retStatus = true; /* TODO - ADD CUSTOMIZATIONS FOR LOGIC TO VERIFY ROLES. * * Can put logic in here to check the custom element * and then verify any field data before running the sync. */ return retStatus; // Default the sync to always run var retStatus = false; // Validate with the Sync Cache data structure if ( StructKeyExists(application.ptSync.cache.mappingData, arguments.sourceFormID) ) { // Check to make sure the destination form ID matches if ( application.ptSync.cache.mappingData[arguments.sourceFormID].values.destCE EQ arguments.destFormID ){ retStatus = true; } } return retStatus; var commandArray = ArrayNew(1); var subCmd = StructNew(); // Get the sync mapping data record var syncMapArray = application.ptSync.syncDAO.getSyncMapping(mappingID=arguments.mappingID); // Get all the active CE records for the custom element var ceDataArray = application.ptSync.ceData.getCEData(customElementName=application.ptSync.ceData.getCENameByFormID(syncMapArray[1].values.sourceCE)); // Loop over the CE Data to build the command to pass back to the scheduler for ( i=1; i LTE ArrayLen(ceDataArray); i=i+1 ){ subCmd = StructNew(); subCmd.bean = "syncController"; subCmd.method = "processSync"; subCmd.args = StructNew(); subCmd.args.srcFormID = ceDataArray[i].formID; subCmd.args.srcDataPageID = ceDataArray[i].pageID; subCmd.args.srcControlID = ceDataArray[i].controlID; ArrayAppend(commandArray,subCmd); } return commandArray; var dbHTML = "";

No automation tasks for this mapping.

Run Automate Sync Task

var dbHTML = ""; var schedulerData = application.ptSync.scheduler.getSchedulerVars();

Automation Sync has been completed.

Last Run = #schedulerData[arguments.scheduleTaskName].SCHEDULEPARAMS.SCHEDULESTOP# Records Synchronized

Run Automate Sync Task

var dbHTML = "";

Automation Sync is currently active.

#application.ptSync.scheduler.getScheduleHTML(scheduleName=arguments.scheduleTaskName)#

var selectDataQry = QueryNew("selectValue,selectOption,server,serverID,serverDisplay,serverURL,site,siteID,siteDisplay,siteRootURL,siteRootPath,siteDatasourceName"); var sortedSelectDataQry = selectDataQry; var configStruct = ""; var serverKeyList = ""; var currServerKey = ""; var csServerInfoQry = ""; var csSiteInfoQry = ""; var k = 1; var m = 1; // Check if the Multi Server is ENABLED if ( application.ptSync.appConfig.multiserver EQ TRUE ){ // Check if the "SERVERS" tag exists if ( StructKeyExists(application.ptSync.appConfig, "servers") ){ // Set to local variable for easier to work with configStruct = application.ptSync.appConfig.servers; // Get the server tags serverKeyList = StructKeyList(configStruct); // Loop over the list for ( k=1; k LTE ListLen(serverKeyList); k=k+1 ){ currServerKey = ListGetAt(serverKeyList,k); // Get the CS Server and Site Info // Check if the record is for our current site if ( currServerKey EQ request.cgivars.SERVER_NAME ){ csServerInfoQry = getCSServerInfo(datasource=request.serverdatasource); csSiteInfoQry = getCSSiteInfo(datasource=request.serverdatasource); } else { csServerInfoQry = getCSServerInfo(datasource=configStruct[currServerKey].datasource); csSiteInfoQry = getCSSiteInfo(datasource=configStruct[currServerKey].datasource); } if ( csServerInfoQry.recordCount AND csSiteInfoQry.recordCount ) { // Loop over the list for ( m=1; m LTE csSiteInfoQry.recordCount; m=m+1 ){ QueryAddRow(selectDataQry); QuerySetCell(selectDataQry, "selectValue", "#configStruct[currServerKey].id#.#csSiteInfoQry.siteID[m]#"); QuerySetCell(selectDataQry, "selectOption", csSiteInfoQry.siteName[m]); QuerySetCell(selectDataQry, "server", currServerKey); QuerySetCell(selectDataQry, "serverID", "#configStruct[currServerKey].id#"); QuerySetCell(selectDataQry, "serverDisplay", csServerInfoQry.ServerName[k]); QuerySetCell(selectDataQry, "site", csSiteInfoQry.siteName[m]); QuerySetCell(selectDataQry, "siteID", csSiteInfoQry.siteID[m]); QuerySetCell(selectDataQry, "siteDisplay", csSiteInfoQry.siteName[m]); QuerySetCell(selectDataQry, "siteRootURL", csSiteInfoQry.RootURL[m]); QuerySetCell(selectDataQry, "siteRootPath", csSiteInfoQry.RootPath[m]); QuerySetCell(selectDataQry, "siteDatasourceName", csSiteInfoQry.DataSourceName[m]); } } } } } SELECT * FROM selectDataQry ORDER BY serverDisplay, siteDisplay var multiserverQry = ""; var retData = StructNew(); SELECT * FROM application.ptSync.cache.multiserver WHERE selectValue = // Check that we returned a record if ( multiserverQry.recordCount ){ // Build the return data structure retData.datasourcename = multiserverQry.siteDatasourceName; retData.rootpath = multiserverQry.siteRootPath; retData.rooturl = multiserverQry.siteRootURL; retData.siteid = multiserverQry.siteID; retData.sitename = multiserverQry.site; } var multiserverQry = ""; var retData = StructNew(); SELECT ServerName FROM Servers var multiserverQry = ""; var retData = StructNew(); SELECT siteID, siteName, Description, DataSourceName, RootPath, RootURL FROM ServerSites WHERE siteID > 0 AND siteState = 1 var logSizeLimit = application.ptSync.appConfig.logHistory; var currentDate = now(); var currLogMsg = StructNew(); currLogMsg.message = arguments.message; currLogMsg.dateTime = application.ptSync.date.csDateFormat(dateInput=currentDate,timeInput=currentDate); // Check the length of the log array if ( ArrayLen(application.ptSync.logs[arguments.state]) GTE logSizeLimit ){ // Delete the top item from the Array ArrayDeleteAt(application.ptSync.logs[arguments.state],1); } // Add the new item to the array ArrayAppend(application.ptSync.logs[arguments.state], currLogMsg); var retLogHTML = ""; var i = 1;
#application.ptSync.date.csDateFormat(dateInput=application.ptSync.logs[arguments.state][i].dateTime,timeInput=application.ptSync.logs[arguments.state][i].dateTime)# #application.ptSync.logs[arguments.state][i].message#
No Records to Display
/* TODO - ADD CUSTOMIZATIONS FOR POST SYNC HOOK * * Add logic to run after a sync has been processed. */ // Sample code to add a message into the App logs //setLog(message="Test from postSyncHook [#now()#]"); // Default the sync to always run var retDestData = arguments.destCEData; // Get the custom element field types for the source CE var srcCEFieldsQry = application.ptSync.ceData.getElementFieldsByFormID(formid=arguments.srcFormID); var currField = ""; var currFieldValue = ""; var newValue = ""; var imageData = ""; var needsUpdate = false; // Set the current field in the data struct currField = Replace(fieldName, "FIC_", ""); currFieldValue = retDestData['#currField#']; newValue = currFieldValue; needsUpdate = false; // Check if the field has a value if ( LEN(currFieldValue) ) { // For IMG and CS_URL fields do extra processing switch (type){ case "img": // Check the app config for operation to perform if ( application.ptSync.appConfig.complexImage EQ 1 ){ // Copy Image to Destination Site //newValue = copyImageToDestination(cpimage=currFieldValue); needsUpdate = true; } else if ( application.ptSync.appConfig.complexImage EQ 2 ){ // Text Field with Image Path to Source Site // Get the image URL from the CPIMAGE data imageData = application.ptSync.csData.decipherCPIMAGE(cpimage=currFieldValue); newValue = getComplexFieldURL(imageData.resolvedURL.serverRelative); needsUpdate = true; } break; case "cs_url": // Check the app config for operation to perform if ( application.ptSync.appConfig.complexDocument EQ 1 ){ // Copy Document to Destination Site newValue = ""; needsUpdate = true; } else if ( application.ptSync.appConfig.complexDocument EQ 2 ){ // Text Field with URL Path to Source Site newValue = getComplexFieldURL(currFieldValue); needsUpdate = true; } break; } } // Update the field back into the destination data, if needed if ( needsUpdate ) retDestData['#currField#'] = newValue; // Initialize the variables var retURL = arguments.relativeURL; // Check if we have a length for the URL if ( LEN(retURL) ) { // Check the multi server configuration //if ( application.ptSync.appConfig.multiserver ){ // Check if the site name is within the path if ( ListFirst(retURL, "/") EQ application.ptSync.cache.siteData.source.siteName ) { // Remove the first item from the list retURL = ListDeleteAt(retURL, 1, "/"); } // Trip any leading "/" if ( LEFT(retURL, 1) EQ "/" ) retURL = Replace(retURL, "/", ""); // Add the ROOT URL to the relative path retURL = application.ptSync.cache.siteData.source.rootURL & retURL; //} //else { // Handle for sync between sites on the same CommonSpot Server //} } return retURL; --->