From 00c4d79f93ea4d95bb11044cd9db2b93af66fbc8 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 17 Mar 2022 18:03:57 -0500 Subject: [PATCH 1/4] version bump --- box.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/box.json b/box.json index c76dc382d6..3f7d8d960f 100644 --- a/box.json +++ b/box.json @@ -1,6 +1,6 @@ { "name":"ContentBox Tester Site", - "version":"5.1.0", + "version":"5.2.0", "author":"Ortus Solutions ", "shortDescription":"A tester site for developing the ContentBox Modular CMS", "type":"cms", From 4cf3d536b2cb441d54c510706d27af4f1b2dc166 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Fri, 18 Mar 2022 14:56:38 -0500 Subject: [PATCH 2/4] CONTENTBOX-1368 #resolve rc.pageUri is only the first segment of the actual slug, now it contains the full hierarchical slug --- .../modules/contentbox-ui/ModuleConfig.cfc | 2 +- .../modules/contentbox-ui/handlers/page.cfc | 83 +++++++++---------- 2 files changed, 38 insertions(+), 47 deletions(-) diff --git a/modules/contentbox/modules/contentbox-ui/ModuleConfig.cfc b/modules/contentbox/modules/contentbox-ui/ModuleConfig.cfc index 6c005cbff8..841f0efb08 100755 --- a/modules/contentbox/modules/contentbox-ui/ModuleConfig.cfc +++ b/modules/contentbox/modules/contentbox-ui/ModuleConfig.cfc @@ -137,7 +137,7 @@ component { }, // Catch All Page Routing { - pattern : "/:pageSlug", + pattern : "/:pageUri", handler : "page", action : "index" }, diff --git a/modules/contentbox/modules/contentbox-ui/handlers/page.cfc b/modules/contentbox/modules/contentbox-ui/handlers/page.cfc index 0a9bc0c9c0..d027005f7e 100644 --- a/modules/contentbox/modules/contentbox-ui/handlers/page.cfc +++ b/modules/contentbox/modules/contentbox-ui/handlers/page.cfc @@ -114,33 +114,21 @@ component extends="content" { * @prc */ function index( event, rc, prc ){ - // incoming params - event.paramValue( "pageSlug", "" ); - var incomingURL = ""; + // Routing placeholder + event.paramValue( "pageUri", "" ); - // Do we have an override page setup by the settings? - if ( !structKeyExists( prc, "pageOverride" ) ) { - // Try slug parsing for hiearchical URLs - incomingURL = reReplaceNoCase( event.getCurrentRoutedURL(), "\/$", "" ); - } else { - incomingURL = prc.pageOverride; - } + // Detect full page uri or override it via a prehandler check + rc.pageUri = isNull( prc.pageOverride ) ? reReplaceNoCase( event.getCurrentRoutedURL(), "\/$", "" ) : prc.pageOverride; - // Entry point cleanup + // Cleanup the module entry point if any if ( len( prc.cbEntryPoint ) ) { - incomingURL = replaceNoCase( incomingURL, prc.cbEntryPoint & "/", "" ); - } - - // get the author and do publish unpublished tests - var showUnpublished = false; - if ( prc.oCurrentAuthor.isLoaded() AND prc.oCurrentAuthor.isLoggedIn() ) { - var showUnpublished = true; + rc.pageUri = replaceNoCase( rc.pageUri, prc.cbEntryPoint & "/", "" ); } // Try to get the page using the incoming URI prc.page = variables.pageService.findBySlug( - slug : incomingURL, - showUnpublished: showUnpublished, + slug : rc.pageUri, + showUnpublished: ( prc.oCurrentAuthor.isLoaded() AND prc.oCurrentAuthor.isLoggedIn() ) ? true : false, siteID : prc.oCurrentSite.getsiteID() ); @@ -151,7 +139,7 @@ component extends="content" { // Retrieve Comments // TODO: paging if ( prc.page.getAllowComments() ) { - var commentResults = commentService.findAllApproved( + var commentResults = variables.commentService.findAllApproved( contentID = prc.page.getContentID(), sortOrder = "asc" ); @@ -162,43 +150,46 @@ component extends="content" { prc.commentsCount = 0; } // Detect Mobile Device - var isMobileDevice = mobileDetector.isMobile(); + prc.isMobileDevice = variables.mobileDetector.isMobile(); // announce event - announce( "cbui_onPage", { page : prc.page, isMobile : isMobileDevice } ); + announce( "cbui_onPage", { page : prc.page, isMobile : prc.isMobileDevice } ); // Use the mobile or standard layout var thisLayout = ( - isMobileDevice ? prc.page.getMobileLayoutWithInheritance() : prc.page.getLayoutWithInheritance() + prc.isMobileDevice ? prc.page.getMobileLayoutWithInheritance() : prc.page.getLayoutWithInheritance() ); // Verify chosen page layout exists in theme, just in case they moved theme so we can produce a good error message verifyPageLayout( thisLayout ); // Verify No Layout if ( thisLayout eq "-no-layout-" ) { return prc.page.renderContent(); - } else { - // set skin view - event - .setLayout( name = "#prc.cbTheme#/layouts/#thisLayout#", module = prc.cbThemeRecord.module ) - .setView( view = "#prc.cbTheme#/views/page", module = prc.cbThemeRecord.module ); } - } else { - // missing page - prc.missingPage = incomingURL; - prc.missingRoutedURL = event.getCurrentRoutedURL(); - // announce event - announce( - "cbui_onPageNotFound", - { - page : prc.page, - missingPage : prc.missingPage, - routedURL : prc.missingRoutedURL - } - ); - // set skin not found + // set layout + view combo event - .setLayout( name = "#prc.cbTheme#/layouts/pages", module = prc.cbThemeRecord.module ) - .setView( view = "#prc.cbTheme#/views/notfound", module = prc.cbThemeRecord.module ) - .setHTTPHeader( "404", "Page not found" ); + .setLayout( name = "#prc.cbTheme#/layouts/#thisLayout#", module = prc.cbThemeRecord.module ) + .setView( view = "#prc.cbTheme#/views/page", module = prc.cbThemeRecord.module ); + return; } + // end if page was loaded + + // missing page + prc.missingPage = rc.pageUri; + prc.missingRoutedURL = event.getCurrentRoutedURL(); + + // announce event + announce( + "cbui_onPageNotFound", + { + page : prc.page, + missingPage : prc.missingPage, + routedURL : prc.missingRoutedURL + } + ); + + // Not Found layout + view + event + .setLayout( name = "#prc.cbTheme#/layouts/pages", module = prc.cbThemeRecord.module ) + .setView( view = "#prc.cbTheme#/views/notfound", module = prc.cbThemeRecord.module ) + .setHTTPHeader( "404", "Page not found" ); } /** From 0521fb07590394b1db21b5ee9740d7f90fbf2dcc Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Fri, 18 Mar 2022 15:20:04 -0500 Subject: [PATCH 3/4] CONTENTBOX-1412 #resolve VerifyPageLayout() on the page rendering touches the filesystem on each request, removing this as it is not needed --- .../modules/contentbox-ui/handlers/page.cfc | 28 ++----------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/modules/contentbox/modules/contentbox-ui/handlers/page.cfc b/modules/contentbox/modules/contentbox-ui/handlers/page.cfc index d027005f7e..ff92c4a93e 100644 --- a/modules/contentbox/modules/contentbox-ui/handlers/page.cfc +++ b/modules/contentbox/modules/contentbox-ui/handlers/page.cfc @@ -157,9 +157,7 @@ component extends="content" { var thisLayout = ( prc.isMobileDevice ? prc.page.getMobileLayoutWithInheritance() : prc.page.getLayoutWithInheritance() ); - // Verify chosen page layout exists in theme, just in case they moved theme so we can produce a good error message - verifyPageLayout( thisLayout ); - // Verify No Layout + // No layout, just render it out if ( thisLayout eq "-no-layout-" ) { return prc.page.renderContent(); } @@ -225,8 +223,7 @@ component extends="content" { prc.searchResultsContent = searchAdapter.renderSearchWithResults( prc.searchResults ); } else { prc.searchResults = getInstance( "SearchResults@contentbox" ); - prc.searchResultsContent = "
Please enter a search term to search on.
-"; + prc.searchResultsContent = "
Please enter a search term to search on.
"; } // set skin search @@ -313,25 +310,4 @@ component extends="content" { return ( arguments.contentType == "page" ? variables.pageService : variables.contentService ); } - /** - * Verify if a chosen page layout exists or not. - * - * @layout The layout to verify - */ - private function verifyPageLayout( required layout ){ - var excluded = "-no-layout-"; - // Verify exclusions - if ( listFindNoCase( excluded, arguments.layout ) ) { - return; - } - // Verify layout - if ( !fileExists( expandPath( CBHelper.themeRoot() & "/layouts/#arguments.layout#.cfm" ) ) ) { - throw( - message = "The layout of the page: '#arguments.layout#' does not exist in the current theme.", - detail = "Please verify your page layout settings", - type = "ContentBox.InvalidPageLayout" - ); - } - } - } From f32865e1a6a11ed530fbf023a78762222416430b Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Mon, 21 Mar 2022 14:24:30 -0500 Subject: [PATCH 4/4] patch release --- box.json | 2 +- changelog.md | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/box.json b/box.json index 3f7d8d960f..dee6c32b2a 100644 --- a/box.json +++ b/box.json @@ -1,6 +1,6 @@ { "name":"ContentBox Tester Site", - "version":"5.2.0", + "version":"5.1.1", "author":"Ortus Solutions ", "shortDescription":"A tester site for developing the ContentBox Modular CMS", "type":"cms", diff --git a/changelog.md b/changelog.md index 80a45834d8..4f09db29ab 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,20 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +---- + +## [5.1.1] => 2022-MAR-17 + +### Fixed + +- Master artifact was stuck at `-snapshot` fix with master artifact + +### Improvements + +- [CONTENTBOX-1412](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1412) VerifyPageLayout\(\) on the page rendering touches the filesystem on each request, removing this as it is not needed +- [CONTENTBOX-1368](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1368) rc.pageUri is only the first segment of the actual slug, now it contains the full hierarchical slug + + ---- ## [5.1.0] => 2022-MAR-17