var retMessage = "true"; var errorFlag = false; var blogData = application.ptBlog2.blogDAO.getBlog(arguments.blogID); var subsiteID = 0; var results = ""; var landingPageName = ""; try { if(!StructIsEmpty(blogData)) { // Check if the subsite URL text is a valid subsite subsiteID = getBlogSubsiteID(blogID = arguments.blogID); if( subsiteID LTE 0) { retMessage = "Unable to create blog subsite [#blogData.subsiteURL#]"; application.ptBlog2.utils.logAppend(retMessage,"blogErrors.log"); errorFlag = true; // Set the Error Flag } // FEATURE - Blog Landing Page // Check the config wants to build the Blog Landing Page if ( NOT errorFlag AND blogData.autoLandingPage ) { // Handle the "Landing Page" features results = handleFeatureBuild(blogID=arguments.blogID, featureType="landingPage"); if ( results.errorFlag ) retMessage = "Error creating Blog Landing Page. " & results.retMessage; else retMessage = "true"; errorFlag = results.errorFlag; //application.ptBlog2.utils.dodump(results,"results-createBlogIndexPage"); } // FEATURE - Tags Listing Page // Check the config to build the Tags Listing Page if ( NOT errorFlag AND application.ptBlog2.appConfig.tagsIntegrated AND blogData.autoTagsPage ) { // Handle the "Tags Listing" features results = handleFeatureBuild(blogID=arguments.blogID, featureType="tagsListing"); if ( results.errorFlag ) retMessage = "Error creating Tags Listing Page. " & results.retMessage; else retMessage = "true"; errorFlag = results.errorFlag; //application.ptBlog2.utils.dodump(results,"results-createTagsListingPage"); } } else { application.ptBlog2.utils.logAppend("Unable to find blog with ID #arguments.blogID#","blogErrors.log"); retMessage = "Unable to identify blog data."; errorFlag = true; // Set the Error Flag } } catch(Any e) { application.ptBlog2.utils.dodump(e, "cfcatch", false); retMessage = e.message; errorFlag = true; } // Return the blog message return retMessage; var results = StructNew(); var retStruct = StructNew(); retStruct.retMessage = "true"; retStruct.errorFlag = false; // Switch-Case to determine the feature switch (arguments.featureType){ case "landingPage": // Landing Page Feature results = application.ptBlog2.blogDAO.createBlogIndexPage(arguments.blogID); break; case "tagsListing": // Tags Listing Page Feature results = application.ptBlog2.blogDAO.createTagsListingPage(arguments.blogID); break; } // Check if any errors if ( (StructKeyExists(results, "csPageID") AND (results.csPageID GT 0)) AND (StructKeyExists(results, "errorFlag") AND (NOT results.errorFlag)) ) { // Set the feature type data results = handleFeatureUpdate(blogID=arguments.blogID, featureType=arguments.featureType, csPageID=results.csPageID); //application.ptBlog2.utils.dodump(results,"results-tagsListing"); // Check the Status if ( NOT results.contentUpdated ) { retStruct.retMessage = results.errorMsg; retStruct.errorFlag = true; // Set the Error Flag } } else { //retStruct.retMessage = "Error creating the Tags Listing Page. Please check that a page with the same name does not exist within the blog subsite."; retStruct.retMessage = results.errorMsg; retStruct.errorFlag = true; // Set the Error Flag } return retStruct; var featureData = StructNew(); var cuurFeatureData = StructNew(); var runCCAPI = false; // Set flag to run CCAPI var results = StructNew(); results.contentUpdated = false; results.msg = ""; // Get the feature data for the blog and feature type cuurFeatureData = application.ptBlog2.blogDAO.getFeatureData(blogID=arguments.blogID, featureType=arguments.featureType); // There is a feature data record if ( ArrayLen(cuurFeatureData) ){ // Check if the new CS Page ID is NOT EQUAL to the current CS Page ID stored if ( arguments.csPageID NEQ cuurFeatureData[1].Values.featureCSPageID ){ // Update the record with the new CS Page ID featureData = cuurFeatureData[1].Values; featureData.dataPageID = cuurFeatureData[1].pageID; featureData.featureCSPageID = arguments.csPageID; runCCAPI = true; // Set flag to run CCAPI } else { // Just say the content was updated to move along the processing results.contentUpdated = true; } } else { // IF we DON'T have an entry in the feature data, then create record // Build the feature type data featureData.blogID = arguments.blogID; featureData.featureType = arguments.featureType; featureData.featureCSPageID = arguments.csPageID; runCCAPI = true; // Set flag to run CCAPI } // Set the data into the Blog2 Feature Data CE if ( runCCAPI ) results = application.ptBlog2.blogDAO.setFeatureData(featureData); return results; // Set the feature types into a list to loop over var featureItemsList = "landingPage,tagsListing"; var featureData = ""; var i = 1; var sparams = StructNew(); // Loop over the list of feature types for ( i=1; i LTE ListLen(featureItemsList); i=i+1 ){ // Get the Landing Page feature data, if it exists featureData = application.ptBlog2.blogDAO.getFeatureData(blogID=arguments.blogID, featureType=ListGetAt(featureItemsList,i)); // Delete current feature pages if ( ArrayLen(featureData) ) { // Load the sparams sparams = StructNew(); sparams.pageid = featureData[1].values.featureCSPageID; // Call CSData to get the subsiteID for the pageID sparams.subsiteid = application.ptBlog2.csdata.getSubsiteIDByPageID(sparams.pageid); // Delete the feature CS pages //application.ptBlog2.csPage.deletePage(deletePageData=sparams); application.ptBlog2.apiPage.delete(csPageID=sparams.pageid); // Delete the feature CE Record application.ptBlog2.ceData.deleteCE(featureData[1].pageid); } } return true; var featureCSPageID = 0; // Get the Feature data var featureData = application.ptBlog2.blogDAO.getFeatureData(blogID=arguments.blogID, featureType=arguments.featureType); if ( ArrayLen(featureData) ) { // Take the top item from the feature data featureCSPageID = featureData[1].values.featureCSPageID; if ( IsNumeric(arguments.subsiteID) AND arguments.subsiteID GT 0 ) { // Get the page ID of the landing page of the Blog Child subsite } // Validate if the featureCSPageID page exists. // If not exist, then clear the featureCSPageID variable if ( NOT LEN(application.ptBlog2.csData.getCSPageURL(featureCSPageID)) ) featureCSPageID = 0; } return featureCSPageID; // Get the Feature CS Page ID var featureCSPageID = getFeatureCSPageID(blogID=arguments.blogID, featureType=arguments.featureType); var featureCSPageURL = ""; if ( featureCSPageID GT 0 ) { // Get the Page URL for the feature Page ID featureCSPageURL = application.ptBlog2.csData.getCSPageURL(featureCSPageID); // Check that we have a URL if ( LEN(featureCSPageURL) ) return featureCSPageURL; } return ""; var blogNotificationData = getNotificationData(blogID=arguments.blogID); var userDataArray = blogNotificationData.to; var i = 1; var notificationEmails = structNew(); notificationEmails.from = blogNotificationData.from; notificationEmails.to = ""; // Check if the group notifications have been selected if ( isArray(userDataArray) and ArrayLen(userDataArray) ){ // Loop over the user data array to build the TO email list for ( i=1; i LTE ArrayLen(userDataArray); i=i+1 ) { if ( LEN(userDataArray[i].emailaddress) ) notificationEmails.to = ListAppend(notificationEmails.to, userDataArray[i].emailaddress); } } //else { // notificationEmails.to = request.subsiteCache[1].webMasterEmail; //} return notificationEmails; // Get the blog information var blogData = application.ptBlog2.blogDAO.getBlog(blogID=arguments.blogID); var groupData = ""; var notificationData = structNew(); var userQuery = queryNew("emailAddress"); var groupsOBJ = Server.CommonSpot.ObjectFactory.getObject("Groups"); notificationData.from = request.subsiteCache[1].webMasterEmail; notificationData.to = ""; if ( structKeyExists(blogData, "notificationFrom") AND len(blogData.notificationFrom) ){ notificationData.from = blogData.notificationFrom; } // Check if the group notifications have been selected if ( StructKeyExists(blogData, "notificationGroups") AND ListLen(blogData.notificationGroups) ){ //groups component userQuery = groupsOBJ.getMembers(groupIDList="#blogData.notificationGroups#"); // Create a comma-delimited list of email addresses to receive notifications. if (userQuery.recordCount) notificationData.to = ValueList(userQuery.emailAddress); } return notificationData; // Initialize the variables var retSubsiteID = 0; // Get the Blog data var blogData = application.ptBlog2.blogDAO.getBlog(arguments.blogID); var postData = ""; var postSubsitePath = ""; // Check if the subsite URL text is a valid subsite retSubsiteID = application.ptBlog2.csData.getSubsiteID(subsiteURL=blogData.subsiteURL); // Build the base subsite Path if ( retSubsiteID LTE 0 ) { // Subsite doesn't exist, so build it now retSubsiteID = application.ptBlog2.CSSubsite.buildSubsitesFromPath(blogData.subsiteURL); } // Check if we are enabling the subsite date formatting if ( LEN(arguments.postID) AND application.ptBlog2.appConfig.enableSubsiteDate ) { postData = application.ptBlog2.postDAO.getPost(postID=arguments.postID); postSubsitePath = request.subsiteCache[retSubsiteID].url & dateFormat(postData.datePosted, application.ptBlog2.appConfig.dateSubsiteFormat); // create the subsite if it doesn't exist retSubsiteID = application.ptBlog2.CSSubsite.buildSubsitesFromPath(postSubsitePath); if ( retSubsiteID LTE 0 ) { var ErrorMsg = "Error: Subsite was NOT created from provided path: " & postSubsitePath; application.ptBlog2.utils.logAppend(ErrorMsg,"PT_Blog_blogService.html"); } } return retSubsiteID;