var itm = 1; var rtnStruct = structNew(); // make sure we have an index for this row try { // loop through the children and build structure for( itm; itm lte arrayLen(arguments.subsiteData[arguments.index].xmlChildren); itm = itm + 1 ) { rtnStruct[arguments.subsiteData[arguments.index].xmlChildren[itm].xmlName] = arguments.subsiteData[arguments.index].xmlChildren[itm].xmlText; } } catch(any e) { ;// TODO logging } var dataIsValid = false; if( structKeyExists(arguments.subsiteStruct, "oldSubsiteURL") and len(arguments.subsiteStruct.oldSubsiteURL) and structKeyExists(arguments.subsiteStruct, "newSubsiteURL") and len(arguments.subsiteStruct.newSubsiteURL) and structKeyExists(arguments.subsiteStruct, "name") and len(arguments.subsiteStruct.name) ) dataIsValid = true; var data = StructNew(); // Call DAO and get the source data var sourceQry = application.ptImport.subsiteDAO.getSourceData(oldSubsiteIDList=arguments.subsiteIDFilter); // Call DAO and get the mapping data var mappingCEQry = application.ptImport.subsiteDAO.getMappingData(); data.type = "Subsites"; data.total = sourceQry.RecordCount; data.mapped = mappingCEQry.RecordCount; data.notmapped = sourceQry.RecordCount - mappingCEQry.RecordCount; if ( data.total GT 0 ) data.percent = ROUND((data.mapped/data.total)*100); else data.percent = 0; return data; var data = StructNew(); // Call DAO and get the mapping data var mappingCEQry = application.ptImport.subsiteDAO.getMappingData(); data.type = "Subsites"; data.total = mappingCEQry.RecordCount; data.built = 0; data.percent = 0; if ( (newSubsiteID GT 0) AND (LEN(dateCreated)) ) data.built = data.built + 1; if ( data.total GT 0 ) { data.percent = ROUND((data.built/data.total)*100); } return data; // Get the app config var appConfig = application.ptImport.getAppConfig(); var subsiteNameLCase = false; // Check if we want to force the subsite name to lowercase if ( (StructKeyExists(appConfig,"force_subsite_name_lcase")) AND (appConfig.force_subsite_name_lcase EQ true) ) subsiteNameLCase = true; // fix the subsite name if( not structKeyExists(arguments.subsiteData, "name") or not len(arguments.subsiteData.name) ) arguments.subsiteData["name"] = arguments.subsiteData.newSubsiteURL; // fix the oldSubsiteURL arguments.subsiteData.oldSubsiteURL = application.ptImport.CSData.formatSubsiteURL(arguments.subsiteData.oldSubsiteURL); // fix the newSubsiteURL arguments.subsiteData.newSubsiteURL = application.ptImport.CSData.formatSubsiteURL(arguments.subsiteData.newSubsiteURL); // fix the name if(!application.ptImport.appConfig.migration){ arguments.subsiteData.name = application.ptImport.importService.makeCSSafe(arguments.subsiteData.name, subsiteNameLCase); } // fix the subsite displayName and description if( not structKeyExists(arguments.subsiteData, "displayName") or not len(arguments.subsiteData.displayName) ) arguments.subsiteData["displayName"] = arguments.subsiteData.name; if( not structKeyExists(arguments.subsiteData, "description") or not len(arguments.subsiteData.description) ) arguments.subsiteData["description"] = arguments.subsiteData.name; var subsiteData = structNew(); // Get the Subsite Mapping Records var subsiteMapQry = application.ptImport.SubsiteDAO.getMappingDataBySubsiteURL(oldSubsiteURL=arguments.subsiteURL); if( subsiteMapQry.RecordCount and len(subsiteMapQry.newSubsiteID) and subsiteMapQry.newSubsiteID neq 0 ) { subsiteData.subsiteID = subsiteMapQry.newSubsiteID; //subsiteData.subsiteURL = request.subsiteCache[subsiteData.subsiteID].url; } var doesExist = false; var formattedOldSubsiteURL = application.ptImport.CSData.formatSubsiteURL(arguments.oldSubsiteURL); var formattedNewSubsiteURL = application.ptImport.CSData.formatSubsiteURL(arguments.newSubsiteURL); var subsiteMapQry = application.ptImport.SubsiteDAO.getMappingDataBySubsiteURL(oldSubsiteURL=formattedOldSubsiteURL,newSubsiteURL=formattedNewSubsiteURL); var mapExists = false; var subsiteMapQry = application.ptImport.SubsiteDAO.getMappingData(); var subsetDataQuery = QueryNew("null"); SELECT * FROM subsiteMapQry WHERE newSubsiteURL = if( subsetDataQuery.RecordCount ) mapExists = true; var subsiteURLList = arguments.oldSubsiteURL; var itm = 1; var tmpSubsite = structNew(); var thisSubsite = ""; var curNewSubsiteURL = ""; var curOldSubsiteURL = ""; var subsiteMapQry = QueryNew("null"); var subsiteMapArray = ArrayNew(1); var subsiteMap = StructNew(); // Get the app config var appConfig = application.ptImport.getAppConfig(); var subsiteNameLCase = false; // Check if we want to force the subsite name to lowercase if ( (StructKeyExists(appConfig,"force_subsite_name_lcase")) AND (appConfig.force_subsite_name_lcase EQ true) ) subsiteNameLCase = true; // make subsiteURL a "better" CF List if( Left(subsiteURLList, 1) eq "/" ) subsiteURLList = Right(subsiteURLList, len(subsiteURLList) - 1); if( Right(arguments.oldSubsiteURL, 1) eq "/" ) subsiteURLList = Left(subsiteURLList, len(subsiteURLList) - 1); for( itm; itm lte listLen(subsiteURLList, "/"); itm = itm + 1 ) { thisSubsiteStr = listGetAt(subsiteURLList, itm, "/"); // keep track of oldSubsiteURL curOldSubsiteURL = application.ptImport.CSData.formatSubsiteURL(curOldSubsiteURL & thisSubsiteStr); // make this subsite a real CS URL again thisSubsite = application.ptImport.CSData.formatSubsiteURL(thisSubsiteStr); // get this subsitesURL (if it exists) //subsiteMap = application.ptImport.SubsiteMapDAO.getSingleSubsiteMap(thisSubsite); subsiteMapQry = application.ptImport.SubsiteDAO.getMappingDataBySubsiteURL(oldSubsiteURL=thisSubsite); if( subsiteMapQry.RecordCount ){ subsiteMapArray = application.ptImport.cedata.buildCEDataArrayFromQuery(ceDataQuery=subsiteMapQry); subsiteMap = subsiteMapArray[1].values; } // add subsite mapping if it doesn't exist already if( not structKeyExists(subsiteMap, "newSubsiteURL") or ( structKeyExists(subsiteMap, "newSubsiteURL") and not len(subsiteMap.newSubsiteURL) ) ) { if( not len(curNewSubsiteURL) ) curNewSubsiteURL = thisSubsite; tmpSubsite = structNew(); tmpSubsite.oldSubsiteURL = curOldSubsiteURL; tmpSubsite.newSubsiteURL = application.ptImport.CSData.formatSubsiteURL(curNewSubsiteURL & thisSubsiteStr); tmpSubsite.name = application.ptImport.importService.makeCSSafe(thisSubsiteStr,subsiteNameLCase); tmpSusbite.displayName = tmpSubsite.name; application.ptImport.SubsiteDAO.setMappingData(tmpSubsite); curNewSubsiteURL = tmpSubsite.newSubsiteURL; } else // track this subsites newSubsiteURL - it could be the parent subsite curNewSubsiteURL = subsiteMap.newSubsiteURL; } SELECT * FROM mappingDataQry WHERE newSubsiteID <> 0 AND newSubsiteID IS NOT NULL SELECT * FROM mappingDataQry WHERE newSubsiteID = 0 OR newSubsiteID IS NULL var itemIDList = ""; var mappedQry = application.ptImport.SubsiteDAO.getMappingData(); var mappedOldSubsiteIDs = ValueList(mappedQry.oldSubsiteID); // Check if the subsite ID is in the mapped old subsite id list if ( NOT ListFind(mappedOldSubsiteIDs, oldSubsiteID) ){ itemIDList = ListAppend(itemIDList, oldSubsiteID); }