var data = StructNew();
// Call DAO and get the source data
var sourceQry = application.ptImport.ImageDAO.getSourceData();
// Call DAO and get the mapping data
var mappingCEQry = application.ptImport.ImageDAO.getMappingData();
// Get the count of mapped pages that have not been imported yet
var sourceNotImportedCount = ListLen(buildUnmappedItemIDList(sourceQry));
data.type = "Images";
// CHECK for CS site migration
/* if ( application.ptImport.appConfig.migration ) {
*/
// Add the Mapping Count Plus the Source Count
data.total = sourceNotImportedCount + mappingCEQry.RecordCount;
data.mapped = mappingCEQry.RecordCount;
data.notmapped = sourceNotImportedCount;
/* }
else {
// Standard Image Import
data.total = sourceQry.RecordCount;
data.mapped = mappingCEQry.RecordCount;
// Check if the source is not 0
if ( data.total GT 0 )
data.notmapped = sourceQry.RecordCount - mappingCEQry.RecordCount;
else
data.notmapped = 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.ImageDAO.getMappingData();
data.type = "Images";
data.total = mappingCEQry.RecordCount;
data.built = 0;
data.percent = 0;
if ( LEN(mappingCEQry.newPageID) AND mappingCEQry.newPageID GT 0 ){
data.built = data.built + 1;
}
var formattedImgPath = arguments.oldSubsiteURL & arguments.fileName;
/* TODO - Enter customized code for the the implementation!
*
*
*/
// Expand path to return the directory
return ExpandPath(formattedImgPath);
var formattedImgPath = arguments.inImgPath;
/* TODO - Enter customized code for the the implementation!
*
*
*/
// Expand path to return the directory
return ExpandPath(formattedImgPath);
// Set the AppConfig Migration URL as the base
var imageURL = application.ptImport.appConfig.migration_site_url;
// Build the full url based on the subsite URL
// Remove any ending "/" from the Image URL
if ( RIGHT(imageURL,1) EQ "/" )
imageURL = LEFT(imageURL,LEN(imageURL)-1);
// Add the subsite URL
imageURL = imageURL & arguments.oldSubsiteURL;
// Check that ends in "/"
if ( RIGHT(imageURL,1) NEQ "/" )
imageURL = imageURL & "/";
// Add the filename
imageURL = imageURL & "images/" & arguments.fileName;
return imageURL;
var resultImageData = StructNew();
var subsiteMapQry = "";
var fileURL = "";
var imgSourceData = "";
// Initialize the return struct fields
resultImageData.filePath = "";
resultImageData.imgBinary = "";
resultImageData.destSubsiteID = "";
resultImageData.errorMsg = "";
// Check for CS Site Migration
if ( application.ptImport.appConfig.migration ){
// Setup the file path and destination subsite ID
// Get the Subsite Mapping data by the old Subsite ID
subsiteMapQry = application.ptImport.SubsiteDAO.getMappingDataBySubsiteURL(oldSubsiteID=arguments.imageMapQuery.oldSubsiteID);
// Validate that we have a subsite mapping
if ( subsiteMapQry.RecordCount ){
// Get the file path based on the old subsite URL
resultImageData.filePath = formatImageDirMigration(oldSubsiteURL=subsiteMapQry.oldSubsiteURL,fileName=arguments.imageMapQuery.fileName);
// Get the file URL based on the old subsite URL
fileURL = formatImageURLMigration(oldSubsiteURL=subsiteMapQry.oldSubsiteURL,fileName=arguments.imageMapQuery.fileName);
// Encode the Document as binary
resultImageData.imgBinary = application.ptImport.ImportService.getHTTPFileBinary(fileURL);
// Check if any errors getting the image binary
if ( NOT isBinary(resultImageData.imgBinary) )
resultImageData.errorMsg = "Error: Unable to return Image Binary data.";
// Set the subsite for the document
resultImageData.destSubsiteID = subsiteMapQry.newSubsiteID;
}
else {
// Catch Error - No Subsite Mapping data for the old subsite ID
resultImageData.errorMsg = "Error: No Image Mapping data for the old subsite ID [" & arguments.imageMapQuery.oldSubsiteID & "].";
}
}
else {
// Standard Doc Import
// Get the image source data for the Image URL
imgSourceData = application.ptImport.imageDAO.getSourceData(pageID=VAL(arguments.imageMapQuery.oldPageID));
// Check that we have the image souce data
if ( imgSourceData.RecordCount ){
// Set the file path from the link URL
resultImageData.filePath = formatImageDir(imgSourceData.LINKURL, imgSourceData.pageID);
// Encode the Document as binary
resultImageData.imgBinary = application.ptImport.ImportService.readBinary(filePath=resultImageData.filePath);
// Check if any errors getting the image binary
if ( NOT isBinary(resultImageData.imgBinary) )
resultImageData.errorMsg = "Error: Unable to return Image Binary data.";
// Based on the PageID (That the link exists on) upload the image into
// that subsite.
resultImageData.destSubsiteID = application.ptImport.csData.getSubsiteIDByPageID(pageid=imgSourceData.pageid);
}
else {
// Catch Error - No Subsite Mapping data for the old subsite ID
resultImageData.errorMsg = "Error: No Image source data for the old page ID [" & arguments.imageMapQuery.oldPageID & "].";
}
}
return resultImageData;
var mappingDataQry = application.ptImport.ImageDAO.getMappingData();
var filteredMappingDataQry = QueryNew("null");
SELECT *
FROM mappingDataQry
WHERE newPageID <> '0'
AND newPageID IS NOT NULL
ORDER BY OldSubsiteID, filename
SELECT *
FROM mappingDataQry
WHERE newPageID = '0'
OR newPageID IS NULL
ORDER BY OldSubsiteID, filename
if ( application.ptImport.appConfig.migration )
keyColFieldName = "pageID";
else
keyColFieldName = "entryID";
sourceDataStruct = application.ptImport.data.queryColumnsToStruct(query=application.ptImport.ImageDAO.getSourceData(),
keyColumn=keyColFieldName,
valueColumn="pageID");
if ( newSubsiteID LTE 0 ){
// Check if the old page ID exists as key, then get the subsite ID for the page ID
if ( StructKeyExists(sourceDataStruct,oldPageID) )
filteredMappingDataQry.newSubsiteID[currentRow] = application.ptImport.csData.getSubsiteIDByPageID(pageid=sourceDataStruct[oldPageID]);
}
var itemIDList = "";
var mappedQry = application.ptImport.ImageDAO.getMappingData();
//var mappedQry = application.ptImport.ImageDAO.getMappingDataForNotImported();
var mappedOldPageIDs = ValueList(mappedQry.oldPageID);
if ( application.ptImport.appConfig.migration ){
// Check if the pageid is in the mapped old page id list
if ( NOT ListFind(mappedOldPageIDs, pageID) ){
itemIDList = ListAppend(itemIDList,pageID);
}
}
else {
// Check if the pageid is in the mapped old page id list
if ( NOT ListFind(mappedOldPageIDs, entryID) ){
itemIDList = ListAppend(itemIDList, entryID);
}
}
var imageQry = "";
var imageURL = "";
SELECT *
FROM ImageGallery
WHERE ImageGallery.VersionState = 2
AND ImageGallery.PageID =
// Check if the image returned from the query
if ( imageQry.RecordCount )
return true;
else
return false;
// Remove any html encoding
var imageTitle = URLDecode(arguments.imgPath);
// Work with the file path to get the title name out
imageTitle = ListFirst(ListLast(imageTitle,"/"),".");
return imageTitle;
var beginImage = "";
var endImage = "";
var srcAnchorFull = "";
var srcAnchorFullAdj = "";
var srcID = "";
var pageID = 0;
var newPageData = StructNew();
var contProcess = false;
var newAnchorFull = "";
var processedContent = arguments.content;
var imageTagFind = "";
// 2008-06-10 jrybacek Look for first/next instance of an anchor tag
beginImage = findNoCase(imageTagFind, arguments.content, arguments.offset);
endImage = findNoCase(">", arguments.content, beginImage);
//application.ptImport.utils.doDump(beginImage, "beginImage", false);
if( ( len(beginImage) AND (beginImage GT 0) ) and ( len(endImage) AND (endImage GT 0) ) )
{
try
{
srcAnchorFull = mid(arguments.content, beginImage, endImage-beginImage+1);
// adjust the anchor tag for CS escaped characters
srcAnchorFullAdj = srcAnchorFull;
// Check if we are doing a CS Migration
// Don't need to get the CS Page ID out if running standard import.
if ( application.ptImport.appConfig.migration ) {
// Get the CS PageID from the string
srcID = application.ptImport.data.getTagAttribute(srcAnchorFullAdj,"id");
pageID = ListLast(srcID,":");
pageID = ListFirst(pageID,"|");
//application.ADF.utils.dodump(pageID,"pageID");
// Set the pageID to a numeric value from string.
// If empty string, returns 0
if ( isNumeric(pageID) )
pageID = val(pageID);
else
pageID = 0;
}
else {
// No Page ID, so this is standard import
// Check if this src URL is a page that has been imported
srcVal = application.ptImport.data.getTagAttribute(srcAnchorFullAdj, "src");
newPageData.srcVal = srcVal;
pageID = getCSPageIDBySrc(srcVal,sourceCSPageID);
}
// Verify that we have an actual pageID
if ( pageID GT 0 )
{
// Get the new data for the pageid
// If migration, then getting data based on the old page ID.
// If standard import, then getting data based on the new page ID
if ( application.ptImport.appConfig.migration )
newPageData = application.ptImport.pageService.getNewPageData(oldPageID=pageID);
else
newPageData = application.ptImport.pageService.getNewPageData(newPageID=pageID);
}
else {
// Set the newPageID for the next IF block
newPageData.newPageID = 0;
}
//application.ADF.utils.dodump(newPageData, "newPageData", false);
if ( newPageData.newPageID GT 0){
// Processing for Image Links
if ( newPageData.type EQ "image" ) {
contProcess = true;
// Build the CS Page anchor tag
newAnchorFull = buildCSImageTag(
csPageID=newPageData.newPageID,
csPageURL=newPageData.newPageURL,
sourceAnchor=srcAnchorFullAdj);
}
else {
contProcess = false;
}
}
// Check if we should process the link
if ( contProcess )
{
// adjust the anchor tag for CS escaped characters
//newAnchorFull = application.cs.data.toHTML(newAnchorFull);
// replace the old anchor tag with the new tag;
processedContent = replaceNoCase(processedContent, srcAnchorFull, newAnchorFull);
}
}
catch(any e)
{
application.ptImport.utils.doDump(e, "cfcatch", false);
}
// If this is not the last anchor then call this function again, but provide a new offset
if( findNoCase(imageTagFind, processedContent, endImage) ) {
processedContent = doImageUpdate(processedContent, arguments.sourceCSPageID, endImage);
}
}
var newAnchorFull = "";
var newImgID = "";
var newSRC = "";
// Set the new ID
newImgID = "||CPIMAGE:" & arguments.csPageID & "||";
// reset the anchor tag with the new information
newAnchorFull = application.ptImport.PageService.setTagAttribute(arguments.sourceAnchor, "src", arguments.csPageURL);
// reset the ID attribut with the new information
newAnchorFull = application.ptImport.PageService.setTagAttribute(newAnchorFull, "ID", newImgID);
return newAnchorFull;
var formattedSrcPath = arguments.srcVal;
var imageFileName = ListLast(formattedSrcPath,"/");
var pageMapData = StructNew();
var pageDataQry = "";
// Dump the current path for the image b/c we import into the pages subsite!
// Need to get the subsite path to append to the link path
// Get the page mapping data for the page with the link
pageMapData = application.ptImport.pageDAO.getMappingData(newPageID=arguments.linkPageID);
//application.ADF.utils.dodump(pageMapData,"pageMapData",false);
// Prepend the subsite URL for the page with the link to the link path
if ( pageMapData.RecordCount )
formattedSrcPath = pageMapData.newSubsiteURL & imageFileName;
// Call CS Data to get the CS Page ID
pageDataQry = application.ptImport.csData.getCSPageDataByURL(formattedSrcPath);
if ( pageDataQry.RecordCount )
return pageDataQry.ID;
else
return 0;