variables.postsCEName = getPostsCEName();
variables.postsViewName = getCEViewName(variables.postsCEName);
var rtnStruct = structNew();
// TODO the element names should all be constants
var postArray = application.ptBlog2.ceData.getCEData("Posts2", "postID", arguments.postID);
if( arrayLen(postArray) )
{
rtnStruct = postArray[1].values;
rtnStruct.dataPageID = postArray[1].pageID;
}
return rtnStruct;
var rtnStruct = structNew();
// TODO the element names should all be constants
var postArray = application.ptBlog2.ceData.getCEData("Posts2", "postPageID", arguments.pageID);
if( arrayLen(postArray) )
{
rtnStruct = postArray[1].values;
rtnStruct.dataPageID = postArray[1].pageID;
}
return application.ptBlog2.ceData.getCEData("Posts2", "blogID", arguments.blogID);
var result = structNew();
var pageData = StructNew();
var pageCreationResults = StructNew();
var makePageUnique = true;
if( not structKeyExists(arguments, "custMetadata") or (structKeyExists(arguments, "custMetadata") and not listLen(structKeyList(arguments.custMetadata)) ) )
arguments.custMetadata = structNew();
//result = application.ptBlog2.CSPage.createPage(arguments.stdMetadata, arguments.custMetadata);
pageData = arguments.stdMetadata;
// Verify that we create a page with a unique page name and page title.
// TODO: ADD Config option for unique page name and title
if ( makePageUnique )
{
pageData['name'] = application.ptBlog2.csData.createUniquePageName(csPageName=pageData.name,csSubsiteID=pageData.subsiteID);
pageData['title'] = application.ptBlog2.csData.createUniquePageTitle(csPageTitle=pageData.title,csSubsiteID=pageData.subsiteID);
}
// Convert the metadata structure to an array of MetadataValue structures for the API
pageData['metadata'] = application.ptBlog2.csData.metadataStructToArray(metadata=custMetadata);
try
{
// Create the page
/* pageCreationResults = application.ptBlog2.apiPage.create(pageData=pageData,
activatePage=true);*/
pageCreationResults = application.ptBlog2.apiPage.createRemote(pageData=pageData,
activatePage=true);
}
catch (any excpt)
{
application.ptBlog2.utils.logAppend(excpt,"PT_Blog_postDAO-error.log");
}
if ( StructKeyExists(pageCreationResults,"CMDSTATUS")
AND pageCreationResults.CMDSTATUS EQ true
AND StructKeyExists(pageCreationResults, "CMDRESULTS")
AND IsNumeric(pageCreationResults.CMDRESULTS)
AND pageCreationResults.CMDRESULTS GT 0)
{
result.newPageID = pageCreationResults.CMDRESULTS;
// Update the page keywords
keywordResult = application.ptBlog2.apiKeywords.setPageKeywordsRemote(csPageID=result.newPageID,
keywordList=pageData.globalKeywords);
}
else
{
result.newPageID = 0;
application.ptBlog2.utils.logAppend(pageCreationResults,"PT_Blog_postDAO.html");
}
return result;
var postData = getPost(postID=arguments.postID);
//var apiPageObj = "";
var delResult = StructNew();
// Check that we have values
if ( StructKeyExists(postData,"postPageID") AND LEN(postData.postPageID) AND isNumeric(postData.postPageID) AND postData.postPageID GT 0 )
{
// create the API page object
//apiPageObj = server.ADF.objectFactory.getBean("apiPage_1_0");
// delete the page with the CMD API (remove any CS Page Redirect first)
//delResult = apiPageObj.delete(csPageID=postData.postPageID,ignoreWarnings=true,removeRedirects=true);
delResult = application.ptBlog2.apiPage.deleteRemote(csPageID=postData.postPageID,ignoreWarnings=true,removeRedirects=true);
}
return delResult;
// Create the page
var pageResult = application.ptBlog2.CSContent.populateContent("BlogPost", arguments.dataValues);
var sDate = application.ptBlog2.date.csDateFormat(arguments.startDate);
var eDate = application.ptBlog2.date.csDateFormat(arguments.endDate);
var postsQuery = queryNew('');
var postsArray = arrayNew(1);
SELECT *
FROM #variables.postsViewName#
WHERE datePosted >
AND datePosted <
AND blogID =
var status = "";
var postData = "";
// TODO - Better Error handling for the deleting
// Delete all comments for the posts
status = application.ptBlog2.commentsDAO.deleteCommentsByPostID(postid=arguments.postid);
// Delete the post page and Posts2 CE record
status = deletePostPage(postid=arguments.postid);
// Delete the Posts2 CE record
postData = getPost(postID=arguments.postid);
status = application.ptBlog2.ceData.deleteCE(datapageidList=postData.dataPageID);
return status;
// Get the blog Posts
var postsData = getPostByBlogID(blogID=arguments.blogID);
var currPost = "";
var status = false;
// Initialize the variables
var postsTagQry = "";
SELECT PageID
FROM #variables.postsViewName#
WHERE tags LIKE '%#arguments.tagID#%'
var result = structNew();
var pageData = StructNew();
var pageSaveInfoResults = StructNew();
var keywordResult = StructNew();
if( not structKeyExists(arguments, "custMetadata") or (structKeyExists(arguments, "custMetadata") and not listLen(structKeyList(arguments.custMetadata)) ) )
arguments.custMetadata = structNew();
pageData = arguments.stdMetadata;
// Convert the metadata structure to an array of MetadataValue structures for the API
pageData['metadata'] = application.ptBlog2.csData.metadataStructToArray(metadata=custMetadata);
// Create the page
//pageSaveInfoResults = application.ptBlog2.apiPage.saveInfo(pageData=pageData);
pageSaveInfoResults = application.ptBlog2.apiPage.saveInfoRemote(pageData=pageData);
if ( StructKeyExists(pageSaveInfoResults,"CMDSTATUS") AND pageSaveInfoResults.CMDSTATUS EQ true )
{
// Update the page keywords
/* keywordResult = application.ptBlog2.apiKeywords.setForObject(csPageID=pageData.id,
keywordList=pageData.globalKeywords); */
keywordResult = application.ptBlog2.apiKeywords.setPageKeywordsRemote(csPageID=pageData.id,
keywordList=pageData.globalKeywords);
}
else
{
application.ptBlog2.utils.logAppend(msg=pageSaveInfoResults,logFile="PT_Blog_postDAO.log",label="saveInfoPost");
}
return pageSaveInfoResults;
// TODO this needs to be converted to use variables. when the bug is fixed
var result = structNew();
var pageData = StructNew();
var pageSaveInfoResults = StructNew();
if( not structKeyExists(arguments, "custMetadata") or (structKeyExists(arguments, "custMetadata") and not listLen(structKeyList(arguments.custMetadata)) ) )
arguments.custMetadata = structNew();
pageData = arguments.stdMetadata;
// Convert the metadata structure to an array of MetadataValue structures for the API
pageData['metadata'] = application.ptBlog2.csData.metadataStructToArray(metadata=custMetadata);
try
{
// Rename the page
//pageSaveInfoResults = application.ptBlog2.apiPage.rename(pageData=pageData);
pageSaveInfoResults = application.ptBlog2.apiPage.renameRemote(pageData=pageData);
//application.ptBlog2.utils.logAppend(pageCreationResults,"PT_Blog_postDAO.log");
}
catch (any excpt)
{
application.ptBlog2.utils.logAppend(excpt,"PT_Blog_postDAO-error.log");
}
return pageSaveInfoResults;