blogData = structNew();
comments = arrayNew(1);
displayOnlyApprovedComments = false;
// TODO remove after development is completed
request.element.isStatic = 0;
blogDataArray = attributes.elementInfo.elementData.propertyValues;
if( arrayLen(blogDataArray) )
{
blogData = blogDataArray[1].values;
blogData.dataPageID = blogDataArray[1].pageID;
// Get the parent blog data for the blog post
parentBlogData = application.ptBlog2.blogDAO.getBlog(blogID=blogData.blogID);
// Check if comments require approval
if ( StructKeyExists(parentBlogData, "commentApproval")
AND parentBlogData.commentApproval EQ 1 )
displayOnlyApprovedComments = true;
}
blogFormID = application.ptBlog2.getBlogFormID();
// Added check to validate that the metadata form field exists.
if ( NOT StructKeyExists(request.page, "metadata")
OR NOT StructKeyExists(request.page.metadata, "blogs2")
OR NOT StructKeyExists(request.page.metadata.blogs2, "blogID") ){
request.page.metadata.blogs2.blogID = "0";
}
commentsFormID = application.ptBlog2.getCommentsFormID();
comments = application.ptBlog2.commentsDAO.getCommentsByContentID(request.page.metadata.blogs2.postID, commentsFormID, "dateCreated", "desc", displayOnlyApprovedComments);
// Get the contact data for the user who posted the blog
if ( StructKeyExists(blogData, "createdBy") AND LEN(blogData.createdBy) )
contactQry = application.ptBlog2.csData.getContactData(userID=blogData.createdBy);
else
contactQry = QueryNew("null");
application.ptBlog2.scripts.loadJQuery();
application.ptBlog2.scripts.loadJQueryUI();
// Check if comments are allowed
if ( blogData.allowComments EQ 1 )
renderComments = true;
else
renderComments = false;
#commentHTML#