var rtnValue = ""; // Get the Custom Metadata field struct with params as values var cmDataStruct = getCustomMetadataFieldsByCSPageID(cspageid=arguments.cspageid,fieldtype="",addFieldParams=true); // Does the provided formname exist in the Custom Metadata field struct if ( StructKeyExists(cmDataStruct,arguments.formname) ) { // Does the provided fieldname exist in the Custom Metadata field struct in formname struct if ( StructKeyExists(cmDataStruct[arguments.formname],arguments.fieldname) ) { // Does the provided field aram (default: label) exist in the Custom Metadata field struct in the form[field] struct if ( StructKeyExists(cmDataStruct[arguments.formname][arguments.fieldname],arguments.fieldparam) ) { // if the form[field][param] exists get the value of the param and set it as the return value rtnValue = cmDataStruct[arguments.formname][arguments.fieldname][arguments.fieldparam]; } } } return rtnValue; var rtnStruct = StructNew(); var cmDataStuct = getCustomMetadata(pageid=arguments.cspageid,convertTaxonomyTermsToIDs=1); //var cmDataStuct = arguments.customMetadata; var thisForm = ""; var thisField = ""; var paramType = "label"; var custMetadataLabel = ""; // Loop over the custom metadata structure that was passed in for ( key in cmDataStuct ) { // set the Key to the thisForm variable thisForm = key; // check to see if the thisForm contains stucture if ( IsStruct(cmDataStuct[thisForm]) ) { // Create the new return struct for this form rtnStruct[thisForm] = StructNew(); // loop over the field in the current form for (key in cmDataStuct[thisForm]) { // Set the Key to the thisField variable thisField = key; // Get the LABEL value for this field custMetadataLabel = getCustomMetadataFieldParamValue(cspageid=arguments.cspageid,formname=thisForm,fieldname=thisField,fieldparam=paramType); // Set the new LABEL key for the return struct for this form rtnStruct[thisForm][custMetadataLabel] = cmDataStuct[thisForm][thisField]; } } } return rtnStruct; var qryData = QueryNew("temp"); SELECT UserID AS UserName FROM users WHERE ID = var rtnStruct = structNew(); var subsiteQry = getSubsiteQueryByID(arguments.subsiteID); if ( StructKeyExists(subsiteQry,"name") ) rtnStruct.subsiteName = subsiteQry["name"][1]; if ( StructKeyExists(subsiteQry,"subsiteID") ) rtnStruct.subsiteID = subsiteQry["subsiteID"][1]; if ( StructKeyExists(subsiteQry,"subsiteURL") ) rtnStruct.subsiteURL = subsiteQry["subsiteURL"][1]; if ( StructKeyExists(subsiteQry,"subsiteDir") ) rtnStruct.subsiteDir = subsiteQry["subsiteDir"][1]; if ( StructKeyExists(subsiteQry,"Title") ) rtnStruct.Title = subsiteQry["Title"][1]; return rtnStruct; var rtnStr = ""; var subsiteStruct = getSubsiteStructBySubsiteID(arguments.subsiteID); if ( StructKeyExists(subsiteStruct,"subsiteURL") ) rtnStr = subsiteStruct["subsiteURL"]; return rtnStr; var retResult = StructNew(); var newPageTitle = arguments.csPageTitle; var newPageName = arguments.csPageName; var newFileName = ""; var newFullFileName = ""; var newFullFileURL = ""; var newFullFilePath = ""; var qSubsite = QueryNew("temp"); var subsiteURL = "/"; var qNewPageData = QueryNew("temp"); var existingFullFilePath = ""; var newUniqueNamePath = ""; // Strip HTML tags newPageTitle = TRIM(variables.data.stripHTMLtags(str=newPageTitle,replaceStr=" ")); if ( arguments.verbose ) application.ADF.utils.doDump(newPageTitle, "newPageTitle - Strip HTML tags", 1); // Convert HTML entities to text newPageTitle = TRIM(variables.data.unescapeHTMLentities(str=newPageTitle)); if ( arguments.verbose ) application.ADF.utils.doDump(newPageTitle, "newPageTitle - Strip HTML entities", 1); // Shorten the newPageTitle by a set number of words ( Zero '0' would bypass this modification ) if ( arguments.pageTitleWordMax NEQ 0 ) newPageTitle = variables.data.trimStringByWordCount(newPageTitle,arguments.pageTitleWordMax,false); if ( arguments.verbose ) application.ADF.utils.doDump(newPageTitle, "newPageTitle - Shortened", 1); // Create a unique Page Title from the passed in csPageTitle // - check the whole site if a SubsiteID is 0 // - if a cs pageid is passed in and it matches an existing and valid cs page DO NOT create unique name newPageTitle = createUniquePageTitle(csPageTitle=newPageTitle,csSubsiteID=arguments.csSubsiteID,csPageID=arguments.csPageID); if ( arguments.verbose ) application.ADF.utils.doDump(newPageTitle, "newPageTitle - Unique", 1); // Build New PageName from the new unique PageTitle newPageName = createUniquePageName(csPageName=newPageName,csSubsiteID=arguments.csSubsiteID,csPageID=arguments.csPageID); if ( arguments.verbose ) application.ADF.utils.doDump(newPageName, "newPageName", 1); // Assign to FileName variable from the shortend PageName newFileName = newPageName; // Filter out any international characters newFileName = variables.data.filterInternationlChars(newFileName); // Make the File Name it CS safe (add dashes, etc.) newFileName = application.ADF.csData.makeCSSafe(newFileName); if ( arguments.verbose ) application.ADF.utils.doDump(newFileName, "newFileName", 1); newFullFileName = newFileName & ".cfm"; if ( arguments.verbose ) application.ADF.utils.doDump(newFullFileName, "newFullFileName", 1); // Make the file name Unique if needed // - Get the subsite data from destSubsiteID qSubsite = application.ADF.CSData.getSubsiteQueryByID(arguments.csSubsiteID); if ( arguments.verbose ) application.ADF.utils.doDump(qSubsite, "qSubsite", 0); if ( qSubsite.RecordCount ) { // Get the Destination Subsite URL subsiteURL = qSubsite.SUBSITEURL; if ( arguments.verbose ) application.ADF.utils.doDump(subsiteURL,"subsiteURL",1); } // Build potential page URL to Check to see if page name is unique newFullFileURL = subsiteURL & newFullFileName; if ( arguments.verbose ) application.ADF.utils.doDump(newFullFileURL,"newFullFileURL",1); // Check to see if file name is unique // - Get the page query but the fullFileURL qNewPageData = application.ADF.csData.getCSPageDataByURL(newFullFileURL); if ( arguments.verbose ) application.ADF.utils.doDump(qNewPageData,"qNewPageData",1); // If pageID exists then create a new unique name if ( structKeyExists(qNewPageData,"ID") AND LEN(TRIM(qNewPageData.ID)) AND IsNumeric(qNewPageData.ID) ) { // Full File Path of the existing page existingFullFilePath = ExpandPath(newFullFileURL); if ( qNewPageData.ID NEQ 0 AND qNewPageData.ID NEQ arguments.csPageID ) { if ( arguments.verbose ) application.ADF.utils.doDump(existingFullFilePath,"existingFullFilePath",1); // new unique File path newUniqueNamePath = application.ADF.utils.createUniqueFileName(existingFullFilePath); } else { newUniqueNamePath = existingFullFilePath; } if ( arguments.verbose ) application.ADF.utils.doDump(newUniqueNamePath,"newUniqueNamePath",1); // Convert Slashes newUniqueNamePath = Replace(newUniqueNamePath,"\","/","all"); // New Full Unique File Name (full w/ ext) newFullFileName = ListLast(newUniqueNamePath,"/"); if ( arguments.verbose ) application.ADF.utils.doDump(newFullFileName,"newFullFileName",1); // New Full URL with File Name newFullFileURL = subsiteURL & newFullFileName; if ( arguments.verbose ) application.ADF.utils.doDump(newFullFileURL,"newFullFileURL",1); // New unique File Name (w/o ext) newFileName = ListFirst(newFullFileName,"."); if ( arguments.verbose ) application.ADF.utils.doDump(newFileName,"newFileName",1); } retResult["title"] = newPageTitle; retResult["name"] = newPageName; retResult["filename"] = newFullFileName; retResult["filenameNoExt"] = newFileName; retResult["url"] = newFullFileURL; retResult["type"] = newFullFileURL; return retResult; var newTitle = TRIM(arguments.csPageTitle); var counter = 0; var pageTitleExists = true; var pageIDlist = ""; // Continue to create new PageTitles if pageTitleExists is true while ( pageTitleExists ) { // increment the counter counter = counter + 1; // Get the list of pageIDs for the current Page Title pageIDlist = getCSPageIDlistByTitle(newTitle,arguments.csSubsiteID); // if the pageIDlist has values but contains the passed in pageid DO NOT create a unique page title if ( ListLen(pageIDlist) AND ListFind(pageIDlist,arguments.csPageID) EQ 0 ) { pageTitleExists = true; newTitle = arguments.csPageTitle & "-" & counter; } else { pageTitleExists = false; } } return newTitle; var csPageID = 0; var pageQry = getCSPageQueryByTitle(csPageTitle=arguments.csPageTitle,csSubsiteID=arguments.csSubsiteID,includeRegisteredURLS=arguments.includeRegisteredURLS); if ( pageQry.recordCount ) csPageID = pageQry.ID; return csPageID; var pageQry = getCSPageQueryByTitle(csPageTitle=arguments.csPageTitle,csSubsiteID=arguments.csSubsiteID,includeRegisteredURLS=arguments.includeRegisteredURLS); if ( pageQry.recordCount ) return true; else return false; var csPageIDlist = ""; var pageQry = getCSPageQueryByTitle(csPageTitle=arguments.csPageTitle,csSubsiteID=arguments.csSubsiteID,includeRegisteredURLS=arguments.includeRegisteredURLS); if ( pageQry.recordCount ) csPageIDlist = ValueList(pageQry.ID); return csPageIDlist; select ID, subsiteid, name, Title, FileName from sitePages where ( title = or title = ) and subsiteID = and ( pageType = or pageType = ) var cleanedPageName = buildCSPageName(TRIM(LCASE(arguments.csPageName))); var newName = cleanedPageName; var counter = 0; var pageNameExists = true; var pageIDlist = ""; // Continue to create new PageName if pageNameExists is true while ( pageNameExists ) { // increment the counter counter = counter + 1; // Get the list of pageIDs for the current Page name pageIDlist = getCSPageIDlistByName(newName,arguments.csSubsiteID); // if the pageIDlist has values but contains the passed in pageid DO NOT create a unique page name if ( ListLen(pageIDlist) AND ListFind(pageIDlist,arguments.csPageID) EQ 0 ) { pageNameExists = true; newName = cleanedPageName & "-" & counter; } else { pageNameExists = false; } } return newName; var csPageIDlist = ""; var pageQry = getCSPageQueryByName(csPageName=arguments.csPageName,csSubsiteID=arguments.csSubsiteID,includeRegisteredURLS=arguments.includeRegisteredURLS); if ( pageQry.recordCount ) csPageIDlist = ValueList(pageQry.ID); return csPageIDlist; var pageQry = getCSPageQueryByName(csPageName=arguments.csPageName,csSubsiteID=arguments.csSubsiteID,includeRegisteredURLS=arguments.includeRegisteredURLS); if ( pageQry.recordCount ) return true; else return false; select ID, subsiteid, name, Title, FileName from sitePages where ( name = or name = ) and subsiteID = and ( pageType = or pageType = ) var metadataArray = ArrayNew(1); var currFormName = ""; var currFormKeyList = ""; var currFieldName = ""; var tempStruct = structNew(); var i=1; var j=1; // Loop over the struct var metadataKeyList = StructKeylist(arguments.metadata); for ( i=1; i LTE ListLen(metadataKeyList); i++ ){ currFormName = ListGetAt(metadataKeyList, i); currFormKeyList = StructKeylist(arguments.metadata[currFormName]); // Loop over the fields in the form for ( j=1; j LTE ListLen(currFormKeyList); j++ ){ currFieldName = ListGetAt(currFormKeyList, j); tempStruct = structNew(); tempStruct['FormName'] = currFormName; tempStruct['FieldName'] = currFieldName; tempStruct['Value'] = arguments.metadata[currFormName][currFieldName]; // Add the struct back into the array ArrayAppend(metadataArray, tempStruct); } } return metadataArray; var targetURL = ''; var matchArray = REMatchNoCase("PAGEID=[\d]+", arguments.str); var PageID = 0; // If str is a pageID use it if( isNumeric(str) ) PageID = int(str); // Check to see if the string contains a 'PAGEID=' else if ( arrayLen(matchArray) GT 0 ) pageID = int( ReReplaceNoCase(matchArray[1],"PAGEID=","") ); var strPageID = ""; var strURL = ""; if (arguments.cpPageID contains "CP___PAGEID=") { strPageID = replacenocase(arguments.cpPageID,"CP___PAGEID=",""); strPageID = listFirst(strPageID,","); // Get the url for this PageID strURL = application.ADF.csData.getCSPageURL(strPageID); } return strURL; var csFileURL = ""; var getPageData = queryNew("test"); SELECT fileName, subsiteID, PageType, DocType FROM sitePages WHERE ID = var padMaskStr = ""; // Get a safe pad size if ( IsNumeric(arguments.padsize) ) { if ( arguments.padsize GTE 2 ) arguments.padsize = arguments.padsize - 1; else arguments.padsize = 1; } // Build the string for the padding mask padMaskStr = RepeatString("0",arguments.padsize) & 9; // Pad the Unique ID return NumberFormat( Request.Site.IDMaster.getID(), padMaskStr ); var csPageID = 0; var pageQry = getCSPageDataByURL(csPageURL=arguments.csPageURL); if ( pageQry.recordCount ) csPageID = pageQry.ID; return csPageID;