var rtnStruct = structNew();
// TODO the element names should all be constants
var blogArray = application.ptBlog2.ceData.getCEData("Blog2", "blogID", arguments.blogID);
if( arrayLen(blogArray) )
{
rtnStruct = blogArray[1].values;
rtnStruct.dataPageID = blogArray[1].pageID;
}
var rtnStruct = structNew();
// TODO the element names should all be constants
var blogArray = application.ptBlog2.ceData.getCEData("Blog2", "Name", arguments.blogName);
if( arrayLen(blogArray) )
{
rtnStruct = blogArray[1].values;
rtnStruct.dataPageID = blogArray[1].pageID;
}
// Return the CCAPI status struct
var contentResult = application.ptBlog2.CSContent.populateContent("Blog", arguments.dataStruct);
var blogData = getBlogByName(blogName=arguments.blogName);
var status = StructNew();
// Check that we have a dataset
if ( structKeyExists(blogData, "name") )
{
// Update the Active field to "No"
blogData["active"] = "No";
// Pass the data back to update the element
status = createBlog(dataStruct=blogData);
}
var pageCreationResults = "";
var blog = getBlog(arguments.blogID);
var stdMetadata = StructNew();
var custMetadata = StructNew();
// Set the landing page name
var landingPageName = application.ptBlog2.csData.buildCSPageName(contentTitle=blog.landingPageName);
// Get the CS Page ID for the Landing Page
var landingCSPageID = application.ptBlog2.blogService.getFeatureCSPageID(blogID=arguments.blogID,
featureType="landingPage");
var pageData = StructNew();
var retData = StructNew();
retData.errorFlag = false;
retData.errorMsg = "";
retData.csPageID = 0;
// Check if the page doesn't exist and we want to build
// the blog landing page.
if( (landingCSPageID LTE 0)
AND (application.ptBlog2.appConfig.blogIndexTemplate)
AND (blog.autoLandingPage) ){
stdMetadata.subsiteID = application.ptBlog2.blogService.getBlogSubsiteID(blogID=arguments.blogID);
stdMetadata.name = landingPageName;
stdMetadata.title = blog.name;
stdMetadata.templateID = application.ptBlog2.appConfig.blogIndexTemplate;
stdMetadata.caption = stdMetadata.title;
stdMetadata.description = stdMetadata.title;
stdMetadata.publicationDate = DateFormat(now(), 'yyyy-mm-dd') & " " & TimeFormat(now(), 'HH:MM:SS');
stdMetadata.categoryID = 1;
//custMetadata = StructNew();
//custMetadata.Blogs2.blogID = arguments.blogID;
// Get the custom metadata from the template (fix for CS CCAPI custom metadata inheritance issue)
custMetadata = application.ptBlog2.csData.getCustomMetadata(pageid=stdMetadata.templateID,convertTaxonomyTermsToIDs=1);
custMetadata["Blogs2"] = structNew();
custMetadata["Blogs2"]["blogID"] = arguments.blogID;
custMetadata["Blogs2"]["postID"] = "";
pageData = stdMetadata;
// Convert the metadata structure to an array of MetadataValue structures for the API
pageData['metadata'] = application.ptBlog2.csData.metadataStructToArray(metadata=custMetadata);
/*pageCreationResults = application.ptBlog2.apiPage.create(pageData=pageData,
activatePage=true);*/
pageCreationResults = application.ptBlog2.apiPage.createRemote(pageData=pageData,
activatePage=true);
if ( StructKeyExists(pageCreationResults, "CMDSTATUS")
AND pageCreationResults.CMDSTATUS EQ true
AND StructKeyExists(pageCreationResults, "CMDRESULTS") ) {
retData.csPageID = pageCreationResults.CMDRESULTS;
}
else {
retData.errorFlag = true;
if ( StructKeyExists(pageCreationResults, "CMDRESULTS") )
retData.errorMsg = pageCreationResults.CMDRESULTS;
else
retData.errorMsg = "Error";
}
}
else {
// Set the landing page CS page ID to send back
retData.csPageID = landingCSPageID;
}
return retData;
// Validate the postID passed into the function
var postData = getPost(arguments.postID);
var sparams = StructNew();
var csPage = "";
/*
// Check that we have values
if ( StructKeyExists(postData, "postPageID") AND LEN(postData.postPageID) AND isNumeric(postData.postPageID) ){
// Load the sparams
sparams.pageid = postData.postPageID;
// Call CSData to get the subsiteID for the pageID
sparams.subsiteid = application.ptBlog2.csdata.getSubsiteIDByPageID(postData.postPageID);
// create the page CFC
csPage = server.ADF.objectFactory.getBean("CSPage_1_0");
// delete the page
csPage.deletePage(sparams);
} */
return true;
var rtnArray = ArrayNew(1);
return rtnArray;
var rtnString = "";
var pageCreationResults = "";
var blog = getBlog(arguments.blogID);
var stdMetadata = StructNew();
var custMetadata = StructNew();
var pageTitle = blog.name & " Tags";
// Set the landing page name
var tagsPageName = application.ptBlog2.csData.buildCSPageName(contentTitle=blog.tagsPageName);
// Get the CS Page ID for the Landing Page
var landingCSPageID = application.ptBlog2.blogService.getFeatureCSPageID(blogID=arguments.blogID,
featureType="tagsListing");
var pageData = StructNew();
var retData = StructNew();
retData.errorFlag = false;
retData.errorMsg = "";
retData.csPageID = 0;
// Check if the page doesn't exist
// AND we want to build the tags listing page
// AND the PT Tags is integrated is enabled
if( (landingCSPageID LTE 0)
AND Len(application.ptBlog2.appConfig.tagsPageTemplate)
AND (blog.autoTagsPage)
AND application.ptBlog2.appConfig.tagsIntegrated ){
stdMetadata.subsiteID = application.ptBlog2.blogService.getBlogSubsiteID(blogID=arguments.blogID);
stdMetadata.name = tagsPageName;
stdMetadata.title = pageTitle;
stdMetadata.templateID = application.ptBlog2.appConfig.tagsPageTemplate;
stdMetadata.caption = stdMetadata.title;
stdMetadata.description = stdMetadata.title;
stdMetadata.publicationDate = DateFormat(now(), 'yyyy-mm-dd') & " " & TimeFormat(now(), 'HH:MM:SS');
stdMetadata.categoryID = 1;
custMetadata = StructNew();
custMetadata.Blogs2.blogID = arguments.blogID;
pageData = stdMetadata;
// Convert the metadata structure to an array of MetadataValue structures for the API
pageData['metadata'] = application.ptBlog2.csData.metadataStructToArray(metadata=custMetadata);
/*pageCreationResults = application.ptBlog2.apiPage.create(pageData=pageData,
activatePage=true);*/
pageCreationResults = application.ptBlog2.apiPage.createRemote(pageData=pageData,
activatePage=true);
if ( StructKeyExists(pageCreationResults, "CMDSTATUS")
AND pageCreationResults.CMDSTATUS EQ true
AND StructKeyExists(pageCreationResults, "CMDRESULTS") ) {
retData.csPageID = pageCreationResults.CMDRESULTS;
}
else {
retData.errorFlag = true;
if ( StructKeyExists(pageCreationResults, "CMDRESULTS") )
retData.errorMsg = pageCreationResults.CMDRESULTS;
else
retData.errorMsg = "Error";
}
}
else {
// Set the landing page CS page ID to send back
retData.csPageID = landingCSPageID;
}
return retData;
// Return the CCAPI status struct
var contentResult = application.ptBlog2.CSContent.populateContent("BlogFeatureData", arguments.dataStruct);
return contentResult;
var rtnStruct = structNew();
// Get the data for the Blog Feature Data
var featureDataArray = arrayNew(1);
// Get based on Blog ID, Feature Type, and Feature CS Page ID
if ( LEN(arguments.blogID) AND LEN(arguments.featureType) AND (arguments.featureCSPageID GT 0) ) {
featureDataArray = application.ptBlog2.ceData.getCEData(customElementName="Blog2 Feature Data",
searchFields="blogID,featureType,featureCSPageID",
searchValues="#arguments.blogID#,#arguments.featureType#,#arguments.featureCSPageID#",
queryType="multi");
}
// Get based on Blog ID and Feature Type
else if ( LEN(arguments.blogID) AND LEN(arguments.featureType) ) {
featureDataArray = application.ptBlog2.ceData.getCEData(customElementName="Blog2 Feature Data",
searchFields="blogID,featureType",
searchValues="#arguments.blogID#,#arguments.featureType#",
queryType="multi");
}
else if ( LEN(arguments.blogID) ) {
featureDataArray = application.ptBlog2.ceData.getCEData(customElementName="Blog2 Feature Data",
customElementFieldName="blogID",
item=arguments.blogID,
queryType="selected");
}
return featureDataArray;