From da8c7707d0b9a81d0de49e7f567b51514c87f768 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Wed, 29 Sep 2021 15:18:56 -0500 Subject: [PATCH 001/100] version bump --- box.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/box.json b/box.json index 1349051073..8c6e4f851a 100644 --- a/box.json +++ b/box.json @@ -1,6 +1,6 @@ { "name":"ContentBox Tester Site", - "version":"5.0.3", + "version":"5.1.0", "author":"Ortus Solutions ", "shortDescription":"A tester site for developing the ContentBox Modular CMS", "type":"cms", @@ -44,7 +44,7 @@ }, "ignores":[], "scripts":{ - "release":"recipe build/release.boxr", + "release":"recipe build/release.boxr", "build:allDocs":"task run taskFile=build/BuildDocs.cfc :version=`package show version`", "build:apidocs":"task run taskFile=build/BuildDocs.cfc target=apiDocs :version=`package show version`", "build:swagger":"task run taskFile=build/BuildDocs.cfc target=swagger :version=`package show version`", From cf45090bf23596dd8befa2a36cbc80c2929d8f27 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 2 Dec 2021 11:26:10 -0600 Subject: [PATCH 002/100] CONTENTBOX-1354 Rapidoc is not publishing on latest builds --- .github/workflows/ci.yml | 1 + .github/workflows/cron.yml | 122 ------------------------------------- build/BuildDocs.cfc | 76 +++++++++++++++-------- 3 files changed, 50 insertions(+), 149 deletions(-) delete mode 100644 .github/workflows/cron.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 212d8045fc..4149826aec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -212,6 +212,7 @@ jobs: run: | # Normalize swagger doc results cp tests/results/contentbox-test-results-lucee@5/contentbox-swagger.json tests/results/ + ls -lR tests/results # Run Docs Build box run-script build:allDocs diff --git a/.github/workflows/cron.yml b/.github/workflows/cron.yml deleted file mode 100644 index 4b82f4a459..0000000000 --- a/.github/workflows/cron.yml +++ /dev/null @@ -1,122 +0,0 @@ -name: Cron - -on: - schedule: - # Run Every Monday Midnight - - cron: 0 0 * * 1 - -jobs: - tests: - name: Tests - runs-on: ubuntu-20.04 - env: - DB_USER: root - DB_PASSWORD: root - strategy: - fail-fast: false - matrix: - cfengine: ["lucee@5", "lucee@be", "adobe@2016", "adobe@2018" ] - javaVersion: [ "openjdk8", "openjdk11" ] - steps: - - name: Checkout Repository - uses: actions/checkout@v2 - - - name: Setup Database and Fixtures - run: | - sudo /etc/init.d/mysql start - mysql -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} -e 'CREATE DATABASE contentbox;' - mysql -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} < tests/resources/sql/mysql/contentbox.sql - - - name: Setup Java - uses: actions/setup-java@v2 - with: - distribution: "adopt" - java-version: "11" - - - name: Set Up CommandBox - uses: elpete/setup-commandbox@v1.0.0 - - - name: Setup .env For Runner - run: | - touch .env - printf "DB_HOST=127.0.0.1\n" >> .env - printf "DB_DATABASE=contentbox\n" >> .env - printf "DB_DRIVER=MySQL\n" >> .env - printf "DB_USER=${{ env.DB_USER }}\n" >> .env - printf "DB_PASSWORD=${{ env.DB_PASSWORD }}\n" >> .env - printf "DB_CLASS=com.mysql.cj.jdbc.Driver\n" >> .env - printf "DB_BUNDLEVERSION=8.0.19\n" >> .env - printf "DB_BUNDLENAME=com.mysql.cj\n" >> .env - - - name: Add Hibernate Logging - if: "${{ matrix.cfengine != 'lucee@5' }}" - run: | - # Log4j Hibernate Debug - mkdir -p .engines/acf2016/WEB-INF/cfusion/lib/ - mkdir -p .engines/acf2018/WEB-INF/cfusion/lib/ - mkdir -p .engines/acf2021/WEB-INF/cfusion/lib/ - cp build/resources/log4j.properties .engines/acf2016/WEB-INF/cfusion/lib/ - cp build/resources/log4j.properties .engines/acf2018/WEB-INF/cfusion/lib/ - cp build/resources/log4j.properties .engines/acf2021/WEB-INF/cfusion/lib/ - - - name: Install Dependencies - run: | - # Site dependencies - box install - # ContentBox dependencies - cd modules/contentbox && box install - - - name: Start ${{ matrix.cfengine }} Server On ${{ matrix.javaVersion }} - run: box server start serverConfigFile="server-${{ matrix.cfengine }}.json" javaVersion=${{ matrix.javaVersion }} --noSaveSettings --debug - - - name: Run Web App Tests - run: | - mkdir tests/results/web - box package set testbox.runner="http://127.0.0.1:8589/tests/runner.cfm" - box testbox run --verbose outputFile=tests/results/web/test-results outputFormats=json,antjunit - - - name: Run API Tests - run: | - mkdir tests/results/api - box package set testbox.runner="http://127.0.0.1:8589/tests/runner-api.cfm" - box testbox run --verbose outputFile=tests/results/api/test-results outputFormats=json,antjunit - - - name: Run Swagger Tests - run: | - curl http://127.0.0.1:8589/index.cfm/cbswagger?debugmode=false&debugpassword=cb > tests/results/contentbox-swagger.json - - - name: Publish Test Results - uses: EnricoMi/publish-unit-test-result-action@v1 - if: always() - with: - files: tests/results/**/*.xml - check_name: "${{ matrix.cfengine }} Test Results" - - - name: Upload Test Results Artifacts - if: always() - uses: actions/upload-artifact@v2 - with: - name: contentbox-test-results-${{ matrix.cfengine }} - path: | - tests/results/**/* - - - name: Slack Notification - if: always() - uses: rtCamp/action-slack-notify@v2 - env: - SLACK_CHANNEL: contentbox - SLACK_COLOR: ${{ job.status }} # or a specific color like 'green' or '#ff00ff' - SLACK_ICON_EMOJI: ":bell:" - SLACK_MESSAGE: 'ContentBox Weekly Cron ${{ job.status }}' - SLACK_TITLE: ContentBox Tests For ${{ matrix.cfengine }}/${{ matrix.javaVersion }} ${{ job.status }} - SLACK_USERNAME: CI - SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} - - - name: Upload Debugging Info To Artifacts - if: ${{ failure() }} - uses: actions/upload-artifact@v2 - with: - name: Failure Debugging Info - ${{ matrix.cfengine }} - path: | - .engines/**/logs/* - .engines/**/WEB-INF/cfusion/logs/* \ No newline at end of file diff --git a/build/BuildDocs.cfc b/build/BuildDocs.cfc index 2f41659e99..b854bfe489 100644 --- a/build/BuildDocs.cfc +++ b/build/BuildDocs.cfc @@ -1,32 +1,38 @@ /** * Generate API Docs for ContentBox */ -component{ +component { function init(){ // Setup Directories - variables.util = shell.getUtil(); - variables.root = getCWD(); - variables.buildDir = variables.root & "build/build-contentbox"; + variables.util = shell.getUtil(); + variables.root = getCWD(); + variables.buildDir = variables.root & "build/build-contentbox"; variables.apidocsDir = variables.buildDir & "/apidocs"; - variables.testsDir = variables.root & "tests/results"; + variables.testsDir = variables.root & "tests/results"; variables.exportsDir = variables.root & "artifacts/contentbox"; // Cleanup directories [ variables.apidocsDir, variables.exportsDir ].each( ( thisDir ) => { - if( directoryExists( arguments.thisDir ) ){ + if ( directoryExists( arguments.thisDir ) ) { directoryDelete( arguments.thisDir, true ); } // Create it now directoryCreate( arguments.thisDir, true ); - }); + } ); // Create all necessary mappings for this build variables.util - .addMapping( '/coldbox', '#variables.root#/coldbox' ) - .addMapping( '/contentbox', '#variables.root#/modules/contentbox' ) - .addMapping( '/cbadmin', '#variables.root#/modules/contentbox/modules/contentbox-admin' ) - .addMapping( '/cborm', '#variables.root#/modules/contentbox/modules/contentbox-deps/modules/cborm' ); + .addMapping( "/coldbox", "#variables.root#/coldbox" ) + .addMapping( "/contentbox", "#variables.root#/modules/contentbox" ) + .addMapping( + "/cbadmin", + "#variables.root#/modules/contentbox/modules/contentbox-admin" + ) + .addMapping( + "/cborm", + "#variables.root#/modules/contentbox/modules/contentbox-deps/modules/cborm" + ); } /** @@ -34,10 +40,10 @@ component{ * * @version The version to add to the title output */ - function run( version="1.0.0" ){ + function run( version = "1.0.0" ){ // Prepare exports via passed version variables.exportsDir &= "/#arguments.version#"; - if( !directoryExists( variables.exportsDir ) ){ + if ( !directoryExists( variables.exportsDir ) ) { directoryCreate( variables.exportsDir, true ); } @@ -56,31 +62,40 @@ component{ swagger( arguments.version ); } - function apiDocs( version="1.0.0" ){ + function apiDocs( version = "1.0.0" ){ var sTime = getTickCount(); print.blueLine( "Generating ContentBox v#arguments.version# CFC Docs..." ).toConsole(); command( "docbox generate" ) .params( - "source" = "/contentbox", - "mapping" = "contentbox", - "strategy-projectTitle" = 'ContentBox Modular CMS #arguments.version#', - "strategy-outputdir" = variables.apidocsDir, - "excludes" = "contentbox-deps" + "source" = "/contentbox", + "mapping" = "contentbox", + "strategy-projectTitle" = "ContentBox Modular CMS #arguments.version#", + "strategy-outputdir" = variables.apidocsDir, + "excludes" = "contentbox-deps" ) .run(); - print.greenLine( "√ CFC Docs completed in #getTickCount() - sTime#ms and can be found at: #variables.apidocsDir#" ).toConsole(); + variables.print + .greenLine( + "√ CFC Docs completed in #getTickCount() - sTime#ms and can be found at: #variables.apidocsDir#" + ) + .toConsole(); } /** * Build the swagger docs */ - function swagger( version="1.0.0" ){ + function swagger( version = "1.0.0" ){ var sTime = getTickCount(); - print.blueLine( "Generating ContentBox #arguments.version# Swagger json docs..." ).toConsole(); + variables.print + .blueLine( "Generating ContentBox #arguments.version# Swagger json docs..." ) + .toConsole(); // Test if swagger doc in resutls already - if( fileExists( variables.testsDir & "contentbox-swagger.json" ) ){ + if ( fileExists( variables.testsDir & "/contentbox-swagger.json" ) ) { + variables.print + .greenLine( "Swagger docs already created, just doing token replacements..." ) + .toConsole(); command( "tokenReplace" ) .params( path = "#variables.testsDir#/contentbox-swagger.json", @@ -89,6 +104,9 @@ component{ ) .run(); } else { + variables.print + .orangeLine( "Swagger docs not found, recreating..." ) + .toConsole(); command( "tokenReplace" ) .params( path = "#variables.root#/config/Coldbox.cfc", @@ -97,9 +115,9 @@ component{ ) .run(); cfhttp( - url="http://127.0.0.1:8589/index.cfm/cbswagger?debugmode=false&debugpassword=cb", + url = "http://127.0.0.1:8589/index.cfm/cbswagger?debugmode=false&debugpassword=cb", path = variables.testsDir, - file="contentbox-swagger.json" + file = "contentbox-swagger.json" ); } @@ -115,7 +133,11 @@ component{ "#variables.exportsDir#/contentbox-swagger-#arguments.version#.json" ); - print.greenLine( "√ Swagger JSON docs generated in #getTickCount() - sTime#ms and can be found at: #variables.apidocsDir#/contentbox-swagger.json" ).toConsole(); + variables.print + .greenLine( + "√ Swagger JSON docs generated in #getTickCount() - sTime#ms and can be found at: #variables.apidocsDir#/contentbox-swagger.json" + ) + .toConsole(); } -} \ No newline at end of file +} From 97c244031bfd4c03f2842064c2c7fec468c31150 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 2 Dec 2021 11:48:34 -0600 Subject: [PATCH 003/100] CONTENTBOX-1354 Rapidoc is not publishing on latest builds --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4149826aec..9874e259d5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -105,7 +105,7 @@ jobs: - name: Run Swagger Tests run: | - curl http://127.0.0.1:8589/index.cfm/cbswagger?debugmode=false&debugpassword=cb > tests/results/contentbox-swagger.json + curl http://127.0.0.1:8589/index.cfm/cbswagger?debugmode=false&debugpassword=cb -o tests/results/contentbox-swagger.json - name: Publish Test Results uses: EnricoMi/publish-unit-test-result-action@v1 From 6a0490da471530b6c144ca8047919ac2b73faa98 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 2 Dec 2021 12:06:24 -0600 Subject: [PATCH 004/100] more tests on CONTENTBOX-1354 --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9874e259d5..ce9b40206a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -105,7 +105,8 @@ jobs: - name: Run Swagger Tests run: | - curl http://127.0.0.1:8589/index.cfm/cbswagger?debugmode=false&debugpassword=cb -o tests/results/contentbox-swagger.json + curl http://127.0.0.1:8589/index.cfm/cbswagger?debugmode=false&debugpassword=cb > tests/results/contentbox-swagger.json + cat tests/results/contentbox-swagger.json - name: Publish Test Results uses: EnricoMi/publish-unit-test-result-action@v1 From 6fe7d991827ee3b5eea3cd2a420cc1c4e5c58f6a Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 2 Dec 2021 12:24:22 -0600 Subject: [PATCH 005/100] stupid curl not working --- .github/workflows/ci.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ce9b40206a..a7d89e7383 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -105,8 +105,7 @@ jobs: - name: Run Swagger Tests run: | - curl http://127.0.0.1:8589/index.cfm/cbswagger?debugmode=false&debugpassword=cb > tests/results/contentbox-swagger.json - cat tests/results/contentbox-swagger.json + curl "http://127.0.0.1:8589/index.cfm/cbswagger?debugmode=false&debugpassword=cb" -o "tests/results/contentbox-swagger.json" - name: Publish Test Results uses: EnricoMi/publish-unit-test-result-action@v1 @@ -212,8 +211,8 @@ jobs: - name: Build Docs run: | # Normalize swagger doc results - cp tests/results/contentbox-test-results-lucee@5/contentbox-swagger.json tests/results/ - ls -lR tests/results + cp -v tests/results/contentbox-test-results-lucee@5/contentbox-swagger.json tests/results/ + #ls -lR tests/results # Run Docs Build box run-script build:allDocs From 90a5d43bdf4cd79c2438e94fd3587baea967e581 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 2 Dec 2021 12:51:22 -0600 Subject: [PATCH 006/100] isntall modules to get the right docs --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a7d89e7383..0f7e3148ff 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -191,6 +191,8 @@ jobs: run: | box install --production box install commandbox-docbox + cd modules/contentbox && box install --production + - name: Setup Environment Variables For Build Process id: current_version From 6fac2f26a30a36338b52b57006d18b699347f2b0 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 2 Dec 2021 12:53:11 -0600 Subject: [PATCH 007/100] CONTENTBOX-1354 --- build/BuildDocs.cfc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build/BuildDocs.cfc b/build/BuildDocs.cfc index b854bfe489..c62fe6caf1 100644 --- a/build/BuildDocs.cfc +++ b/build/BuildDocs.cfc @@ -127,11 +127,15 @@ component { "#variables.apidocsDir#/apidoc.html" ); - // Move Swagger Doc to Exports + // Move Swagger Doc to Exports + Apidocs fileCopy( "#variables.testsDir#/contentbox-swagger.json", "#variables.exportsDir#/contentbox-swagger-#arguments.version#.json" ); + fileCopy( + "#variables.testsDir#/contentbox-swagger.json", + "#variables.apidocsDir#/contentbox-swagger.json" + ); variables.print .greenLine( From 2cc77088bc45423af292c06d976ee78468f2b296 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 2 Dec 2021 16:15:48 -0600 Subject: [PATCH 008/100] CONTENTBOX-1355 #resolve Category isPublic new boolean flag cannot be notnull=true as it has been a new added field --- modules/contentbox/models/content/Category.cfc | 5 ++++- .../migrations/2020_08_24_150933_v5Upgrade.cfc | 10 +++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/modules/contentbox/models/content/Category.cfc b/modules/contentbox/models/content/Category.cfc index 89f3170df2..e2dd7f5a51 100755 --- a/modules/contentbox/models/content/Category.cfc +++ b/modules/contentbox/models/content/Category.cfc @@ -22,14 +22,17 @@ component name ="categoryService" inject ="categoryService@contentbox" persistent="false"; + property name ="pageService" inject ="pageService@contentbox" persistent="false"; + property name ="entryService" inject ="entryService@contentbox" persistent="false"; + property name ="contentStoreService" inject ="contentStoreService@contentbox" @@ -76,7 +79,7 @@ component name ="isPublic" column ="isPublic" ormtype="boolean" - notnull="true" + notnull="false" default="true" index ="idx_isPublic"; diff --git a/resources/database/migrations/2020_08_24_150933_v5Upgrade.cfc b/resources/database/migrations/2020_08_24_150933_v5Upgrade.cfc index 34e722c3c8..3c884e0c5f 100755 --- a/resources/database/migrations/2020_08_24_150933_v5Upgrade.cfc +++ b/resources/database/migrations/2020_08_24_150933_v5Upgrade.cfc @@ -51,7 +51,7 @@ component { // Get the db schema name, we might need it when dropping keys variables.dbSchema = migrationService.getSchema(); - variables.uuidLib = createobject("java", "java.util.UUID"); + variables.uuidLib = createobject( "java", "java.util.UUID" ); scopeGrammarUDFs( argumentCollection=arguments ); @@ -91,6 +91,14 @@ component { table.index( [ "slug", "isPublished" ], "idx_publishedSlug" ); table.index( [ "title", "isPublished" ], "idx_search" ); } ); + // Create Category isPublic with indexes + if( !hasColumn( "cb_category", "isPublic" ) ){ + schema.alter( "cb_category", ( table ) => { + table.addColumn( table.boolean( "isPublic" ).default( true ) ); + table.index( [ "isPublic" ], "idx_isPublic" ); + } ); + } + } catch ( any e ) { transactionRollback(); systemOutput( e.stacktrace, true ); From 26055dfd60bf084aba8f08e95f16fd88bda5a6ea Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 2 Dec 2021 16:18:39 -0600 Subject: [PATCH 009/100] CONTENTBOX-1356 #resolve Invalid setting name on migration removing unique constraints --- resources/database/migrations/2020_08_24_150933_v5Upgrade.cfc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/database/migrations/2020_08_24_150933_v5Upgrade.cfc b/resources/database/migrations/2020_08_24_150933_v5Upgrade.cfc index 3c884e0c5f..4eefa297b5 100755 --- a/resources/database/migrations/2020_08_24_150933_v5Upgrade.cfc +++ b/resources/database/migrations/2020_08_24_150933_v5Upgrade.cfc @@ -135,7 +135,7 @@ component { private function removeUniqueConstraints( schema, query ){ // Remove Setting Name Unique Constraint - dropIndexesForTableColumn( "cb_settings", "name" ); + dropIndexesForTableColumn( "cb_setting", "name" ); systemOutput( "√ - Setting name unique constraint dropped", true ); // Remove Content Unique Constraint From 8aa6ae103ee22bc9c6ff333186223fc9eb18bc55 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 2 Dec 2021 16:23:10 -0600 Subject: [PATCH 010/100] CONTENTBOX-1353 #resolve MSSQL Issues when upgrading v4 databases due to uuid's and invalid sql syntaxes --- .../2020_08_24_150933_v5Upgrade.cfc | 60 +++++++++++-------- 1 file changed, 35 insertions(+), 25 deletions(-) diff --git a/resources/database/migrations/2020_08_24_150933_v5Upgrade.cfc b/resources/database/migrations/2020_08_24_150933_v5Upgrade.cfc index 4eefa297b5..a72b17c78e 100755 --- a/resources/database/migrations/2020_08_24_150933_v5Upgrade.cfc +++ b/resources/database/migrations/2020_08_24_150933_v5Upgrade.cfc @@ -157,7 +157,7 @@ component { if( !hasColumn( thisTable, "FK_siteID" ) ){ // Add site id relationship schema.alter( thisTable, ( table ) => { - table.addColumn( table.uuid( "FK_siteID" ).nullable() ); + table.addColumn( table.string( "FK_siteID", 36 ).nullable() ); table.addConstraint( table .foreignKey( "FK_siteID" ) @@ -172,13 +172,15 @@ component { } // Seed with site id - query - .newQuery() - .from( thisTable ) - .whereNull( "FK_siteID" ) - .update( { "FK_siteID" : siteId } ); - - systemOutput( "√ - Populated '#thisTable#' with default site data", true ); + if( thisTable != "cb_setting" ){ + query + .newQuery() + .from( thisTable ) + .whereNull( "FK_siteID" ) + .update( { "FK_siteID" : siteId } ); + + systemOutput( "√ - Populated '#thisTable#' with default site data", true ); + } } ); } @@ -265,7 +267,7 @@ component { private function createDefaultSite( schema, query ){ // Create the site table arguments.schema.create( "cb_site", ( table ) => { - table.uuid( "siteID" ).primaryKey(); + table.string( "siteID", 36 ).primaryKey(); table.dateTime( "createdDate" ); table.dateTime( "modifiedDate" ); table.boolean( "isDeleted" ).default( false ); @@ -294,8 +296,8 @@ component { schema.alter( "cb_setting", function( table ){ - table.addColumn( table.uuid( "FK_siteID" ).nullable() ); - table.addConstraint( table.uuid( "FK_siteID" ).references( "siteID" ).onTable( "cb_site" ) ) + table.addColumn( table.string( "FK_siteID", 36 ).nullable() ); + table.addConstraint( table.string( "FK_siteID", 36 ).references( "siteID" ).onTable( "cb_site" ) ) } ); @@ -392,13 +394,13 @@ component { variables.idTables.keyArray().each( function( tableName ){ var pkColumn = idTables[ tableName ]; schema.alter( tableName, function( table ){ - table.addColumn( table.uuid( "id" ).unique().nullable() ); + table.addColumn( table.string( "id", 36 ).default( "#guidFn#" ) ); } ); query .newQuery() .from( tableName ) .update( { - "id" : query.raw( "#guidFn#") + "id" : query.raw( "#guidFn#" ) }); systemOutput( " √ - #tablename# new uuid pk created and populated", true ); } ); @@ -418,7 +420,7 @@ component { var tmpColumn = "tmp_" & pkColumn; schema.alter( tableName, function( table ){ - table.addColumn( table.uuid( tmpColumn ).nullable() ); + table.addColumn( table.string( tmpColumn, 36 ).nullable() ); } ); populateChildFKValues( tmpColumn, tableName ); systemOutput( " √ - (#tableName#) rekeyed to new parent uuid", true ); @@ -442,12 +444,12 @@ component { var tmpColumn = "tmp_" & arguments.keyConfig.column; schema.alter( tableName, function( table ){ - table.addColumn( table.uuid( tmpColumn ).nullable() ); + table.addColumn( table.string( tmpColumn, 36 ).nullable() ); } ); populateFKValues( tmpColumn, tableName, arguments.keyConfig ); schema.alter( tableName, function( table ){ table.dropColumn( keyConfig.column ); - table.renameColumn( tmpColumn, table.uuid( keyConfig.column ).nullable() ); + table.renameColumn( tmpColumn, table.string( keyConfig.column, 36 ).nullable() ); } ); systemOutput( " √ - (#tableName#) foreign key (#arguments.keyConfig.column#) rekeyed as a uuid into (#tmpColumn#)", true ); } ); @@ -467,7 +469,7 @@ component { queryExecute( pkDropSQL( tableName, pkColumn ) ); table.dropColumn( pkColumn ); // Rename it back to what it was called - table.renameColumn( "id", table.uuid( pkColumn ).unique() ) + table.renameColumn( "id", table.string( pkColumn, 36 ).unique() ) table.addConstraint( table.primaryKey( pkColumn ) ); } ); systemOutput( " √ (#arguments.tableName#) new uuid key set and finalized!", true ); @@ -485,7 +487,7 @@ component { FKeys.each( function( keyConfig ){ var tmpColumn = "tmp_" & keyConfig.column; schema.alter( tableName, function( table ){ - table.addConstraint( table.uuid( keyConfig.column ).references( keyConfig.reference.column ).onTable( keyConfig.reference.table ) ); + table.addConstraint( table.string( keyConfig.column, 36 ).references( keyConfig.reference.column ).onTable( keyConfig.reference.table ) ); } ); } ); systemOutput( " √ (#arguments.tableName#) foreign key constraints finalized!", true ); @@ -504,11 +506,17 @@ component { schema.alter( tableName, function( table ){ queryExecute( pkDropSQL( tableName, pkColumn ) ); // ensure it is a not null field before we make it PK - table.modifyColumn( tmpColumn, table.uuid( tmpColumn ) ); + table.modifyColumn( tmpColumn, table.string( tmpColumn, 36 ) ); + } ); + schema.alter( tableName, function( table ){ table.addConstraint( table.primaryKey( tmpColumn ) ); + } ); + schema.alter( tableName, function( table ){ table.dropColumn( pkColumn ); - table.renameColumn( tmpColumn, table.uuid( pkColumn ) ); - table.addConstraint( table.uuid( pkColumn ).references( pkColumn ).onTable( childTables[ tableName ].parent ) ); + table.renameColumn( tmpColumn, table.string( pkColumn, 36 ) ); + } ); + schema.alter( tableName, function( table ){ + table.addConstraint( table.string( pkColumn, 36 ).references( pkColumn ).onTable( childTables[ tableName ].parent ) ); } ); systemOutput( " √ (#arguments.tableName#) finalized!", true ); } ); @@ -789,10 +797,11 @@ component { } variables.populateFKValues = function( tmpColumn, tableName, keyConfig ){ queryExecute(" - UPDATE #arguments.tableName# as target + UPDATE target + SET target.#arguments.tmpColumn# = ref.id + FROM #arguments.tableName# as target JOIN #arguments.keyConfig.reference.table# as ref ON target.#arguments.keyConfig.column# = ref.#arguments.keyConfig.reference.column# - SET target.#arguments.tmpColumn# = ref.id "); }; @@ -800,7 +809,8 @@ component { queryExecute(" UPDATE #arguments.tableName# SET #arguments.tmpColumn# = ( - SELECT id from #childTables[ arguments.tableName ].parent# + SELECT id + FROM #childTables[ arguments.tableName ].parent# WHERE #childTables[ arguments.tableName ].parent#.#childTables[ arguments.tableName ].key# = #arguments.tableName#.#childTables[ arguments.tableName ].key# ) "); @@ -878,4 +888,4 @@ component { } } -} +} \ No newline at end of file From 187f561a25b112090bb9a5f6b0304b2d55b4881c Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 2 Dec 2021 17:03:54 -0600 Subject: [PATCH 011/100] CONTENTBOX-1333 #resolve If you activate a new theme in the active theme area, contentbox creates double entries for theme settings --- .cfformat.json | 2 +- .gitignore | 28 ++++++------- modules/contentbox/models/ui/ThemeService.cfc | 41 ++++++------------- .../contentbox-admin/handlers/themes.cfc | 16 ++++---- 4 files changed, 33 insertions(+), 54 deletions(-) diff --git a/.cfformat.json b/.cfformat.json index f733831dea..a167f3fcc0 100644 --- a/.cfformat.json +++ b/.cfformat.json @@ -41,7 +41,7 @@ "keywords.spacing_to_block": "spaced", "keywords.spacing_to_group": true, "keywords.empty_group_spacing": false, - "max_columns": 100, + "max_columns": 120, "metadata.multiline.element_count": 3, "metadata.multiline.min_length": 50, "method_call.chain.multiline" : 3, diff --git a/.gitignore b/.gitignore index 83c65a05c4..3493d2dd83 100755 --- a/.gitignore +++ b/.gitignore @@ -1,16 +1,15 @@ # Global Ignores .DS_Store -.sass-cache -.settings/** -settings.xml .project *.cache.* .idea web.config "Icon\r" WEB-INF/** +.env # Build Dependencies +coldbox/* artifacts/** build/build.number build/apidocs/docbox @@ -19,23 +18,21 @@ build/build-contentbox/** build/build-forgebox/** build/dependencies -# Global Dependencies +# Logs config/logs/** -logs/** -coldbox/* -testbox/* -**/node_modules/** -**/app_modules/** -**/bower_components/** -**/app_modules/** -workbench/app_modules -.env # Engines + Docker Libraries .engines bin/.db/** tests/resources/dbs/.db/** +# UI Dependencies +**/node_modules/** +**/app_modules/** +**/bower_components/** +**/app_modules/** +workbench/app_modules + # Module Dependencies modules/contentbox/themes/default/bower_components modules/contentbox/themes/default/node_modules @@ -45,8 +42,9 @@ modules/cbdebugger # ContentBox Dependency Modules modules/contentbox/modules/contentbox-deps/modules/* - -# Testing +# Testing Dependencies +modules/contentbox/themes/_test/** +testbox/* /tests/**/logs/** /tests/test-results/* tests/resources/patches/tmp/ diff --git a/modules/contentbox/models/ui/ThemeService.cfc b/modules/contentbox/models/ui/ThemeService.cfc index 91f5954f06..4a7a996871 100644 --- a/modules/contentbox/models/ui/ThemeService.cfc +++ b/modules/contentbox/models/ui/ThemeService.cfc @@ -98,9 +98,7 @@ component accessors="true" threadSafe singleton { // verify existence of convention if ( fileExists( - expandPath( - variables.CBHelper.themeRoot() & "/layouts/#arguments.layout#_#arguments.format#.cfm" - ) + expandPath( variables.CBHelper.themeRoot() & "/layouts/#arguments.layout#_#arguments.format#.cfm" ) ) ) { return "#arguments.layout#_#arguments.format#"; @@ -149,10 +147,7 @@ component accessors="true" threadSafe singleton { variables.siteService .getAllSiteThemes() .each( function( record ){ - startupTheme( - name: arguments.record[ "activeTheme" ], - site: arguments.record[ "siteID" ] - ); + startupTheme( name: arguments.record[ "activeTheme" ], site: arguments.record[ "siteID" ] ); } ); // Flush the settings now @@ -164,7 +159,7 @@ component accessors="true" threadSafe singleton { * * @name The name of the theme to activate * @processWidgets Process widget registration on activation, defaults to true. - * @siteID The site id or object we are starting up this theme for + * @site The site id or object we are starting up this theme for */ function startupTheme( required name, @@ -296,7 +291,7 @@ component accessors="true" threadSafe singleton { } /** - * Activate a theme by name + * Activate a specific theme for the current working site * * @themeName The theme name to activate */ @@ -305,7 +300,7 @@ component accessors="true" threadSafe singleton { var currentSite = variables.siteService.getCurrentWorkingSite(); var themeRecord = getThemeRecord( currentSite.getActiveTheme() ); - // Call deactivation event + // Call deactivation event for the previous active theme variables.interceptorService.announce( "cbadmin_onThemeDeactivation", { @@ -315,12 +310,12 @@ component accessors="true" threadSafe singleton { } ); - // Call Theme Callback: onDeactivation + // Call Old Theme Callback: onDeactivation if ( structKeyExists( themeRecord.descriptor, "onDeactivation" ) ) { themeRecord.descriptor.onDeactivation(); } - // unload theme modules + // Unload old theme modules for ( var thisModule in themeRecord.modules.listToArray() ) { variables.moduleService.unload( thisModule ); } @@ -334,20 +329,13 @@ component accessors="true" threadSafe singleton { currentSite.setActiveTheme( arguments.themeName ); variables.siteService.save( currentSite ); - // Startup the theme - startupTheme( - name : arguments.themeName, - processWidgets: false, - site : currentSite - ); - // Force Recreation of all Widgets, since we need to deactivate the old widgets variables.widgetService.getWidgets( reload = true ); - - // flush the settings just in case - variables.settingService.flushSettingsCache(); } + // Flush the settings from the cache, now that they are persisted + variables.settingService.flushSettingsCache(); + return this; } @@ -453,9 +441,7 @@ component accessors="true" threadSafe singleton { descriptorPath = arguments.path & "/#arguments.name#/#arguments.name#.cfc"; descriptorInstance = arguments.invocationPath & ".#arguments.name#.#arguments.name#"; if ( !fileExists( descriptorPath ) ) { - log.warn( - "The theme: #arguments.name# has no theme descriptor, skipping registration." - ); + log.warn( "The theme: #arguments.name# has no theme descriptor, skipping registration." ); variables.themeRegistry[ arguments.name ] = record; return; } @@ -917,10 +903,7 @@ component accessors="true" threadSafe singleton { arguments.settings // only load defaults that do not exist .filter( function( thisSetting ){ - return !arrayContainsNoCase( - loadedSiteSettings, - "cb_theme_#name#_#thisSetting.name#" - ); + return !arrayContainsNoCase( loadedSiteSettings, "cb_theme_#name#_#thisSetting.name#" ); } ) // Create the missing setting .each( function( thisSetting ){ diff --git a/modules/contentbox/modules/contentbox-admin/handlers/themes.cfc b/modules/contentbox/modules/contentbox-admin/handlers/themes.cfc index 9f0f825e0a..ef5d35a12b 100755 --- a/modules/contentbox/modules/contentbox-admin/handlers/themes.cfc +++ b/modules/contentbox/modules/contentbox-admin/handlers/themes.cfc @@ -62,8 +62,8 @@ component extends="baseHandler" { function saveSettings( event, rc, prc ){ prc.xehActiveTheme = "#prc.cbAdminEntryPoint#.themes.active"; var vResults = validate( - target = rc, - constraints = variables.themeService.getSettingsConstraints( rc.themeName ) + target : rc, + constraints: variables.themeService.getSettingsConstraints( rc.themeName ) ); // Validate results @@ -84,11 +84,11 @@ component extends="baseHandler" { announce( "cbadmin_postThemeSettingsSave", { name : rc.themeName } ); // Relocate - relocate( event = prc.xehActiveTheme ); + relocate( prc.xehActiveTheme ); } /** - * Activate a theme + * Activate a theme for the site */ function activate( event, rc, prc ){ // Activate the theme @@ -107,7 +107,7 @@ component extends="baseHandler" { function rebuildRegistry( event, rc, prc ){ variables.themeService.buildThemeRegistry(); variables.cbMessagebox.info( "Themes re-scanned and registered!" ); - relocate( event = prc.xehThemes, queryString = "##themesPane" ); + relocate( prc.xehThemes ); } /** @@ -117,11 +117,9 @@ component extends="baseHandler" { if ( variables.themeService.removeTheme( rc.themeName ) ) { variables.cbMessagebox.info( "Theme Removed Forever!" ); } else { - variables.cbMessagebox.error( - "Error removing theme, please check your logs for more information!" - ); + variables.cbMessagebox.error( "Error removing theme, please check your logs for more information!" ); } - relocate( event = prc.xehThemes, queryString = "##themesPane" ); + relocate( prc.xehThemes ); } } From a3b954eb8a8390cedc2a21658063829d33d5c54e Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 2 Dec 2021 17:31:07 -0600 Subject: [PATCH 012/100] CONTENTBOX-1351 #resolve Resources folder that contain apidocs + seeders + migrations is not updateable --- box-site.json | 8 +- box.json | 18 +- .../2020_08_24_150933_v5Upgrade.cfc | 670 ++++++++++-------- .../contentbox/seeders}/BaseSeeder.cfc | 367 +++++----- .../contentbox/seeders}/SeedMSSQL.cfc | 2 +- .../contentbox/seeders}/SeedMySQL.cfc | 2 +- .../contentbox/seeders}/SeedPostgreSQL.cfc | 2 +- .../contentbox/seeders}/mockdata/authors.json | 0 .../seeders}/mockdata/categories.json | 0 .../seeders}/mockdata/comments.json | 0 .../contentbox/seeders}/mockdata/content.json | 0 .../seeders}/mockdata/contentVersions.json | 0 .../contentbox/seeders}/mockdata/entries.json | 0 .../seeders}/mockdata/loginAttempts.json | 0 .../contentbox/seeders}/mockdata/pages.json | 0 .../seeders}/mockdata/permissions.json | 0 .../seeders}/mockdata/rolePermissions.json | 0 .../contentbox/seeders}/mockdata/roles.json | 0 .../seeders}/mockdata/securityRules.json | 0 .../seeders}/mockdata/settings.json | 0 .../contentbox/seeders}/mockdata/sites.json | 0 .../contentbox/seeders}/mockdata/stats.json | 0 .../seeders}/mockdata/subscribers.json | 0 .../seeders}/mockdata/subscriptions.json | 0 24 files changed, 584 insertions(+), 485 deletions(-) rename {resources/database => modules/contentbox}/migrations/2020_08_24_150933_v5Upgrade.cfc (57%) rename {resources/seeder => modules/contentbox/seeders}/BaseSeeder.cfc (62%) rename {resources/seeder => modules/contentbox/seeders}/SeedMSSQL.cfc (91%) rename {resources/seeder => modules/contentbox/seeders}/SeedMySQL.cfc (91%) rename {resources/seeder => modules/contentbox/seeders}/SeedPostgreSQL.cfc (91%) rename {resources/seeder => modules/contentbox/seeders}/mockdata/authors.json (100%) rename {resources/seeder => modules/contentbox/seeders}/mockdata/categories.json (100%) rename {resources/seeder => modules/contentbox/seeders}/mockdata/comments.json (100%) rename {resources/seeder => modules/contentbox/seeders}/mockdata/content.json (100%) rename {resources/seeder => modules/contentbox/seeders}/mockdata/contentVersions.json (100%) rename {resources/seeder => modules/contentbox/seeders}/mockdata/entries.json (100%) rename {resources/seeder => modules/contentbox/seeders}/mockdata/loginAttempts.json (100%) rename {resources/seeder => modules/contentbox/seeders}/mockdata/pages.json (100%) rename {resources/seeder => modules/contentbox/seeders}/mockdata/permissions.json (100%) rename {resources/seeder => modules/contentbox/seeders}/mockdata/rolePermissions.json (100%) rename {resources/seeder => modules/contentbox/seeders}/mockdata/roles.json (100%) rename {resources/seeder => modules/contentbox/seeders}/mockdata/securityRules.json (100%) rename {resources/seeder => modules/contentbox/seeders}/mockdata/settings.json (100%) rename {resources/seeder => modules/contentbox/seeders}/mockdata/sites.json (100%) rename {resources/seeder => modules/contentbox/seeders}/mockdata/stats.json (100%) rename {resources/seeder => modules/contentbox/seeders}/mockdata/subscribers.json (100%) rename {resources/seeder => modules/contentbox/seeders}/mockdata/subscriptions.json (100%) diff --git a/box-site.json b/box-site.json index a04379c059..cea197dd07 100644 --- a/box-site.json +++ b/box-site.json @@ -35,6 +35,7 @@ }, "devDependencies":{ "testbox":"*", + "cbdebugger":"^3.0.0", "commandbox-cfformat":"*", "commandbox-docbox":"*" }, @@ -53,5 +54,10 @@ "password":"${DB_PASSWORD}" }, "defaultGrammar":"AutoDiscover@qb" - } + }, + "scripts" : { + "contentbox:migrate" : "migrate up migrationsDirectory=modules/contentbox/migrations", + "contentbox:migrate:up" : "run-script contentbox:migrate", + "contentbox:migrate:down" : "migrate down migrationsDirectory=modules/contentbox/migrations" + } } \ No newline at end of file diff --git a/box.json b/box.json index 8c6e4f851a..cc189beefc 100644 --- a/box.json +++ b/box.json @@ -48,12 +48,12 @@ "build:allDocs":"task run taskFile=build/BuildDocs.cfc :version=`package show version`", "build:apidocs":"task run taskFile=build/BuildDocs.cfc target=apiDocs :version=`package show version`", "build:swagger":"task run taskFile=build/BuildDocs.cfc target=swagger :version=`package show version`", - "dbseed:mysql":"task run resources/seeder/MSSQL.cfc", - "dbseed:mssal":"task run resources/seeder/SeedMySQL.cfc", - "dbseed:postgres":"task run resources/seeder/SeedPostgreSQL.cfc", - "format":"cfformat run modules/**/*.cfc,tests/specs/**/*.cfc --overwrite", - "format:watch":"cfformat watch modules/**/*.cfc,tests/specs/**/*.cfc ./.cfformat.json", - "format:check":"cfformat check modules/**/*.cfc,tests/specs/**/*.cfc", + "dbseed:mysql":"task run contentbox/modules/seeders/MSSQL.cfc", + "dbseed:mssal":"task run contentbox/modules/seeders/SeedMySQL.cfc", + "dbseed:postgres":"task run contentbox/modules/seeders/SeedPostgreSQL.cfc", + "format":"cfformat run config,modules/**/*.cfc,tests/specs/**/*.cfc --overwrite", + "format:watch":"cfformat watch config,modules/**/*.cfc,tests/specs/**/*.cfc ./.cfformat.json", + "format:check":"cfformat check config,modules/**/*.cfc,tests/specs/**/*.cfc", "start:lucee":"server start serverConfigFile='server-lucee@5.json' --force --debug", "start:2016":"server start serverConfigFile='server-adobe@2016.json' --force --debug", "start:2018":"server start serverConfigFile='server-adobe@2018.json' --force --debug", @@ -64,7 +64,11 @@ "log:2021":"server log serverConfigFile=server-adobe@2021.json --follow", "cfpm":"echo '\".engines/acf2021/WEB-INF/cfusion/bin/cfpm.sh\"' | run", "cfpm:install":"echo '\".engines/acf2021/WEB-INF/cfusion/bin/cfpm.sh\" install ${1}' | run", - "install:2021":"run-script cfpm:install zip,orm,mysql,postgresql,sqlserver,document,feed" + "install:2021":"run-script cfpm:install zip,orm,mysql,postgresql,sqlserver,document,feed", + "contentbox:migrate:create" : "migrate create name=${1} migrationsDirectory=modules/contentbox/migrations", + "contentbox:migrate" : "migrate up migrationsDirectory=modules/contentbox/migrations", + "contentbox:migrate:up" : "run-script contentbox:migrate", + "contentbox:migrate:down" : "migrate down migrationsDirectory=modules/contentbox/migrations" }, "cfmigrations":{ "schema":"${DB_DATABASE}", diff --git a/resources/database/migrations/2020_08_24_150933_v5Upgrade.cfc b/modules/contentbox/migrations/2020_08_24_150933_v5Upgrade.cfc similarity index 57% rename from resources/database/migrations/2020_08_24_150933_v5Upgrade.cfc rename to modules/contentbox/migrations/2020_08_24_150933_v5Upgrade.cfc index a72b17c78e..d4de2cf18f 100755 --- a/resources/database/migrations/2020_08_24_150933_v5Upgrade.cfc +++ b/modules/contentbox/migrations/2020_08_24_150933_v5Upgrade.cfc @@ -26,12 +26,12 @@ component { type = "columns", table = arguments.targetTable ); - if( + if ( qSettingColumns.filter( ( thisRow ) => { // systemOutput( thisRow, true ); return thisRow.column_name == targetColumn } ).recordCount > 0 - ){ + ) { return true; } return false; @@ -44,20 +44,23 @@ component { function up( schema, query ){ // If you are on version 4 continue, else skip // If cb_setting doesn't have a FK_siteID then it's 4 - if( !isContentBox4() ){ - systemOutput( "- Skipping ContentBox v4 -> v5 Migration as we have detected you are already on the v5 schema", true ); + if ( !isContentBox4() ) { + systemOutput( + "- Skipping ContentBox v4 -> v5 Migration as we have detected you are already on the v5 schema", + true + ); return; } // Get the db schema name, we might need it when dropping keys variables.dbSchema = migrationService.getSchema(); - variables.uuidLib = createobject( "java", "java.util.UUID" ); + variables.uuidLib = createObject( "java", "java.util.UUID" ); - scopeGrammarUDFs( argumentCollection=arguments ); + scopeGrammarUDFs( argumentCollection = arguments ); - try{ - migrateIdentifiersToGUIDs( argumentCollection=arguments ); - } catch( any e ){ + try { + migrateIdentifiersToGUIDs( argumentCollection = arguments ); + } catch ( any e ) { systemOutput( e.message, true ); systemOutput( e.stacktrace, true ); transactionRollback(); @@ -81,7 +84,7 @@ component { // Update Slugs/Titles to 1000 characters dropIndexesForTableColumn( "cb_content", "title" ); dropIndexesForTableColumn( "cb_content", "slug" ); - schema.alter( "cb_content", function( table ) { + schema.alter( "cb_content", function( table ){ table.modifyColumn( "title", table.string( "title", 500 ) ); table.modifyColumn( "slug", table.string( "slug", 500 ) ); table.modifyColumn( "featuredImage", table.string( "featuredImage", 500 ) ); @@ -92,13 +95,12 @@ component { table.index( [ "title", "isPublished" ], "idx_search" ); } ); // Create Category isPublic with indexes - if( !hasColumn( "cb_category", "isPublic" ) ){ + if ( !hasColumn( "cb_category", "isPublic" ) ) { schema.alter( "cb_category", ( table ) => { table.addColumn( table.boolean( "isPublic" ).default( true ) ); table.index( [ "isPublic" ], "idx_isPublic" ); } ); } - } catch ( any e ) { transactionRollback(); systemOutput( e.stacktrace, true ); @@ -108,7 +110,7 @@ component { } function down( schema, query ){ - if( !isContentBox4() ){ + if ( !isContentBox4() ) { return; } @@ -153,8 +155,7 @@ component { private function createSiteRelationships( schema, query, siteId ){ variables.siteTables.each( ( thisTable ) => { - - if( !hasColumn( thisTable, "FK_siteID" ) ){ + if ( !hasColumn( thisTable, "FK_siteID" ) ) { // Add site id relationship schema.alter( thisTable, ( table ) => { table.addColumn( table.string( "FK_siteID", 36 ).nullable() ); @@ -172,7 +173,7 @@ component { } // Seed with site id - if( thisTable != "cb_setting" ){ + if ( thisTable != "cb_setting" ) { query .newQuery() .from( thisTable ) @@ -181,7 +182,6 @@ component { systemOutput( "√ - Populated '#thisTable#' with default site data", true ); } - } ); } @@ -239,10 +239,7 @@ component { .isEmpty(); if ( !isNewPermission ) { - systemOutput( - "√ - #thisPermission.name# permission already in database skipping", - true - ); + systemOutput( "√ - #thisPermission.name# permission already in database skipping", true ); return; } @@ -293,13 +290,15 @@ component { } ); systemOutput( "√ - Site table created", true ); - schema.alter( - "cb_setting", - function( table ){ - table.addColumn( table.string( "FK_siteID", 36 ).nullable() ); - table.addConstraint( table.string( "FK_siteID", 36 ).references( "siteID" ).onTable( "cb_site" ) ) - } - ); + schema.alter( "cb_setting", function( table ){ + table.addColumn( table.string( "FK_siteID", 36 ).nullable() ); + table.addConstraint( + table + .string( "FK_siteID", 36 ) + .references( "siteID" ) + .onTable( "cb_site" ) + ) + } ); var allSettings = arguments.query .newQuery() @@ -321,7 +320,7 @@ component { "createdDate" : today, "modifiedDate" : today, "isDeleted" : 0, - "isActive" : 1, + "isActive" : 1, "name" : allSettings.cb_site_name, "slug" : "default", "homepage" : allSettings.cb_site_homepage, @@ -387,23 +386,22 @@ component { * Migrate numeric IDs to Guids */ function migrateIdentifiersToGUIDs( schema, query ){ - systemOutput( "> Starting to process migration of identifiers to uuid's...", true ); // Create new master table identifiers with a temp name so we can migrate - variables.idTables.keyArray().each( function( tableName ){ - var pkColumn = idTables[ tableName ]; - schema.alter( tableName, function( table ){ - table.addColumn( table.string( "id", 36 ).default( "#guidFn#" ) ); + variables.idTables + .keyArray() + .each( function( tableName ){ + var pkColumn = idTables[ tableName ]; + schema.alter( tableName, function( table ){ + table.addColumn( table.string( "id", 36 ).default( "#guidFn#" ) ); + } ); + query + .newQuery() + .from( tableName ) + .update( { "id" : query.raw( "#guidFn#" ) } ); + systemOutput( " √ - #tablename# new uuid pk created and populated", true ); } ); - query - .newQuery() - .from( tableName ) - .update( { - "id" : query.raw( "#guidFn#" ) - }); - systemOutput( " √ - #tablename# new uuid pk created and populated", true ); - } ); systemOutput( "√√ - Finalized adding new primary keys to all tables", true ); systemOutput( "", true ); @@ -411,20 +409,22 @@ component { systemOutput( "", true ); // Create child table foreign and future PKs - childTables.keyArray().each( function( tableName ){ - systemOutput( "> Starting to process child table: #tableName#", true ); + childTables + .keyArray() + .each( function( tableName ){ + systemOutput( "> Starting to process child table: #tableName#", true ); - var pkColumn = childTables[ tableName ].key; - dropForeignKeysAndConstraints( tableName, pkColumn ); - systemOutput( " √ - (#tableName#) Dropped foreign key and constraints", true ); + var pkColumn = childTables[ tableName ].key; + dropForeignKeysAndConstraints( tableName, pkColumn ); + systemOutput( " √ - (#tableName#) Dropped foreign key and constraints", true ); - var tmpColumn = "tmp_" & pkColumn; - schema.alter( tableName, function( table ){ - table.addColumn( table.string( tmpColumn, 36 ).nullable() ); + var tmpColumn = "tmp_" & pkColumn; + schema.alter( tableName, function( table ){ + table.addColumn( table.string( tmpColumn, 36 ).nullable() ); + } ); + populateChildFKValues( tmpColumn, tableName ); + systemOutput( " √ - (#tableName#) rekeyed to new parent uuid", true ); } ); - populateChildFKValues( tmpColumn, tableName ); - systemOutput( " √ - (#tableName#) rekeyed to new parent uuid", true ); - } ); systemOutput( "√√ - Finalized rekeying all child tables", true ); systemOutput( "", true ); @@ -432,48 +432,55 @@ component { systemOutput( "", true ); // Update all foreign keys - FKMap.keyArray().each( function( tableName ){ - - systemOutput( "> Starting to process (#arguments.tableName#) foreign keys...", true ); - - var FKeys = FKMap[ arguments.tableName ]; - FKeys.each( function( keyConfig ){ - - dropForeignKeysAndConstraints( tableName, arguments.keyConfig.column ); - systemOutput( " √ - (#tableName#) Dropped foreign key and constraints (#arguments.keyConfig.column#)", true ); + FKMap + .keyArray() + .each( function( tableName ){ + systemOutput( "> Starting to process (#arguments.tableName#) foreign keys...", true ); + + var FKeys = FKMap[ arguments.tableName ]; + FKeys.each( function( keyConfig ){ + dropForeignKeysAndConstraints( tableName, arguments.keyConfig.column ); + systemOutput( + " √ - (#tableName#) Dropped foreign key and constraints (#arguments.keyConfig.column#)", + true + ); - var tmpColumn = "tmp_" & arguments.keyConfig.column; - schema.alter( tableName, function( table ){ - table.addColumn( table.string( tmpColumn, 36 ).nullable() ); - } ); - populateFKValues( tmpColumn, tableName, arguments.keyConfig ); - schema.alter( tableName, function( table ){ - table.dropColumn( keyConfig.column ); - table.renameColumn( tmpColumn, table.string( keyConfig.column, 36 ).nullable() ); + var tmpColumn = "tmp_" & arguments.keyConfig.column; + schema.alter( tableName, function( table ){ + table.addColumn( table.string( tmpColumn, 36 ).nullable() ); + } ); + populateFKValues( tmpColumn, tableName, arguments.keyConfig ); + schema.alter( tableName, function( table ){ + table.dropColumn( keyConfig.column ); + table.renameColumn( tmpColumn, table.string( keyConfig.column, 36 ).nullable() ); + } ); + systemOutput( + " √ - (#tableName#) foreign key (#arguments.keyConfig.column#) rekeyed as a uuid into (#tmpColumn#)", + true + ); } ); - systemOutput( " √ - (#tableName#) foreign key (#arguments.keyConfig.column#) rekeyed as a uuid into (#tmpColumn#)", true ); } ); - } ); - systemOutput( "√√ - Finalized rekeying all foreign keys to new uuid's", true ); systemOutput( "", true ); systemOutput( "> Beginning to drop original primary keys and rekeying tables with new uuids...", true ); systemOutput( "", true ); // Change primary keys over on master tables - idTables.keyArray().each( function( tableName ){ - systemOutput( "> Starting to process (#arguments.tableName#)...", true ); - var pkColumn = idTables[ tableName ]; - schema.alter( tableName, function( table ){ - queryExecute( pkDropSQL( tableName, pkColumn ) ); - table.dropColumn( pkColumn ); - // Rename it back to what it was called - table.renameColumn( "id", table.string( pkColumn, 36 ).unique() ) - table.addConstraint( table.primaryKey( pkColumn ) ); + idTables + .keyArray() + .each( function( tableName ){ + systemOutput( "> Starting to process (#arguments.tableName#)...", true ); + var pkColumn = idTables[ tableName ]; + schema.alter( tableName, function( table ){ + queryExecute( pkDropSQL( tableName, pkColumn ) ); + table.dropColumn( pkColumn ); + // Rename it back to what it was called + table.renameColumn( "id", table.string( pkColumn, 36 ).unique() ) + table.addConstraint( table.primaryKey( pkColumn ) ); + } ); + systemOutput( " √ (#arguments.tableName#) new uuid key set and finalized!", true ); } ); - systemOutput( " √ (#arguments.tableName#) new uuid key set and finalized!", true ); - } ); systemOutput( "√√ - Finalized rekeying all tables with new identifiers and old identifiers dropped", true ); systemOutput( "", true ); @@ -481,17 +488,24 @@ component { systemOutput( "", true ); // Now restore the foreign key constraints - FKMap.keyArray().each( function( tableName ){ - systemOutput( "> Starting to process (#arguments.tableName#)...", true ); - var FKeys = FKMap[ tableName ]; - FKeys.each( function( keyConfig ){ - var tmpColumn = "tmp_" & keyConfig.column; - schema.alter( tableName, function( table ){ - table.addConstraint( table.string( keyConfig.column, 36 ).references( keyConfig.reference.column ).onTable( keyConfig.reference.table ) ); + FKMap + .keyArray() + .each( function( tableName ){ + systemOutput( "> Starting to process (#arguments.tableName#)...", true ); + var FKeys = FKMap[ tableName ]; + FKeys.each( function( keyConfig ){ + var tmpColumn = "tmp_" & keyConfig.column; + schema.alter( tableName, function( table ){ + table.addConstraint( + table + .string( keyConfig.column, 36 ) + .references( keyConfig.reference.column ) + .onTable( keyConfig.reference.table ) + ); + } ); } ); + systemOutput( " √ (#arguments.tableName#) foreign key constraints finalized!", true ); } ); - systemOutput( " √ (#arguments.tableName#) foreign key constraints finalized!", true ); - } ); systemOutput( "√√ - All foreign key constraints finalized", true ); systemOutput( "", true ); @@ -499,27 +513,34 @@ component { systemOutput( "", true ); // Change primary keys over on child tables - childTables.keyArray().each( function( tableName ){ - systemOutput( "> Processing child table (#arguments.tableName#)...", true ); - var pkColumn = childTables[ tableName ].key; - var tmpColumn = "tmp_" & pkColumn; - schema.alter( tableName, function( table ){ - queryExecute( pkDropSQL( tableName, pkColumn ) ); - // ensure it is a not null field before we make it PK - table.modifyColumn( tmpColumn, table.string( tmpColumn, 36 ) ); - } ); - schema.alter( tableName, function( table ){ - table.addConstraint( table.primaryKey( tmpColumn ) ); - } ); - schema.alter( tableName, function( table ){ - table.dropColumn( pkColumn ); - table.renameColumn( tmpColumn, table.string( pkColumn, 36 ) ); - } ); - schema.alter( tableName, function( table ){ - table.addConstraint( table.string( pkColumn, 36 ).references( pkColumn ).onTable( childTables[ tableName ].parent ) ); + childTables + .keyArray() + .each( function( tableName ){ + systemOutput( "> Processing child table (#arguments.tableName#)...", true ); + var pkColumn = childTables[ tableName ].key; + var tmpColumn = "tmp_" & pkColumn; + schema.alter( tableName, function( table ){ + queryExecute( pkDropSQL( tableName, pkColumn ) ); + // ensure it is a not null field before we make it PK + table.modifyColumn( tmpColumn, table.string( tmpColumn, 36 ) ); + } ); + schema.alter( tableName, function( table ){ + table.addConstraint( table.primaryKey( tmpColumn ) ); + } ); + schema.alter( tableName, function( table ){ + table.dropColumn( pkColumn ); + table.renameColumn( tmpColumn, table.string( pkColumn, 36 ) ); + } ); + schema.alter( tableName, function( table ){ + table.addConstraint( + table + .string( pkColumn, 36 ) + .references( pkColumn ) + .onTable( childTables[ tableName ].parent ) + ); + } ); + systemOutput( " √ (#arguments.tableName#) finalized!", true ); } ); - systemOutput( " √ (#arguments.tableName#) finalized!", true ); - } ); systemOutput( "√√√ - All tables migrated from incremental identifiers to GUIDs", true ); systemOutput( "", true ); @@ -530,262 +551,288 @@ component { * Utility functions per database */ function scopeGrammarUDFs( query, schema ){ - variables.idTables = { - "cb_author" : "authorID", - "cb_category" : "categoryID", - "cb_comment" : "commentID", - "cb_content" : "contentID", - "cb_contentVersion" : "contentVersionID", - "cb_customfield" : "customFieldID", - "cb_loginAttempts" : "loginAttemptsID", - "cb_menu" : "menuID", - "cb_menuItem" : "menuItemID", - "cb_module" : "moduleID", - "cb_permission" : "permissionID", + "cb_author" : "authorID", + "cb_category" : "categoryID", + "cb_comment" : "commentID", + "cb_content" : "contentID", + "cb_contentVersion" : "contentVersionID", + "cb_customfield" : "customFieldID", + "cb_loginAttempts" : "loginAttemptsID", + "cb_menu" : "menuID", + "cb_menuItem" : "menuItemID", + "cb_module" : "moduleID", + "cb_permission" : "permissionID", "cb_permissionGroup" : "permissionGroupID", - "cb_role" : "roleID", - "cb_securityRule" : "ruleID", - "cb_setting" : "settingID", - "cb_stats" : "statsID", - "cb_subscribers" : "subscriberID", - "cb_subscriptions" : "subscriptionID" + "cb_role" : "roleID", + "cb_securityRule" : "ruleID", + "cb_setting" : "settingID", + "cb_stats" : "statsID", + "cb_subscribers" : "subscriberID", + "cb_subscriptions" : "subscriptionID" }; variables.childTables = { - "cb_entry" : { "parent" : "cb_content", "key" : "contentID" }, - "cb_page" : { "parent" : "cb_content", "key" : "contentID" }, - "cb_contentStore" : {"parent" : "cb_content", "key" : "contentID"}, - "cb_commentSubscriptions" : { "parent": "cb_subscriptions", "key" : "subscriptionID"} + "cb_entry" : { "parent" : "cb_content", "key" : "contentID" }, + "cb_page" : { "parent" : "cb_content", "key" : "contentID" }, + "cb_contentStore" : { "parent" : "cb_content", "key" : "contentID" }, + "cb_commentSubscriptions" : { "parent" : "cb_subscriptions", "key" : "subscriptionID" } }; variables.FKMap = { "cb_authorPermissionGroups" : [ { - "column" : "FK_permissionGroupID", - "reference" : { "table" : "cb_permissionGroup", "column" : "permissionGroupID" } + "column" : "FK_permissionGroupID", + "reference" : { + "table" : "cb_permissionGroup", + "column" : "permissionGroupID" + } }, { - "column" : "FK_authorID", + "column" : "FK_authorID", "reference" : { "table" : "cb_author", "column" : "authorID" } } ], "cb_authorPermissions" : [ { - "column" : "FK_permissionID", + "column" : "FK_permissionID", "reference" : { "table" : "cb_permission", "column" : "permissionID" } }, { - "column" : "FK_authorID", + "column" : "FK_authorID", "reference" : { "table" : "cb_author", "column" : "authorID" } } ], "cb_rolePermissions" : [ { - "column" : "FK_permissionID", + "column" : "FK_permissionID", "reference" : { "table" : "cb_permission", "column" : "permissionID" } }, { - "column" : "FK_roleID", + "column" : "FK_roleID", "reference" : { "table" : "cb_role", "column" : "roleID" } } ], "cb_relatedContent" : [ { - "column" : "FK_contentID", + "column" : "FK_contentID", "reference" : { "table" : "cb_content", "column" : "contentID" } }, { - "column" : "FK_relatedContentID", + "column" : "FK_relatedContentID", "reference" : { "table" : "cb_content", "column" : "contentID" } } ], "cb_groupPermissions" : [ { - "column" : "FK_permissionGroupID", - "reference" : { "table" : "cb_permissionGroup", "column" : "permissionGroupID" } + "column" : "FK_permissionGroupID", + "reference" : { + "table" : "cb_permissionGroup", + "column" : "permissionGroupID" + } }, { - "column" : "FK_permissionID", + "column" : "FK_permissionID", "reference" : { "table" : "cb_permission", "column" : "permissionID" } } ], "cb_contentCategories" : [ { - "column" : "FK_contentID", + "column" : "FK_contentID", "reference" : { "table" : "cb_content", "column" : "contentID" } }, { - "column" : "FK_categoryID", + "column" : "FK_categoryID", "reference" : { "table" : "cb_category", "column" : "categoryID" } } ], "cb_commentSubscriptions" : [ { - "column" : "FK_contentID", + "column" : "FK_contentID", "reference" : { "table" : "cb_content", "column" : "contentID" } } ], "cb_author" : [ { - "column" : "FK_roleID", + "column" : "FK_roleID", "reference" : { "table" : "cb_role", "column" : "roleID" } } ], "cb_menuItem" : [ { - "column" : "FK_menuID", + "column" : "FK_menuID", "reference" : { "table" : "cb_menu", "column" : "menuID" } }, { - "column" : "FK_parentID", + "column" : "FK_parentID", "reference" : { "table" : "cb_menuItem", "column" : "menuItemID" } } ], "cb_customField" : [ { - "column" : "FK_contentID", + "column" : "FK_contentID", "reference" : { "table" : "cb_content", "column" : "contentID" } } ], "cb_stats" : [ { - "column" : "FK_contentID", + "column" : "FK_contentID", "reference" : { "table" : "cb_content", "column" : "contentID" } } ], "cb_comment" : [ { - "column" : "FK_contentID", + "column" : "FK_contentID", "reference" : { "table" : "cb_content", "column" : "contentID" } } ], "cb_content" : [ { - "column" : "FK_authorID", + "column" : "FK_authorID", "reference" : { "table" : "cb_author", "column" : "authorID" } }, { - "column" : "FK_parentID", + "column" : "FK_parentID", "reference" : { "table" : "cb_content", "column" : "contentID" } } ], "cb_contentVersion" : [ { - "column" : "FK_authorID", + "column" : "FK_authorID", "reference" : { "table" : "cb_author", "column" : "authorID" } }, { - "column" : "FK_contentID", + "column" : "FK_contentID", "reference" : { "table" : "cb_content", "column" : "contentID" } } ], "cb_subscriptions" : [ { - "column" : "FK_subscriberID", + "column" : "FK_subscriberID", "reference" : { "table" : "cb_subscribers", "column" : "subscriberID" } } ] }; var grammar = query.getGrammar(); - if( isInstanceOf( grammar, "AutoDiscover" ) ){ + if ( isInstanceOf( grammar, "AutoDiscover" ) ) { grammar = grammar.autoDiscoverGrammar(); } - switch( listLast( getMetadata( grammar ).name, "." ) ){ - case "MySQLGrammar":{ - variables.guidFn = 'UUID()'; + switch ( listLast( getMetadata( grammar ).name, "." ) ) { + case "MySQLGrammar": { + variables.guidFn = "UUID()"; variables.populateFKValues = function( tmpColumn, tableName, keyConfig ){ - queryExecute(" + queryExecute( + " UPDATE #arguments.tableName# as target JOIN #arguments.keyConfig.reference.table# as ref ON target.#arguments.keyConfig.column# = ref.#arguments.keyConfig.reference.column# SET target.#arguments.tmpColumn# = ref.id - "); + " + ); }; variables.populateChildFKValues = function( tmpColumn, tableName ){ - queryExecute(" + queryExecute( + " UPDATE #arguments.tableName# SET #arguments.tmpColumn# = ( SELECT id from #childTables[ arguments.tableName ].parent# WHERE #childTables[ arguments.tableName ].parent#.#childTables[ arguments.tableName ].key# = #arguments.tableName#.#childTables[ arguments.tableName ].key# ) - "); + " + ); }; variables.pkDropSQL = function( tableName, pkColumn ){ return "ALTER TABLE #arguments.tableName# DROP PRIMARY KEY, MODIFY #arguments.pkColumn# int(11)"; } - variables.dropForeignKeysAndConstraints = function( tableName, columnName, dropReferenced=true ){ - + variables.dropForeignKeysAndConstraints = function( tableName, columnName, dropReferenced = true ){ // Drop FKs - query.newQuery().select( [ "CONSTRAINT_NAME" ] ) - .from( "INFORMATION_SCHEMA.KEY_COLUMN_USAGE" ) - .where( "TABLE_NAME", tableName ) - .where( "COLUMN_NAME", columnName ) - .where( "CONSTRAINT_NAME", "!=", "PRIMARY" ) - .where( "TABLE_SCHEMA", variables.dbSchema ) - .whereNotNull( "REFERENCED_TABLE_NAME" ) - .get() - .map( function( row ){ return row.constraint_name; } ) - .each( function( constraintName ){ - queryExecute( "ALTER TABLE #tableName# DROP FOREIGN KEY #constraintName#"); - } ); + query + .newQuery() + .select( [ "CONSTRAINT_NAME" ] ) + .from( "INFORMATION_SCHEMA.KEY_COLUMN_USAGE" ) + .where( "TABLE_NAME", tableName ) + .where( "COLUMN_NAME", columnName ) + .where( "CONSTRAINT_NAME", "!=", "PRIMARY" ) + .where( "TABLE_SCHEMA", variables.dbSchema ) + .whereNotNull( "REFERENCED_TABLE_NAME" ) + .get() + .map( function( row ){ + return row.constraint_name; + } ) + .each( function( constraintName ){ + queryExecute( "ALTER TABLE #tableName# DROP FOREIGN KEY #constraintName#" ); + } ); // Drop Indexes - query.newQuery().select( [ "INDEX_NAME" ] ) - .from( "INFORMATION_SCHEMA.STATISTICS" ) - .where( "TABLE_NAME", tableName ) - .where( "COLUMN_NAME", columnName ) - .where( "INDEX_NAME", "!=", "PRIMARY" ) - .where( "TABLE_SCHEMA", variables.dbSchema ) - .get() - .map( function( row ){ return row.index_name; } ) - .each( function( indexName ){ - schema.alter( tableName, function( table ){ - table.dropConstraint( indexName ); - } ); + query + .newQuery() + .select( [ "INDEX_NAME" ] ) + .from( "INFORMATION_SCHEMA.STATISTICS" ) + .where( "TABLE_NAME", tableName ) + .where( "COLUMN_NAME", columnName ) + .where( "INDEX_NAME", "!=", "PRIMARY" ) + .where( "TABLE_SCHEMA", variables.dbSchema ) + .get() + .map( function( row ){ + return row.index_name; + } ) + .each( function( indexName ){ + schema.alter( tableName, function( table ){ + table.dropConstraint( indexName ); } ); + } ); // Drop any foreign keys which reference this table - if( arguments.dropReferenced && idTables.keyExists( tableName ) ){ - query.newQuery().select( [ "CONSTRAINT_NAME", "TABLE_NAME" ] ) - .from( "INFORMATION_SCHEMA.KEY_COLUMN_USAGE" ) - .where( "REFERENCED_TABLE_NAME", tableName ) - .where( "REFERENCED_COLUMN_NAME", idTables[ tableName ] ) - .where( "CONSTRAINT_NAME", "!=", "PRIMARY" ) - .where( "TABLE_SCHEMA", variables.dbSchema ) - .whereNotNull( "TABLE_NAME" ) - .get() - .map( function( row ){ return { "table" : row.table_name, "constraint" : row.constraint_name }; } ) - .each( function( row ){ - queryExecute( "ALTER TABLE #row.table# DROP FOREIGN KEY #row.constraint#"); - } ); + if ( arguments.dropReferenced && idTables.keyExists( tableName ) ) { + query + .newQuery() + .select( [ "CONSTRAINT_NAME", "TABLE_NAME" ] ) + .from( "INFORMATION_SCHEMA.KEY_COLUMN_USAGE" ) + .where( "REFERENCED_TABLE_NAME", tableName ) + .where( "REFERENCED_COLUMN_NAME", idTables[ tableName ] ) + .where( "CONSTRAINT_NAME", "!=", "PRIMARY" ) + .where( "TABLE_SCHEMA", variables.dbSchema ) + .whereNotNull( "TABLE_NAME" ) + .get() + .map( function( row ){ + return { + "table" : row.table_name, + "constraint" : row.constraint_name + }; + } ) + .each( function( row ){ + queryExecute( "ALTER TABLE #row.table# DROP FOREIGN KEY #row.constraint#" ); + } ); } - }; variables.dropIndexesForTableColumn = function( tableName, columnName ){ - query.newQuery().select( [ "INDEX_NAME" ] ) - .from( "INFORMATION_SCHEMA.STATISTICS" ) - .where( "TABLE_NAME", tableName ) - .where( "COLUMN_NAME", columnName ) - .where( "INDEX_NAME", "!=", "PRIMARY" ) - .where( "TABLE_SCHEMA", variables.dbSchema ) - .get() - .map( function( row ){ return row.index_name; } ) - .each( function( indexName ){ - schema.alter( tableName, function( table ){ - table.dropConstraint( indexName ); - } ); + query + .newQuery() + .select( [ "INDEX_NAME" ] ) + .from( "INFORMATION_SCHEMA.STATISTICS" ) + .where( "TABLE_NAME", tableName ) + .where( "COLUMN_NAME", columnName ) + .where( "INDEX_NAME", "!=", "PRIMARY" ) + .where( "TABLE_SCHEMA", variables.dbSchema ) + .get() + .map( function( row ){ + return row.index_name; + } ) + .each( function( indexName ){ + schema.alter( tableName, function( table ){ + table.dropConstraint( indexName ); } ); + } ); } break; } - case "SqlServerGrammar":{ - variables.guidFn = 'NEWID()'; + case "SqlServerGrammar": { + variables.guidFn = "NEWID()"; variables.pkDropSQL = function( tableName ){ var constraintName = queryExecute( "SELECT name @@ -796,96 +843,151 @@ component { return "ALTER TABLE #tableName# DROP CONSTRAINT #constraintName#"; } variables.populateFKValues = function( tmpColumn, tableName, keyConfig ){ - queryExecute(" + queryExecute( + " UPDATE target SET target.#arguments.tmpColumn# = ref.id FROM #arguments.tableName# as target JOIN #arguments.keyConfig.reference.table# as ref ON target.#arguments.keyConfig.column# = ref.#arguments.keyConfig.reference.column# - "); + " + ); }; variables.populateChildFKValues = function( tmpColumn, tableName ){ - queryExecute(" + queryExecute( + " UPDATE #arguments.tableName# SET #arguments.tmpColumn# = ( SELECT id FROM #childTables[ arguments.tableName ].parent# WHERE #childTables[ arguments.tableName ].parent#.#childTables[ arguments.tableName ].key# = #arguments.tableName#.#childTables[ arguments.tableName ].key# ) - "); + " + ); }; - variables.dropForeignKeysAndConstraints = function( tableName, columnName, dropReferenced=true ){ - - query.newQuery().select( [ "sys.foreign_keys.name" ] ) - .from( "sys.foreign_keys" ) - .join( "sys.foreign_key_columns", "sys.foreign_key_columns.constraint_object_id", "sys.foreign_keys.OBJECT_ID" ) - .join( "sys.tables", "sys.tables.OBJECT_ID", "sys.foreign_keys.referenced_object_id" ) - .whereRaw( "OBJECT_NAME( sys.foreign_keys.parent_object_id ) = '#tableName#'" ) - .whereRaw( "COL_NAME(sys.foreign_key_columns.parent_object_id,sys.foreign_key_columns.parent_column_id) = '#columnName#'" ) - .get() - .map( function( row ){ return row.name; } ) - .each( function( constraintName ){ - queryExecute( "ALTER TABLE #tableName# DROP CONSTRAINT #constraintName#"); - } ); - - query.newQuery().select( [ "name" ] ) - .from( "sys.indexes" ) - .join( "sys.index_columns", "sys.indexes.index_id", "sys.index_columns.index_id" ) - .where( "sys.indexes.is_hypothetical", 0 ) - .whereRaw( "sys.indexes.object_id = OBJECT_ID( '#tableName#' ) and COL_NAME(sys.index_columns.object_id,sys.index_columns.column_id) = '#columnName#' AND name NOT LIKE 'PK_%'" ) - .get() - .map( function( row ){ return row.name; } ) - .each( function( indexName ){ - queryExecute( listFirst( indexName, "_" ) == 'UQ' ? "ALTER TABLE #tableName# DROP CONSTRAINT #indexName#" : "DROP INDEX IF EXISTS #indexName# on #tableName#"); - } ); + variables.dropForeignKeysAndConstraints = function( tableName, columnName, dropReferenced = true ){ + query + .newQuery() + .select( [ "sys.foreign_keys.name" ] ) + .from( "sys.foreign_keys" ) + .join( + "sys.foreign_key_columns", + "sys.foreign_key_columns.constraint_object_id", + "sys.foreign_keys.OBJECT_ID" + ) + .join( + "sys.tables", + "sys.tables.OBJECT_ID", + "sys.foreign_keys.referenced_object_id" + ) + .whereRaw( "OBJECT_NAME( sys.foreign_keys.parent_object_id ) = '#tableName#'" ) + .whereRaw( + "COL_NAME(sys.foreign_key_columns.parent_object_id,sys.foreign_key_columns.parent_column_id) = '#columnName#'" + ) + .get() + .map( function( row ){ + return row.name; + } ) + .each( function( constraintName ){ + queryExecute( "ALTER TABLE #tableName# DROP CONSTRAINT #constraintName#" ); + } ); + + query + .newQuery() + .select( [ "name" ] ) + .from( "sys.indexes" ) + .join( + "sys.index_columns", + "sys.indexes.index_id", + "sys.index_columns.index_id" + ) + .where( "sys.indexes.is_hypothetical", 0 ) + .whereRaw( + "sys.indexes.object_id = OBJECT_ID( '#tableName#' ) and COL_NAME(sys.index_columns.object_id,sys.index_columns.column_id) = '#columnName#' AND name NOT LIKE 'PK_%'" + ) + .get() + .map( function( row ){ + return row.name; + } ) + .each( function( indexName ){ + queryExecute( + listFirst( indexName, "_" ) == "UQ" ? "ALTER TABLE #tableName# DROP CONSTRAINT #indexName#" : "DROP INDEX IF EXISTS #indexName# on #tableName#" + ); + } ); // Drop any foreign keys which reference this table - if( arguments.dropReferenced && idTables.keyExists( tableName ) ){ - query.newQuery().selectRaw( "sys.foreign_keys.name as constraint_name, OBJECT_NAME( sys.foreign_keys.parent_object_id ) as table_name") - .from( "sys.foreign_keys" ) - .join( "sys.foreign_key_columns", "sys.foreign_key_columns.constraint_object_id", "sys.foreign_keys.OBJECT_ID" ) - .join( "sys.tables", "sys.tables.OBJECT_ID", "sys.foreign_keys.referenced_object_id" ) - .whereRaw( "OBJECT_NAME (sys.foreign_keys.referenced_object_id) = '#tableName#'" ) - .get() - .map( function( row ){ return { "table" : row.table_name, "constraint" : row.constraint_name }; } ) - .each( function( row ){ - queryExecute( "ALTER TABLE #row.table# DROP CONSTRAINT #row.constraint#"); - } ); + if ( arguments.dropReferenced && idTables.keyExists( tableName ) ) { + query + .newQuery() + .selectRaw( + "sys.foreign_keys.name as constraint_name, OBJECT_NAME( sys.foreign_keys.parent_object_id ) as table_name" + ) + .from( "sys.foreign_keys" ) + .join( + "sys.foreign_key_columns", + "sys.foreign_key_columns.constraint_object_id", + "sys.foreign_keys.OBJECT_ID" + ) + .join( + "sys.tables", + "sys.tables.OBJECT_ID", + "sys.foreign_keys.referenced_object_id" + ) + .whereRaw( "OBJECT_NAME (sys.foreign_keys.referenced_object_id) = '#tableName#'" ) + .get() + .map( function( row ){ + return { + "table" : row.table_name, + "constraint" : row.constraint_name + }; + } ) + .each( function( row ){ + queryExecute( "ALTER TABLE #row.table# DROP CONSTRAINT #row.constraint#" ); + } ); } - } variables.dropIndexesForTableColumn = function( tableName, columnName ){ - query.newQuery().select( [ "name" ] ) - .from( "sys.indexes" ) - .join( "sys.index_columns", "sys.indexes.index_id", "sys.index_columns.index_id" ) - .where( "sys.indexes.is_hypothetical", 0 ) - .whereRaw( "sys.indexes.object_id = OBJECT_ID( '#tableName#' ) and COL_NAME(sys.index_columns.object_id,sys.index_columns.column_id) = '#columnName#' AND sys.indexes.type > 2" ) - .get() - .map( function( row ){ return row.name; } ) - .each( function( indexName ){ - // These may be either constraints or indexes, depending. Try both - try{ - queryExecute( "ALTER TABLE #tableName# DROP CONSTRAINT #indexName#" ); - } catch( any e ){ - queryExecute( "DROP INDEX #indexName# on #tableName#" ); - } - } ); + query + .newQuery() + .select( [ "name" ] ) + .from( "sys.indexes" ) + .join( + "sys.index_columns", + "sys.indexes.index_id", + "sys.index_columns.index_id" + ) + .where( "sys.indexes.is_hypothetical", 0 ) + .whereRaw( + "sys.indexes.object_id = OBJECT_ID( '#tableName#' ) and COL_NAME(sys.index_columns.object_id,sys.index_columns.column_id) = '#columnName#' AND sys.indexes.type > 2" + ) + .get() + .map( function( row ){ + return row.name; + } ) + .each( function( indexName ){ + // These may be either constraints or indexes, depending. Try both + try { + queryExecute( "ALTER TABLE #tableName# DROP CONSTRAINT #indexName#" ); + } catch ( any e ) { + queryExecute( "DROP INDEX #indexName# on #tableName#" ); + } + } ); } break; } case "PostgresGrammar": - case "OracleGrammar":{ + case "OracleGrammar": { + throw( "Database Migrations from ContentBox v4 to v5 are not supported for this DBMS platform" ); + } + default: { throw( - "Database Migrations from ContentBox v4 to v5 are not supported for this DBMS platform" + "DBMS Grammatical type could not be determined from the grammar #getMetadata( grammar ).name#. The migration must be aborted." ); } - default:{ - throw( "DBMS Grammatical type could not be determined from the grammar #getMetadata( grammar ).name#. The migration must be aborted." ); - } } } -} \ No newline at end of file +} diff --git a/resources/seeder/BaseSeeder.cfc b/modules/contentbox/seeders/BaseSeeder.cfc similarity index 62% rename from resources/seeder/BaseSeeder.cfc rename to modules/contentbox/seeders/BaseSeeder.cfc index 978c606f95..6a805350e5 100644 --- a/resources/seeder/BaseSeeder.cfc +++ b/modules/contentbox/seeders/BaseSeeder.cfc @@ -1,9 +1,9 @@ -abstract component{ +abstract component { // DI property name="packageService" inject="PackageService"; - property name="JSONService" inject="JSONService"; - property name="qb" inject="provider:QueryBuilder@qb"; + property name="JSONService" inject="JSONService"; + property name="qb" inject="provider:QueryBuilder@qb"; // Site Defaults this.SITE_DEFAULTS = { @@ -41,15 +41,12 @@ abstract component{ function init(){ // Create mockDataCFC mapping: Must be in `modules` folder. - fileSystemUtil.createMapping( - "mockdatacfc", - "#getCWD()#testbox/system/modules/mockdatacfc" - ); + fileSystemUtil.createMapping( "mockdatacfc", "#getCWD()#testbox/system/modules/mockdatacfc" ); // create mock data variables.mockData = new mockdatacfc.models.MockData(); // Bcrypt hash of the word "test" variables.bcryptTest = "$2a$12$FE2J7ZLWaI2rSqejAu/84uLy7qlSufQsDsSE1lNNKyA05GG30gr8C"; - variables.uuidLib = createobject("java", "java.util.UUID"); + variables.uuidLib = createObject( "java", "java.util.UUID" ); return this; } @@ -59,9 +56,7 @@ abstract component{ function onDIComplete(){ variables.cfmigrationsInfo = getCFMigrationsInfo(); - print.cyanLine( - "Please wait, connecting to your database: #variables.cfmigrationsInfo.schema#" - ); + print.cyanLine( "Please wait, connecting to your database: #variables.cfmigrationsInfo.schema#" ); var appSettings = getApplicationSettings(); var dataSources = appSettings.datasources ?: {}; dataSources[ "seeder" ] = variables.cfmigrationsInfo.connectionInfo @@ -92,11 +87,7 @@ abstract component{ } function run(){ - if ( - !confirm( - "This seeder will wipe out your entire data and replace it with mock data, are you sure?" - ) - ) { + if ( !confirm( "This seeder will wipe out your entire data and replace it with mock data, are you sure?" ) ) { print.line().redLine( "Bye Bye!" ); return; } @@ -109,8 +100,7 @@ abstract component{ /******************** PERMISSIONS ********************/ print.line().greenLine( "Generating user permissions..." ); truncate( "cb_permission" ); - var aPerms = deserializeJSON( fileRead( "mockdata/permissions.json" ) ) - .each( ( thisRecord ) => thisRecord[ "permissionID" ] = uuidLib.randomUUID().toString() ); + var aPerms = deserializeJSON( fileRead( "mockdata/permissions.json" ) ).each( ( thisRecord ) => thisRecord[ "permissionID" ] = uuidLib.randomUUID().toString() ); qb.from( "cb_permission" ).insert( aPerms ); print.cyanLine( " ==> (#aPerms.len()#) User Permissions inserted" ); @@ -120,20 +110,20 @@ abstract component{ truncate( "cb_permissionGroup" ); var aPermissionGroups = [ { - "permissionGroupID": uuidLib.randomUUID().toString(), - "createdDate": "2017-06-12 16:01:13", - "modifiedDate": "2017-06-12 20:31:52", - "isDeleted": 0, - "name": "Finance", - "description": "Finance team permissions" + "permissionGroupID" : uuidLib.randomUUID().toString(), + "createdDate" : "2017-06-12 16:01:13", + "modifiedDate" : "2017-06-12 20:31:52", + "isDeleted" : 0, + "name" : "Finance", + "description" : "Finance team permissions" }, { - "permissionGroupID": uuidLib.randomUUID().toString(), - "createdDate": "2017-06-16 13:02:12", - "modifiedDate": "2017-06-16 13:02:12", - "isDeleted": 0, - "name": "Security", - "description": "" + "permissionGroupID" : uuidLib.randomUUID().toString(), + "createdDate" : "2017-06-16 13:02:12", + "modifiedDate" : "2017-06-16 13:02:12", + "isDeleted" : 0, + "name" : "Security", + "description" : "" } ]; qb.from( "cb_permissionGroup" ).insert( aPermissionGroups ); @@ -145,24 +135,24 @@ abstract component{ truncate( "cb_groupPermissions" ); var aGroupPermissions = [ { - "FK_permissionGroupID": aPermissionGroups[1].permissionGroupID, - "FK_permissionID": aPerms[ randRange( 1, aPerms.len() ) ].permissionID + "FK_permissionGroupID" : aPermissionGroups[ 1 ].permissionGroupID, + "FK_permissionID" : aPerms[ randRange( 1, aPerms.len() ) ].permissionID }, { - "FK_permissionGroupID": aPermissionGroups[1].permissionGroupID, - "FK_permissionID": aPerms[ randRange( 1, aPerms.len() ) ].permissionID + "FK_permissionGroupID" : aPermissionGroups[ 1 ].permissionGroupID, + "FK_permissionID" : aPerms[ randRange( 1, aPerms.len() ) ].permissionID }, { - "FK_permissionGroupID": aPermissionGroups[1].permissionGroupID, - "FK_permissionID": aPerms[ randRange( 1, aPerms.len() ) ].permissionID + "FK_permissionGroupID" : aPermissionGroups[ 1 ].permissionGroupID, + "FK_permissionID" : aPerms[ randRange( 1, aPerms.len() ) ].permissionID }, { - "FK_permissionGroupID": aPermissionGroups[2].permissionGroupID, - "FK_permissionID": aPerms[ randRange( 1, aPerms.len() ) ].permissionID + "FK_permissionGroupID" : aPermissionGroups[ 2 ].permissionGroupID, + "FK_permissionID" : aPerms[ randRange( 1, aPerms.len() ) ].permissionID }, { - "FK_permissionGroupID": aPermissionGroups[2].permissionGroupID, - "FK_permissionID": aPerms[ randRange( 1, aPerms.len() ) ].permissionID + "FK_permissionGroupID" : aPermissionGroups[ 2 ].permissionGroupID, + "FK_permissionID" : aPerms[ randRange( 1, aPerms.len() ) ].permissionID } ]; @@ -209,14 +199,14 @@ abstract component{ var aSettings = []; this.SITE_DEFAULTS.each( ( key, value ) => { aSettings.append( { - "settingID" : uuidLib.randomUUID().toString(), - "name" : key, - "value" : value, - "isCore" : 0, - "createdDate": "2020-09-09 17:34:50", - "modifiedDate": "2020-09-09 17:34:50", - "isDeleted" : 0, - "FK_siteID" : thisSite.siteID + "settingID" : uuidLib.randomUUID().toString(), + "name" : key, + "value" : value, + "isCore" : 0, + "createdDate" : "2020-09-09 17:34:50", + "modifiedDate" : "2020-09-09 17:34:50", + "isDeleted" : 0, + "FK_siteID" : thisSite.siteID } ); } ); qb.from( "cb_setting" ).insert( aSettings ); @@ -252,11 +242,11 @@ abstract component{ /******************** AUTHOR PERMISSIONS *********************/ print.line().greenLine( "Generating authors a-la-carte permissions..." ); truncate( "cb_authorPermissions" ); - var testAuthor = aAuthors.filter( (thisAuthor) => thisAuthor.username == "testermajano" )[ 1 ]; + var testAuthor = aAuthors.filter( ( thisAuthor ) => thisAuthor.username == "testermajano" )[ 1 ]; var aAuthorPermissions = []; - for( var x=1; x lte 4; x++ ){ + for ( var x = 1; x lte 4; x++ ) { aAuthorPermissions.append( { - "FK_authorID": testAuthor.authorID, + "FK_authorID" : testAuthor.authorID, "FK_permissionID" : aPerms[ randRange( 1, aPerms.len() ) ].permissionID } ); } @@ -267,19 +257,19 @@ abstract component{ /******************** AUTHOR PERMISSION GROUPS *********************/ print.line().greenLine( "Generating authors permissions groups..." ); truncate( "cb_authorPermissionGroups" ); - var testUser1 = aAuthors.filter( (thisAuthor) => thisAuthor.username == "joejoe" )[ 1 ]; - var testUser2 = aAuthors.filter( (thisAuthor) => thisAuthor.username == "joremorelos@morelos.com" )[ 1 ]; + var testUser1 = aAuthors.filter( ( thisAuthor ) => thisAuthor.username == "joejoe" )[ 1 ]; + var testUser2 = aAuthors.filter( ( thisAuthor ) => thisAuthor.username == "joremorelos@morelos.com" )[ 1 ]; var aAuthorPermissionGroups = [ { - "FK_authorID" : testUser1.authorID, + "FK_authorID" : testUser1.authorID, "FK_permissionGroupID" : aPermissionGroups[ 1 ].permissionGroupID }, { - "FK_authorID" : testUser2.authorID, + "FK_authorID" : testUser2.authorID, "FK_permissionGroupID" : aPermissionGroups[ 1 ].permissionGroupID }, { - "FK_authorID" : testUser2.authorID, + "FK_authorID" : testUser2.authorID, "FK_permissionGroupID" : aPermissionGroups[ 2 ].permissionGroupID } ] @@ -307,17 +297,17 @@ abstract component{ var aCommentSubscriptions = [ { - "subscriptionID": "F6B464C7-7E47-4991-A0B28121EFFB67F5", - "FK_contentID": "0e35bbec-a441-11eb-ab6f-0290cc502141" + "subscriptionID" : "F6B464C7-7E47-4991-A0B28121EFFB67F5", + "FK_contentID" : "0e35bbec-a441-11eb-ab6f-0290cc502141" }, { - "subscriptionID": "F6B464C7-7E47-4991-A0B28121EFFB67F6", - "FK_contentID": "0e35bbec-a441-11eb-ab6f-0290cc502141" + "subscriptionID" : "F6B464C7-7E47-4991-A0B28121EFFB67F6", + "FK_contentID" : "0e35bbec-a441-11eb-ab6f-0290cc502141" }, { - "subscriptionID": "F6B464C7-7E47-4991-A0B28121EFFB67F4", - "FK_contentID": "0e35bbec-a441-11eb-ab6f-0290cc502142" - }, + "subscriptionID" : "F6B464C7-7E47-4991-A0B28121EFFB67F4", + "FK_contentID" : "0e35bbec-a441-11eb-ab6f-0290cc502142" + } ]; qb.from( "cb_commentSubscriptions" ).insert( aCommentSubscriptions ); @@ -329,40 +319,40 @@ abstract component{ var aContentCategories = [ { - "FK_contentID": "0e35bbec-a441-11eb-ab6f-0290cc502114", - "FK_categoryID": 2 + "FK_contentID" : "0e35bbec-a441-11eb-ab6f-0290cc502114", + "FK_categoryID" : 2 }, { - "FK_contentID": "0e35bbec-a441-11eb-ab6f-0290cc502114", - "FK_categoryID": 4 + "FK_contentID" : "0e35bbec-a441-11eb-ab6f-0290cc502114", + "FK_categoryID" : 4 }, { - "FK_contentID": "0e35bbec-a441-11eb-ab6f-0290cc502a64", - "FK_categoryID": "ff80808178fbc7620178fbc7f1180124" + "FK_contentID" : "0e35bbec-a441-11eb-ab6f-0290cc502a64", + "FK_categoryID" : "ff80808178fbc7620178fbc7f1180124" }, { - "FK_contentID": "0e35bbec-a441-11eb-ab6f-0290cc502a64", - "FK_categoryID": "ff80808178fbc7620178fbc7f1180126" + "FK_contentID" : "0e35bbec-a441-11eb-ab6f-0290cc502a64", + "FK_categoryID" : "ff80808178fbc7620178fbc7f1180126" }, { - "FK_contentID": "0e35bbec-a441-11eb-ab6f-0290cc502a87", - "FK_categoryID": "ff80808178fbc7620178fbc7f1180124" + "FK_contentID" : "0e35bbec-a441-11eb-ab6f-0290cc502a87", + "FK_categoryID" : "ff80808178fbc7620178fbc7f1180124" }, { - "FK_contentID": "0e35bbec-a441-11eb-ab6f-0290cc502a87", - "FK_categoryID": "ff80808178fbc7620178fbc7f1180126" + "FK_contentID" : "0e35bbec-a441-11eb-ab6f-0290cc502a87", + "FK_categoryID" : "ff80808178fbc7620178fbc7f1180126" }, { - "FK_contentID": "0e35bbec-a441-11eb-ab6f-0290cc502a88", - "FK_categoryID": "ff80808178fbc7620178fbc7f1180124" + "FK_contentID" : "0e35bbec-a441-11eb-ab6f-0290cc502a88", + "FK_categoryID" : "ff80808178fbc7620178fbc7f1180124" }, { - "FK_contentID": "0e35bbec-a441-11eb-ab6f-0290cc502a88", - "FK_categoryID": "ff80808178fbc7620178fbc7f1180126" + "FK_contentID" : "0e35bbec-a441-11eb-ab6f-0290cc502a88", + "FK_categoryID" : "ff80808178fbc7620178fbc7f1180126" }, { - "FK_contentID": "0e35bbec-a441-11eb-ab6f-0290cc502147", - "FK_categoryID": "ff80808178fbc7620178fbc7f1180125" + "FK_contentID" : "0e35bbec-a441-11eb-ab6f-0290cc502147", + "FK_categoryID" : "ff80808178fbc7620178fbc7f1180125" } ]; @@ -375,54 +365,54 @@ abstract component{ aContentStore = [ { - "contentID": "0e35bbec-a441-11eb-ab6f-0290cc502111", - "description": "My very first content", - "order": 0 + "contentID" : "0e35bbec-a441-11eb-ab6f-0290cc502111", + "description" : "My very first content", + "order" : 0 }, { - "contentID": "0e35bbec-a441-11eb-ab6f-0290cc502114", - "description": "Most greatest news", - "order": 0 + "contentID" : "0e35bbec-a441-11eb-ab6f-0290cc502114", + "description" : "Most greatest news", + "order" : 0 }, { - "contentID": "0e35bbec-a441-11eb-ab6f-0290cc502122", - "description": "", - "order": 0 + "contentID" : "0e35bbec-a441-11eb-ab6f-0290cc502122", + "description" : "", + "order" : 0 }, { - "contentID": "0e35bbec-a441-11eb-ab6f-0290cc502123", - "description": "footer", - "order": 0 + "contentID" : "0e35bbec-a441-11eb-ab6f-0290cc502123", + "description" : "footer", + "order" : 0 }, { - "contentID": "0e35bbec-a441-11eb-ab6f-0290cc502124", - "description": "support options", - "order": 0 + "contentID" : "0e35bbec-a441-11eb-ab6f-0290cc502124", + "description" : "support options", + "order" : 0 }, { - "contentID": "0e35bbec-a441-11eb-ab6f-0290cc502127", - "description": "Test", - "order": 0 + "contentID" : "0e35bbec-a441-11eb-ab6f-0290cc502127", + "description" : "Test", + "order" : 0 }, { - "contentID": "0e35bbec-a441-11eb-ab6f-0290cc502159", - "description": "A small footer", - "order": 0 + "contentID" : "0e35bbec-a441-11eb-ab6f-0290cc502159", + "description" : "A small footer", + "order" : 0 }, { - "contentID": "0e35bbec-a441-11eb-ab6f-0290cc502168", - "description": "test", - "order": 0 + "contentID" : "0e35bbec-a441-11eb-ab6f-0290cc502168", + "description" : "test", + "order" : 0 }, { - "contentID": "0e35bbec-a441-11eb-ab6f-0290cc502169", - "description": "asdf", - "order": 0 + "contentID" : "0e35bbec-a441-11eb-ab6f-0290cc502169", + "description" : "asdf", + "order" : 0 }, { - "contentID": "0e35bbec-a441-11eb-ab6f-0290cc502219", - "description": "", - "order": 0 + "contentID" : "0e35bbec-a441-11eb-ab6f-0290cc502219", + "description" : "", + "order" : 0 } ]; @@ -444,22 +434,22 @@ abstract component{ var aCustomFields = [ { - "customFieldID": "3E0AB238-1783-4DD6-93518F0B67B9B5F3", - "key": "age", - "value": '30', - "FK_contentID": "0e35bbec-a441-11eb-ab6f-0290cc502114", - "createdDate": "2016-05-03 16:23:25", - "modifiedDate": "2016-05-03 16:23:25", - "isDeleted": 0 + "customFieldID" : "3E0AB238-1783-4DD6-93518F0B67B9B5F3", + "key" : "age", + "value" : "30", + "FK_contentID" : "0e35bbec-a441-11eb-ab6f-0290cc502114", + "createdDate" : "2016-05-03 16:23:25", + "modifiedDate" : "2016-05-03 16:23:25", + "isDeleted" : 0 }, { - "customFieldID": "3E0AB238-1783-4DD6-93518F0B67B9B5F4", - "key": "subtitle", - "value": '4', - "FK_contentID": "0e35bbec-a441-11eb-ab6f-0290cc502114", - "createdDate": "2016-05-03 16:23:25", - "modifiedDate": "2016-05-03 16:23:25", - "isDeleted": 0 + "customFieldID" : "3E0AB238-1783-4DD6-93518F0B67B9B5F4", + "key" : "subtitle", + "value" : "4", + "FK_contentID" : "0e35bbec-a441-11eb-ab6f-0290cc502114", + "createdDate" : "2016-05-03 16:23:25", + "modifiedDate" : "2016-05-03 16:23:25", + "isDeleted" : 0 } ]; @@ -483,28 +473,28 @@ abstract component{ var aMenus = [ { - "menuID": "69C9F53E-A13C-4D4C-A39641562E5EAE72", - "title": "Test", - "slug": "test", - "listType": "ul", - "createdDate": "2016-05-04 17:00:14", - "menuClass": "", - "listClass": "", - "modifiedDate": "2016-05-04 17:20:11", - "isDeleted": 0, - "FK_siteId": "ff80808178fbc7620178fbc7e5f400af" + "menuID" : "69C9F53E-A13C-4D4C-A39641562E5EAE72", + "title" : "Test", + "slug" : "test", + "listType" : "ul", + "createdDate" : "2016-05-04 17:00:14", + "menuClass" : "", + "listClass" : "", + "modifiedDate" : "2016-05-04 17:20:11", + "isDeleted" : 0, + "FK_siteId" : "ff80808178fbc7620178fbc7e5f400af" }, { - "menuID": "69C9F53E-A13C-4D4C-A39641562E5EAE73", - "title": "test", - "slug": "test -e123c", - "listType": "ul", - "createdDate": "2016-05-04 17:02:54", - "menuClass": "", - "listClass": "", - "modifiedDate": "2016-05-04 17:02:54", - "isDeleted": 0, - "FK_siteId": "ff80808178fbc7620178fbc7e5f400af" + "menuID" : "69C9F53E-A13C-4D4C-A39641562E5EAE73", + "title" : "test", + "slug" : "test -e123c", + "listType" : "ul", + "createdDate" : "2016-05-04 17:02:54", + "menuClass" : "", + "listClass" : "", + "modifiedDate" : "2016-05-04 17:02:54", + "isDeleted" : 0, + "FK_siteId" : "ff80808178fbc7620178fbc7e5f400af" } ]; @@ -517,46 +507,46 @@ abstract component{ var aMenuItems = [ { - "menuItemID": "2508B7D0-F3B7-4395-BDFBD12BCBB8CE97", - "menuType": "Free", - "title": "", - "label": "test", - "data": "", - "active": 1, - "FK_menuID": "69C9F53E-A13C-4D4C-A39641562E5EAE73", - "FK_parentID": { "value": "", "null": true }, - "mediaPath": { "value": "", "null": true }, - "contentSlug": { "value": "", "null": true }, - "menuSlug": { "value": "", "null": true }, - "url": { "value": "", "null": true }, - "js": { "value": "", "null": true }, - "itemClass": "", - "target": { "value": "", "null": true }, - "urlClass": { "value": "", "null": true }, - "createdDate": "2016-05-04 17:22:08", - "modifiedDate": "2016-05-04 17:22:08", - "isDeleted": 0 + "menuItemID" : "2508B7D0-F3B7-4395-BDFBD12BCBB8CE97", + "menuType" : "Free", + "title" : "", + "label" : "test", + "data" : "", + "active" : 1, + "FK_menuID" : "69C9F53E-A13C-4D4C-A39641562E5EAE73", + "FK_parentID" : { "value" : "", "null" : true }, + "mediaPath" : { "value" : "", "null" : true }, + "contentSlug" : { "value" : "", "null" : true }, + "menuSlug" : { "value" : "", "null" : true }, + "url" : { "value" : "", "null" : true }, + "js" : { "value" : "", "null" : true }, + "itemClass" : "", + "target" : { "value" : "", "null" : true }, + "urlClass" : { "value" : "", "null" : true }, + "createdDate" : "2016-05-04 17:22:08", + "modifiedDate" : "2016-05-04 17:22:08", + "isDeleted" : 0 }, { - "menuItemID": "2508B7D0-F3B7-4395-BDFBD12BCBB8CE98", - "menuType": "URL", - "title": "", - "label": "hello", - "data": "", - "active": 1, - "FK_menuID": "69C9F53E-A13C-4D4C-A39641562E5EAE73", - "FK_parentID": { "value": "", "null": true }, - "mediaPath": { "value": "", "null": true }, - "contentSlug": { "value": "", "null": true }, - "menuSlug": { "value": "", "null": true }, - "url": "http://www.ortussolutions.com", - "js": { "value": "", "null": true }, - "itemClass": "", - "target": "_blank", - "urlClass": "test", - "createdDate": "2016-05-04 17:22:08", - "modifiedDate": "2016-05-04 17:22:08", - "isDeleted": 0 + "menuItemID" : "2508B7D0-F3B7-4395-BDFBD12BCBB8CE98", + "menuType" : "URL", + "title" : "", + "label" : "hello", + "data" : "", + "active" : 1, + "FK_menuID" : "69C9F53E-A13C-4D4C-A39641562E5EAE73", + "FK_parentID" : { "value" : "", "null" : true }, + "mediaPath" : { "value" : "", "null" : true }, + "contentSlug" : { "value" : "", "null" : true }, + "menuSlug" : { "value" : "", "null" : true }, + "url" : "http://www.ortussolutions.com", + "js" : { "value" : "", "null" : true }, + "itemClass" : "", + "target" : "_blank", + "urlClass" : "test", + "createdDate" : "2016-05-04 17:22:08", + "modifiedDate" : "2016-05-04 17:22:08", + "isDeleted" : 0 } ]; @@ -579,8 +569,8 @@ abstract component{ var aRelatedContent = [ { - "FK_contentID": "0e35bbec-a441-11eb-ab6f-0290cc502127", - "FK_relatedContentID": "0e35bbec-a441-11eb-ab6f-0290cc502111" + "FK_contentID" : "0e35bbec-a441-11eb-ab6f-0290cc502127", + "FK_relatedContentID" : "0e35bbec-a441-11eb-ab6f-0290cc502111" } ]; @@ -623,18 +613,15 @@ abstract component{ } finally { keysOn(); } - } function seedLoginAttempts(){ /******************** LOGIN ATTEMPTS *************************/ print.line().greenLine( "Generating login attempts..." ); truncate( "cb_loginAttempts" ); - var aLoginAttempts = deserializeJSON( fileRead( "mockdata/loginAttempts.json" ) ) - .each( ( thisRecord ) => thisRecord[ "loginAttemptsID" ] = uuidLib.randomUUID().toString() ); + var aLoginAttempts = deserializeJSON( fileRead( "mockdata/loginAttempts.json" ) ).each( ( thisRecord ) => thisRecord[ "loginAttemptsID" ] = uuidLib.randomUUID().toString() ); qb.from( "cb_loginAttempts" ).insert( aLoginAttempts ); print.cyanLine( " ==> (#aLoginAttempts.len()#) Login Attempts inserted" ); } - -} \ No newline at end of file +} diff --git a/resources/seeder/SeedMSSQL.cfc b/modules/contentbox/seeders/SeedMSSQL.cfc similarity index 91% rename from resources/seeder/SeedMSSQL.cfc rename to modules/contentbox/seeders/SeedMSSQL.cfc index 11443278e3..59dbf7af8b 100644 --- a/resources/seeder/SeedMSSQL.cfc +++ b/modules/contentbox/seeders/SeedMSSQL.cfc @@ -1,7 +1,7 @@ /** * Task that seeds my database with test data */ -component extends="BaseSeeder"{ +component extends="BaseSeeder" { function init(){ super.init(); diff --git a/resources/seeder/SeedMySQL.cfc b/modules/contentbox/seeders/SeedMySQL.cfc similarity index 91% rename from resources/seeder/SeedMySQL.cfc rename to modules/contentbox/seeders/SeedMySQL.cfc index 11443278e3..59dbf7af8b 100644 --- a/resources/seeder/SeedMySQL.cfc +++ b/modules/contentbox/seeders/SeedMySQL.cfc @@ -1,7 +1,7 @@ /** * Task that seeds my database with test data */ -component extends="BaseSeeder"{ +component extends="BaseSeeder" { function init(){ super.init(); diff --git a/resources/seeder/SeedPostgreSQL.cfc b/modules/contentbox/seeders/SeedPostgreSQL.cfc similarity index 91% rename from resources/seeder/SeedPostgreSQL.cfc rename to modules/contentbox/seeders/SeedPostgreSQL.cfc index 11443278e3..59dbf7af8b 100644 --- a/resources/seeder/SeedPostgreSQL.cfc +++ b/modules/contentbox/seeders/SeedPostgreSQL.cfc @@ -1,7 +1,7 @@ /** * Task that seeds my database with test data */ -component extends="BaseSeeder"{ +component extends="BaseSeeder" { function init(){ super.init(); diff --git a/resources/seeder/mockdata/authors.json b/modules/contentbox/seeders/mockdata/authors.json similarity index 100% rename from resources/seeder/mockdata/authors.json rename to modules/contentbox/seeders/mockdata/authors.json diff --git a/resources/seeder/mockdata/categories.json b/modules/contentbox/seeders/mockdata/categories.json similarity index 100% rename from resources/seeder/mockdata/categories.json rename to modules/contentbox/seeders/mockdata/categories.json diff --git a/resources/seeder/mockdata/comments.json b/modules/contentbox/seeders/mockdata/comments.json similarity index 100% rename from resources/seeder/mockdata/comments.json rename to modules/contentbox/seeders/mockdata/comments.json diff --git a/resources/seeder/mockdata/content.json b/modules/contentbox/seeders/mockdata/content.json similarity index 100% rename from resources/seeder/mockdata/content.json rename to modules/contentbox/seeders/mockdata/content.json diff --git a/resources/seeder/mockdata/contentVersions.json b/modules/contentbox/seeders/mockdata/contentVersions.json similarity index 100% rename from resources/seeder/mockdata/contentVersions.json rename to modules/contentbox/seeders/mockdata/contentVersions.json diff --git a/resources/seeder/mockdata/entries.json b/modules/contentbox/seeders/mockdata/entries.json similarity index 100% rename from resources/seeder/mockdata/entries.json rename to modules/contentbox/seeders/mockdata/entries.json diff --git a/resources/seeder/mockdata/loginAttempts.json b/modules/contentbox/seeders/mockdata/loginAttempts.json similarity index 100% rename from resources/seeder/mockdata/loginAttempts.json rename to modules/contentbox/seeders/mockdata/loginAttempts.json diff --git a/resources/seeder/mockdata/pages.json b/modules/contentbox/seeders/mockdata/pages.json similarity index 100% rename from resources/seeder/mockdata/pages.json rename to modules/contentbox/seeders/mockdata/pages.json diff --git a/resources/seeder/mockdata/permissions.json b/modules/contentbox/seeders/mockdata/permissions.json similarity index 100% rename from resources/seeder/mockdata/permissions.json rename to modules/contentbox/seeders/mockdata/permissions.json diff --git a/resources/seeder/mockdata/rolePermissions.json b/modules/contentbox/seeders/mockdata/rolePermissions.json similarity index 100% rename from resources/seeder/mockdata/rolePermissions.json rename to modules/contentbox/seeders/mockdata/rolePermissions.json diff --git a/resources/seeder/mockdata/roles.json b/modules/contentbox/seeders/mockdata/roles.json similarity index 100% rename from resources/seeder/mockdata/roles.json rename to modules/contentbox/seeders/mockdata/roles.json diff --git a/resources/seeder/mockdata/securityRules.json b/modules/contentbox/seeders/mockdata/securityRules.json similarity index 100% rename from resources/seeder/mockdata/securityRules.json rename to modules/contentbox/seeders/mockdata/securityRules.json diff --git a/resources/seeder/mockdata/settings.json b/modules/contentbox/seeders/mockdata/settings.json similarity index 100% rename from resources/seeder/mockdata/settings.json rename to modules/contentbox/seeders/mockdata/settings.json diff --git a/resources/seeder/mockdata/sites.json b/modules/contentbox/seeders/mockdata/sites.json similarity index 100% rename from resources/seeder/mockdata/sites.json rename to modules/contentbox/seeders/mockdata/sites.json diff --git a/resources/seeder/mockdata/stats.json b/modules/contentbox/seeders/mockdata/stats.json similarity index 100% rename from resources/seeder/mockdata/stats.json rename to modules/contentbox/seeders/mockdata/stats.json diff --git a/resources/seeder/mockdata/subscribers.json b/modules/contentbox/seeders/mockdata/subscribers.json similarity index 100% rename from resources/seeder/mockdata/subscribers.json rename to modules/contentbox/seeders/mockdata/subscribers.json diff --git a/resources/seeder/mockdata/subscriptions.json b/modules/contentbox/seeders/mockdata/subscriptions.json similarity index 100% rename from resources/seeder/mockdata/subscriptions.json rename to modules/contentbox/seeders/mockdata/subscriptions.json From e4d3b2b98a3b0f89065724f0bef389aeefaec539 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 2 Dec 2021 17:48:33 -0600 Subject: [PATCH 013/100] CONTENTBOX-1351 Resources folder that contain apidocs + seeders + migrations is not updateable --- .../contentbox}/apidocs/_schemas/app-invalid.json | 0 .../contentbox}/apidocs/_schemas/app-response.json | 0 .../contentbox}/apidocs/_schemas/app-user.json | 0 .../apidocs/_schemas/app-validation.json | 0 .../apidocs/auth/login/example.200.json | 0 .../apidocs/auth/login/example.401.json | 0 .../apidocs/auth/login/requestBody.json | 0 .../contentbox}/apidocs/auth/login/responses.json | 0 .../apidocs/auth/logout/example.200.json | 0 .../apidocs/auth/logout/example.500.json | 0 .../contentbox}/apidocs/auth/logout/responses.json | 0 .../apidocs/auth/refreshToken/example.200.json | 0 .../apidocs/auth/refreshToken/responses.json | 0 .../apidocs/auth/register/example.200.json | 0 .../apidocs/auth/register/example.400.json | 0 .../apidocs/auth/register/requestBody.json | 0 .../apidocs/auth/register/responses.json | 0 .../apidocs/authors/create/example.200.json | 0 .../apidocs/authors/create/example.400.json | 0 .../apidocs/authors/create/responses.json | 0 .../apidocs/authors/delete/example.200.json | 0 .../apidocs/authors/delete/example.404.json | 0 .../apidocs/authors/delete/example.405.json | 0 .../apidocs/authors/delete/responses.json | 0 .../apidocs/authors/index/example.200.json | 0 .../apidocs/authors/index/responses.json | 0 .../apidocs/authors/show/example.200.json | 0 .../apidocs/authors/show/example.404.json | 0 .../apidocs/authors/show/responses.json | 0 .../apidocs/authors/update/example.200.json | 0 .../apidocs/authors/update/example.404.json | 0 .../apidocs/authors/update/responses.json | 0 .../apidocs/categories/create/example.200.json | 0 .../apidocs/categories/create/example.400.json | 0 .../apidocs/categories/create/responses.json | 0 .../apidocs/categories/delete/example.200.json | 0 .../apidocs/categories/delete/example.404.json | 0 .../apidocs/categories/delete/responses.json | 0 .../apidocs/categories/index/example.200.json | 0 .../apidocs/categories/index/responses.json | 0 .../apidocs/categories/show/example.200.json | 0 .../apidocs/categories/show/example.404.json | 0 .../apidocs/categories/show/responses.json | 0 .../apidocs/categories/update/example.200.json | 0 .../apidocs/categories/update/example.404.json | 0 .../apidocs/categories/update/responses.json | 0 .../apidocs/comments/create/example.200.json | 0 .../apidocs/comments/create/example.400.json | 0 .../apidocs/comments/create/responses.json | 0 .../apidocs/comments/delete/example.200.json | 0 .../apidocs/comments/delete/example.404.json | 0 .../apidocs/comments/delete/responses.json | 0 .../apidocs/comments/index/example.200.json | 0 .../apidocs/comments/index/responses.json | 0 .../apidocs/comments/show/example.200.json | 0 .../apidocs/comments/show/example.404.json | 0 .../apidocs/comments/show/responses.json | 0 .../apidocs/comments/update/example.200.json | 0 .../apidocs/comments/update/example.404.json | 0 .../apidocs/comments/update/responses.json | 0 .../apidocs/contentStore/create/example.200.json | 0 .../apidocs/contentStore/create/example.400.json | 0 .../apidocs/contentStore/create/responses.json | 0 .../apidocs/contentStore/delete/example.200.json | 0 .../apidocs/contentStore/delete/example.404.json | 0 .../apidocs/contentStore/delete/responses.json | 0 .../apidocs/contentStore/index/example.200.json | 0 .../apidocs/contentStore/index/responses.json | 0 .../apidocs/contentStore/show/example.200.json | 0 .../apidocs/contentStore/show/example.404.json | 0 .../apidocs/contentStore/show/responses.json | 0 .../apidocs/contentStore/update/example.200.json | 0 .../apidocs/contentStore/update/example.404.json | 0 .../apidocs/contentStore/update/responses.json | 0 .../apidocs/echo/index/example.200.json | 0 .../contentbox}/apidocs/echo/index/responses.json | 0 .../apidocs/echo/whoami/example.200.json | 0 .../apidocs/echo/whoami/example.401.json | 0 .../contentbox}/apidocs/echo/whoami/responses.json | 0 .../apidocs/entries/create/example.200.json | 0 .../apidocs/entries/create/example.400.json | 0 .../apidocs/entries/create/responses.json | 0 .../apidocs/entries/delete/example.200.json | 0 .../apidocs/entries/delete/example.404.json | 0 .../apidocs/entries/delete/responses.json | 0 .../apidocs/entries/index/example.200.json | 0 .../apidocs/entries/index/responses.json | 0 .../apidocs/entries/show/example.200.json | 0 .../apidocs/entries/show/example.404.json | 0 .../apidocs/entries/show/responses.json | 0 .../apidocs/entries/update/example.200.json | 0 .../apidocs/entries/update/example.404.json | 0 .../apidocs/entries/update/responses.json | 0 .../apidocs/menus/create/example.200.json | 0 .../apidocs/menus/create/responses.400.json | 0 .../apidocs/menus/create/responses.json | 0 .../apidocs/menus/delete/example.200.json | 0 .../apidocs/menus/delete/example.404.json | 0 .../apidocs/menus/delete/responses.json | 0 .../apidocs/menus/index/example.200.json | 0 .../contentbox}/apidocs/menus/index/responses.json | 0 .../apidocs/menus/show/example.200.json | 0 .../apidocs/menus/show/example.404.json | 0 .../contentbox}/apidocs/menus/show/responses.json | 0 .../apidocs/menus/update/example.200.json | 0 .../apidocs/menus/update/example.404.json | 0 .../apidocs/menus/update/responses.json | 0 .../apidocs/pages/create/example.200.json | 0 .../apidocs/pages/create/example.400.json | 0 .../apidocs/pages/create/responses.json | 0 .../apidocs/pages/delete/example.200.json | 0 .../apidocs/pages/delete/example.404.json | 0 .../apidocs/pages/delete/responses.json | 0 .../apidocs/pages/index/example.200.json | 0 .../contentbox}/apidocs/pages/index/responses.json | 0 .../apidocs/pages/show/example.200.json | 0 .../apidocs/pages/show/example.404.json | 0 .../contentbox}/apidocs/pages/show/responses.json | 0 .../apidocs/pages/update/example.200.json | 0 .../apidocs/pages/update/example.404.json | 0 .../apidocs/pages/update/responses.json | 0 .../apidocs/settings/index/example.200.json | 0 .../apidocs/settings/index/responses.json | 0 .../apidocs/sites/create/example.200.json | 0 .../apidocs/sites/create/example.400.json | 0 .../apidocs/sites/create/responses.json | 0 .../apidocs/sites/delete/example.200.json | 0 .../apidocs/sites/delete/example.404.json | 0 .../apidocs/sites/delete/responses.json | 0 .../apidocs/sites/index/example.200.json | 0 .../contentbox}/apidocs/sites/index/responses.json | 0 .../apidocs/sites/settings/example.200.json | 0 .../apidocs/sites/settings/example.404.json | 0 .../apidocs/sites/settings/responses.json | 0 .../apidocs/sites/show/example.200.json | 0 .../apidocs/sites/show/example.404.json | 0 .../contentbox}/apidocs/sites/show/responses.json | 0 .../apidocs/sites/update/example.200.json | 0 .../apidocs/sites/update/example.404.json | 0 .../apidocs/sites/update/responses.json | 0 .../apidocs/versions/delete/example.200.json | 0 .../apidocs/versions/delete/example.404.json | 0 .../apidocs/versions/delete/responses.json | 0 .../apidocs/versions/index/example.200.json | 0 .../apidocs/versions/index/responses.json | 0 .../apidocs/versions/show/example.200.json | 0 .../apidocs/versions/show/example.404.json | 0 .../apidocs/versions/show/responses.json | 0 .../modules/contentbox-api-v1/handlers/auth.cfc | 14 +++++--------- resources/Application.cfm | 10 ---------- 150 files changed, 5 insertions(+), 19 deletions(-) rename {resources => modules/contentbox}/apidocs/_schemas/app-invalid.json (100%) rename {resources => modules/contentbox}/apidocs/_schemas/app-response.json (100%) rename {resources => modules/contentbox}/apidocs/_schemas/app-user.json (100%) rename {resources => modules/contentbox}/apidocs/_schemas/app-validation.json (100%) rename {resources => modules/contentbox}/apidocs/auth/login/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/auth/login/example.401.json (100%) rename {resources => modules/contentbox}/apidocs/auth/login/requestBody.json (100%) rename {resources => modules/contentbox}/apidocs/auth/login/responses.json (100%) rename {resources => modules/contentbox}/apidocs/auth/logout/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/auth/logout/example.500.json (100%) rename {resources => modules/contentbox}/apidocs/auth/logout/responses.json (100%) rename {resources => modules/contentbox}/apidocs/auth/refreshToken/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/auth/refreshToken/responses.json (100%) rename {resources => modules/contentbox}/apidocs/auth/register/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/auth/register/example.400.json (100%) rename {resources => modules/contentbox}/apidocs/auth/register/requestBody.json (100%) rename {resources => modules/contentbox}/apidocs/auth/register/responses.json (100%) rename {resources => modules/contentbox}/apidocs/authors/create/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/authors/create/example.400.json (100%) rename {resources => modules/contentbox}/apidocs/authors/create/responses.json (100%) rename {resources => modules/contentbox}/apidocs/authors/delete/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/authors/delete/example.404.json (100%) rename {resources => modules/contentbox}/apidocs/authors/delete/example.405.json (100%) rename {resources => modules/contentbox}/apidocs/authors/delete/responses.json (100%) rename {resources => modules/contentbox}/apidocs/authors/index/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/authors/index/responses.json (100%) rename {resources => modules/contentbox}/apidocs/authors/show/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/authors/show/example.404.json (100%) rename {resources => modules/contentbox}/apidocs/authors/show/responses.json (100%) rename {resources => modules/contentbox}/apidocs/authors/update/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/authors/update/example.404.json (100%) rename {resources => modules/contentbox}/apidocs/authors/update/responses.json (100%) rename {resources => modules/contentbox}/apidocs/categories/create/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/categories/create/example.400.json (100%) rename {resources => modules/contentbox}/apidocs/categories/create/responses.json (100%) rename {resources => modules/contentbox}/apidocs/categories/delete/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/categories/delete/example.404.json (100%) rename {resources => modules/contentbox}/apidocs/categories/delete/responses.json (100%) rename {resources => modules/contentbox}/apidocs/categories/index/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/categories/index/responses.json (100%) rename {resources => modules/contentbox}/apidocs/categories/show/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/categories/show/example.404.json (100%) rename {resources => modules/contentbox}/apidocs/categories/show/responses.json (100%) rename {resources => modules/contentbox}/apidocs/categories/update/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/categories/update/example.404.json (100%) rename {resources => modules/contentbox}/apidocs/categories/update/responses.json (100%) rename {resources => modules/contentbox}/apidocs/comments/create/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/comments/create/example.400.json (100%) rename {resources => modules/contentbox}/apidocs/comments/create/responses.json (100%) rename {resources => modules/contentbox}/apidocs/comments/delete/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/comments/delete/example.404.json (100%) rename {resources => modules/contentbox}/apidocs/comments/delete/responses.json (100%) rename {resources => modules/contentbox}/apidocs/comments/index/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/comments/index/responses.json (100%) rename {resources => modules/contentbox}/apidocs/comments/show/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/comments/show/example.404.json (100%) rename {resources => modules/contentbox}/apidocs/comments/show/responses.json (100%) rename {resources => modules/contentbox}/apidocs/comments/update/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/comments/update/example.404.json (100%) rename {resources => modules/contentbox}/apidocs/comments/update/responses.json (100%) rename {resources => modules/contentbox}/apidocs/contentStore/create/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/contentStore/create/example.400.json (100%) rename {resources => modules/contentbox}/apidocs/contentStore/create/responses.json (100%) rename {resources => modules/contentbox}/apidocs/contentStore/delete/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/contentStore/delete/example.404.json (100%) rename {resources => modules/contentbox}/apidocs/contentStore/delete/responses.json (100%) rename {resources => modules/contentbox}/apidocs/contentStore/index/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/contentStore/index/responses.json (100%) rename {resources => modules/contentbox}/apidocs/contentStore/show/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/contentStore/show/example.404.json (100%) rename {resources => modules/contentbox}/apidocs/contentStore/show/responses.json (100%) rename {resources => modules/contentbox}/apidocs/contentStore/update/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/contentStore/update/example.404.json (100%) rename {resources => modules/contentbox}/apidocs/contentStore/update/responses.json (100%) rename {resources => modules/contentbox}/apidocs/echo/index/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/echo/index/responses.json (100%) rename {resources => modules/contentbox}/apidocs/echo/whoami/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/echo/whoami/example.401.json (100%) rename {resources => modules/contentbox}/apidocs/echo/whoami/responses.json (100%) rename {resources => modules/contentbox}/apidocs/entries/create/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/entries/create/example.400.json (100%) rename {resources => modules/contentbox}/apidocs/entries/create/responses.json (100%) rename {resources => modules/contentbox}/apidocs/entries/delete/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/entries/delete/example.404.json (100%) rename {resources => modules/contentbox}/apidocs/entries/delete/responses.json (100%) rename {resources => modules/contentbox}/apidocs/entries/index/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/entries/index/responses.json (100%) rename {resources => modules/contentbox}/apidocs/entries/show/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/entries/show/example.404.json (100%) rename {resources => modules/contentbox}/apidocs/entries/show/responses.json (100%) rename {resources => modules/contentbox}/apidocs/entries/update/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/entries/update/example.404.json (100%) rename {resources => modules/contentbox}/apidocs/entries/update/responses.json (100%) rename {resources => modules/contentbox}/apidocs/menus/create/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/menus/create/responses.400.json (100%) rename {resources => modules/contentbox}/apidocs/menus/create/responses.json (100%) rename {resources => modules/contentbox}/apidocs/menus/delete/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/menus/delete/example.404.json (100%) rename {resources => modules/contentbox}/apidocs/menus/delete/responses.json (100%) rename {resources => modules/contentbox}/apidocs/menus/index/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/menus/index/responses.json (100%) rename {resources => modules/contentbox}/apidocs/menus/show/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/menus/show/example.404.json (100%) rename {resources => modules/contentbox}/apidocs/menus/show/responses.json (100%) rename {resources => modules/contentbox}/apidocs/menus/update/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/menus/update/example.404.json (100%) rename {resources => modules/contentbox}/apidocs/menus/update/responses.json (100%) rename {resources => modules/contentbox}/apidocs/pages/create/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/pages/create/example.400.json (100%) rename {resources => modules/contentbox}/apidocs/pages/create/responses.json (100%) rename {resources => modules/contentbox}/apidocs/pages/delete/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/pages/delete/example.404.json (100%) rename {resources => modules/contentbox}/apidocs/pages/delete/responses.json (100%) rename {resources => modules/contentbox}/apidocs/pages/index/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/pages/index/responses.json (100%) rename {resources => modules/contentbox}/apidocs/pages/show/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/pages/show/example.404.json (100%) rename {resources => modules/contentbox}/apidocs/pages/show/responses.json (100%) rename {resources => modules/contentbox}/apidocs/pages/update/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/pages/update/example.404.json (100%) rename {resources => modules/contentbox}/apidocs/pages/update/responses.json (100%) rename {resources => modules/contentbox}/apidocs/settings/index/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/settings/index/responses.json (100%) rename {resources => modules/contentbox}/apidocs/sites/create/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/sites/create/example.400.json (100%) rename {resources => modules/contentbox}/apidocs/sites/create/responses.json (100%) rename {resources => modules/contentbox}/apidocs/sites/delete/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/sites/delete/example.404.json (100%) rename {resources => modules/contentbox}/apidocs/sites/delete/responses.json (100%) rename {resources => modules/contentbox}/apidocs/sites/index/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/sites/index/responses.json (100%) rename {resources => modules/contentbox}/apidocs/sites/settings/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/sites/settings/example.404.json (100%) rename {resources => modules/contentbox}/apidocs/sites/settings/responses.json (100%) rename {resources => modules/contentbox}/apidocs/sites/show/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/sites/show/example.404.json (100%) rename {resources => modules/contentbox}/apidocs/sites/show/responses.json (100%) rename {resources => modules/contentbox}/apidocs/sites/update/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/sites/update/example.404.json (100%) rename {resources => modules/contentbox}/apidocs/sites/update/responses.json (100%) rename {resources => modules/contentbox}/apidocs/versions/delete/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/versions/delete/example.404.json (100%) rename {resources => modules/contentbox}/apidocs/versions/delete/responses.json (100%) rename {resources => modules/contentbox}/apidocs/versions/index/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/versions/index/responses.json (100%) rename {resources => modules/contentbox}/apidocs/versions/show/example.200.json (100%) rename {resources => modules/contentbox}/apidocs/versions/show/example.404.json (100%) rename {resources => modules/contentbox}/apidocs/versions/show/responses.json (100%) delete mode 100755 resources/Application.cfm diff --git a/resources/apidocs/_schemas/app-invalid.json b/modules/contentbox/apidocs/_schemas/app-invalid.json similarity index 100% rename from resources/apidocs/_schemas/app-invalid.json rename to modules/contentbox/apidocs/_schemas/app-invalid.json diff --git a/resources/apidocs/_schemas/app-response.json b/modules/contentbox/apidocs/_schemas/app-response.json similarity index 100% rename from resources/apidocs/_schemas/app-response.json rename to modules/contentbox/apidocs/_schemas/app-response.json diff --git a/resources/apidocs/_schemas/app-user.json b/modules/contentbox/apidocs/_schemas/app-user.json similarity index 100% rename from resources/apidocs/_schemas/app-user.json rename to modules/contentbox/apidocs/_schemas/app-user.json diff --git a/resources/apidocs/_schemas/app-validation.json b/modules/contentbox/apidocs/_schemas/app-validation.json similarity index 100% rename from resources/apidocs/_schemas/app-validation.json rename to modules/contentbox/apidocs/_schemas/app-validation.json diff --git a/resources/apidocs/auth/login/example.200.json b/modules/contentbox/apidocs/auth/login/example.200.json similarity index 100% rename from resources/apidocs/auth/login/example.200.json rename to modules/contentbox/apidocs/auth/login/example.200.json diff --git a/resources/apidocs/auth/login/example.401.json b/modules/contentbox/apidocs/auth/login/example.401.json similarity index 100% rename from resources/apidocs/auth/login/example.401.json rename to modules/contentbox/apidocs/auth/login/example.401.json diff --git a/resources/apidocs/auth/login/requestBody.json b/modules/contentbox/apidocs/auth/login/requestBody.json similarity index 100% rename from resources/apidocs/auth/login/requestBody.json rename to modules/contentbox/apidocs/auth/login/requestBody.json diff --git a/resources/apidocs/auth/login/responses.json b/modules/contentbox/apidocs/auth/login/responses.json similarity index 100% rename from resources/apidocs/auth/login/responses.json rename to modules/contentbox/apidocs/auth/login/responses.json diff --git a/resources/apidocs/auth/logout/example.200.json b/modules/contentbox/apidocs/auth/logout/example.200.json similarity index 100% rename from resources/apidocs/auth/logout/example.200.json rename to modules/contentbox/apidocs/auth/logout/example.200.json diff --git a/resources/apidocs/auth/logout/example.500.json b/modules/contentbox/apidocs/auth/logout/example.500.json similarity index 100% rename from resources/apidocs/auth/logout/example.500.json rename to modules/contentbox/apidocs/auth/logout/example.500.json diff --git a/resources/apidocs/auth/logout/responses.json b/modules/contentbox/apidocs/auth/logout/responses.json similarity index 100% rename from resources/apidocs/auth/logout/responses.json rename to modules/contentbox/apidocs/auth/logout/responses.json diff --git a/resources/apidocs/auth/refreshToken/example.200.json b/modules/contentbox/apidocs/auth/refreshToken/example.200.json similarity index 100% rename from resources/apidocs/auth/refreshToken/example.200.json rename to modules/contentbox/apidocs/auth/refreshToken/example.200.json diff --git a/resources/apidocs/auth/refreshToken/responses.json b/modules/contentbox/apidocs/auth/refreshToken/responses.json similarity index 100% rename from resources/apidocs/auth/refreshToken/responses.json rename to modules/contentbox/apidocs/auth/refreshToken/responses.json diff --git a/resources/apidocs/auth/register/example.200.json b/modules/contentbox/apidocs/auth/register/example.200.json similarity index 100% rename from resources/apidocs/auth/register/example.200.json rename to modules/contentbox/apidocs/auth/register/example.200.json diff --git a/resources/apidocs/auth/register/example.400.json b/modules/contentbox/apidocs/auth/register/example.400.json similarity index 100% rename from resources/apidocs/auth/register/example.400.json rename to modules/contentbox/apidocs/auth/register/example.400.json diff --git a/resources/apidocs/auth/register/requestBody.json b/modules/contentbox/apidocs/auth/register/requestBody.json similarity index 100% rename from resources/apidocs/auth/register/requestBody.json rename to modules/contentbox/apidocs/auth/register/requestBody.json diff --git a/resources/apidocs/auth/register/responses.json b/modules/contentbox/apidocs/auth/register/responses.json similarity index 100% rename from resources/apidocs/auth/register/responses.json rename to modules/contentbox/apidocs/auth/register/responses.json diff --git a/resources/apidocs/authors/create/example.200.json b/modules/contentbox/apidocs/authors/create/example.200.json similarity index 100% rename from resources/apidocs/authors/create/example.200.json rename to modules/contentbox/apidocs/authors/create/example.200.json diff --git a/resources/apidocs/authors/create/example.400.json b/modules/contentbox/apidocs/authors/create/example.400.json similarity index 100% rename from resources/apidocs/authors/create/example.400.json rename to modules/contentbox/apidocs/authors/create/example.400.json diff --git a/resources/apidocs/authors/create/responses.json b/modules/contentbox/apidocs/authors/create/responses.json similarity index 100% rename from resources/apidocs/authors/create/responses.json rename to modules/contentbox/apidocs/authors/create/responses.json diff --git a/resources/apidocs/authors/delete/example.200.json b/modules/contentbox/apidocs/authors/delete/example.200.json similarity index 100% rename from resources/apidocs/authors/delete/example.200.json rename to modules/contentbox/apidocs/authors/delete/example.200.json diff --git a/resources/apidocs/authors/delete/example.404.json b/modules/contentbox/apidocs/authors/delete/example.404.json similarity index 100% rename from resources/apidocs/authors/delete/example.404.json rename to modules/contentbox/apidocs/authors/delete/example.404.json diff --git a/resources/apidocs/authors/delete/example.405.json b/modules/contentbox/apidocs/authors/delete/example.405.json similarity index 100% rename from resources/apidocs/authors/delete/example.405.json rename to modules/contentbox/apidocs/authors/delete/example.405.json diff --git a/resources/apidocs/authors/delete/responses.json b/modules/contentbox/apidocs/authors/delete/responses.json similarity index 100% rename from resources/apidocs/authors/delete/responses.json rename to modules/contentbox/apidocs/authors/delete/responses.json diff --git a/resources/apidocs/authors/index/example.200.json b/modules/contentbox/apidocs/authors/index/example.200.json similarity index 100% rename from resources/apidocs/authors/index/example.200.json rename to modules/contentbox/apidocs/authors/index/example.200.json diff --git a/resources/apidocs/authors/index/responses.json b/modules/contentbox/apidocs/authors/index/responses.json similarity index 100% rename from resources/apidocs/authors/index/responses.json rename to modules/contentbox/apidocs/authors/index/responses.json diff --git a/resources/apidocs/authors/show/example.200.json b/modules/contentbox/apidocs/authors/show/example.200.json similarity index 100% rename from resources/apidocs/authors/show/example.200.json rename to modules/contentbox/apidocs/authors/show/example.200.json diff --git a/resources/apidocs/authors/show/example.404.json b/modules/contentbox/apidocs/authors/show/example.404.json similarity index 100% rename from resources/apidocs/authors/show/example.404.json rename to modules/contentbox/apidocs/authors/show/example.404.json diff --git a/resources/apidocs/authors/show/responses.json b/modules/contentbox/apidocs/authors/show/responses.json similarity index 100% rename from resources/apidocs/authors/show/responses.json rename to modules/contentbox/apidocs/authors/show/responses.json diff --git a/resources/apidocs/authors/update/example.200.json b/modules/contentbox/apidocs/authors/update/example.200.json similarity index 100% rename from resources/apidocs/authors/update/example.200.json rename to modules/contentbox/apidocs/authors/update/example.200.json diff --git a/resources/apidocs/authors/update/example.404.json b/modules/contentbox/apidocs/authors/update/example.404.json similarity index 100% rename from resources/apidocs/authors/update/example.404.json rename to modules/contentbox/apidocs/authors/update/example.404.json diff --git a/resources/apidocs/authors/update/responses.json b/modules/contentbox/apidocs/authors/update/responses.json similarity index 100% rename from resources/apidocs/authors/update/responses.json rename to modules/contentbox/apidocs/authors/update/responses.json diff --git a/resources/apidocs/categories/create/example.200.json b/modules/contentbox/apidocs/categories/create/example.200.json similarity index 100% rename from resources/apidocs/categories/create/example.200.json rename to modules/contentbox/apidocs/categories/create/example.200.json diff --git a/resources/apidocs/categories/create/example.400.json b/modules/contentbox/apidocs/categories/create/example.400.json similarity index 100% rename from resources/apidocs/categories/create/example.400.json rename to modules/contentbox/apidocs/categories/create/example.400.json diff --git a/resources/apidocs/categories/create/responses.json b/modules/contentbox/apidocs/categories/create/responses.json similarity index 100% rename from resources/apidocs/categories/create/responses.json rename to modules/contentbox/apidocs/categories/create/responses.json diff --git a/resources/apidocs/categories/delete/example.200.json b/modules/contentbox/apidocs/categories/delete/example.200.json similarity index 100% rename from resources/apidocs/categories/delete/example.200.json rename to modules/contentbox/apidocs/categories/delete/example.200.json diff --git a/resources/apidocs/categories/delete/example.404.json b/modules/contentbox/apidocs/categories/delete/example.404.json similarity index 100% rename from resources/apidocs/categories/delete/example.404.json rename to modules/contentbox/apidocs/categories/delete/example.404.json diff --git a/resources/apidocs/categories/delete/responses.json b/modules/contentbox/apidocs/categories/delete/responses.json similarity index 100% rename from resources/apidocs/categories/delete/responses.json rename to modules/contentbox/apidocs/categories/delete/responses.json diff --git a/resources/apidocs/categories/index/example.200.json b/modules/contentbox/apidocs/categories/index/example.200.json similarity index 100% rename from resources/apidocs/categories/index/example.200.json rename to modules/contentbox/apidocs/categories/index/example.200.json diff --git a/resources/apidocs/categories/index/responses.json b/modules/contentbox/apidocs/categories/index/responses.json similarity index 100% rename from resources/apidocs/categories/index/responses.json rename to modules/contentbox/apidocs/categories/index/responses.json diff --git a/resources/apidocs/categories/show/example.200.json b/modules/contentbox/apidocs/categories/show/example.200.json similarity index 100% rename from resources/apidocs/categories/show/example.200.json rename to modules/contentbox/apidocs/categories/show/example.200.json diff --git a/resources/apidocs/categories/show/example.404.json b/modules/contentbox/apidocs/categories/show/example.404.json similarity index 100% rename from resources/apidocs/categories/show/example.404.json rename to modules/contentbox/apidocs/categories/show/example.404.json diff --git a/resources/apidocs/categories/show/responses.json b/modules/contentbox/apidocs/categories/show/responses.json similarity index 100% rename from resources/apidocs/categories/show/responses.json rename to modules/contentbox/apidocs/categories/show/responses.json diff --git a/resources/apidocs/categories/update/example.200.json b/modules/contentbox/apidocs/categories/update/example.200.json similarity index 100% rename from resources/apidocs/categories/update/example.200.json rename to modules/contentbox/apidocs/categories/update/example.200.json diff --git a/resources/apidocs/categories/update/example.404.json b/modules/contentbox/apidocs/categories/update/example.404.json similarity index 100% rename from resources/apidocs/categories/update/example.404.json rename to modules/contentbox/apidocs/categories/update/example.404.json diff --git a/resources/apidocs/categories/update/responses.json b/modules/contentbox/apidocs/categories/update/responses.json similarity index 100% rename from resources/apidocs/categories/update/responses.json rename to modules/contentbox/apidocs/categories/update/responses.json diff --git a/resources/apidocs/comments/create/example.200.json b/modules/contentbox/apidocs/comments/create/example.200.json similarity index 100% rename from resources/apidocs/comments/create/example.200.json rename to modules/contentbox/apidocs/comments/create/example.200.json diff --git a/resources/apidocs/comments/create/example.400.json b/modules/contentbox/apidocs/comments/create/example.400.json similarity index 100% rename from resources/apidocs/comments/create/example.400.json rename to modules/contentbox/apidocs/comments/create/example.400.json diff --git a/resources/apidocs/comments/create/responses.json b/modules/contentbox/apidocs/comments/create/responses.json similarity index 100% rename from resources/apidocs/comments/create/responses.json rename to modules/contentbox/apidocs/comments/create/responses.json diff --git a/resources/apidocs/comments/delete/example.200.json b/modules/contentbox/apidocs/comments/delete/example.200.json similarity index 100% rename from resources/apidocs/comments/delete/example.200.json rename to modules/contentbox/apidocs/comments/delete/example.200.json diff --git a/resources/apidocs/comments/delete/example.404.json b/modules/contentbox/apidocs/comments/delete/example.404.json similarity index 100% rename from resources/apidocs/comments/delete/example.404.json rename to modules/contentbox/apidocs/comments/delete/example.404.json diff --git a/resources/apidocs/comments/delete/responses.json b/modules/contentbox/apidocs/comments/delete/responses.json similarity index 100% rename from resources/apidocs/comments/delete/responses.json rename to modules/contentbox/apidocs/comments/delete/responses.json diff --git a/resources/apidocs/comments/index/example.200.json b/modules/contentbox/apidocs/comments/index/example.200.json similarity index 100% rename from resources/apidocs/comments/index/example.200.json rename to modules/contentbox/apidocs/comments/index/example.200.json diff --git a/resources/apidocs/comments/index/responses.json b/modules/contentbox/apidocs/comments/index/responses.json similarity index 100% rename from resources/apidocs/comments/index/responses.json rename to modules/contentbox/apidocs/comments/index/responses.json diff --git a/resources/apidocs/comments/show/example.200.json b/modules/contentbox/apidocs/comments/show/example.200.json similarity index 100% rename from resources/apidocs/comments/show/example.200.json rename to modules/contentbox/apidocs/comments/show/example.200.json diff --git a/resources/apidocs/comments/show/example.404.json b/modules/contentbox/apidocs/comments/show/example.404.json similarity index 100% rename from resources/apidocs/comments/show/example.404.json rename to modules/contentbox/apidocs/comments/show/example.404.json diff --git a/resources/apidocs/comments/show/responses.json b/modules/contentbox/apidocs/comments/show/responses.json similarity index 100% rename from resources/apidocs/comments/show/responses.json rename to modules/contentbox/apidocs/comments/show/responses.json diff --git a/resources/apidocs/comments/update/example.200.json b/modules/contentbox/apidocs/comments/update/example.200.json similarity index 100% rename from resources/apidocs/comments/update/example.200.json rename to modules/contentbox/apidocs/comments/update/example.200.json diff --git a/resources/apidocs/comments/update/example.404.json b/modules/contentbox/apidocs/comments/update/example.404.json similarity index 100% rename from resources/apidocs/comments/update/example.404.json rename to modules/contentbox/apidocs/comments/update/example.404.json diff --git a/resources/apidocs/comments/update/responses.json b/modules/contentbox/apidocs/comments/update/responses.json similarity index 100% rename from resources/apidocs/comments/update/responses.json rename to modules/contentbox/apidocs/comments/update/responses.json diff --git a/resources/apidocs/contentStore/create/example.200.json b/modules/contentbox/apidocs/contentStore/create/example.200.json similarity index 100% rename from resources/apidocs/contentStore/create/example.200.json rename to modules/contentbox/apidocs/contentStore/create/example.200.json diff --git a/resources/apidocs/contentStore/create/example.400.json b/modules/contentbox/apidocs/contentStore/create/example.400.json similarity index 100% rename from resources/apidocs/contentStore/create/example.400.json rename to modules/contentbox/apidocs/contentStore/create/example.400.json diff --git a/resources/apidocs/contentStore/create/responses.json b/modules/contentbox/apidocs/contentStore/create/responses.json similarity index 100% rename from resources/apidocs/contentStore/create/responses.json rename to modules/contentbox/apidocs/contentStore/create/responses.json diff --git a/resources/apidocs/contentStore/delete/example.200.json b/modules/contentbox/apidocs/contentStore/delete/example.200.json similarity index 100% rename from resources/apidocs/contentStore/delete/example.200.json rename to modules/contentbox/apidocs/contentStore/delete/example.200.json diff --git a/resources/apidocs/contentStore/delete/example.404.json b/modules/contentbox/apidocs/contentStore/delete/example.404.json similarity index 100% rename from resources/apidocs/contentStore/delete/example.404.json rename to modules/contentbox/apidocs/contentStore/delete/example.404.json diff --git a/resources/apidocs/contentStore/delete/responses.json b/modules/contentbox/apidocs/contentStore/delete/responses.json similarity index 100% rename from resources/apidocs/contentStore/delete/responses.json rename to modules/contentbox/apidocs/contentStore/delete/responses.json diff --git a/resources/apidocs/contentStore/index/example.200.json b/modules/contentbox/apidocs/contentStore/index/example.200.json similarity index 100% rename from resources/apidocs/contentStore/index/example.200.json rename to modules/contentbox/apidocs/contentStore/index/example.200.json diff --git a/resources/apidocs/contentStore/index/responses.json b/modules/contentbox/apidocs/contentStore/index/responses.json similarity index 100% rename from resources/apidocs/contentStore/index/responses.json rename to modules/contentbox/apidocs/contentStore/index/responses.json diff --git a/resources/apidocs/contentStore/show/example.200.json b/modules/contentbox/apidocs/contentStore/show/example.200.json similarity index 100% rename from resources/apidocs/contentStore/show/example.200.json rename to modules/contentbox/apidocs/contentStore/show/example.200.json diff --git a/resources/apidocs/contentStore/show/example.404.json b/modules/contentbox/apidocs/contentStore/show/example.404.json similarity index 100% rename from resources/apidocs/contentStore/show/example.404.json rename to modules/contentbox/apidocs/contentStore/show/example.404.json diff --git a/resources/apidocs/contentStore/show/responses.json b/modules/contentbox/apidocs/contentStore/show/responses.json similarity index 100% rename from resources/apidocs/contentStore/show/responses.json rename to modules/contentbox/apidocs/contentStore/show/responses.json diff --git a/resources/apidocs/contentStore/update/example.200.json b/modules/contentbox/apidocs/contentStore/update/example.200.json similarity index 100% rename from resources/apidocs/contentStore/update/example.200.json rename to modules/contentbox/apidocs/contentStore/update/example.200.json diff --git a/resources/apidocs/contentStore/update/example.404.json b/modules/contentbox/apidocs/contentStore/update/example.404.json similarity index 100% rename from resources/apidocs/contentStore/update/example.404.json rename to modules/contentbox/apidocs/contentStore/update/example.404.json diff --git a/resources/apidocs/contentStore/update/responses.json b/modules/contentbox/apidocs/contentStore/update/responses.json similarity index 100% rename from resources/apidocs/contentStore/update/responses.json rename to modules/contentbox/apidocs/contentStore/update/responses.json diff --git a/resources/apidocs/echo/index/example.200.json b/modules/contentbox/apidocs/echo/index/example.200.json similarity index 100% rename from resources/apidocs/echo/index/example.200.json rename to modules/contentbox/apidocs/echo/index/example.200.json diff --git a/resources/apidocs/echo/index/responses.json b/modules/contentbox/apidocs/echo/index/responses.json similarity index 100% rename from resources/apidocs/echo/index/responses.json rename to modules/contentbox/apidocs/echo/index/responses.json diff --git a/resources/apidocs/echo/whoami/example.200.json b/modules/contentbox/apidocs/echo/whoami/example.200.json similarity index 100% rename from resources/apidocs/echo/whoami/example.200.json rename to modules/contentbox/apidocs/echo/whoami/example.200.json diff --git a/resources/apidocs/echo/whoami/example.401.json b/modules/contentbox/apidocs/echo/whoami/example.401.json similarity index 100% rename from resources/apidocs/echo/whoami/example.401.json rename to modules/contentbox/apidocs/echo/whoami/example.401.json diff --git a/resources/apidocs/echo/whoami/responses.json b/modules/contentbox/apidocs/echo/whoami/responses.json similarity index 100% rename from resources/apidocs/echo/whoami/responses.json rename to modules/contentbox/apidocs/echo/whoami/responses.json diff --git a/resources/apidocs/entries/create/example.200.json b/modules/contentbox/apidocs/entries/create/example.200.json similarity index 100% rename from resources/apidocs/entries/create/example.200.json rename to modules/contentbox/apidocs/entries/create/example.200.json diff --git a/resources/apidocs/entries/create/example.400.json b/modules/contentbox/apidocs/entries/create/example.400.json similarity index 100% rename from resources/apidocs/entries/create/example.400.json rename to modules/contentbox/apidocs/entries/create/example.400.json diff --git a/resources/apidocs/entries/create/responses.json b/modules/contentbox/apidocs/entries/create/responses.json similarity index 100% rename from resources/apidocs/entries/create/responses.json rename to modules/contentbox/apidocs/entries/create/responses.json diff --git a/resources/apidocs/entries/delete/example.200.json b/modules/contentbox/apidocs/entries/delete/example.200.json similarity index 100% rename from resources/apidocs/entries/delete/example.200.json rename to modules/contentbox/apidocs/entries/delete/example.200.json diff --git a/resources/apidocs/entries/delete/example.404.json b/modules/contentbox/apidocs/entries/delete/example.404.json similarity index 100% rename from resources/apidocs/entries/delete/example.404.json rename to modules/contentbox/apidocs/entries/delete/example.404.json diff --git a/resources/apidocs/entries/delete/responses.json b/modules/contentbox/apidocs/entries/delete/responses.json similarity index 100% rename from resources/apidocs/entries/delete/responses.json rename to modules/contentbox/apidocs/entries/delete/responses.json diff --git a/resources/apidocs/entries/index/example.200.json b/modules/contentbox/apidocs/entries/index/example.200.json similarity index 100% rename from resources/apidocs/entries/index/example.200.json rename to modules/contentbox/apidocs/entries/index/example.200.json diff --git a/resources/apidocs/entries/index/responses.json b/modules/contentbox/apidocs/entries/index/responses.json similarity index 100% rename from resources/apidocs/entries/index/responses.json rename to modules/contentbox/apidocs/entries/index/responses.json diff --git a/resources/apidocs/entries/show/example.200.json b/modules/contentbox/apidocs/entries/show/example.200.json similarity index 100% rename from resources/apidocs/entries/show/example.200.json rename to modules/contentbox/apidocs/entries/show/example.200.json diff --git a/resources/apidocs/entries/show/example.404.json b/modules/contentbox/apidocs/entries/show/example.404.json similarity index 100% rename from resources/apidocs/entries/show/example.404.json rename to modules/contentbox/apidocs/entries/show/example.404.json diff --git a/resources/apidocs/entries/show/responses.json b/modules/contentbox/apidocs/entries/show/responses.json similarity index 100% rename from resources/apidocs/entries/show/responses.json rename to modules/contentbox/apidocs/entries/show/responses.json diff --git a/resources/apidocs/entries/update/example.200.json b/modules/contentbox/apidocs/entries/update/example.200.json similarity index 100% rename from resources/apidocs/entries/update/example.200.json rename to modules/contentbox/apidocs/entries/update/example.200.json diff --git a/resources/apidocs/entries/update/example.404.json b/modules/contentbox/apidocs/entries/update/example.404.json similarity index 100% rename from resources/apidocs/entries/update/example.404.json rename to modules/contentbox/apidocs/entries/update/example.404.json diff --git a/resources/apidocs/entries/update/responses.json b/modules/contentbox/apidocs/entries/update/responses.json similarity index 100% rename from resources/apidocs/entries/update/responses.json rename to modules/contentbox/apidocs/entries/update/responses.json diff --git a/resources/apidocs/menus/create/example.200.json b/modules/contentbox/apidocs/menus/create/example.200.json similarity index 100% rename from resources/apidocs/menus/create/example.200.json rename to modules/contentbox/apidocs/menus/create/example.200.json diff --git a/resources/apidocs/menus/create/responses.400.json b/modules/contentbox/apidocs/menus/create/responses.400.json similarity index 100% rename from resources/apidocs/menus/create/responses.400.json rename to modules/contentbox/apidocs/menus/create/responses.400.json diff --git a/resources/apidocs/menus/create/responses.json b/modules/contentbox/apidocs/menus/create/responses.json similarity index 100% rename from resources/apidocs/menus/create/responses.json rename to modules/contentbox/apidocs/menus/create/responses.json diff --git a/resources/apidocs/menus/delete/example.200.json b/modules/contentbox/apidocs/menus/delete/example.200.json similarity index 100% rename from resources/apidocs/menus/delete/example.200.json rename to modules/contentbox/apidocs/menus/delete/example.200.json diff --git a/resources/apidocs/menus/delete/example.404.json b/modules/contentbox/apidocs/menus/delete/example.404.json similarity index 100% rename from resources/apidocs/menus/delete/example.404.json rename to modules/contentbox/apidocs/menus/delete/example.404.json diff --git a/resources/apidocs/menus/delete/responses.json b/modules/contentbox/apidocs/menus/delete/responses.json similarity index 100% rename from resources/apidocs/menus/delete/responses.json rename to modules/contentbox/apidocs/menus/delete/responses.json diff --git a/resources/apidocs/menus/index/example.200.json b/modules/contentbox/apidocs/menus/index/example.200.json similarity index 100% rename from resources/apidocs/menus/index/example.200.json rename to modules/contentbox/apidocs/menus/index/example.200.json diff --git a/resources/apidocs/menus/index/responses.json b/modules/contentbox/apidocs/menus/index/responses.json similarity index 100% rename from resources/apidocs/menus/index/responses.json rename to modules/contentbox/apidocs/menus/index/responses.json diff --git a/resources/apidocs/menus/show/example.200.json b/modules/contentbox/apidocs/menus/show/example.200.json similarity index 100% rename from resources/apidocs/menus/show/example.200.json rename to modules/contentbox/apidocs/menus/show/example.200.json diff --git a/resources/apidocs/menus/show/example.404.json b/modules/contentbox/apidocs/menus/show/example.404.json similarity index 100% rename from resources/apidocs/menus/show/example.404.json rename to modules/contentbox/apidocs/menus/show/example.404.json diff --git a/resources/apidocs/menus/show/responses.json b/modules/contentbox/apidocs/menus/show/responses.json similarity index 100% rename from resources/apidocs/menus/show/responses.json rename to modules/contentbox/apidocs/menus/show/responses.json diff --git a/resources/apidocs/menus/update/example.200.json b/modules/contentbox/apidocs/menus/update/example.200.json similarity index 100% rename from resources/apidocs/menus/update/example.200.json rename to modules/contentbox/apidocs/menus/update/example.200.json diff --git a/resources/apidocs/menus/update/example.404.json b/modules/contentbox/apidocs/menus/update/example.404.json similarity index 100% rename from resources/apidocs/menus/update/example.404.json rename to modules/contentbox/apidocs/menus/update/example.404.json diff --git a/resources/apidocs/menus/update/responses.json b/modules/contentbox/apidocs/menus/update/responses.json similarity index 100% rename from resources/apidocs/menus/update/responses.json rename to modules/contentbox/apidocs/menus/update/responses.json diff --git a/resources/apidocs/pages/create/example.200.json b/modules/contentbox/apidocs/pages/create/example.200.json similarity index 100% rename from resources/apidocs/pages/create/example.200.json rename to modules/contentbox/apidocs/pages/create/example.200.json diff --git a/resources/apidocs/pages/create/example.400.json b/modules/contentbox/apidocs/pages/create/example.400.json similarity index 100% rename from resources/apidocs/pages/create/example.400.json rename to modules/contentbox/apidocs/pages/create/example.400.json diff --git a/resources/apidocs/pages/create/responses.json b/modules/contentbox/apidocs/pages/create/responses.json similarity index 100% rename from resources/apidocs/pages/create/responses.json rename to modules/contentbox/apidocs/pages/create/responses.json diff --git a/resources/apidocs/pages/delete/example.200.json b/modules/contentbox/apidocs/pages/delete/example.200.json similarity index 100% rename from resources/apidocs/pages/delete/example.200.json rename to modules/contentbox/apidocs/pages/delete/example.200.json diff --git a/resources/apidocs/pages/delete/example.404.json b/modules/contentbox/apidocs/pages/delete/example.404.json similarity index 100% rename from resources/apidocs/pages/delete/example.404.json rename to modules/contentbox/apidocs/pages/delete/example.404.json diff --git a/resources/apidocs/pages/delete/responses.json b/modules/contentbox/apidocs/pages/delete/responses.json similarity index 100% rename from resources/apidocs/pages/delete/responses.json rename to modules/contentbox/apidocs/pages/delete/responses.json diff --git a/resources/apidocs/pages/index/example.200.json b/modules/contentbox/apidocs/pages/index/example.200.json similarity index 100% rename from resources/apidocs/pages/index/example.200.json rename to modules/contentbox/apidocs/pages/index/example.200.json diff --git a/resources/apidocs/pages/index/responses.json b/modules/contentbox/apidocs/pages/index/responses.json similarity index 100% rename from resources/apidocs/pages/index/responses.json rename to modules/contentbox/apidocs/pages/index/responses.json diff --git a/resources/apidocs/pages/show/example.200.json b/modules/contentbox/apidocs/pages/show/example.200.json similarity index 100% rename from resources/apidocs/pages/show/example.200.json rename to modules/contentbox/apidocs/pages/show/example.200.json diff --git a/resources/apidocs/pages/show/example.404.json b/modules/contentbox/apidocs/pages/show/example.404.json similarity index 100% rename from resources/apidocs/pages/show/example.404.json rename to modules/contentbox/apidocs/pages/show/example.404.json diff --git a/resources/apidocs/pages/show/responses.json b/modules/contentbox/apidocs/pages/show/responses.json similarity index 100% rename from resources/apidocs/pages/show/responses.json rename to modules/contentbox/apidocs/pages/show/responses.json diff --git a/resources/apidocs/pages/update/example.200.json b/modules/contentbox/apidocs/pages/update/example.200.json similarity index 100% rename from resources/apidocs/pages/update/example.200.json rename to modules/contentbox/apidocs/pages/update/example.200.json diff --git a/resources/apidocs/pages/update/example.404.json b/modules/contentbox/apidocs/pages/update/example.404.json similarity index 100% rename from resources/apidocs/pages/update/example.404.json rename to modules/contentbox/apidocs/pages/update/example.404.json diff --git a/resources/apidocs/pages/update/responses.json b/modules/contentbox/apidocs/pages/update/responses.json similarity index 100% rename from resources/apidocs/pages/update/responses.json rename to modules/contentbox/apidocs/pages/update/responses.json diff --git a/resources/apidocs/settings/index/example.200.json b/modules/contentbox/apidocs/settings/index/example.200.json similarity index 100% rename from resources/apidocs/settings/index/example.200.json rename to modules/contentbox/apidocs/settings/index/example.200.json diff --git a/resources/apidocs/settings/index/responses.json b/modules/contentbox/apidocs/settings/index/responses.json similarity index 100% rename from resources/apidocs/settings/index/responses.json rename to modules/contentbox/apidocs/settings/index/responses.json diff --git a/resources/apidocs/sites/create/example.200.json b/modules/contentbox/apidocs/sites/create/example.200.json similarity index 100% rename from resources/apidocs/sites/create/example.200.json rename to modules/contentbox/apidocs/sites/create/example.200.json diff --git a/resources/apidocs/sites/create/example.400.json b/modules/contentbox/apidocs/sites/create/example.400.json similarity index 100% rename from resources/apidocs/sites/create/example.400.json rename to modules/contentbox/apidocs/sites/create/example.400.json diff --git a/resources/apidocs/sites/create/responses.json b/modules/contentbox/apidocs/sites/create/responses.json similarity index 100% rename from resources/apidocs/sites/create/responses.json rename to modules/contentbox/apidocs/sites/create/responses.json diff --git a/resources/apidocs/sites/delete/example.200.json b/modules/contentbox/apidocs/sites/delete/example.200.json similarity index 100% rename from resources/apidocs/sites/delete/example.200.json rename to modules/contentbox/apidocs/sites/delete/example.200.json diff --git a/resources/apidocs/sites/delete/example.404.json b/modules/contentbox/apidocs/sites/delete/example.404.json similarity index 100% rename from resources/apidocs/sites/delete/example.404.json rename to modules/contentbox/apidocs/sites/delete/example.404.json diff --git a/resources/apidocs/sites/delete/responses.json b/modules/contentbox/apidocs/sites/delete/responses.json similarity index 100% rename from resources/apidocs/sites/delete/responses.json rename to modules/contentbox/apidocs/sites/delete/responses.json diff --git a/resources/apidocs/sites/index/example.200.json b/modules/contentbox/apidocs/sites/index/example.200.json similarity index 100% rename from resources/apidocs/sites/index/example.200.json rename to modules/contentbox/apidocs/sites/index/example.200.json diff --git a/resources/apidocs/sites/index/responses.json b/modules/contentbox/apidocs/sites/index/responses.json similarity index 100% rename from resources/apidocs/sites/index/responses.json rename to modules/contentbox/apidocs/sites/index/responses.json diff --git a/resources/apidocs/sites/settings/example.200.json b/modules/contentbox/apidocs/sites/settings/example.200.json similarity index 100% rename from resources/apidocs/sites/settings/example.200.json rename to modules/contentbox/apidocs/sites/settings/example.200.json diff --git a/resources/apidocs/sites/settings/example.404.json b/modules/contentbox/apidocs/sites/settings/example.404.json similarity index 100% rename from resources/apidocs/sites/settings/example.404.json rename to modules/contentbox/apidocs/sites/settings/example.404.json diff --git a/resources/apidocs/sites/settings/responses.json b/modules/contentbox/apidocs/sites/settings/responses.json similarity index 100% rename from resources/apidocs/sites/settings/responses.json rename to modules/contentbox/apidocs/sites/settings/responses.json diff --git a/resources/apidocs/sites/show/example.200.json b/modules/contentbox/apidocs/sites/show/example.200.json similarity index 100% rename from resources/apidocs/sites/show/example.200.json rename to modules/contentbox/apidocs/sites/show/example.200.json diff --git a/resources/apidocs/sites/show/example.404.json b/modules/contentbox/apidocs/sites/show/example.404.json similarity index 100% rename from resources/apidocs/sites/show/example.404.json rename to modules/contentbox/apidocs/sites/show/example.404.json diff --git a/resources/apidocs/sites/show/responses.json b/modules/contentbox/apidocs/sites/show/responses.json similarity index 100% rename from resources/apidocs/sites/show/responses.json rename to modules/contentbox/apidocs/sites/show/responses.json diff --git a/resources/apidocs/sites/update/example.200.json b/modules/contentbox/apidocs/sites/update/example.200.json similarity index 100% rename from resources/apidocs/sites/update/example.200.json rename to modules/contentbox/apidocs/sites/update/example.200.json diff --git a/resources/apidocs/sites/update/example.404.json b/modules/contentbox/apidocs/sites/update/example.404.json similarity index 100% rename from resources/apidocs/sites/update/example.404.json rename to modules/contentbox/apidocs/sites/update/example.404.json diff --git a/resources/apidocs/sites/update/responses.json b/modules/contentbox/apidocs/sites/update/responses.json similarity index 100% rename from resources/apidocs/sites/update/responses.json rename to modules/contentbox/apidocs/sites/update/responses.json diff --git a/resources/apidocs/versions/delete/example.200.json b/modules/contentbox/apidocs/versions/delete/example.200.json similarity index 100% rename from resources/apidocs/versions/delete/example.200.json rename to modules/contentbox/apidocs/versions/delete/example.200.json diff --git a/resources/apidocs/versions/delete/example.404.json b/modules/contentbox/apidocs/versions/delete/example.404.json similarity index 100% rename from resources/apidocs/versions/delete/example.404.json rename to modules/contentbox/apidocs/versions/delete/example.404.json diff --git a/resources/apidocs/versions/delete/responses.json b/modules/contentbox/apidocs/versions/delete/responses.json similarity index 100% rename from resources/apidocs/versions/delete/responses.json rename to modules/contentbox/apidocs/versions/delete/responses.json diff --git a/resources/apidocs/versions/index/example.200.json b/modules/contentbox/apidocs/versions/index/example.200.json similarity index 100% rename from resources/apidocs/versions/index/example.200.json rename to modules/contentbox/apidocs/versions/index/example.200.json diff --git a/resources/apidocs/versions/index/responses.json b/modules/contentbox/apidocs/versions/index/responses.json similarity index 100% rename from resources/apidocs/versions/index/responses.json rename to modules/contentbox/apidocs/versions/index/responses.json diff --git a/resources/apidocs/versions/show/example.200.json b/modules/contentbox/apidocs/versions/show/example.200.json similarity index 100% rename from resources/apidocs/versions/show/example.200.json rename to modules/contentbox/apidocs/versions/show/example.200.json diff --git a/resources/apidocs/versions/show/example.404.json b/modules/contentbox/apidocs/versions/show/example.404.json similarity index 100% rename from resources/apidocs/versions/show/example.404.json rename to modules/contentbox/apidocs/versions/show/example.404.json diff --git a/resources/apidocs/versions/show/responses.json b/modules/contentbox/apidocs/versions/show/responses.json similarity index 100% rename from resources/apidocs/versions/show/responses.json rename to modules/contentbox/apidocs/versions/show/responses.json diff --git a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/auth.cfc b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/auth.cfc index fd310f9016..61a735a841 100644 --- a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/auth.cfc +++ b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/auth.cfc @@ -10,6 +10,8 @@ component extends="baseHandler" { * Login to ContentBox and get your JWT Token * * @tags Authentication + * @requestBody contentbox/apidocs/auth/login/requestBody.json + * @responses contentbox/apidocs/auth/login/responses.json */ function login( event, rc, prc ){ param rc.username = ""; @@ -28,9 +30,7 @@ component extends="baseHandler" { var errorMessage = "Your user needs to reset their password before using the API Services"; prc.response .setErrorMessage( errorMessage, event.STATUS.NOT_ALLOWED ) - .addMessage( - "Please visit #variables.cb.linkAdminLogin()# in order to reset your password." - ); + .addMessage( "Please visit #variables.cb.linkAdminLogin()# in order to reset your password." ); return; } @@ -47,9 +47,7 @@ component extends="baseHandler" { ignoreDefaults = rc.ignoreDefaults ) } ) - .addMessage( - "Bearer token created and it expires in #jwtAuth().getSettings().jwt.expiration# minutes" - ) + .addMessage( "Bearer token created and it expires in #jwtAuth().getSettings().jwt.expiration# minutes" ) .addMessage( "Refresh token created and it expires in #jwtAuth().getSettings().jwt.refreshExpiration# minutes" ); @@ -81,9 +79,7 @@ component extends="baseHandler" { .setData( prc.newTokens ) .addMessage( "Tokens refreshed! The passed in refresh token has been invalidated" ); } catch ( RefreshTokensNotActive e ) { - return event - .getResponse() - .setErrorMessage( "Refresh Tokens Not Active", 404, "Disabled" ); + return event.getResponse().setErrorMessage( "Refresh Tokens Not Active", 404, "Disabled" ); } catch ( TokenNotFoundException e ) { return event .getResponse() diff --git a/resources/Application.cfm b/resources/Application.cfm deleted file mode 100755 index ce5885e51d..0000000000 --- a/resources/Application.cfm +++ /dev/null @@ -1,10 +0,0 @@ - -Not Permitted. - From 7bf62f9500d729d4e203a36b4f97bfec481ac858 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Fri, 3 Dec 2021 14:13:17 -0600 Subject: [PATCH 014/100] CONTENTBOX-1357 #resolve If using the contentbox installer and no database tables are created yet, running the migrations fail due to tables not found --- .../migrations/2020_08_24_150933_v5Upgrade.cfc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/contentbox/migrations/2020_08_24_150933_v5Upgrade.cfc b/modules/contentbox/migrations/2020_08_24_150933_v5Upgrade.cfc index d4de2cf18f..69d816a81c 100755 --- a/modules/contentbox/migrations/2020_08_24_150933_v5Upgrade.cfc +++ b/modules/contentbox/migrations/2020_08_24_150933_v5Upgrade.cfc @@ -26,6 +26,7 @@ component { type = "columns", table = arguments.targetTable ); + if ( qSettingColumns.filter( ( thisRow ) => { // systemOutput( thisRow, true ); @@ -38,7 +39,16 @@ component { } private function isContentBox4(){ - return !hasColumn( "cb_setting", "FK_siteID" ); + try{ + return !hasColumn( "cb_setting", "FK_siteID" ); + } catch( any e ){ + // check if we don't have a database yet. + if( findNoCase( "there is no table", e.message ) ){ + return false; + } else { + rethrow; + } + } } function up( schema, query ){ From c1e1b0b9ded4159304dece1313b38b43a3efc213 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Fri, 3 Dec 2021 16:31:23 -0600 Subject: [PATCH 015/100] CONTENTBOX-1358 #resolve API throwing exception when content objects exist in multiple sites --- .../handlers/baseContentHandler.cfc | 3 ++- .../contentbox-api-v1/handlers/baseHandler.cfc | 17 ++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/baseContentHandler.cfc b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/baseContentHandler.cfc index 37c155f0e0..027c06fc66 100644 --- a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/baseContentHandler.cfc +++ b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/baseContentHandler.cfc @@ -41,11 +41,12 @@ component extends="baseHandler" { } /***************************************************************************/ - /** PRIVATE **/ + /** PRIVATE HELPERS **/ /***************************************************************************/ /** * Shared method for create and update to be DRY + * * @populate Population arguments * @validate Validation arguments * @saveMethod The method to use for saving entities diff --git a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/baseHandler.cfc b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/baseHandler.cfc index 59f08b7213..9c4d65a0bf 100644 --- a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/baseHandler.cfc +++ b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/baseHandler.cfc @@ -81,7 +81,7 @@ component extends="cborm.models.resources.BaseHandler" { // Get by id or slug prc.oEntity = ( variables.useGetOrFail ? variables.ormService.getOrFail( rc.id ) : getByIdOrSlugOrFail( - rc.id + rc.id, prc ) ); @@ -136,7 +136,7 @@ component extends="cborm.models.resources.BaseHandler" { arguments.populate.memento = rc; arguments.populate.model = ( variables.useGetOrFail ? variables.ormService.getOrFail( rc.id ) : getByIdOrSlugOrFail( - rc.id + rc.id, prc ) ); @@ -188,7 +188,7 @@ component extends="cborm.models.resources.BaseHandler" { prc.oEntity = ( variables.useGetOrFail ? variables.ormService.getOrFail( rc.id ) : getByIdOrSlugOrFail( - rc.id + rc.id, prc ) ); @@ -218,18 +218,25 @@ component extends="cborm.models.resources.BaseHandler" { /** * This utility tries to get the incoming resource by id or slug or fails * + * @id The id/slug identifier to retrieve the entity + * @prc The ColdBox PRC + * * @throws EntityNotFound * * @return The found entity */ - private function getByIdOrSlugOrFail( required id ){ - var c = newCriteria(); + private function getByIdOrSlugOrFail( required id, required prc ){ + var c = variables.ormService.newCriteria(); var oEntity = c .$or( // note: id is a shortcut in Hibernate for the Primary Key c.restrictions.isEq( "id", arguments.id ), c.restrictions.isEq( "slug", arguments.id ) ) + // If the site exists, seed it + .when( !isNull( prc.oCurrentSite ), function( c ){ + c.isEq( "site", prc.oCurrentSite ); + } ) .get(); if ( isNull( oEntity ) ) { From e5cde6cd61e45da94f753af4746621a92c0253f1 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Sat, 4 Dec 2021 12:33:45 -0600 Subject: [PATCH 016/100] CONTENTBOX-1358 API throwing exception when content objects exist in multiple sites --- .../modules/contentbox-api-v1/handlers/baseContentHandler.cfc | 4 ++-- .../modules/contentbox-api-v1/handlers/versions.cfc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/baseContentHandler.cfc b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/baseContentHandler.cfc index 027c06fc66..25818d8905 100644 --- a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/baseContentHandler.cfc +++ b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/baseContentHandler.cfc @@ -86,7 +86,7 @@ component extends="baseHandler" { } // Setup Parent if sent! if ( !isNull( rc.parent ) && len( rc.parent ) ) { - rc.parent = getByIdOrSlugOrFail( rc.parent ); + rc.parent = getByIdOrSlugOrFail( rc.parent, prc ); } // slugify the incoming title or slug if ( !isNull( rc.slug ) && len( rc.slug ) ) { @@ -101,7 +101,7 @@ component extends="baseHandler" { arguments.populate.memento = rc; // Check if creation or editing arguments.populate.model = ( - !len( rc.id ) ? variables.ormService.new() : getByIdOrSlugOrFail( rc.id ) + !len( rc.id ) ? variables.ormService.new() : getByIdOrSlugOrFail( rc.id, prc ) ); arguments.populate.nullEmptyInclude = "parent"; arguments.populate.exclude = "contentID,creator,categories,comments,customFields,contentVersions,children,commentSubscriptions"; diff --git a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/versions.cfc b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/versions.cfc index 50ffad2735..2dee3cca02 100644 --- a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/versions.cfc +++ b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/versions.cfc @@ -30,7 +30,7 @@ component prc.oCurrentSite = rc.site = getSiteByIdOrSlugOrFail( rc.site ); prc.contentType = event.getCurrentRouteMeta().contentType; - prc.oRelatedContent = variables.contentService.getByIdOrSlugOrFail( rc.contentIdOrSlug ); + prc.oRelatedContent = variables.contentService.getByIdOrSlugOrFail( rc.contentIdOrSlug, prc ); } /** From 1bb5f8218df9744c42690b59827690423f3e7bab Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Tue, 7 Dec 2021 14:15:16 -0600 Subject: [PATCH 017/100] CONTENTBOX-1352 #resolve Accelerate entity injections by lazy loading all DI injections --- modules/contentbox/models/BaseEntityMethods.cfc | 8 ++++---- modules/contentbox/models/comments/Comment.cfc | 2 +- .../contentbox/models/content/BaseContent.cfc | 16 ++++++++-------- modules/contentbox/models/content/Category.cfc | 15 +++++---------- .../contentbox/models/content/ContentVersion.cfc | 5 ----- modules/contentbox/models/menu/Menu.cfc | 6 +++--- .../contentbox/models/menu/item/BaseMenuItem.cfc | 2 +- .../models/menu/item/ContentMenuItem.cfc | 4 ++-- .../contentbox/models/menu/item/FreeMenuItem.cfc | 2 +- .../contentbox/models/menu/item/JSMenuItem.cfc | 2 +- .../models/menu/item/MediaMenuItem.cfc | 2 +- .../contentbox/models/menu/item/SubMenuItem.cfc | 2 +- .../contentbox/models/menu/item/URLMenuItem.cfc | 2 +- modules/contentbox/models/security/Author.cfc | 4 ++-- modules/contentbox/models/security/Role.cfc | 2 +- .../models/subscriptions/CommentSubscription.cfc | 2 +- 16 files changed, 33 insertions(+), 43 deletions(-) diff --git a/modules/contentbox/models/BaseEntityMethods.cfc b/modules/contentbox/models/BaseEntityMethods.cfc index cb22c1fdd2..3d270e1aea 100644 --- a/modules/contentbox/models/BaseEntityMethods.cfc +++ b/modules/contentbox/models/BaseEntityMethods.cfc @@ -14,22 +14,22 @@ component { property name ="coldbox" - inject ="coldbox" + inject ="provider:coldbox" persistent="false"; property name ="cachebox" - inject ="cachebox" + inject ="provider:cachebox" persistent="false"; property name ="interceptorService" - inject ="coldbox:interceptorService" + inject ="provider:coldbox:interceptorService" persistent="false"; property name ="wirebox" - inject ="wirebox" + inject ="provider:wirebox" persistent="false"; /* ********************************************************************* diff --git a/modules/contentbox/models/comments/Comment.cfc b/modules/contentbox/models/comments/Comment.cfc index a52f614303..6fcdfbe32a 100755 --- a/modules/contentbox/models/comments/Comment.cfc +++ b/modules/contentbox/models/comments/Comment.cfc @@ -21,7 +21,7 @@ component property name ="markdown" - inject ="Processor@cbmarkdown" + inject ="provider:Processor@cbmarkdown" persistent="false"; /* ********************************************************************* diff --git a/modules/contentbox/models/content/BaseContent.cfc b/modules/contentbox/models/content/BaseContent.cfc index a8a55fb98b..cfa9db9614 100644 --- a/modules/contentbox/models/content/BaseContent.cfc +++ b/modules/contentbox/models/content/BaseContent.cfc @@ -21,42 +21,42 @@ component property name ="categoryService" - inject ="categoryService@contentbox" + inject ="provider:categoryService@contentbox" persistent="false"; property name ="contentService" - inject ="contentService@contentbox" + inject ="provider:contentService@contentbox" persistent="false"; property name ="contentVersionService" - inject ="contentVersionService@contentbox" + inject ="provider:contentVersionService@contentbox" persistent="false"; property name ="customFieldService" - inject ="customFieldService@contentbox" + inject ="provider:customFieldService@contentbox" persistent="false"; property name ="i18n" - inject ="i18n@cbi18n" + inject ="provider:i18n@cbi18n" persistent="false"; property name ="JSONPrettyPrint" - inject ="JSONPrettyPrint@JSONPrettyPrint" + inject ="provider:JSONPrettyPrint@JSONPrettyPrint" persistent="false"; property name ="contentboxSettings" - inject ="coldbox:moduleSettings:contentbox" + inject ="provider:coldbox:moduleSettings:contentbox" persistent="false"; property name ="settingService" - inject ="id:settingService@contentbox" + inject ="provider:settingService@contentbox" persistent="false"; /* ********************************************************************* diff --git a/modules/contentbox/models/content/Category.cfc b/modules/contentbox/models/content/Category.cfc index e2dd7f5a51..6b2f7700cf 100755 --- a/modules/contentbox/models/content/Category.cfc +++ b/modules/contentbox/models/content/Category.cfc @@ -20,32 +20,27 @@ component property name ="categoryService" - inject ="categoryService@contentbox" + inject ="provider:categoryService@contentbox" persistent="false"; property name ="pageService" - inject ="pageService@contentbox" + inject ="provider:pageService@contentbox" persistent="false"; property name ="entryService" - inject ="entryService@contentbox" + inject ="provider:entryService@contentbox" persistent="false"; property name ="contentStoreService" - inject ="contentStoreService@contentbox" - persistent="false"; - - property - name ="cachebox" - inject ="cachebox" + inject ="provider:contentStoreService@contentbox" persistent="false"; property name ="settingService" - inject ="settingService@contentbox" + inject ="provider:settingService@contentbox" persistent="false"; /* ********************************************************************* diff --git a/modules/contentbox/models/content/ContentVersion.cfc b/modules/contentbox/models/content/ContentVersion.cfc index cb9c37a3cb..7b46e46e52 100755 --- a/modules/contentbox/models/content/ContentVersion.cfc +++ b/modules/contentbox/models/content/ContentVersion.cfc @@ -19,11 +19,6 @@ component ** DI ********************************************************************* */ - property - name ="interceptorService" - inject ="coldbox:interceptorService" - persistent="false"; - /* ********************************************************************* ** PROPERTIES ********************************************************************* */ diff --git a/modules/contentbox/models/menu/Menu.cfc b/modules/contentbox/models/menu/Menu.cfc index 6fa42438f7..e95be1f4cb 100644 --- a/modules/contentbox/models/menu/Menu.cfc +++ b/modules/contentbox/models/menu/Menu.cfc @@ -20,17 +20,17 @@ component property name ="menuService" - inject ="menuService@contentbox" + inject ="provider:menuService@contentbox" persistent="false"; property name ="menuItemService" - inject ="menuItemService@contentbox" + inject ="provider:menuItemService@contentbox" persistent="false"; property name ="ORMService" - inject ="entityservice" + inject ="provider:entityservice" persistent="false"; /* ********************************************************************* diff --git a/modules/contentbox/models/menu/item/BaseMenuItem.cfc b/modules/contentbox/models/menu/item/BaseMenuItem.cfc index 012ffc429f..8fc3e33fdb 100644 --- a/modules/contentbox/models/menu/item/BaseMenuItem.cfc +++ b/modules/contentbox/models/menu/item/BaseMenuItem.cfc @@ -21,7 +21,7 @@ component property name ="menuItemService" - inject ="menuItemService@contentbox" + inject ="provider:menuItemService@contentbox" persistent="false"; /* ********************************************************************* diff --git a/modules/contentbox/models/menu/item/ContentMenuItem.cfc b/modules/contentbox/models/menu/item/ContentMenuItem.cfc index 412798c472..cc8c3ef25c 100644 --- a/modules/contentbox/models/menu/item/ContentMenuItem.cfc +++ b/modules/contentbox/models/menu/item/ContentMenuItem.cfc @@ -20,11 +20,11 @@ component property name ="provider" persistent="false" - inject ="contentbox.models.menu.providers.ContentProvider"; + inject ="provider:contentbox.models.menu.providers.ContentProvider"; property name ="contentService" persistent="false" - inject ="id:contentService@contentbox"; + inject ="provider:contentService@contentbox"; /* ********************************************************************* ** PROPERTIES diff --git a/modules/contentbox/models/menu/item/FreeMenuItem.cfc b/modules/contentbox/models/menu/item/FreeMenuItem.cfc index 3c472de160..b2a125857f 100644 --- a/modules/contentbox/models/menu/item/FreeMenuItem.cfc +++ b/modules/contentbox/models/menu/item/FreeMenuItem.cfc @@ -20,7 +20,7 @@ component property name ="provider" persistent="false" - inject ="contentbox.models.menu.providers.FreeProvider"; + inject ="provider:contentbox.models.menu.providers.FreeProvider"; /* ********************************************************************* ** PROPERTIES diff --git a/modules/contentbox/models/menu/item/JSMenuItem.cfc b/modules/contentbox/models/menu/item/JSMenuItem.cfc index 7fa3ba1358..06fce7b3e4 100644 --- a/modules/contentbox/models/menu/item/JSMenuItem.cfc +++ b/modules/contentbox/models/menu/item/JSMenuItem.cfc @@ -20,7 +20,7 @@ component property name ="provider" persistent="false" - inject ="contentbox.models.menu.providers.JSProvider"; + inject ="provider:contentbox.models.menu.providers.JSProvider"; /* ********************************************************************* ** PROPERTIES diff --git a/modules/contentbox/models/menu/item/MediaMenuItem.cfc b/modules/contentbox/models/menu/item/MediaMenuItem.cfc index 9e96218a0a..4bdba3c40b 100644 --- a/modules/contentbox/models/menu/item/MediaMenuItem.cfc +++ b/modules/contentbox/models/menu/item/MediaMenuItem.cfc @@ -19,7 +19,7 @@ component property name ="provider" persistent="false" - inject ="contentbox.models.menu.providers.MediaProvider"; + inject ="provider:contentbox.models.menu.providers.MediaProvider"; /* ********************************************************************* ** PROPERTIES diff --git a/modules/contentbox/models/menu/item/SubMenuItem.cfc b/modules/contentbox/models/menu/item/SubMenuItem.cfc index bd0fee6ff1..91bbe668a3 100644 --- a/modules/contentbox/models/menu/item/SubMenuItem.cfc +++ b/modules/contentbox/models/menu/item/SubMenuItem.cfc @@ -19,7 +19,7 @@ component property name ="provider" persistent="false" - inject ="contentbox.models.menu.providers.SubMenuProvider"; + inject ="provider:contentbox.models.menu.providers.SubMenuProvider"; /* ********************************************************************* ** PROPERTIES diff --git a/modules/contentbox/models/menu/item/URLMenuItem.cfc b/modules/contentbox/models/menu/item/URLMenuItem.cfc index 594f72d5c4..52db84f625 100644 --- a/modules/contentbox/models/menu/item/URLMenuItem.cfc +++ b/modules/contentbox/models/menu/item/URLMenuItem.cfc @@ -20,7 +20,7 @@ component property name ="provider" persistent="false" - inject ="contentbox.models.menu.providers.URLProvider"; + inject ="provider:contentbox.models.menu.providers.URLProvider"; /* ********************************************************************* ** PROPERTIES diff --git a/modules/contentbox/models/security/Author.cfc b/modules/contentbox/models/security/Author.cfc index 5aa1ea1061..0d0aa26830 100644 --- a/modules/contentbox/models/security/Author.cfc +++ b/modules/contentbox/models/security/Author.cfc @@ -21,12 +21,12 @@ component property name ="authorService" - inject ="authorService@contentbox" + inject ="provider:authorService@contentbox" persistent="false"; property name ="avatar" - inject ="Avatar@contentbox" + inject ="provider:Avatar@contentbox" persistent="false"; /* ********************************************************************* diff --git a/modules/contentbox/models/security/Role.cfc b/modules/contentbox/models/security/Role.cfc index c12a1076e9..771f40851c 100644 --- a/modules/contentbox/models/security/Role.cfc +++ b/modules/contentbox/models/security/Role.cfc @@ -20,7 +20,7 @@ component property name ="permissionService" - inject ="permissionService@contentbox" + inject ="provider:permissionService@contentbox" persistent="false"; /* ********************************************************************* diff --git a/modules/contentbox/models/subscriptions/CommentSubscription.cfc b/modules/contentbox/models/subscriptions/CommentSubscription.cfc index 119506849e..1af2e55ec0 100644 --- a/modules/contentbox/models/subscriptions/CommentSubscription.cfc +++ b/modules/contentbox/models/subscriptions/CommentSubscription.cfc @@ -21,7 +21,7 @@ component property name ="commentSubscriptionService" - inject ="commentSubscriptionService@contentbox" + inject ="provider:commentSubscriptionService@contentbox" persistent="false"; /* ********************************************************************* From 3eedb2a3f00afca7d97f52f1c964c8e09a0b5f68 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Tue, 7 Dec 2021 14:53:02 -0600 Subject: [PATCH 018/100] CONTENTBOX-1352 - fixing injection issues --- modules/contentbox/models/content/BaseContent.cfc | 2 +- tests/index.cfm | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/modules/contentbox/models/content/BaseContent.cfc b/modules/contentbox/models/content/BaseContent.cfc index cfa9db9614..37f4c3649c 100644 --- a/modules/contentbox/models/content/BaseContent.cfc +++ b/modules/contentbox/models/content/BaseContent.cfc @@ -618,7 +618,7 @@ component */ function onDIComplete(){ // Load up content helpers - variables.contentboxSettings.contentHelpers.each( function( thisHelper ){ + variables.contentboxSettings.$get().contentHelpers.each( function( thisHelper ){ includeMixin( arguments.thisHelper ); } ); } diff --git a/tests/index.cfm b/tests/index.cfm index 1b0300cb68..7fb0840230 100644 --- a/tests/index.cfm +++ b/tests/index.cfm @@ -2,7 +2,7 @@ - + @@ -91,8 +91,15 @@
Contents: #executePath# -

+ + + +
+
+ @@ -119,4 +126,4 @@ - \ No newline at end of file + From 51c4868b0c33fab9effaa74d1c32d6d15f70b92a Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Tue, 7 Dec 2021 16:08:43 -0600 Subject: [PATCH 019/100] CONTENTBOX-1352 --- modules/contentbox/ModuleConfig.cfc | 4 +- .../contentbox/models/content/BaseContent.cfc | 12 ++---- .../models/modules/ModuleService.cfc | 28 +++----------- .../contentbox/models/ui/WidgetService.cfc | 38 +++++++++++-------- 4 files changed, 35 insertions(+), 47 deletions(-) diff --git a/modules/contentbox/ModuleConfig.cfc b/modules/contentbox/ModuleConfig.cfc index f31509af57..754af8665d 100755 --- a/modules/contentbox/ModuleConfig.cfc +++ b/modules/contentbox/ModuleConfig.cfc @@ -76,7 +76,7 @@ component { }; // Async Executors for ContentBox Core - executors = { "contentbox-tasks" : { type : "scheduled", threads : 20 } }; + //executors = { "contentbox-tasks" : { type : "scheduled", threads : 20 } }; // interceptors interceptors = [ @@ -135,8 +135,8 @@ component { */ function onLoad(){ // Create `cb` alias : REMOVE BY CONTENTBOX NEXT MAJOR VERSION + var s = getTickCount(); binder.mapDirectory( packagePath = "contentbox.models", namespace = "@cb" ); - var settingService = wirebox.getInstance( "settingService@contentbox" ); // Pre-flight check settings settingService.preFlightCheck(); // Loadup Config Overrides diff --git a/modules/contentbox/models/content/BaseContent.cfc b/modules/contentbox/models/content/BaseContent.cfc index 37f4c3649c..45f9522bf9 100644 --- a/modules/contentbox/models/content/BaseContent.cfc +++ b/modules/contentbox/models/content/BaseContent.cfc @@ -49,11 +49,6 @@ component inject ="provider:JSONPrettyPrint@JSONPrettyPrint" persistent="false"; - property - name ="contentboxSettings" - inject ="provider:coldbox:moduleSettings:contentbox" - persistent="false"; - property name ="settingService" inject ="provider:settingService@contentbox" @@ -618,9 +613,10 @@ component */ function onDIComplete(){ // Load up content helpers - variables.contentboxSettings.$get().contentHelpers.each( function( thisHelper ){ - includeMixin( arguments.thisHelper ); - } ); + variables.wirebox.getInstance( dsl : "coldbox:moduleSettings:contentbox" ) + .contentHelpers.each( function( thisHelper ){ + includeMixin( arguments.thisHelper ); + } ); } diff --git a/modules/contentbox/models/modules/ModuleService.cfc b/modules/contentbox/models/modules/ModuleService.cfc index b3b0580408..9aac2d5606 100644 --- a/modules/contentbox/models/modules/ModuleService.cfc +++ b/modules/contentbox/models/modules/ModuleService.cfc @@ -187,10 +187,7 @@ component var thisInvocationPath = variables[ arguments.type & "ModulesInvocationPath" ]; if ( fileExists( thisPath & "/#arguments.name#/ModuleConfig.cfc" ) ) { - var oConfig = createObject( - "component", - thisInvocationPath & ".#arguments.name#.ModuleConfig" - ); + var oConfig = createObject( "component", thisInvocationPath & ".#arguments.name#.ModuleConfig" ); var oModule = new ( { name : arguments.name, moduleType : arguments.type } ); save( populateModule( oModule, oConfig ) ); @@ -226,10 +223,7 @@ component try { config.onDeactivate(); } catch ( Any e ) { - log.error( - "Error deactivating module: #arguments.name# with #e.message & e.detail#", - e - ); + log.error( "Error deactivating module: #arguments.name# with #e.message & e.detail#", e ); // dont' throw. just log and continue deactivating modules. } } @@ -314,10 +308,7 @@ component var moduleEntry = variables.moduleMap[ arguments.name ]; // Try to do an onDelete() callback. - var oConfig = createObject( - "component", - moduleEntry.invocationPath & ".#name#.ModuleConfig" - ); + var oConfig = createObject( "component", moduleEntry.invocationPath & ".#name#.ModuleConfig" ); if ( structKeyExists( oConfig, "onDelete" ) ) { oConfig.onDelete(); } @@ -387,12 +378,7 @@ component } // If we get here, the module is loaded in the database now - if ( - oModule.getIsActive() AND !structKeyExists( - variables.moduleRegistry, - arguments.name - ) - ) { + if ( oModule.getIsActive() AND !structKeyExists( variables.moduleRegistry, arguments.name ) ) { // Register with ColdBox now variables.coldboxModuleService.registerModule( moduleName = arguments.name, @@ -468,9 +454,7 @@ component // Deactivate it, not fond in registry, might be an orphaned record if ( log.canWarn() ) { - log.warn( - "Orphaned module discovered: #thisModule.getName()#, deactiving it from the database" - ); + log.warn( "Orphaned module discovered: #thisModule.getName()#, deactiving it from the database" ); } deactivateModule( thisModule.getName() ); return false; @@ -498,7 +482,7 @@ component } ); // Force Reload all widgets - widgetService.getWidgets( reload = true ); + variables.widgetService.getWidgets( reload = true ); return this; } diff --git a/modules/contentbox/models/ui/WidgetService.cfc b/modules/contentbox/models/ui/WidgetService.cfc index 9d1e5c2c3b..317c5124c3 100644 --- a/modules/contentbox/models/ui/WidgetService.cfc +++ b/modules/contentbox/models/ui/WidgetService.cfc @@ -175,15 +175,16 @@ component accessors="true" singleton threadSafe { variables[ arguments.type & "widgetsMap" ][ widgetName ] = invocationPath; try { + var oWidget = getWidget( widgetName, arguments.type ); querySetCell( arguments.qRecords, "category", - getWidgetCategory( widgetName, arguments.type ) + getWidgetCategory( oWidget, arguments.type ) ); querySetCell( arguments.qRecords, "icon", - getWidgetIcon( widgetName, arguments.type ) + getWidgetIcon( oWidget, arguments.type ) ); } catch ( any e ) { log.error( "Error creating #arguments.type# widget: #widgetName#", e ); @@ -229,15 +230,16 @@ component accessors="true" singleton threadSafe { ); try { + var oWidget = getWidget( widgetName, arguments.type ); querySetCell( arguments.qRecords, "category", - getWidgetCategory( name = widget, type = "module" ) + getWidgetCategory( name = oWidget, type = "module" ) ); querySetCell( arguments.qRecords, "icon", - getWidgetIcon( name = widget, type = "module" ) + getWidgetIcon( name = oWidget, type = "module" ) ); } catch ( any e ) { log.error( "Error creating module (#moduleName#) widget: #widgetName#", e ); @@ -280,15 +282,16 @@ component accessors="true" singleton threadSafe { ); try { + var oWidget = getWidget( widget, "theme" ); querySetCell( qRecords, "category", - getWidgetCategory( name = widget, type = "theme" ) + getWidgetCategory( name = oWidget, type = "theme" ) ); querySetCell( qRecords, "icon", - getWidgetIcon( name = widget, type = "theme" ) + getWidgetIcon( name = oWidget, type = "theme" ) ); } catch ( any e ) { log.error( "Error creating theme (#thisRecord.theme#) widget: #widget#", e ); @@ -386,10 +389,7 @@ component accessors="true" singleton threadSafe { if ( len( widgetPath ) ) { // Init Arguments added for backwards compat - return wirebox.getInstance( - name = widgetPath, - initArguments = { "controller" : variables.coldbox } - ); + return wirebox.getInstance( name = widgetPath, initArguments = { "controller" : variables.coldbox } ); } else { throw( message = "The widget (#arguments.name#) could not be located anywhere.", @@ -401,12 +401,16 @@ component accessors="true" singleton threadSafe { /** * Get a widget icon representation * - * @name The name of the widget + * @name The name of the widget or the widget instance * @type This can be one of the following: core, theme, module */ string function getWidgetIcon( required name, required string type = "core" ){ - var widget = getWidget( argumentCollection = arguments ); - var icon = widget.getIcon(); + if ( isSimpleValue( arguments.name ) ) { + var widget = getWidget( argumentCollection = arguments ); + } else { + var widget = arguments.name; + } + var icon = widget.getIcon(); if ( isNull( icon ) || icon == "" ) { switch ( type ) { case "theme": @@ -426,11 +430,15 @@ component accessors="true" singleton threadSafe { /** * Get a widget category * - * @name The name of the widget + * @name The name of the widget or the actual widget object * @type This can be one of the following: core, theme, module */ string function getWidgetCategory( required name, required string type = "core" ){ - var widget = getWidget( argumentCollection = arguments ); + if ( isSimpleValue( arguments.name ) ) { + var widget = getWidget( argumentCollection = arguments ); + } else { + widget = arguments.name; + } var category = widget.getCategory(); if ( isNull( category ) || category == "" ) { switch ( type ) { From a7ecce7ea7372427318712a0ee2583679b6f8218 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Tue, 7 Dec 2021 16:16:48 -0600 Subject: [PATCH 020/100] cfformating --- .../contentbox-admin/handlers/authors.cfc | 71 ++++--------------- .../handlers/baseContentHandler.cfc | 60 ++++------------ .../contentbox-admin/handlers/baseHandler.cfc | 4 +- .../contentbox-admin/handlers/categories.cfc | 25 ++----- .../contentbox-admin/handlers/comments.cfc | 25 ++----- .../contentbox-admin/handlers/content.cfc | 13 +--- .../contentbox-admin/handlers/dashboard.cfc | 13 +--- .../contentbox-admin/handlers/menus.cfc | 14 +--- .../contentbox-admin/handlers/modules.cfc | 4 +- .../handlers/permissionGroups.cfc | 25 ++----- .../contentbox-admin/handlers/permissions.cfc | 20 ++---- .../contentbox-admin/handlers/roles.cfc | 16 ++--- .../handlers/securityRules.cfc | 18 ++--- .../contentbox-admin/handlers/settings.cfc | 14 +--- .../contentbox-admin/handlers/sites.cfc | 8 +-- .../contentbox-admin/handlers/tools.cfc | 8 +-- .../contentbox-admin/handlers/versions.cfc | 5 +- .../contentbox-admin/handlers/widgets.cfc | 5 +- .../interceptors/CBRequest.cfc | 29 +++----- .../interceptors/MenuCleanup.cfc | 8 +-- .../UnenrollTwoFactorOnProviderChange.cfc | 4 +- .../contentbox-ckeditor/models/CKEditor.cfc | 20 ++---- .../contentbox-filebrowser/ModuleConfig.cfc | 5 +- .../contentbox-filebrowser/handlers/Home.cfc | 46 +++--------- .../ModuleConfig.cfc | 4 +- .../models/MarkdownEditor.cfc | 4 +- .../contentbox-security/handlers/security.cfc | 38 +++------- .../handlers/twofactor.cfc | 10 +-- .../ModuleConfig.cfc | 4 +- .../models/EmailTwoFactorProvider.cfc | 5 +- .../handlers/baseContentHandler.cfc | 19 ++--- .../handlers/baseHandler.cfc | 22 ++---- .../modules/contentbox-ui/handlers/blog.cfc | 44 +++--------- .../contentbox-ui/handlers/content.cfc | 37 +++------- .../modules/contentbox-ui/handlers/media.cfc | 10 +-- .../modules/contentbox-ui/handlers/page.cfc | 20 ++---- .../contentbox-ui/handlers/subscription.cfc | 8 +-- .../interceptors/SimpleSecurity.cfc | 13 +--- 38 files changed, 161 insertions(+), 537 deletions(-) diff --git a/modules/contentbox/modules/contentbox-admin/handlers/authors.cfc b/modules/contentbox/modules/contentbox-admin/handlers/authors.cfc index 1bd2107a88..7f6e2ad5a0 100755 --- a/modules/contentbox/modules/contentbox-admin/handlers/authors.cfc +++ b/modules/contentbox/modules/contentbox-admin/handlers/authors.cfc @@ -250,9 +250,7 @@ component extends="baseHandler" { ); // announce event announce( "cbadmin_onPasswordReset", { author : oAuthor } ); - cbMessagebox.info( - "Author marked for password reset upon login and email notification sent!" - ); + cbMessagebox.info( "Author marked for password reset upon login and email notification sent!" ); } else { cbMessagebox.error( "Invalid Author Sent!" ); } @@ -479,24 +477,15 @@ component extends="baseHandler" { // Store Preferences oAuthor.setPreferences( allPreferences ); // announce event - announce( - "cbadmin_preAuthorPreferencesSave", - { author : oAuthor, preferences : allPreferences } - ); + announce( "cbadmin_preAuthorPreferencesSave", { author : oAuthor, preferences : allPreferences } ); // save Author variables.authorService.save( oAuthor ); // announce event - announce( - "cbadmin_postAuthorPreferencesSave", - { author : oAuthor, preferences : allPreferences } - ); + announce( "cbadmin_postAuthorPreferencesSave", { author : oAuthor, preferences : allPreferences } ); // message cbMessagebox.setMessage( "info", "Author Preferences Saved!" ); // relocate - relocate( - event = prc.xehAuthorEditor, - queryString = "authorID=#oAuthor.getAuthorID()###preferences" - ); + relocate( event = prc.xehAuthorEditor, queryString = "authorID=#oAuthor.getAuthorID()###preferences" ); } /** @@ -505,40 +494,25 @@ component extends="baseHandler" { function saveRawPreferences( event, rc, prc ){ var oAuthor = authorService.get( id = rc.authorID ); // Validate raw preferences - var vResult = validate( - target = rc, - constraints = { preferences : { required : true, type : "json" } } - ); + var vResult = validate( target = rc, constraints = { preferences : { required : true, type : "json" } } ); if ( !vResult.hasErrors() ) { // store preferences oAuthor.setPreferences( rc.preferences ); // announce event - announce( - "cbadmin_preAuthorPreferencesSave", - { author : oAuthor, preferences : rc.preferences } - ); + announce( "cbadmin_preAuthorPreferencesSave", { author : oAuthor, preferences : rc.preferences } ); // save Author variables.authorService.save( oAuthor ); // announce event - announce( - "cbadmin_postAuthorPreferencesSave", - { author : oAuthor, preferences : rc.preferences } - ); + announce( "cbadmin_postAuthorPreferencesSave", { author : oAuthor, preferences : rc.preferences } ); // message cbMessagebox.setMessage( "info", "Author Preferences Saved!" ); // relocate - relocate( - event = prc.xehAuthorEditor, - queryString = "authorID=#oAuthor.getAuthorID()###preferences" - ); + relocate( event = prc.xehAuthorEditor, queryString = "authorID=#oAuthor.getAuthorID()###preferences" ); } else { // message cbMessagebox.error( vResult.getAllErrors() ); // relocate - relocate( - event = prc.xehAuthorEditor, - queryString = "authorID=#oAuthor.getAuthorID()###preferences" - ); + relocate( event = prc.xehAuthorEditor, queryString = "authorID=#oAuthor.getAuthorID()###preferences" ); } } @@ -559,10 +533,7 @@ component extends="baseHandler" { } // validate it - var vResults = validate( - target = oAuthor, - excludes = ( structKeyExists( rc, "password" ) ? "" : "password" ) - ); + var vResults = validate( target = oAuthor, excludes = ( structKeyExists( rc, "password" ) ? "" : "password" ) ); if ( !vResults.hasErrors() ) { // announce event announce( @@ -583,10 +554,7 @@ component extends="baseHandler" { relocate( prc.xehAuthors ); } else { cbMessagebox.warn( vResults.getAllErrors() ); - relocate( - event = prc.xehAuthorEditor, - queryString = "authorID=#oAuthor.getAuthorID()#" - ); + relocate( event = prc.xehAuthorEditor, queryString = "authorID=#oAuthor.getAuthorID()#" ); } } @@ -595,9 +563,7 @@ component extends="baseHandler" { */ function passwordChange( event, rc, prc ){ if ( prc.oCurrentAuthor.getAuthorID() != rc.authorID ) { - cbMessagebox.error( - "You cannot change passwords for other users. Please start a password reset instead." - ); + cbMessagebox.error( "You cannot change passwords for other users. Please start a password reset instead." ); return relocate( event = prc.xehAuthorEditor, queryString = "authorID=#rc.authorID#" ); } var oAuthor = authorService.get( id = rc.authorID ); @@ -608,10 +574,7 @@ component extends="baseHandler" { oAuthor.setPassword( rc.password ); variables.authorService.save( author = oAuthor, passwordChange = true ); // announce event - announce( - "cbadmin_onAuthorPasswordChange", - { author : oAuthor, password : rc.password } - ); + announce( "cbadmin_onAuthorPasswordChange", { author : oAuthor, password : rc.password } ); // message cbMessagebox.info( "Password Updated!" ); } else { @@ -766,9 +729,7 @@ component extends="baseHandler" { .map( function( id ){ return variables.authorService .get( arguments.id ) - .getMemento( - includes: "permissions,permissionGroups,isPasswordReset,is2FactorAuth" - ); + .getMemento( includes: "permissions,permissionGroups,isPasswordReset,is2FactorAuth" ); } ); } else { return variables.authorService.getAllForExport(); @@ -790,9 +751,7 @@ component extends="baseHandler" { cbMessagebox.info( "Users imported sucessfully!" ); flash.put( "importLog", importLog ); } else { - cbMessagebox.error( - "The import file is invalid: #rc.importFile# cannot continue with import" - ); + cbMessagebox.error( "The import file is invalid: #rc.importFile# cannot continue with import" ); } } catch ( any e ) { var errorMessage = "Error importing file: #e.message# #e.detail# #e.stackTrace#"; diff --git a/modules/contentbox/modules/contentbox-admin/handlers/baseContentHandler.cfc b/modules/contentbox/modules/contentbox-admin/handlers/baseContentHandler.cfc index 33d339e0db..083967ded5 100644 --- a/modules/contentbox/modules/contentbox-admin/handlers/baseContentHandler.cfc +++ b/modules/contentbox/modules/contentbox-admin/handlers/baseContentHandler.cfc @@ -217,19 +217,14 @@ component extends="baseHandler" { // check if id list has length if ( len( rc.contentID ) ) { - variables.ormService.bulkPublishStatus( - contentID: rc.contentID, - status : rc.contentStatus - ); + variables.ormService.bulkPublishStatus( contentID: rc.contentID, status: rc.contentStatus ); // announce event announce( "cbadmin_on#variables.entity#StatusUpdate", { contentID : rc.contentID, status : rc.contentStatus } ); // Message - variables.cbMessageBox.info( - "#listLen( rc.contentID )# content where set to '#rc.contentStatus#'" - ); + variables.cbMessageBox.info( "#listLen( rc.contentID )# content where set to '#rc.contentStatus#'" ); } else { variables.cbMessageBox.warn( "No content selected!" ); } @@ -287,20 +282,15 @@ component extends="baseHandler" { // Get User's default editor prc.defaultEditor = getUserDefaultEditor( prc.oCurrentAuthor ); // Check if the markup matches the choosen editor - if ( - listFindNoCase( "markdown,json", prc.oContent.getMarkup() ) && prc.defaultEditor != "simplemde" - ) { + if ( listFindNoCase( "markdown,json", prc.oContent.getMarkup() ) && prc.defaultEditor != "simplemde" ) { prc.defaultEditor = "simplemde"; } // Get the editor driver object - prc.oEditorDriver = variables.editorService.getEditor( prc.defaultEditor ); + prc.oEditorDriver = variables.editorService.getEditor( prc.defaultEditor ); // Get All registered markups so we can display them - prc.markups = variables.editorService.getRegisteredMarkups(); + prc.markups = variables.editorService.getRegisteredMarkups(); // Get User's default markup - prc.defaultMarkup = prc.oCurrentAuthor.getPreference( - "markup", - variables.editorService.getDefaultMarkup() - ); + prc.defaultMarkup = prc.oCurrentAuthor.getPreference( "markup", variables.editorService.getDefaultMarkup() ); // get all authors prc.authors = variables.authorService.getAll( sortOrder = "lastName" ); // get related content @@ -476,10 +466,7 @@ component extends="baseHandler" { // relocate variables.cbMessageBox.info( "Page Saved!" ); if ( oContent.hasParent() ) { - relocate( - event = arguments.relocateTo, - querystring = "parent=#oContent.getParent().getContentID()#" - ); + relocate( event = arguments.relocateTo, querystring = "parent=#oContent.getParent().getContentID()#" ); } else { relocate( event = arguments.relocateTo ); } @@ -497,9 +484,7 @@ component extends="baseHandler" { // validation if ( !event.valueExists( "title" ) OR !event.valueExists( "contentID" ) ) { - variables.cbMessageBox.warn( - "Can't clone the unclonable, meaning no contentID or title passed." - ); + variables.cbMessageBox.warn( "Can't clone the unclonable, meaning no contentID or title passed." ); relocate( arguments.relocateTo ); return; } @@ -522,9 +507,7 @@ component extends="baseHandler" { // attach to the original's parent. if ( original.hasParent() ) { - clone - .setParent( original.getParent() ) - .setSlug( original.getSlug() & "/" & clone.getSlug() ); + clone.setParent( original.getParent() ).setSlug( original.getSlug() & "/" & clone.getSlug() ); } // prepare descendants for cloning, might take a while if lots of children to copy. @@ -545,10 +528,7 @@ component extends="baseHandler" { // Relocate if ( original.hasParent() ) { - relocate( - event = arguments.relocateTo, - querystring = "parent=#original.getParent().getContentID()#" - ); + relocate( event = arguments.relocateTo, querystring = "parent=#original.getParent().getContentID()#" ); } else { relocate( event = arguments.relocateTo ); } @@ -577,10 +557,7 @@ component extends="baseHandler" { for ( var thisContentID in rc.contentID ) { var oContent = variables.ormService.get( thisContentID ); if ( isNull( oContent ) ) { - arrayAppend( - messages, - "Invalid contentID sent: #thisContentID#, so skipped removal" - ); + arrayAppend( messages, "Invalid contentID sent: #thisContentID#, so skipped removal" ); } else { // GET id to be sent for announcing later var contentID = oContent.getContentID(); @@ -666,9 +643,7 @@ component extends="baseHandler" { * @return json */ function export( event, rc, prc ){ - return variables.ormService - .get( event.getValue( "contentID", 0 ) ) - .getMemento( profile: "export" ); + return variables.ormService.get( event.getValue( "contentID", 0 ) ).getMemento( profile: "export" ); } /** @@ -765,10 +740,8 @@ component extends="baseHandler" { prc.contentPager_id = createUUID(); // prepare paging object - prc.contentPager_oPaging = getInstance( "Paging@contentbox" ); - prc.contentPager_paging = prc.contentPager_oPaging.getBoundaries( - page: rc.contentPager_page - ); + prc.contentPager_oPaging = getInstance( "Paging@contentbox" ); + prc.contentPager_paging = prc.contentPager_oPaging.getBoundaries( page: rc.contentPager_page ); prc.contentPager_pagingLink = "javascript:pagerLink(@page@)"; prc.contentPager_pagination = arguments.pagination; @@ -815,10 +788,7 @@ component extends="baseHandler" { */ private function getUserDefaultEditor( required author ){ // get user default editor - var userEditor = arguments.author.getPreference( - "editor", - editorService.getDefaultEditor() - ); + var userEditor = arguments.author.getPreference( "editor", editorService.getDefaultEditor() ); // verify if editor exists if ( editorService.hasEditor( userEditor ) ) { diff --git a/modules/contentbox/modules/contentbox-admin/handlers/baseHandler.cfc b/modules/contentbox/modules/contentbox-admin/handlers/baseHandler.cfc index bb2c07bb39..45561aa3c8 100755 --- a/modules/contentbox/modules/contentbox-admin/handlers/baseHandler.cfc +++ b/modules/contentbox/modules/contentbox-admin/handlers/baseHandler.cfc @@ -26,9 +26,7 @@ component extends="coldbox.system.RestHandler" { * @return The max rows to return for pagination */ private numeric function getMaxRows( maxRows ){ - var results = isNull( arguments.maxRows ) ? variables.settingService.getSetting( - "cb_paging_maxrows" - ) : arguments.maxRows; + var results = isNull( arguments.maxRows ) ? variables.settingService.getSetting( "cb_paging_maxrows" ) : arguments.maxRows; return val( results ); } diff --git a/modules/contentbox/modules/contentbox-admin/handlers/categories.cfc b/modules/contentbox/modules/contentbox-admin/handlers/categories.cfc index 59cc066c11..06482c0f48 100755 --- a/modules/contentbox/modules/contentbox-admin/handlers/categories.cfc +++ b/modules/contentbox/modules/contentbox-admin/handlers/categories.cfc @@ -86,19 +86,15 @@ component extends="baseHandler" { } // Pop/Get/Set - var oCategory = populateModel( - model : variables.categoryService.get( rc.categoryID ), - exclude: "categoryID" - ).setSite( prc.oCurrentSite ); + var oCategory = populateModel( model: variables.categoryService.get( rc.categoryID ), exclude: "categoryID" ).setSite( + prc.oCurrentSite + ); // Validation Results var vResults = validate( oCategory ); if ( !vResults.hasErrors() ) { // announce event - announce( - "cbadmin_preCategorySave", - { category : oCategory, categoryID : rc.categoryID } - ); + announce( "cbadmin_preCategorySave", { category : oCategory, categoryID : rc.categoryID } ); // save category variables.categoryService.save( oCategory ); // announce event @@ -145,10 +141,7 @@ component extends="baseHandler" { var categoryID = category.getCategoryID(); var title = category.getSlug(); // announce event - announce( - "cbadmin_preCategoryRemove", - { category : category, categoryID : categoryID } - ); + announce( "cbadmin_preCategoryRemove", { category : category, categoryID : categoryID } ); // Delete category via service variables.categoryService.delete( category ); arrayAppend( messages, "Category '#title#' removed" ); @@ -178,9 +171,7 @@ component extends="baseHandler" { return rc.categoryID .listToArray() .map( function( id ){ - return variables.categoryService - .get( arguments.id ) - .getMemento( profile: "export" ); + return variables.categoryService.get( arguments.id ).getMemento( profile: "export" ); } ); } else { return variables.categoryService.getAllForExport( prc.oCurrentSite ); @@ -202,9 +193,7 @@ component extends="baseHandler" { cbMessagebox.info( "Categories imported sucessfully!" ); flash.put( "importLog", importLog ); } else { - cbMessagebox.error( - "The import file is invalid: #rc.importFile# cannot continue with import" - ); + cbMessagebox.error( "The import file is invalid: #rc.importFile# cannot continue with import" ); } } catch ( any e ) { var errorMessage = "Error importing file: #e.message# #e.detail# #e.stackTrace#"; diff --git a/modules/contentbox/modules/contentbox-admin/handlers/comments.cfc b/modules/contentbox/modules/contentbox-admin/handlers/comments.cfc index c4fe838fba..70a102c013 100755 --- a/modules/contentbox/modules/contentbox-admin/handlers/comments.cfc +++ b/modules/contentbox/modules/contentbox-admin/handlers/comments.cfc @@ -108,10 +108,7 @@ component extends="baseHandler" { if ( len( rc.commentID ) ) { commentService.bulkStatus( commentID = rc.commentID, status = rc.commentStatus ); // announce event - announce( - "cbadmin_onCommentStatusUpdate", - { commentID : rc.commentID, status : rc.commentStatus } - ); + announce( "cbadmin_onCommentStatusUpdate", { commentID : rc.commentID, status : rc.commentStatus } ); // Message data.messages = "#listLen( rc.commentID )# Comment(s) #rc.commentStatus#d"; cbMessagebox.info( data.messages ); @@ -193,10 +190,7 @@ component extends="baseHandler" { */ function save( event, rc, prc ){ // populate and get comment - var oComment = populateModel( - model : commentService.get( id = rc.commentID ), - exclude: "commentID" - ); + var oComment = populateModel( model: commentService.get( id = rc.commentID ), exclude: "commentID" ); // announce event announce( "cbadmin_preCommentSave", { comment : oComment, commentID : rc.commentID } ); // save comment @@ -261,16 +255,10 @@ component extends="baseHandler" { var oComment = commentService.get( thisCommentID ); // null checks if ( isNull( oComment ) ) { - arrayAppend( - data.messages, - "Invalid commentID sent: #thisCommentID#, so skipped removal" - ); + arrayAppend( data.messages, "Invalid commentID sent: #thisCommentID#, so skipped removal" ); } else { // announce event - announce( - "cbadmin_preCommentRemove", - { comment : oComment, commentID : thisCommentID } - ); + announce( "cbadmin_preCommentRemove", { comment : oComment, commentID : thisCommentID } ); // remove commentService.delete( oComment ); arrayAppend( data.messages, "Comment #thisCommentID# removed" ); @@ -382,10 +370,7 @@ component extends="baseHandler" { */ function saveSettings( event, rc, prc ){ // announce event - announce( - "cbadmin_preCommentSettingsSave", - { oldSettings : prc.cbSettings, newSettings : rc } - ); + announce( "cbadmin_preCommentSettingsSave", { oldSettings : prc.cbSettings, newSettings : rc } ); // bulk save the options settingsService.bulkSave( rc.filter( function( key ){ diff --git a/modules/contentbox/modules/contentbox-admin/handlers/content.cfc b/modules/contentbox/modules/contentbox-admin/handlers/content.cfc index ea2920c51e..a56664f594 100755 --- a/modules/contentbox/modules/contentbox-admin/handlers/content.cfc +++ b/modules/contentbox/modules/contentbox-admin/handlers/content.cfc @@ -92,10 +92,7 @@ component extends="baseHandler" { // Search for Authors if ( !len( prc.context ) || listFindNoCase( "author", prc.context ) ) { - prc.authors = authorService.search( - searchTerm: rc.search, - max : prc.cbSettings.cb_admin_quicksearch_max - ); + prc.authors = authorService.search( searchTerm: rc.search, max: prc.cbSettings.cb_admin_quicksearch_max ); prc.minAuthorCount = ( prc.authors.count lt prc.cbSettings.cb_admin_quicksearch_max ? prc.authors.count : prc.cbSettings.cb_admin_quicksearch_max ); @@ -240,9 +237,7 @@ component extends="baseHandler" { // Reset Hits .each( function( thisContent ){ variables.contentService.save( arguments.thisContent.getStats().setHits( 0 ) ); - event - .getResponse() - .addMessage( "Hits reset for (#arguments.thisContent.getTitle()#)" ); + event.getResponse().addMessage( "Hits reset for (#arguments.thisContent.getTitle()#)" ); } ); } @@ -351,9 +346,7 @@ component extends="baseHandler" { } // Future Published Content else { - aContent = variables.contentService.findFuturePublishedContent( - argumentCollection = args - ); + aContent = variables.contentService.findFuturePublishedContent( argumentCollection = args ); } // view pager diff --git a/modules/contentbox/modules/contentbox-admin/handlers/dashboard.cfc b/modules/contentbox/modules/contentbox-admin/handlers/dashboard.cfc index 1de5d8bc8c..2952b90352 100755 --- a/modules/contentbox/modules/contentbox-admin/handlers/dashboard.cfc +++ b/modules/contentbox/modules/contentbox-admin/handlers/dashboard.cfc @@ -178,10 +178,7 @@ component extends="baseHandler" { max : prc.cbSettings.cb_dashboard_recentComments, pagination : false }; - prc.commentsViewlet = runEvent( - event = "contentbox-admin:comments.pager", - eventArguments = eArgs - ); + prc.commentsViewlet = runEvent( event = "contentbox-admin:comments.pager", eventArguments = eArgs ); event.setView( view = "dashboard/latestComments", layout = "ajax" ); } @@ -214,9 +211,7 @@ component extends="baseHandler" { * @return html */ function latestLogins( event, rc, prc ){ - prc.lastLogins = loginTrackerService.getLastLogins( - max = prc.cbsettings.cb_security_blocktime - ); + prc.lastLogins = loginTrackerService.getLastLogins( max = prc.cbsettings.cb_security_blocktime ); event.setView( view = "dashboard/latestLogins", layout = "ajax" ); } @@ -297,9 +292,7 @@ component extends="baseHandler" { event.renderData( type = "json", data = data ); } else { // MessageBox - cbMessagebox.error( - "Error running admin reload module action: #e.message# #e.detail#" - ); + cbMessagebox.error( "Error running admin reload module action: #e.message# #e.detail#" ); // relocate back to dashboard relocate( prc.xehDashboard ); } diff --git a/modules/contentbox/modules/contentbox-admin/handlers/menus.cfc b/modules/contentbox/modules/contentbox-admin/handlers/menus.cfc index bccd98ac4c..c75991486b 100644 --- a/modules/contentbox/modules/contentbox-admin/handlers/menus.cfc +++ b/modules/contentbox/modules/contentbox-admin/handlers/menus.cfc @@ -82,10 +82,7 @@ component extends="baseHandler" { var data = { "UNIQUE" : false }; // check slug if something is passed in if ( len( rc.slug ) ) { - data[ "UNIQUE" ] = variables.menuService.isSlugUnique( - trim( rc.slug ), - trim( rc.menuID ) - ); + data[ "UNIQUE" ] = variables.menuService.isSlugUnique( trim( rc.slug ), trim( rc.menuID ) ); } // render result event.renderData( data = data, type = "json" ); @@ -219,10 +216,7 @@ component extends="baseHandler" { // populate items from form oMenu.populateMenuItems( rawData = deserializeJSON( rc.menuItems ) ); // render data - event.renderData( - data = variables.cbHelper.buildProviderMenu( menu = oMenu ), - type = "text" - ); + event.renderData( data = variables.cbHelper.buildProviderMenu( menu = oMenu ), type = "text" ); } /** @@ -307,9 +301,7 @@ component extends="baseHandler" { cbMessagebox.info( "Menus imported sucessfully!" ); flash.put( "importLog", importLog ); } else { - cbMessagebox.error( - "The import file is invalid: #rc.importFile# cannot continue with import" - ); + cbMessagebox.error( "The import file is invalid: #rc.importFile# cannot continue with import" ); } } catch ( any e ) { var errorMessage = "Error importing file: #e.message# #e.detail# #e.stackTrace#"; diff --git a/modules/contentbox/modules/contentbox-admin/handlers/modules.cfc b/modules/contentbox/modules/contentbox-admin/handlers/modules.cfc index bd8d1d7133..a0ff542a4c 100755 --- a/modules/contentbox/modules/contentbox-admin/handlers/modules.cfc +++ b/modules/contentbox/modules/contentbox-admin/handlers/modules.cfc @@ -48,9 +48,7 @@ component extends="baseHandler" { // Check if route is discovered, basically if we get handler => contentbox-ui:page then it was not found if ( routeResults.route.handler == "contentbox-ui:page" ) { - cbMessagebox.warn( - "No module where found with the incoming route: #encodeForHTML( routedURL )#" - ); + cbMessagebox.warn( "No module where found with the incoming route: #encodeForHTML( routedURL )#" ); return relocate( prc.xehModules ); } diff --git a/modules/contentbox/modules/contentbox-admin/handlers/permissionGroups.cfc b/modules/contentbox/modules/contentbox-admin/handlers/permissionGroups.cfc index c5be19a9bb..0b3d6a7ee3 100755 --- a/modules/contentbox/modules/contentbox-admin/handlers/permissionGroups.cfc +++ b/modules/contentbox/modules/contentbox-admin/handlers/permissionGroups.cfc @@ -71,10 +71,7 @@ component extends="baseHandler" { var vResults = validate( oGroup ); if ( !vResults.hasErrors() ) { // announce event - announce( - "cbadmin_prePermissionGroupSave", - { group : oGroup, permissionGroupID : rc.permissionGroupID } - ); + announce( "cbadmin_prePermissionGroupSave", { group : oGroup, permissionGroupID : rc.permissionGroupID } ); // save group permissionGroupService.save( oGroup ); // announce event @@ -103,10 +100,7 @@ component extends="baseHandler" { // finally delete permissionGroupService.delete( oGroup ); // announce event - announce( - "cbadmin_postPermissionGroupRemove", - { permissionGroupID : rc.permissionGroupID } - ); + announce( "cbadmin_postPermissionGroupRemove", { permissionGroupID : rc.permissionGroupID } ); // Message cbMessagebox.setMessage( "info", "Permission Group Removed!" ); // relocate @@ -122,12 +116,9 @@ component extends="baseHandler" { // Get or fail prc.oGroup = variables.permissionGroupService.get( rc.permissionGroupID ); // Load permissions - prc.aPermissions = variables.permissionService.list( - sortOrder = "permission", - asQuery = false - ); + prc.aPermissions = variables.permissionService.list( sortOrder = "permission", asQuery = false ); // Exit handlers - prc.xehGroupSave = "#prc.cbAdminEntryPoint#.permissionGroups.save"; + prc.xehGroupSave = "#prc.cbAdminEntryPoint#.permissionGroups.save"; // View event.setView( "permissionGroups/editor" ); } @@ -136,9 +127,7 @@ component extends="baseHandler" { * Export a permission group */ function export( event, rc, prc ){ - return variables.permissionGroupService - .get( event.getValue( "permissionGroupID", 0 ) ) - .getMemento(); + return variables.permissionGroupService.get( event.getValue( "permissionGroupID", 0 ) ).getMemento(); } /** @@ -151,9 +140,7 @@ component extends="baseHandler" { return rc.permissionGroupID .listToArray() .map( function( id ){ - return variables.permissionGroupService - .get( arguments.id ) - .getMemento( profile: "export" ); + return variables.permissionGroupService.get( arguments.id ).getMemento( profile: "export" ); } ); } else { return variables.permissionGroupService.getAllForExport(); diff --git a/modules/contentbox/modules/contentbox-admin/handlers/permissions.cfc b/modules/contentbox/modules/contentbox-admin/handlers/permissions.cfc index 191ce8c376..c4622fce0f 100755 --- a/modules/contentbox/modules/contentbox-admin/handlers/permissions.cfc +++ b/modules/contentbox/modules/contentbox-admin/handlers/permissions.cfc @@ -58,19 +58,13 @@ component extends="baseHandler" { // UCASE permission rc.permission = uCase( rc.permission ); // populate and get - var oPermission = populateModel( - model : permissionService.get( rc.permissionID ), - exclude: "permissionID" - ); - var vResults = validate( oPermission ); + var oPermission = populateModel( model: permissionService.get( rc.permissionID ), exclude: "permissionID" ); + var vResults = validate( oPermission ); // Validation Results if ( !vResults.hasErrors() ) { // announce event - announce( - "cbadmin_prePermissionSave", - { permission : oPermission, permissionID : rc.permissionID } - ); + announce( "cbadmin_prePermissionSave", { permission : oPermission, permissionID : rc.permissionID } ); // save permission permissionService.save( oPermission ); // announce event @@ -124,9 +118,7 @@ component extends="baseHandler" { return rc.permissionID .listToArray() .map( function( id ){ - return variables.permissionService - .get( arguments.id ) - .getMemento( profile: "export" ); + return variables.permissionService.get( arguments.id ).getMemento( profile: "export" ); } ); } else { return variables.permissionService.getAllForExport(); @@ -148,9 +140,7 @@ component extends="baseHandler" { cbMessagebox.info( "Permissions imported sucessfully!" ); flash.put( "importLog", importLog ); } else { - cbMessagebox.error( - "The import file is invalid: #rc.importFile# cannot continue with import" - ); + cbMessagebox.error( "The import file is invalid: #rc.importFile# cannot continue with import" ); } } catch ( any e ) { var errorMessage = "Error importing file: #e.message# #e.detail# #e.stackTrace#"; diff --git a/modules/contentbox/modules/contentbox-admin/handlers/roles.cfc b/modules/contentbox/modules/contentbox-admin/handlers/roles.cfc index 80eccf7d0e..0fc104c50a 100755 --- a/modules/contentbox/modules/contentbox-admin/handlers/roles.cfc +++ b/modules/contentbox/modules/contentbox-admin/handlers/roles.cfc @@ -127,12 +127,9 @@ component extends="baseHandler" { prc.oRole = variables.roleService.get( rc.roleId ); } // Load permissions - prc.aPermissions = variables.permissionService.list( - sortOrder = "permission", - asQuery = false - ); + prc.aPermissions = variables.permissionService.list( sortOrder = "permission", asQuery = false ); // Exit handlers - prc.xehRoleSave = "#prc.cbAdminEntryPoint#.roles.save"; + prc.xehRoleSave = "#prc.cbAdminEntryPoint#.roles.save"; // View event.setView( "roles/editor" ); } @@ -145,9 +142,7 @@ component extends="baseHandler" { * @prc */ function export( event, rc, prc ){ - return variables.roleService - .get( event.getValue( "roleID", 0 ) ) - .getMemento( includes = "permissions" ); + return variables.roleService.get( event.getValue( "roleID", 0 ) ).getMemento( includes = "permissions" ); } /** @@ -183,10 +178,7 @@ component extends="baseHandler" { event.paramValue( "overrideContent", false ); try { if ( len( rc.importFile ) and fileExists( rc.importFile ) ) { - var importLog = roleService.importFromFile( - importFile = rc.importFile, - override = rc.overrideContent - ); + var importLog = roleService.importFromFile( importFile = rc.importFile, override = rc.overrideContent ); cbMessagebox.info( "Roles imported sucessfully!" ); flash.put( "importLog", importLog ); } else { diff --git a/modules/contentbox/modules/contentbox-admin/handlers/securityRules.cfc b/modules/contentbox/modules/contentbox-admin/handlers/securityRules.cfc index 7780e6148c..0d43952b17 100755 --- a/modules/contentbox/modules/contentbox-admin/handlers/securityRules.cfc +++ b/modules/contentbox/modules/contentbox-admin/handlers/securityRules.cfc @@ -103,14 +103,11 @@ component extends="baseHandler" { prc.rule = ruleService.get( event.getValue( "ruleID", 0 ) ); } // Load permissions - prc.aPermissions = variables.permissionService.list( - sortOrder = "permission", - asQuery = false - ); + prc.aPermissions = variables.permissionService.list( sortOrder = "permission", asQuery = false ); // Load roles - prc.aRoles = variables.roleService.list( sortOrder = "role", asQuery = false ); + prc.aRoles = variables.roleService.list( sortOrder = "role", asQuery = false ); // exit handlers - prc.xehRuleSave = "#prc.cbAdminEntryPoint#.securityRules.save"; + prc.xehRuleSave = "#prc.cbAdminEntryPoint#.securityRules.save"; // view event.setView( "securityRules/editor" ); } @@ -180,16 +177,11 @@ component extends="baseHandler" { event.paramValue( "overrideContent", false ); try { if ( len( rc.importFile ) and fileExists( rc.importFile ) ) { - var importLog = ruleService.importFromFile( - importFile = rc.importFile, - override = rc.overrideContent - ); + var importLog = ruleService.importFromFile( importFile = rc.importFile, override = rc.overrideContent ); cbMessagebox.info( "Rules imported sucessfully!" ); flash.put( "importLog", importLog ); } else { - cbMessagebox.error( - "The import file is invalid: #rc.importFile# cannot continue with import" - ); + cbMessagebox.error( "The import file is invalid: #rc.importFile# cannot continue with import" ); } } catch ( any e ) { var errorMessage = "Error importing file: #e.message# #e.detail# #e.stackTrace#"; diff --git a/modules/contentbox/modules/contentbox-admin/handlers/settings.cfc b/modules/contentbox/modules/contentbox-admin/handlers/settings.cfc index d002d8d1d5..d0ac3b251e 100755 --- a/modules/contentbox/modules/contentbox-admin/handlers/settings.cfc +++ b/modules/contentbox/modules/contentbox-admin/handlers/settings.cfc @@ -195,9 +195,7 @@ component extends="baseHandler" { return rc.settingID .listToArray() .map( function( id ){ - return variables.settingsService - .get( arguments.id ) - .getMemento( profile: "export" ); + return variables.settingsService.get( arguments.id ).getMemento( profile: "export" ); } ); } else { return variables.settingsService.getAllForExport(); @@ -306,10 +304,7 @@ component extends="baseHandler" { */ function flushSingletons( event, rc, prc ){ wirebox.clearSingletons(); - variables.cbMessagebox.setMessage( - "info", - "All singletons flushed and awaiting re-creation." - ); + variables.cbMessagebox.setMessage( "info", "All singletons flushed and awaiting re-creation." ); relocate( event = prc.xehRawSettings, queryString = "##wirebox" ); } @@ -337,10 +332,7 @@ component extends="baseHandler" { // Check if the feature is enabled if ( prc.featureEnabled ) { - prc.logs = variables.loginTrackerService.getAll( - sortOrder = "attempts", - asQuery = false - ); + prc.logs = variables.loginTrackerService.getAll( sortOrder = "attempts", asQuery = false ); } else { prc.featureEnabled = false; } diff --git a/modules/contentbox/modules/contentbox-admin/handlers/sites.cfc b/modules/contentbox/modules/contentbox-admin/handlers/sites.cfc index 08df40f0bc..f5e518b439 100644 --- a/modules/contentbox/modules/contentbox-admin/handlers/sites.cfc +++ b/modules/contentbox/modules/contentbox-admin/handlers/sites.cfc @@ -120,9 +120,7 @@ component extends="baseHandler" { function export( event, rc, prc ){ // Set a high timeout for long exports setting requestTimeout="9999"; - return variables.siteService - .get( event.getValue( "siteID", 0 ) ) - .getMemento( profile: "export" ); + return variables.siteService.get( event.getValue( "siteID", 0 ) ).getMemento( profile: "export" ); } /** @@ -149,9 +147,7 @@ component extends="baseHandler" { cbMessagebox.info( "Site(s) imported sucessfully!" ); flash.put( "importLog", importLog ); } else { - cbMessagebox.error( - "The import file is invalid: #rc.importFile# cannot continue with import" - ); + cbMessagebox.error( "The import file is invalid: #rc.importFile# cannot continue with import" ); } } catch ( any e ) { rethrow; diff --git a/modules/contentbox/modules/contentbox-admin/handlers/tools.cfc b/modules/contentbox/modules/contentbox-admin/handlers/tools.cfc index c955279a66..c3da4d8f12 100755 --- a/modules/contentbox/modules/contentbox-admin/handlers/tools.cfc +++ b/modules/contentbox/modules/contentbox-admin/handlers/tools.cfc @@ -78,9 +78,7 @@ component extends="baseHandler" { importer.setup( importFile = rc.CBUpload ); // already validated, so just process the import var importLog = importer.execute( overrideContent = rc.overwrite ); - cbMessagebox.info( - "ContentBox package imported sucessfully! Please check out your ContentBox now!" - ); + cbMessagebox.info( "ContentBox package imported sucessfully! Please check out your ContentBox now!" ); flash.put( "importLog", importLog ); } else { cbMessagebox.error( "The ContentBox package is invalid. Please try again." ); @@ -116,9 +114,7 @@ component extends="baseHandler" { // get importer var importer = getInstance( "#rc.importer#Importer@contentbox" ); importer.execute( argumentCollection = rc ); - cbMessagebox.info( - "Content imported successfully! Please check out your ContentBox now!" - ); + cbMessagebox.info( "Content imported successfully! Please check out your ContentBox now!" ); } catch ( any e ) { cbMessagebox.error( "Error importing from datasource: #e.message# #e.detail#" ); } diff --git a/modules/contentbox/modules/contentbox-admin/handlers/versions.cfc b/modules/contentbox/modules/contentbox-admin/handlers/versions.cfc index 2dbde75dbf..458a2800df 100755 --- a/modules/contentbox/modules/contentbox-admin/handlers/versions.cfc +++ b/modules/contentbox/modules/contentbox-admin/handlers/versions.cfc @@ -70,10 +70,7 @@ component extends="baseHandler" { prc.versionsPager_content = contentService.get( arguments.contentID ); // Get the latest versions - var results = contentVersionService.findRelatedVersions( - contentID = arguments.contentID, - max = arguments.max - ); + var results = contentVersionService.findRelatedVersions( contentID = arguments.contentID, max = arguments.max ); prc.versionsPager_count = results.count; prc.versionsPager_versions = results.versions; diff --git a/modules/contentbox/modules/contentbox-admin/handlers/widgets.cfc b/modules/contentbox/modules/contentbox-admin/handlers/widgets.cfc index 3d8d014ddf..025bc2f7d6 100755 --- a/modules/contentbox/modules/contentbox-admin/handlers/widgets.cfc +++ b/modules/contentbox/modules/contentbox-admin/handlers/widgets.cfc @@ -76,10 +76,7 @@ component extends="baseHandler" { event.renderData( data = invoke( widget, rc.widgetudf, rc ), type = "html" ); } catch ( any e ) { log.error( "Error rendering widget: #e.message# #e.detail#", e ); - event.renderData( - data = "Error rendering widget: #e.message# #e.detail# #e.stacktrace#", - type = "html" - ); + event.renderData( data = "Error rendering widget: #e.message# #e.detail# #e.stacktrace#", type = "html" ); } } diff --git a/modules/contentbox/modules/contentbox-admin/interceptors/CBRequest.cfc b/modules/contentbox/modules/contentbox-admin/interceptors/CBRequest.cfc index 081bb0e49b..f6c99a2636 100755 --- a/modules/contentbox/modules/contentbox-admin/interceptors/CBRequest.cfc +++ b/modules/contentbox/modules/contentbox-admin/interceptors/CBRequest.cfc @@ -18,10 +18,7 @@ component extends="coldbox.system.Interceptor" { * Configure CB Request */ function configure(){ - variables.childModulesRegex = arrayToList( - getModuleConfig( "contentbox-admin" ).childModules, - "|" - ); + variables.childModulesRegex = arrayToList( getModuleConfig( "contentbox-admin" ).childModules, "|" ); } /** @@ -29,12 +26,7 @@ component extends="coldbox.system.Interceptor" { */ function preProcess( event, data, rc, prc ){ // Only execute for admin or child modules - if ( - !reFindNoCase( - "^(contentbox-admin|#variables.childModulesRegex#)", - event.getCurrentEvent() - ) - ) { + if ( !reFindNoCase( "^(contentbox-admin|#variables.childModulesRegex#)", event.getCurrentEvent() ) ) { return; } @@ -60,16 +52,14 @@ component extends="coldbox.system.Interceptor" { prc.cbEntryPoint = ""; } // Place user in prc - prc.oCurrentAuthor = variables.securityService.getAuthorSession(); + prc.oCurrentAuthor = variables.securityService.getAuthorSession(); // Place all sites in prc for usage by the UI switcher - prc.allSites = variables.siteService.getAllFlat( isActive: true ); + prc.allSites = variables.siteService.getAllFlat( isActive: true ); // Get the current working site object on PRC - prc.oCurrentSite = variables.siteService.getCurrentWorkingSite(); + prc.oCurrentSite = variables.siteService.getCurrentWorkingSite(); // Place global cb options on scope - prc.cbSettings = variables.settingService.getAllSettings(); - prc.cbSiteSettings = variables.settingService.getAllSiteSettings( - prc.oCurrentSite.getSlug() - ); + prc.cbSettings = variables.settingService.getAllSettings(); + prc.cbSiteSettings = variables.settingService.getAllSiteSettings( prc.oCurrentSite.getSlug() ); // Place widgets root location prc.cbWidgetRoot = getContextRoot() & event.getModuleRoot( "contentbox" ) & "/widgets"; // store admin menu service @@ -99,10 +89,7 @@ component extends="coldbox.system.Interceptor" { getInstance( "messagebox@cbMessagebox" ).info( prc.CBHelper.r( "messages.password_reset_detected@security" ) ); - relocate( - event = "#prc.cbAdminEntryPoint#.security.verifyReset", - queryString = "token=#token#" - ); + relocate( event = "#prc.cbAdminEntryPoint#.security.verifyReset", queryString = "token=#token#" ); return; } diff --git a/modules/contentbox/modules/contentbox-admin/interceptors/MenuCleanup.cfc b/modules/contentbox/modules/contentbox-admin/interceptors/MenuCleanup.cfc index f1ed62fa5f..39c3b2911a 100644 --- a/modules/contentbox/modules/contentbox-admin/interceptors/MenuCleanup.cfc +++ b/modules/contentbox/modules/contentbox-admin/interceptors/MenuCleanup.cfc @@ -34,9 +34,7 @@ component extends="coldbox.system.Interceptor" { */ function cbadmin_prePageRemove( required any event, required struct data ){ var criteria = menuItemService.newCriteria(); - var menuItemsInNeed = criteria - .isEq( "contentSlug", "#arguments.data.content.getSlug()#" ) - .list(); + var menuItemsInNeed = criteria.isEq( "contentSlug", "#arguments.data.content.getSlug()#" ).list(); for ( var menuItem in menuItemsInNeed ) { menuItem.setContentSlug( javacast( "null", "" ) ); menuItem.setActive( false ); @@ -61,9 +59,7 @@ component extends="coldbox.system.Interceptor" { */ function cbadmin_preEntryRemove( required any event, required struct data ){ var criteria = menuItemService.newCriteria(); - var menuItemsInNeed = criteria - .isEq( "contentSlug", "#arguments.data.content.getSlug()#" ) - .list(); + var menuItemsInNeed = criteria.isEq( "contentSlug", "#arguments.data.content.getSlug()#" ).list(); for ( var menuItem in menuItemsInNeed ) { menuItem.setContentSlug( javacast( "null", "" ) ); menuItem.setActive( false ); diff --git a/modules/contentbox/modules/contentbox-admin/interceptors/UnenrollTwoFactorOnProviderChange.cfc b/modules/contentbox/modules/contentbox-admin/interceptors/UnenrollTwoFactorOnProviderChange.cfc index a0818730ba..a2270bb311 100644 --- a/modules/contentbox/modules/contentbox-admin/interceptors/UnenrollTwoFactorOnProviderChange.cfc +++ b/modules/contentbox/modules/contentbox-admin/interceptors/UnenrollTwoFactorOnProviderChange.cfc @@ -26,9 +26,7 @@ component extends="coldbox.system.Interceptor" { return; } // Verify provider change? - if ( - data.oldSettings.cb_security_2factorAuth_provider != data.newSettings.cb_security_2factorAuth_provider - ) { + if ( data.oldSettings.cb_security_2factorAuth_provider != data.newSettings.cb_security_2factorAuth_provider ) { queryExecute( "UPDATE cb_author SET is2FactorAuth = 0" ); } } diff --git a/modules/contentbox/modules/contentbox-admin/modules/contentbox-ckeditor/models/CKEditor.cfc b/modules/contentbox/modules/contentbox-admin/modules/contentbox-ckeditor/models/CKEditor.cfc index f75c753072..eab376546a 100644 --- a/modules/contentbox/modules/contentbox-admin/modules/contentbox-ckeditor/models/CKEditor.cfc +++ b/modules/contentbox/modules/contentbox-admin/modules/contentbox-ckeditor/models/CKEditor.cfc @@ -72,18 +72,12 @@ component // prepare toolbar announcement on startup var iData = { toolbar : deserializeJSON( settingService.getSetting( "cb_editors_ckeditor_toolbar" ) ), - excerptToolbar : deserializeJSON( - settingService.getSetting( "cb_editors_ckeditor_excerpt_toolbar" ) - ) + excerptToolbar : deserializeJSON( settingService.getSetting( "cb_editors_ckeditor_excerpt_toolbar" ) ) }; // Announce the editor toolbar is about to be processed interceptorService.announce( "cbadmin_ckeditorToolbar", iData ); // Load extra plugins according to our version - var iData2 = { - extraPlugins : listToArray( - settingService.getSetting( "cb_editors_ckeditor_extraplugins" ) - ) - }; + var iData2 = { extraPlugins : listToArray( settingService.getSetting( "cb_editors_ckeditor_extraplugins" ) ) }; // Announce extra plugins to see if user implements more. interceptorService.announce( "cbadmin_ckeditorExtraPlugins", iData2 ); // Load extra configuration @@ -106,14 +100,8 @@ component var js = ""; // Load Assets, they are included with ContentBox - html.addAsset( - asset: "#variables.CKEDITOR_ROOT#/includes/ckeditor/ckeditor.js", - defer: true - ); - html.addAsset( - asset: "#variables.CKEDITOR_ROOT#/includes/ckeditor/adapters/jquery.js", - defer: true - ); + html.addAsset( asset: "#variables.CKEDITOR_ROOT#/includes/ckeditor/ckeditor.js", defer: true ); + html.addAsset( asset: "#variables.CKEDITOR_ROOT#/includes/ckeditor/adapters/jquery.js", defer: true ); // cfformat-ignore-start savecontent variable="js" { diff --git a/modules/contentbox/modules/contentbox-admin/modules/contentbox-filebrowser/ModuleConfig.cfc b/modules/contentbox/modules/contentbox-admin/modules/contentbox-filebrowser/ModuleConfig.cfc index f4d87a4ddc..3a6fe57782 100644 --- a/modules/contentbox/modules/contentbox-admin/modules/contentbox-filebrowser/ModuleConfig.cfc +++ b/modules/contentbox/modules/contentbox-admin/modules/contentbox-filebrowser/ModuleConfig.cfc @@ -77,10 +77,7 @@ component { // clean directory root settings.directoryRoot = reReplace( settings.directoryRoot, "\\", "/", "all" ); if ( right( settings.directoryRoot, 1 ) EQ "/" ) { - settings.directoryRoot = left( - settings.directoryRoot, - len( settings.directoryRoot ) - 1 - ); + settings.directoryRoot = left( settings.directoryRoot, len( settings.directoryRoot ) - 1 ); } // i18n diff --git a/modules/contentbox/modules/contentbox-admin/modules/contentbox-filebrowser/handlers/Home.cfc b/modules/contentbox/modules/contentbox-admin/modules/contentbox-filebrowser/handlers/Home.cfc index c12d1396f4..f10e82dba3 100644 --- a/modules/contentbox/modules/contentbox-admin/modules/contentbox-filebrowser/handlers/Home.cfc +++ b/modules/contentbox/modules/contentbox-admin/modules/contentbox-filebrowser/handlers/Home.cfc @@ -190,12 +190,7 @@ component extends="cbadmin.handlers.baseHandler" { */ private boolean function isTraversalSecure( required prc, required targetPath ){ // Do some cleanup just in case in the incoming root. - if ( - prc.fbSettings.traversalSecurity AND NOT findNoCase( - prc.fbSettings.directoryRoot, - arguments.targetPath - ) - ) { + if ( prc.fbSettings.traversalSecurity AND NOT findNoCase( prc.fbSettings.directoryRoot, arguments.targetPath ) ) { return false; } return true; @@ -244,19 +239,13 @@ component extends="cbadmin.handlers.baseHandler" { announce( "fb_preFolderCreation", iData ); directoryCreate( rc.path & "/" & rc.dName ); data.errors = false; - data.messages = $r( - resource = "messages.folder_created@fb", - values = "#rc.path#/#rc.dName#" - ); + data.messages = $r( resource = "messages.folder_created@fb", values = "#rc.path#/#rc.dName#" ); // Announce it announce( "fb_postFolderCreation", iData ); } catch ( Any e ) { data.errors = true; - data.messages = $r( - resource = "messages.error_creating_folder@fb", - values = "#e.message# #e.detail#" - ); + data.messages = $r( resource = "messages.error_creating_folder@fb", values = "#e.message# #e.detail#" ); log.error( data.messages, e ); } // render stuff out @@ -315,10 +304,7 @@ component extends="cbadmin.handlers.baseHandler" { announce( "fb_postFileRemoval", iData ); } catch ( Any e ) { data.errors = true; - data.messages = $r( - resource = "messages.error_removing@fb", - values = "#e.message# #e.detail#" - ); + data.messages = $r( resource = "messages.error_removing@fb", values = "#e.message# #e.detail#" ); log.error( data.messages, e ); } } @@ -349,8 +335,7 @@ component extends="cbadmin.handlers.baseHandler" { return; } rc.pathsArray = listToArray( rc.path, "||" ); - if ( fileExists( "#getTempDirectory()#\download.zip" ) ) - fileDelete( "#getTempDirectory()#\download.zip" ); + if ( fileExists( "#getTempDirectory()#\download.zip" ) ) fileDelete( "#getTempDirectory()#\download.zip" ); if ( arrayLen( rc.pathsArray ) > 1 ) { cfzip( action = "zip", file = "#getTempDirectory()#\download.zip" ) { for ( var thisFile in rc.pathsArray ) { @@ -390,10 +375,7 @@ component extends="cbadmin.handlers.baseHandler" { announce( "fb_postFileDownload", iData ); } catch ( Any e ) { data.errors = true; - data.messages = $r( - resource = "messages.error_downloading@fb", - values = "#e.message# #e.detail#" - ); + data.messages = $r( resource = "messages.error_downloading@fb", values = "#e.message# #e.detail#" ); log.error( data.messages, e ); // render stuff out event.renderData( data = data, type = "json" ); @@ -444,10 +426,7 @@ component extends="cbadmin.handlers.baseHandler" { announce( "fb_postFileRename", iData ); } catch ( Any e ) { data.errors = true; - data.messages = $r( - resource = "messages.error_renaming@fb", - values = "#e.message# #e.detail#" - ); + data.messages = $r( resource = "messages.error_renaming@fb", values = "#e.message# #e.detail#" ); log.error( data.messages, e ); } // render stuff out @@ -506,10 +485,7 @@ component extends="cbadmin.handlers.baseHandler" { announce( "fb_postFileUpload", iData ); } catch ( Any e ) { data.errors = true; - data.messages = $r( - resource = "messages.error_uploading@fb", - values = "#e.message# #e.detail#" - ); + data.messages = $r( resource = "messages.error_uploading@fb", values = "#e.message# #e.detail#" ); if ( getSetting( "environment" ) == "development" ) { data.messages &= "Stack: #e.stacktrace#"; } @@ -670,11 +646,7 @@ component extends="cbadmin.handlers.baseHandler" { */ private function inflateFlashParams( event, rc, prc ){ // Check if callbacks stored in flash. - if ( - structKeyExists( flash.get( "fileBrowser", {} ), "callback" ) and len( - flash.get( "fileBrowser" ).callback - ) - ) { + if ( structKeyExists( flash.get( "fileBrowser", {} ), "callback" ) and len( flash.get( "fileBrowser" ).callback ) ) { rc.callback = flash.get( "fileBrowser" ).callback; } // cancel callback diff --git a/modules/contentbox/modules/contentbox-admin/modules/contentbox-markdowneditor/ModuleConfig.cfc b/modules/contentbox/modules/contentbox-admin/modules/contentbox-markdowneditor/ModuleConfig.cfc index a97235f1fe..d4bc040de6 100644 --- a/modules/contentbox/modules/contentbox-admin/modules/contentbox-markdowneditor/ModuleConfig.cfc +++ b/modules/contentbox/modules/contentbox-admin/modules/contentbox-markdowneditor/ModuleConfig.cfc @@ -40,9 +40,7 @@ component { */ function onLoad(){ var editorService = wirebox.getInstance( "EditorService@contentbox" ); - editorService.registerEditor( - wirebox.getInstance( "MarkdownEditor@contentbox-markdowneditor" ) - ); + editorService.registerEditor( wirebox.getInstance( "MarkdownEditor@contentbox-markdowneditor" ) ); } /** diff --git a/modules/contentbox/modules/contentbox-admin/modules/contentbox-markdowneditor/models/MarkdownEditor.cfc b/modules/contentbox/modules/contentbox-admin/modules/contentbox-markdowneditor/models/MarkdownEditor.cfc index d3ff0af374..d89c730bd7 100644 --- a/modules/contentbox/modules/contentbox-admin/modules/contentbox-markdowneditor/models/MarkdownEditor.cfc +++ b/modules/contentbox/modules/contentbox-admin/modules/contentbox-markdowneditor/models/MarkdownEditor.cfc @@ -42,9 +42,7 @@ component variables.toolbarExcerptJS = buildToolbarJS( "excerpt" ); // Register our Editor events - interceptorService.appendInterceptionPoints( - "cbadmin_mdEditorToolbar,cbadmin_mdEditorExtraConfig" - ); + interceptorService.appendInterceptionPoints( "cbadmin_mdEditorToolbar,cbadmin_mdEditorExtraConfig" ); return this; } diff --git a/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/handlers/security.cfc b/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/handlers/security.cfc index 584fbf7f46..2a158d15d1 100755 --- a/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/handlers/security.cfc +++ b/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/handlers/security.cfc @@ -31,9 +31,7 @@ component extends="baseHandler" { prc.xehDoLogin = "#prc.cbAdminEntryPoint#.security.doLogin"; prc.xehLostPassword = "#prc.cbAdminEntryPoint#.security.lostPassword"; // remember me - prc.rememberMe = variables.antiSamy.htmlSanitizer( - variables.securityService.getRememberMe() - ); + prc.rememberMe = variables.antiSamy.htmlSanitizer( variables.securityService.getRememberMe() ); // secured URL from security interceptor arguments.event.paramValue( "_securedURL", "" ); rc._securedURL = variables.antiSamy.htmlSanitizer( rc._securedURL ); @@ -81,10 +79,7 @@ component extends="baseHandler" { if ( prc.oAuthor.getIsPasswordReset() ) { var token = variables.securityService.generateResetToken( prc.oAuthor ); variables.messagebox.info( cb.r( "messages.password_reset_detected@security" ) ); - return relocate( - event = "#prc.cbAdminEntryPoint#.security.verifyReset", - queryString = "token=#token#" - ); + return relocate( event = "#prc.cbAdminEntryPoint#.security.verifyReset", queryString = "token=#token#" ); } // If Global MFA is turned on and the user is not enrolled to a provider, then force it to enroll @@ -123,10 +118,7 @@ component extends="baseHandler" { } // Set keep me log in remember cookie, if set. - variables.securityService.setRememberMe( - username: rc.username, - days : val( rc.rememberMe ) - ); + variables.securityService.setRememberMe( username: rc.username, days: val( rc.rememberMe ) ); // Set in session, validations are now complete variables.securityService.login( prc.oAuthor ); @@ -207,9 +199,7 @@ component extends="baseHandler" { oAuthor = authorService.findWhere( { email : rc.email, isActive : 1 } ); if ( isNull( oAuthor ) OR NOT oAuthor.isLoaded() ) { // Don't give away that the email did not exist. - messagebox.info( - cb.r( resource = "messages.lostpassword_check@security", values = "5" ) - ); + messagebox.info( cb.r( resource = "messages.lostpassword_check@security", values = "5" ) ); return relocate( "#prc.cbAdminEntryPoint#.security.lostPassword" ); } } @@ -276,30 +266,21 @@ component extends="baseHandler" { if ( !csrfVerify( rc._csrftoken ) ) { messagebox.warning( cb.r( "messages.invalid_token@security" ) ); - return relocate( - event = "#prc.cbAdminEntryPoint#.security.verifyReset", - queryString = "token=#rc.token#" - ); + return relocate( event = "#prc.cbAdminEntryPoint#.security.verifyReset", queryString = "token=#rc.token#" ); } // Validate passwords if ( !len( rc.password ) || !len( rc.password_confirmation ) ) { // Exception messagebox.error( cb.r( "messages.invalid_password@security" ) ); - relocate( - event = "#prc.cbAdminEntryPoint#.security.verifyReset", - queryString = "token=#rc.token#" - ); + relocate( event = "#prc.cbAdminEntryPoint#.security.verifyReset", queryString = "token=#rc.token#" ); return; } // Validate confirmed password if ( compare( rc.password, rc.password_confirmation ) neq 0 ) { messagebox.error( cb.r( "messages.password_mismatch@security" ) ); - relocate( - event = "#prc.cbAdminEntryPoint#.security.verifyReset", - queryString = "token=#rc.token#" - ); + relocate( event = "#prc.cbAdminEntryPoint#.security.verifyReset", queryString = "token=#rc.token#" ); return; } @@ -320,10 +301,7 @@ component extends="baseHandler" { announce( "cbadmin_onInvalidPasswordReset", { token : rc.token } ); // Exception messagebox.error( cb.r( "messages.password_used@security" ) ); - relocate( - event = "#prc.cbAdminEntryPoint#.security.verifyReset", - queryString = "token=#rc.token#" - ); + relocate( event = "#prc.cbAdminEntryPoint#.security.verifyReset", queryString = "token=#rc.token#" ); return; } diff --git a/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/handlers/twofactor.cfc b/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/handlers/twofactor.cfc index 5562a4a52f..404590fc4c 100644 --- a/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/handlers/twofactor.cfc +++ b/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/handlers/twofactor.cfc @@ -66,10 +66,7 @@ component extends="baseHandler" { var authorData = flash.get( "authorData" ); // Verify the challenge code - var results = variables.twoFactorService.verifyChallenge( - code = rc.twofactorcode, - author = prc.oAuthor - ); + var results = variables.twoFactorService.verifyChallenge( code = rc.twofactorcode, author = prc.oAuthor ); // Check for errors if ( results.error ) { @@ -106,10 +103,7 @@ component extends="baseHandler" { // Set in session, validations are now complete variables.securityService.login( prc.oAuthor ); // announce event - announce( - "cbadmin_onLogin", - { author : prc.oAuthor, securedURL : authorData.securedURL } - ); + announce( "cbadmin_onLogin", { author : prc.oAuthor, securedURL : authorData.securedURL } ); } // check if securedURL came in? diff --git a/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/modules/contentbox-email-twofactor/ModuleConfig.cfc b/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/modules/contentbox-email-twofactor/ModuleConfig.cfc index 27f9a055a2..af38fd664b 100644 --- a/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/modules/contentbox-email-twofactor/ModuleConfig.cfc +++ b/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/modules/contentbox-email-twofactor/ModuleConfig.cfc @@ -39,9 +39,7 @@ component { function onLoad(){ // Register this 2 Auth provider with the TwoFactorService var twoFactorService = wirebox.getInstance( "TwoFactorService@contentbox" ); - twoFactorService.registerProvider( - wirebox.getInstance( "EmailTwoFactorProvider@contentbox-email-twofactor" ) - ); + twoFactorService.registerProvider( wirebox.getInstance( "EmailTwoFactorProvider@contentbox-email-twofactor" ) ); } /** diff --git a/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/modules/contentbox-email-twofactor/models/EmailTwoFactorProvider.cfc b/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/modules/contentbox-email-twofactor/models/EmailTwoFactorProvider.cfc index 4917f0be20..6c6ae08f5f 100644 --- a/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/modules/contentbox-email-twofactor/models/EmailTwoFactorProvider.cfc +++ b/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/modules/contentbox-email-twofactor/models/EmailTwoFactorProvider.cfc @@ -90,10 +90,7 @@ component */ string function generateValidationToken( required author ){ // Store Security Token For X minutes - var token = left( - hash( arguments.author.getEmail() & arguments.author.getAuthorID() & now() ), - 6 - ); + var token = left( hash( arguments.author.getEmail() & arguments.author.getAuthorID() & now() ), 6 ); // Cache the code for 5 minutes variables.cache.set( "email-twofactor-token-#token#", diff --git a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/baseContentHandler.cfc b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/baseContentHandler.cfc index 25818d8905..7bf0bb4758 100644 --- a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/baseContentHandler.cfc +++ b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/baseContentHandler.cfc @@ -79,9 +79,7 @@ component extends="baseHandler" { // Verify content exists ONLY for new objects if ( !len( rc.id ) && !len( rc.content ) ) { - arguments.event - .getResponse() - .setErrorMessage( "Content is required", arguments.event.STATUS.BAD_REQUEST ); + arguments.event.getResponse().setErrorMessage( "Content is required", arguments.event.STATUS.BAD_REQUEST ); return; } // Setup Parent if sent! @@ -98,11 +96,9 @@ component extends="baseHandler" { } // Population arguments - arguments.populate.memento = rc; + arguments.populate.memento = rc; // Check if creation or editing - arguments.populate.model = ( - !len( rc.id ) ? variables.ormService.new() : getByIdOrSlugOrFail( rc.id, prc ) - ); + arguments.populate.model = ( !len( rc.id ) ? variables.ormService.new() : getByIdOrSlugOrFail( rc.id, prc ) ); arguments.populate.nullEmptyInclude = "parent"; arguments.populate.exclude = "contentID,creator,categories,comments,customFields,contentVersions,children,commentSubscriptions"; @@ -113,9 +109,7 @@ component extends="baseHandler" { .oCurrentAuthor() .checkPermission( "#arguments.contentType#_ADMIN" ) ) { - arguments.populate.model.setCreator( - variables.authorService.retrieveUserById( rc.creator ) - ); + arguments.populate.model.setCreator( variables.authorService.retrieveUserById( rc.creator ) ); } // populate it @@ -143,10 +137,7 @@ component extends="baseHandler" { } prc.oEntity.setCategories( rc.categories.map( function( thisCategory ){ - return variables.categoryService.getOrCreateBySlug( - arguments.thisCategory, - rc.site - ); + return variables.categoryService.getOrCreateBySlug( arguments.thisCategory, rc.site ); } ) ); } diff --git a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/baseHandler.cfc b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/baseHandler.cfc index 9c4d65a0bf..82ea6a4546 100644 --- a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/baseHandler.cfc +++ b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/baseHandler.cfc @@ -73,16 +73,11 @@ component extends="cborm.models.resources.BaseHandler" { param rc.id = 0; // announce it - announceInterception( - "#variables.settings.resources.eventPrefix#pre#variables.entity#Show", - {} - ); + announceInterception( "#variables.settings.resources.eventPrefix#pre#variables.entity#Show", {} ); // Get by id or slug prc.oEntity = ( - variables.useGetOrFail ? variables.ormService.getOrFail( rc.id ) : getByIdOrSlugOrFail( - rc.id, prc - ) + variables.useGetOrFail ? variables.ormService.getOrFail( rc.id ) : getByIdOrSlugOrFail( rc.id, prc ) ); // announce it @@ -135,9 +130,7 @@ component extends="cborm.models.resources.BaseHandler" { // Population arguments arguments.populate.memento = rc; arguments.populate.model = ( - variables.useGetOrFail ? variables.ormService.getOrFail( rc.id ) : getByIdOrSlugOrFail( - rc.id, prc - ) + variables.useGetOrFail ? variables.ormService.getOrFail( rc.id ) : getByIdOrSlugOrFail( rc.id, prc ) ); // Validation Arguments @@ -187,9 +180,7 @@ component extends="cborm.models.resources.BaseHandler" { param rc.id = 0; prc.oEntity = ( - variables.useGetOrFail ? variables.ormService.getOrFail( rc.id ) : getByIdOrSlugOrFail( - rc.id, prc - ) + variables.useGetOrFail ? variables.ormService.getOrFail( rc.id ) : getByIdOrSlugOrFail( rc.id, prc ) ); // announce it @@ -206,10 +197,7 @@ component extends="cborm.models.resources.BaseHandler" { ); // announce it - announceInterception( - "#variables.settings.resources.eventPrefix#post#variables.entity#Delete", - { id : rc.id } - ); + announceInterception( "#variables.settings.resources.eventPrefix#post#variables.entity#Delete", { id : rc.id } ); // Marshall it out prc.response.addMessage( "#variables.entity# deleted!" ); diff --git a/modules/contentbox/modules/contentbox-ui/handlers/blog.cfc b/modules/contentbox/modules/contentbox-ui/handlers/blog.cfc index d5bb24a807..563725b91e 100644 --- a/modules/contentbox/modules/contentbox-ui/handlers/blog.cfc +++ b/modules/contentbox/modules/contentbox-ui/handlers/blog.cfc @@ -72,10 +72,7 @@ component extends="content" { // set skin view event - .setLayout( - name = "#prc.cbTheme#/layouts/#rc.layout#", - module = prc.cbThemeRecord.module - ) + .setLayout( name = "#prc.cbTheme#/layouts/#rc.layout#", module = prc.cbThemeRecord.module ) .setView( view = "#prc.cbTheme#/views/entry", module = prc.cbThemeRecord.module ); } @@ -97,11 +94,9 @@ component extends="content" { // prepare paging object prc.oPaging = variables.paginator; - prc.pagingBoundaries = prc.oPaging.getBoundaries( - pagingMaxRows: prc.cbSettings.cb_paging_maxentries - ); - prc.blogLink = variables.CBHelper.linkBlog(); - prc.pagingLink = prc.blogLink & "?page=@page@"; + prc.pagingBoundaries = prc.oPaging.getBoundaries( pagingMaxRows: prc.cbSettings.cb_paging_maxentries ); + prc.blogLink = variables.CBHelper.linkBlog(); + prc.pagingLink = prc.blogLink & "?page=@page@"; // Search Paging Link Override? if ( len( rc.q ) ) { @@ -144,14 +139,8 @@ component extends="content" { default: { // set skin view event - .setLayout( - name = "#prc.cbTheme#/layouts/blog", - module = prc.cbThemeRecord.module - ) - .setView( - view = "#prc.cbTheme#/views/index", - module = prc.cbThemeRecord.module - ); + .setLayout( name = "#prc.cbTheme#/layouts/blog", module = prc.cbThemeRecord.module ) + .setView( view = "#prc.cbTheme#/views/index", module = prc.cbThemeRecord.module ); } } } @@ -175,10 +164,8 @@ component extends="content" { // prepare paging object prc.oPaging = variables.paginator; - prc.pagingBoundaries = prc.oPaging.getBoundaries( - pagingMaxRows = prc.cbSettings.cb_paging_maxentries - ); - prc.pagingLink = event.getCurrentRoutedURL() & "?page=@page@"; + prc.pagingBoundaries = prc.oPaging.getBoundaries( pagingMaxRows = prc.cbSettings.cb_paging_maxentries ); + prc.pagingLink = event.getCurrentRoutedURL() & "?page=@page@"; // get published entries var entryResults = variables.entryService.findPublishedEntriesByDate( @@ -210,14 +197,8 @@ component extends="content" { default: { // set skin view event - .setLayout( - name = "#prc.cbTheme#/layouts/blog", - module = prc.cbThemeRecord.module - ) - .setView( - view = "#prc.cbTheme#/views/archives", - module = prc.cbThemeRecord.module - ); + .setLayout( name = "#prc.cbTheme#/layouts/blog", module = prc.cbThemeRecord.module ) + .setView( view = "#prc.cbTheme#/views/archives", module = prc.cbThemeRecord.module ); } } } @@ -318,10 +299,7 @@ component extends="content" { // incoming params event.paramValue( "entrySlug", "" ); // Try to retrieve entry by slug - var thisEntry = variables.entryService.findBySlug( - slug : rc.entrySlug, - siteID: prc.oCurrentSite.getsiteID() - ); + var thisEntry = variables.entryService.findBySlug( slug: rc.entrySlug, siteID: prc.oCurrentSite.getsiteID() ); // If null, kick them out if ( isNull( thisEntry ) ) { relocate( prc.cbEntryPoint ); diff --git a/modules/contentbox/modules/contentbox-ui/handlers/content.cfc b/modules/contentbox/modules/contentbox-ui/handlers/content.cfc index 61881e28d0..4268ac6681 100644 --- a/modules/contentbox/modules/contentbox-ui/handlers/content.cfc +++ b/modules/contentbox/modules/contentbox-ui/handlers/content.cfc @@ -30,11 +30,7 @@ component { function preHandler( event, rc, prc, action, eventArguments ){ // Maintenance Mode? if ( prc.cbSettings.cb_site_maintenance ) { - if ( - prc.oCurrentAuthor.isLoggedIn() && prc.oCurrentAuthor.checkPermission( - "MAINTENANCE_MODE_VIEWER" - ) - ) { + if ( prc.oCurrentAuthor.isLoggedIn() && prc.oCurrentAuthor.checkPermission( "MAINTENANCE_MODE_VIEWER" ) ) { addAsset( "#prc.cbRoot#/includes/js/maintenance.js" ); } else { event.overrideEvent( "contentbox-ui:page.maintenance" ); @@ -97,10 +93,7 @@ component { var eArgs = { noCache : true }; runEvent( event = "contentbox-ui:page.index", eventArguments = eArgs ); // Override the layout - event.setLayout( - name = "#prc.cbTheme#/layouts/pages", - module = prc.cbThemeRecord.module - ); + event.setLayout( name = "#prc.cbTheme#/layouts/pages", module = prc.cbThemeRecord.module ); } else { // Override layout and event so we can display it event.setLayout( "#rc.l#/layouts/blog" ).overrideEvent( "contentbox-ui:blog.index" ); @@ -119,9 +112,7 @@ component { function maintenance( event, rc, prc ){ // If no maintenance view exists, just output data if ( !themeService.themeMaintenanceViewExists() ) { - event.renderData( - data = variables.markdown.toHTML( prc.cbSettings.cb_site_maintenance_message ) - ); + event.renderData( data = variables.markdown.toHTML( prc.cbSettings.cb_site_maintenance_message ) ); } else { // output maintenance view event @@ -129,10 +120,7 @@ component { name = "#prc.cbTheme#/layouts/#themeService.getThemeMaintenanceLayout()#", module = prc.cbThemeRecord.module ) - .setView( - view = "#prc.cbTheme#/views/maintenance", - module = prc.cbThemeRecord.module - ); + .setView( view = "#prc.cbTheme#/views/maintenance", module = prc.cbThemeRecord.module ); } } @@ -212,9 +200,7 @@ component { } // Incorporate internal hash + rc distinct hash + formats - cacheKey &= hash( - ".#getFWLocale()#.#rc.format#.#event.isSSL()#" & prc.cbox_incomingContextHash - ); + cacheKey &= hash( ".#getFWLocale()#.#rc.format#.#event.isSSL()#" & prc.cbox_incomingContextHash ); // get content data from cache prc.contentCacheData = cache.get( cacheKey ); @@ -314,18 +300,14 @@ component { ); // verify if caching is possible by testing the content parameters - if ( - cacheEnabled AND oContent.isLoaded() AND oContent.getCacheLayout() AND oContent.isContentPublished() - ) { + if ( cacheEnabled AND oContent.isLoaded() AND oContent.getCacheLayout() AND oContent.isContentPublished() ) { // store content ID as we have it by now data.contentID = oContent.getContentID(); // Cache data cache.set( cachekey, data, - ( - oContent.getCacheTimeout() eq 0 ? prc.cbSettings.cb_content_cachingTimeout : oContent.getCacheTimeout() - ), + ( oContent.getCacheTimeout() eq 0 ? prc.cbSettings.cb_content_cachingTimeout : oContent.getCacheTimeout() ), ( oContent.getCacheLastAccessTimeout() eq 0 ? prc.cbSettings.cb_content_cachingTimeoutIdle : oContent.getCacheLastAccessTimeout() ) @@ -454,10 +436,7 @@ component { // relate it to content comment.setRelatedContent( arguments.thisContent ); // save it - var results = commentService.saveComment( - comment = comment, - loggedInUser = prc.oCurrentAuthor - ); + var results = commentService.saveComment( comment = comment, loggedInUser = prc.oCurrentAuthor ); // announce event announce( diff --git a/modules/contentbox/modules/contentbox-ui/handlers/media.cfc b/modules/contentbox/modules/contentbox-ui/handlers/media.cfc index 6938fe0ea8..15327acb94 100644 --- a/modules/contentbox/modules/contentbox-ui/handlers/media.cfc +++ b/modules/contentbox/modules/contentbox-ui/handlers/media.cfc @@ -53,20 +53,14 @@ component singleton { if ( !rc.cbcache and settingService.getSetting( "cb_media_provider_caching" ) ) { // Set expiration for one year in advanced event - .setHTTPHeader( - name = "expires", - value = "#getHTTPTimeString( dateAdd( "yyyy", 1, now() ) )#" - ) + .setHTTPHeader( name = "expires", value = "#getHTTPTimeString( dateAdd( "yyyy", 1, now() ) )#" ) .setHTTPHeader( name = "pragma", value = "cache" ) .setHTTPHeader( name = "cache-control", value = "public, max-age=2592000" ); } else { event .setHTTPHeader( name = "expires", value = "#getHTTPTimeString( now() )#" ) .setHTTPHeader( name = "pragma", value = "no-cache" ) - .setHTTPHeader( - name = "cache-control", - value = "no-cache, no-store, must-revalidate" - ); + .setHTTPHeader( name = "cache-control", value = "no-cache, no-store, must-revalidate" ); } // Deliver it baby! diff --git a/modules/contentbox/modules/contentbox-ui/handlers/page.cfc b/modules/contentbox/modules/contentbox-ui/handlers/page.cfc index a889c51cf1..1c0274cc25 100644 --- a/modules/contentbox/modules/contentbox-ui/handlers/page.cfc +++ b/modules/contentbox/modules/contentbox-ui/handlers/page.cfc @@ -148,9 +148,7 @@ component extends="content" { if ( prc.page.isLoaded() ) { // Verify SSL? if ( prc.page.getSSLOnly() and !event.isSSL() ) { - log.warn( - "Page requested: #incomingURL# without SSL and SSL required. Relocating..." - ); + log.warn( "Page requested: #incomingURL# without SSL and SSL required. Relocating..." ); relocate( event = incomingURL, ssl = true ); return; } @@ -185,10 +183,7 @@ component extends="content" { } else { // set skin view event - .setLayout( - name = "#prc.cbTheme#/layouts/#thisLayout#", - module = prc.cbThemeRecord.module - ) + .setLayout( name = "#prc.cbTheme#/layouts/#thisLayout#", module = prc.cbThemeRecord.module ) .setView( view = "#prc.cbTheme#/views/page", module = prc.cbThemeRecord.module ); } } else { @@ -206,10 +201,7 @@ component extends="content" { ); // set skin not found event - .setLayout( - name = "#prc.cbTheme#/layouts/pages", - module = prc.cbThemeRecord.module - ) + .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" ); } @@ -233,10 +225,8 @@ component extends="content" { // prepare paging object prc.oPaging = getInstance( "paging@contentbox" ); - prc.pagingBoundaries = prc.oPaging.getBoundaries( - pagingMaxRows: prc.cbSettings.cb_search_maxResults - ); - prc.pagingLink = variables.CBHelper.linkContentSearch() & "/#urlEncodedFormat( rc.q )#/@page@"; + prc.pagingBoundaries = prc.oPaging.getBoundaries( pagingMaxRows: prc.cbSettings.cb_search_maxResults ); + prc.pagingLink = variables.CBHelper.linkContentSearch() & "/#urlEncodedFormat( rc.q )#/@page@"; // get search results if ( len( rc.q ) ) { diff --git a/modules/contentbox/modules/contentbox-ui/handlers/subscription.cfc b/modules/contentbox/modules/contentbox-ui/handlers/subscription.cfc index bfaf0b91a4..e59695b147 100644 --- a/modules/contentbox/modules/contentbox-ui/handlers/subscription.cfc +++ b/modules/contentbox/modules/contentbox-ui/handlers/subscription.cfc @@ -22,9 +22,7 @@ component { // check to make sure that at least one subscription AND subscriber token are found if ( len( rc.keysToRemove ) && len( rc.subscriberToken ) ) { // try to find subscriber by token - var oSubscriber = subscriberService.findWhere( - criteria = { "subscriberToken" : rc.subscriberToken } - ); + var oSubscriber = subscriberService.findWhere( criteria = { "subscriberToken" : rc.subscriberToken } ); if ( !isNull( oSubscriber ) ) { var targets = listToArray( rc.keysToRemove ); // loop over remove targets @@ -50,9 +48,7 @@ component { event.paramValue( "subscriberToken", "" ); if ( len( rc.subscriberToken ) ) { // get subscriber - prc.oSubscriber = subscriberService.findWhere( - criteria = { "subscriberToken" : rc.subscriberToken } - ); + prc.oSubscriber = subscriberService.findWhere( criteria = { "subscriberToken" : rc.subscriberToken } ); if ( !isNull( prc.oSubscriber ) ) { prc.subscriptions = prc.oSubscriber.getSubscriptionsByContentType(); } else { diff --git a/modules/contentbox/modules/contentbox-ui/interceptors/SimpleSecurity.cfc b/modules/contentbox/modules/contentbox-ui/interceptors/SimpleSecurity.cfc index b60c2968f0..1112c05232 100755 --- a/modules/contentbox/modules/contentbox-ui/interceptors/SimpleSecurity.cfc +++ b/modules/contentbox/modules/contentbox-ui/interceptors/SimpleSecurity.cfc @@ -29,18 +29,9 @@ component { } // Verify Incoming Headers to see if we are authorizing already or we can view the page already - if ( - !securityService.isContentViewable( content ) OR len( - event.getHTTPHeader( "Authorization", "" ) - ) - ) { + if ( !securityService.isContentViewable( content ) OR len( event.getHTTPHeader( "Authorization", "" ) ) ) { // Verify incoming authorization for content - if ( - securityService.authorizeContent( - content, - event.getHTTPBasicCredentials().password - ) - ) { + if ( securityService.authorizeContent( content, event.getHTTPBasicCredentials().password ) ) { // we are secured woot woot! return; }; From bfbdb413a3d0d61c8c2687bc066f323a121e4e2c Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Tue, 7 Dec 2021 16:18:23 -0600 Subject: [PATCH 021/100] oops! --- modules/contentbox/ModuleConfig.cfc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/contentbox/ModuleConfig.cfc b/modules/contentbox/ModuleConfig.cfc index 754af8665d..e54d094328 100755 --- a/modules/contentbox/ModuleConfig.cfc +++ b/modules/contentbox/ModuleConfig.cfc @@ -76,7 +76,7 @@ component { }; // Async Executors for ContentBox Core - //executors = { "contentbox-tasks" : { type : "scheduled", threads : 20 } }; + // executors = { "contentbox-tasks" : { type : "scheduled", threads : 20 } }; // interceptors interceptors = [ @@ -135,8 +135,8 @@ component { */ function onLoad(){ // Create `cb` alias : REMOVE BY CONTENTBOX NEXT MAJOR VERSION - var s = getTickCount(); binder.mapDirectory( packagePath = "contentbox.models", namespace = "@cb" ); + var settingService = wirebox.getInstance( "settingService@contentbox" ); // Pre-flight check settings settingService.preFlightCheck(); // Loadup Config Overrides From 1656f9c864b1a15ebae870e2d6b14ef36eecfd30 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Tue, 7 Dec 2021 16:42:43 -0600 Subject: [PATCH 022/100] More injection tests --- modules/contentbox/models/BaseEntityMethods.cfc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/contentbox/models/BaseEntityMethods.cfc b/modules/contentbox/models/BaseEntityMethods.cfc index 3d270e1aea..4c27a811e0 100644 --- a/modules/contentbox/models/BaseEntityMethods.cfc +++ b/modules/contentbox/models/BaseEntityMethods.cfc @@ -29,7 +29,7 @@ component { property name ="wirebox" - inject ="provider:wirebox" + inject ="wirebox" persistent="false"; /* ********************************************************************* From 65926330d5c5646e1ff94e27f46e3447d143c3d3 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Tue, 7 Dec 2021 17:02:19 -0600 Subject: [PATCH 023/100] Refactoring of tests so we don't override crap --- .../models/search/SearchService.cfc | 5 +- .../unit/media/MediaServiceTest.cfc | 87 +++++-------------- .../contentbox/unit/search/DBSearchTest.cfc | 12 --- .../unit/search/SearchResultsTest.cfc | 52 +++++------ .../unit/search/SearchServiceTest.cfc | 33 +++---- 5 files changed, 63 insertions(+), 126 deletions(-) diff --git a/modules/contentbox/models/search/SearchService.cfc b/modules/contentbox/models/search/SearchService.cfc index 7b6883ed07..fa64dc5cdd 100644 --- a/modules/contentbox/models/search/SearchService.cfc +++ b/modules/contentbox/models/search/SearchService.cfc @@ -11,6 +11,9 @@ component accessors="true" { property name="wirebox" inject="wirebox"; property name="settingService" inject="settingService@contentbox"; + /** + * Constructor + */ SearchService function init(){ return this; } @@ -20,7 +23,7 @@ component accessors="true" { * the following interface: contentbox.models.search.ISearchAdapter */ any function getSearchAdapter(){ - return wirebox.getInstance( variables.settingService.getSetting( "cb_search_adapter" ) ); + return variables.wirebox.getInstance( variables.settingService.getSetting( "cb_search_adapter" ) ); } } diff --git a/tests/specs/contentbox-web/contentbox/unit/media/MediaServiceTest.cfc b/tests/specs/contentbox-web/contentbox/unit/media/MediaServiceTest.cfc index 38e3f21c1b..54728096ec 100644 --- a/tests/specs/contentbox-web/contentbox/unit/media/MediaServiceTest.cfc +++ b/tests/specs/contentbox-web/contentbox/unit/media/MediaServiceTest.cfc @@ -4,72 +4,27 @@ * www.ortussolutions.com/products/contentbox * --- */ -component extends="coldbox.system.testing.BaseModelTest" model="contentbox.models.media.MediaService" { - - this.unLoadColdBox = false; - - function setup(){ - super.setup(); - mockProvider = getMockBox() - .createMock( "contentbox.models.media.CFContentMediaProvider" ) - .init(); - mockWireBox.$( "getInstance", mockProvider ); - - model.init( mockWireBox ); - mockSettings = getMockBox() - .createEmptyMock( "contentbox.models.system.SettingService" ) - .$( "getSetting", "CFContentMediaProvider" ); - model.$property( "settingService", "variables", mockSettings ); - } - - function testGetProvider(){ - var provider = model.getProvider( "CFContentMediaProvider" ); - assertEquals( "CFContentMediaProvider", provider.getName() ); - assertEquals( "CF Content Media Provider", provider.getDisplayName() ); - } - - function testGetDefaultProviderName(){ - assertEquals( "CFContentMediaProvider", model.getDefaultProviderName() ); - } - - - function testGetDefaultProvider(){ - var provider = model.getDefaultProvider(); - assertEquals( "CFContentMediaProvider", provider.getName() ); - assertEquals( "CF Content Media Provider", provider.getDisplayName() ); - } - - function testRegisterProvider(){ - model.setProviders( {} ); - model.registerProvider( mockProvider ); - expect( model.getDefaultProviderName() ).toBe( "CFContentMediaProvider" ); - } - - function testUnRegisterProvider(){ - model.setProviders( {} ); - model.registerProvider( mockProvider ); - model.unRegisterProvider( "CFContentMediaProvider" ); - expect( model.getProviders() ).toHaveLength( 0 ); - } - - function testGetRegisteredProviders(){ - var providers = model.getRegisteredProviders(); - assertTrue( arrayFind( providers, "CFContentMediaProvider" ) ); - } - - function testGetRegisteredProvidersMap(){ - var providerPath = model.getRegisteredProvidersMap(); - assertIsArray( providerPath ); - assertIsStruct( providerPath[ 1 ] ); - } - - function testGetCoreMediaRoot(){ - mockSettings = getMockBox() - .createEmptyMock( "contentbox.models.system.SettingService" ) - .$( "getSetting", "/content" ); - model.$property( "settingService", "variables", mockSettings ); - var path = model.getCoreMediaRoot(); - assertEquals( "/content", path ); +component extends="tests.resources.BaseTest" { + + function run( testResults, testBox ){ + describe( "DB Search Adapter", function(){ + beforeEach( function( currentSpec ){ + setup(); + model = getInstance( "MediaService@contentbox" ); + } ); + + it( "can get a provider", function(){ + var provider = model.getProvider( "CFContentMediaProvider" ); + expect( provider ).toBeComponent(); + assertEquals( "CFContentMediaProvider", provider.getName() ); + assertEquals( "CF Content Media Provider", provider.getDisplayName() ); + } ); + + + it( "can get the default provider", function(){ + assertEquals( "CFContentMediaProvider", model.getDefaultProviderName() ); + } ); + } ); } } diff --git a/tests/specs/contentbox-web/contentbox/unit/search/DBSearchTest.cfc b/tests/specs/contentbox-web/contentbox/unit/search/DBSearchTest.cfc index 7e127ab99c..a4f439bec9 100755 --- a/tests/specs/contentbox-web/contentbox/unit/search/DBSearchTest.cfc +++ b/tests/specs/contentbox-web/contentbox/unit/search/DBSearchTest.cfc @@ -6,18 +6,6 @@ */ component extends="tests.resources.BaseTest" { - /*********************************** LIFE CYCLE Methods ***********************************/ - - // executes before all suites+specs in the run() method - function beforeAll(){ - super.beforeAll(); - } - - // executes after all suites+specs in the run() method - function afterAll(){ - super.afterAll(); - } - /*********************************** BDD SUITES ***********************************/ function run( testResults, testBox ){ diff --git a/tests/specs/contentbox-web/contentbox/unit/search/SearchResultsTest.cfc b/tests/specs/contentbox-web/contentbox/unit/search/SearchResultsTest.cfc index cdff955d8f..4c1dc6cc3f 100755 --- a/tests/specs/contentbox-web/contentbox/unit/search/SearchResultsTest.cfc +++ b/tests/specs/contentbox-web/contentbox/unit/search/SearchResultsTest.cfc @@ -4,37 +4,37 @@ * www.ortussolutions.com/products/contentbox * --- */ -component - extends="coldbox.system.testing.BaseModelTest" - model ="contentbox.models.search.SearchResults" -{ +component extends="tests.resources.BaseTest" { - this.unLoadColdBox = false; + function run( testResults, testBox ){ + describe( "Search Results", function(){ + beforeEach( function( currentSpec ){ + setup(); + model = getInstance( "SearchResults@contentbox" ); + } ); - function setup(){ - super.setup(); - model.init(); - } - function testMemento(){ - r = model.getmemento(); - assertTrue( structCount( r ) ); - } + it( "can get the memento", function(){ + var results = model.getMemento(); + expect( results ).toBeStruct(); + } ); - function testPopulate(){ - r = { - results : [], - searchTime : getTickCount(), - total : 0, - metadata : { name : "luis", value : "awesome" }, - error : false, - errorMessages : [], - searchTerm : "luis" - }; + it( "can populate", function(){ + var r = { + results : [], + searchTime : getTickCount(), + total : 0, + metadata : { name : "luis", value : "awesome" }, + error : false, + errorMessages : [], + searchTerm : "luis" + }; - model.populate( r ); - m = model.getMemento(); - assertEquals( r, m ); + model.populate( r ); + var m = model.getMemento(); + assertEquals( r, m ); + } ); + } ); } } diff --git a/tests/specs/contentbox-web/contentbox/unit/search/SearchServiceTest.cfc b/tests/specs/contentbox-web/contentbox/unit/search/SearchServiceTest.cfc index f23fa38fc1..2dfae3fe54 100755 --- a/tests/specs/contentbox-web/contentbox/unit/search/SearchServiceTest.cfc +++ b/tests/specs/contentbox-web/contentbox/unit/search/SearchServiceTest.cfc @@ -4,29 +4,20 @@ * www.ortussolutions.com/products/contentbox * --- */ -component - extends="coldbox.system.testing.BaseModelTest" - model ="contentbox.models.search.SearchService" -{ +component extends="tests.resources.BaseTest" { - this.unLoadColdBox = false; + function run( testResults, testBox ){ + describe( "Search Service", function(){ + beforeEach( function( currentSpec ){ + setup(); + searchService = getInstance( "SearchService@contentbox" ); + } ); - function setup(){ - super.setup(); - model.init(); - } - - function testGetSearchAdapter(){ - mockAdapter = getMockBox().createEmptyMock( "contentbox.models.search.DBSearch" ); - mockWireBox.$( "getInstance", mockAdapter ); - mockSettings = getMockBox() - .createEmptyMock( "contentbox.models.system.SettingService" ) - .$( "getSetting", "contentbox.models.search.DBSearch" ); - model.$property( "wirebox", "variables", mockWireBox ); - model.$property( "settingService", "variables", mockSettings ); - - a = model.getSearchAdapter(); - assertEquals( mockAdapter, a ); + it( "can get the search adapter", function(){ + var adapter = searchService.getSearchAdapter(); + expect( adapter ).toBeComponent(); + } ); + } ); } } From 05397bc333c16de6f812577e73d7d6911b5faf48 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Tue, 7 Dec 2021 20:10:12 -0600 Subject: [PATCH 024/100] CONTENTBOX-1359 #resolve Add Error handling to renderWithSearchResults --- .cfformat.json | 3 +- modules/contentbox/models/search/DBSearch.cfc | 60 +++++++++++-------- .../models/search/ISearchAdapter.cfc | 25 +++++--- .../models/search/SearchResults.cfc | 6 ++ 4 files changed, 61 insertions(+), 33 deletions(-) diff --git a/.cfformat.json b/.cfformat.json index a167f3fcc0..750c2f588e 100644 --- a/.cfformat.json +++ b/.cfformat.json @@ -8,6 +8,7 @@ "alignment.consecutive.assignments": true, "alignment.consecutive.properties": false, "alignment.consecutive.params": true, + "alignment.doc_comments" : true, "brackets.padding": true, "comment.asterisks": "align", "binary_operators.padding": true, @@ -59,4 +60,4 @@ "struct.multiline.element_count": 2, "struct.multiline.min_length": 60, "tab_indent": true -} \ No newline at end of file +} diff --git a/modules/contentbox/models/search/DBSearch.cfc b/modules/contentbox/models/search/DBSearch.cfc index d23d7f47dc..7449881363 100644 --- a/modules/contentbox/models/search/DBSearch.cfc +++ b/modules/contentbox/models/search/DBSearch.cfc @@ -25,9 +25,9 @@ component accessors="true" singleton { * Search content and return an standardized ContentBox Results object. * * @searchTerm The search term to search on - * @max The max results to return if paging - * @offset The offset to use in the search results if paging - * @siteID The site to filter on if passed + * @max The max results to return if paging + * @offset The offset to use in the search results if paging + * @siteID The site to filter on if passed * * @return contentbox.models.search.SearchResults Object */ @@ -102,29 +102,41 @@ component accessors="true" singleton { // cfformat-ignore-start savecontent variable="results" { - writeOutput( - " -
-
- Found #total# results in #arguments.searchResults.getSearchTime()#ms! -
- " - ); - for ( var item in searchItems ) { - writeOutput( - " -
- -
-

#highlightSearchTerm( searchTerm, stripHTML( item.renderContent() ) )#

- #item.getContentType()# : #cb.linkContent( item )#
+ // Render out the results or error if the results had errors + if( arguments.searchResults.getError() ){ + writeOutput(" +
+

Error Running Search

+

+ #arrayToList( + arguments.searchResults.getErrorMessages(), + "
" + )# +

- " - ); + ") + } else { + writeOutput( + "
+
+ Found #total# results in #arguments.searchResults.getSearchTime()#ms! +
+ "); + } + // Render out the items + for ( var item in searchItems ) { + writeOutput(" +
+ +
+

#highlightSearchTerm( searchTerm, stripHTML( item.renderContent() ) )#

+ #item.getContentType()# : #cb.linkContent( item )#
+
+ "); if ( item.hasCategories() ) { writeOutput( "
Categories: " ); @@ -153,7 +165,7 @@ component accessors="true" singleton { /** * Utility function to help you highlight search terms in content - * @term The search term + * @term The search term * @content The content searched */ private function highlightSearchTerm( required term, required content ){ diff --git a/modules/contentbox/models/search/ISearchAdapter.cfc b/modules/contentbox/models/search/ISearchAdapter.cfc index 480f22d210..fa951293d7 100644 --- a/modules/contentbox/models/search/ISearchAdapter.cfc +++ b/modules/contentbox/models/search/ISearchAdapter.cfc @@ -9,10 +9,13 @@ interface { /** * Search content and return an standardized ContentBox Results object. + * * @searchTerm The search term to search on - * @max The max results to return if paging - * @offset The offset to use in the search results if paging - * @siteID The site id to search on if passed + * @max The max results to return if paging + * @offset The offset to use in the search results if paging + * @siteID The site id to search on if passed + * + * @return SearchResults object with the results */ contentbox.models.search.SearchResults function search( required string searchTerm, @@ -23,14 +26,19 @@ interface { /** * If chosen to be implemented, it should refresh search indexes and collections + * + * @return Itself */ contentbox.models.search.ISearchAdapter function refresh(); /** * Render the search results according to the adapter and return HTML + * * @searchTerm The search term to search on - * @max The max results to return if paging - * @offset The offset to use in the search results if paging + * @max The max results to return if paging + * @offset The offset to use in the search results if paging + * + * @return The search html */ any function renderSearch( required string searchTerm, @@ -40,10 +48,11 @@ interface { /** * Render the search results according the passed in search results object + * * @searchResults The search results object + * + * @return The search html */ - any function renderSearchWithResults( - required contentbox.models.search.SearchResults searchResults - ); + any function renderSearchWithResults( required contentbox.models.search.SearchResults searchResults ); } diff --git a/modules/contentbox/models/search/SearchResults.cfc b/modules/contentbox/models/search/SearchResults.cfc index ce6a5f5eaf..19150d7476 100644 --- a/modules/contentbox/models/search/SearchResults.cfc +++ b/modules/contentbox/models/search/SearchResults.cfc @@ -11,26 +11,32 @@ component accessors="true" { name="results" type="any" hint="The search results in query or array or whatever format"; + property name="total" type="numeric" hint="The total number of records found"; + property name="searchTime" type="numeric" hint="The amount of time it took for the search in milliseconds"; + property name="searchTerm" type="string" hint="The search term used"; + property name="error" type="boolean" hint="Mark if the search results produce an error or not"; + property name="errorMessages" type="array" hint="An array of error messagse if any"; + property name="metadata" type="struct" From 514ecead1fb7e59cd81e62095d105dc17746beec Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Wed, 8 Dec 2021 09:15:22 -0600 Subject: [PATCH 025/100] fixed adobe ; semicolons --- modules/contentbox/models/search/DBSearch.cfc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/contentbox/models/search/DBSearch.cfc b/modules/contentbox/models/search/DBSearch.cfc index 7449881363..a75f331413 100644 --- a/modules/contentbox/models/search/DBSearch.cfc +++ b/modules/contentbox/models/search/DBSearch.cfc @@ -105,7 +105,7 @@ component accessors="true" singleton { // Render out the results or error if the results had errors if( arguments.searchResults.getError() ){ - writeOutput(" + writeOutput( "

Error Running Search

@@ -115,14 +115,14 @@ component accessors="true" singleton { )#

- ") + " ); } else { - writeOutput( - "
+ writeOutput( " +
Found #total# results in #arguments.searchResults.getSearchTime()#ms!
- "); + " ); } // Render out the items From 41afe2aa4ed4852e3bd564e9e74d4cad73ba8c3b Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 9 Dec 2021 15:57:14 -0600 Subject: [PATCH 026/100] adding more tests --- .../contentbox/models/media/MediaService.cfc | 57 +++++++++++-------- .../unit/media/MediaServiceTest.cfc | 30 ++++++++-- 2 files changed, 58 insertions(+), 29 deletions(-) diff --git a/modules/contentbox/models/media/MediaService.cfc b/modules/contentbox/models/media/MediaService.cfc index 98468fb673..113c8a7c57 100644 --- a/modules/contentbox/models/media/MediaService.cfc +++ b/modules/contentbox/models/media/MediaService.cfc @@ -7,15 +7,31 @@ */ component accessors="true" singleton { - // DI + /** + * -------------------------------------------------------------------------- + * DI + * -------------------------------------------------------------------------- + */ property name="log" inject="logbox:logger:{this}"; property name="settingService" inject="settingservice@contentbox"; + /** + * -------------------------------------------------------------------------- + * Properties + * -------------------------------------------------------------------------- + */ + /** * ContentBox Providers Map */ property name="providers" type="struct"; + /** + * -------------------------------------------------------------------------- + * Static + * -------------------------------------------------------------------------- + */ + // Static default media root, just in case it is not loaded. variables.DEFAULT_MEDIA_ROOT = "/contentbox-custom/_content"; @@ -40,7 +56,7 @@ component accessors="true" singleton { } /** - * Get the default system media provider name + * Get the default system media provider name as a string */ function getDefaultProviderName(){ return variables.settingService.getSetting( "cb_media_provider" ); @@ -48,6 +64,8 @@ component accessors="true" singleton { /** * Get the default system media provider object + * + * @return contentbox.models.media.IMediaProvider */ function getDefaultProvider(){ return getProvider( getDefaultProviderName() ); @@ -57,6 +75,8 @@ component accessors="true" singleton { * Get a named provider object * * @name The provider to get,that must be registered + * + * @return contentbox.models.media.IMediaProvider */ function getProvider( required name ){ return variables.providers[ arguments.name ]; @@ -67,9 +87,7 @@ component accessors="true" singleton { * * @provider The provider object to register */ - MediaService function registerProvider( - required contentbox.models.media.IMediaProvider provider - ){ + MediaService function registerProvider( required contentbox.models.media.IMediaProvider provider ){ variables.providers[ arguments.provider.getName() ] = arguments.provider; return this; } @@ -93,23 +111,17 @@ component accessors="true" singleton { /** * Get an array of registered provider names in alphabetical order with their display names + * + * @return array of structs { name, displayName, description } */ array function getRegisteredProvidersMap(){ - var aProviders = getRegisteredProviders(); - var result = []; - - for ( var thisProvider in aProviders ) { - arrayAppend( - result, - { - name : thisProvider, - displayName : variables.providers[ thisProvider ].getDisplayName(), - description : variables.providers[ thisProvider ].getDescription() - } - ); - } - - return result; + return getRegisteredProviders().map( function( thisProvider ){ + return { + name : arguments.thisProvider, + displayName : variables.providers[ arguments.thisProvider ].getDisplayName(), + description : variables.providers[ arguments.thisProvider ].getDescription() + }; + } ); } /** @@ -118,10 +130,7 @@ component accessors="true" singleton { * @absolute Return the absolute path or relative, if absolute then it expands the path. */ function getCoreMediaRoot( required boolean absolute = false ){ - var mRoot = variables.settingService.getSetting( - "cb_media_directoryRoot", - variables.DEFAULT_MEDIA_ROOT - ); + var mRoot = variables.settingService.getSetting( "cb_media_directoryRoot", variables.DEFAULT_MEDIA_ROOT ); return ( arguments.absolute ? expandPath( mRoot ) : mRoot ); } diff --git a/tests/specs/contentbox-web/contentbox/unit/media/MediaServiceTest.cfc b/tests/specs/contentbox-web/contentbox/unit/media/MediaServiceTest.cfc index 54728096ec..4ff093fd55 100644 --- a/tests/specs/contentbox-web/contentbox/unit/media/MediaServiceTest.cfc +++ b/tests/specs/contentbox-web/contentbox/unit/media/MediaServiceTest.cfc @@ -10,19 +10,39 @@ component extends="tests.resources.BaseTest" { describe( "DB Search Adapter", function(){ beforeEach( function( currentSpec ){ setup(); - model = getInstance( "MediaService@contentbox" ); + service = getInstance( "MediaService@contentbox" ).init( getWireBox() ); } ); - it( "can get a provider", function(){ - var provider = model.getProvider( "CFContentMediaProvider" ); + it( "can register and get providers", function(){ + var provider = service.getProvider( "CFContentMediaProvider" ); expect( provider ).toBeComponent(); assertEquals( "CFContentMediaProvider", provider.getName() ); assertEquals( "CF Content Media Provider", provider.getDisplayName() ); } ); - it( "can get the default provider", function(){ - assertEquals( "CFContentMediaProvider", model.getDefaultProviderName() ); + assertEquals( "CFContentMediaProvider", service.getDefaultProviderName() ); + } ); + + it( "can unregister a provider", function(){ + service.unregisterProvider( "CFContentMediaProvider" ); + expect( service.getRegisteredProviders() ).notToInclude( "CFContentMediaProvider" ); + } ); + + it( "can get the registered providers map", function(){ + var map = service.getRegisteredProvidersMap(); + debug( map ); + expect( map ).toBeArray().notToBeEmpty(); + } ); + + it( "can get the path to the core media root", function(){ + var path = service.getCoreMediaRoot(); + expect( path ).toInclude( "/contentbox-custom/_content" ); + } ); + + it( "can get the absolute path to the core media root", function(){ + var path = service.getCoreMediaRoot( true ); + expect( directoryExists( path ) ).toBeTrue(); } ); } ); } From d14089d792ad3300cf94c35657f8f80d260d8669 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 16 Dec 2021 15:03:45 -0600 Subject: [PATCH 027/100] CONTENTBOX-1362 #resolve Change all date comparisons on the expirations and publishing dates to dateCompare() to avoid ambiguity with types CONTENTBOX-1361 #resolve Pages with null expiration date show as Expired in Page Editor --- .../contentbox/models/content/BaseContent.cfc | 153 +++++++++--------- 1 file changed, 77 insertions(+), 76 deletions(-) diff --git a/modules/contentbox/models/content/BaseContent.cfc b/modules/contentbox/models/content/BaseContent.cfc index 45f9522bf9..97dc9289b3 100644 --- a/modules/contentbox/models/content/BaseContent.cfc +++ b/modules/contentbox/models/content/BaseContent.cfc @@ -3,7 +3,8 @@ * Copyright since 2012 by Ortus Solutions, Corp * www.ortussolutions.com/products/contentbox * --- - * A mapped super class used for contentbox content: entries and pages + * A mapped super class used for any ContentBox content object. All concrete content objects + * will inherit from this one. */ component persistent ="true" @@ -15,9 +16,12 @@ component discriminatorColumn="contentType" { - /* ********************************************************************* - ** DI INJECTIONS - ********************************************************************* */ + /** + * -------------------------------------------------------------------------- + * DI + * -------------------------------------------------------------------------- + * All DI is done lazyly to avoid any performance issues. Thus the provider annotation + */ property name ="categoryService" @@ -54,18 +58,24 @@ component inject ="provider:settingService@contentbox" persistent="false"; - /* ********************************************************************* - ** NON PERSISTED PROPERTIES - ********************************************************************* */ + /** + * -------------------------------------------------------------------------- + * NON PERSISTED PROPERTIES + * -------------------------------------------------------------------------- + */ property name ="renderedContent" persistent="false" default =""; - /* ********************************************************************* - ** STUPID PROPERTIES DUE TO ACF BUG - ********************************************************************* */ + /** + * -------------------------------------------------------------------------- + * STUPID PROPERTIES DUE TO ACF BUG + * -------------------------------------------------------------------------- + * There is a bug in acf2016, 2018, 2021 dealing with table inheritance. It + * has never been fixed. Until it does, keep these. + */ property name ="createdDate" @@ -89,9 +99,11 @@ component notnull="true" default="false"; - /* ********************************************************************* - ** PROPERTIES - ********************************************************************* */ + /** + * -------------------------------------------------------------------------- + * PROPERTIES + * -------------------------------------------------------------------------- + */ property name ="contentID" @@ -247,9 +259,11 @@ component default="" length ="500"; - /* ********************************************************************* - ** RELATIONSHIPS - ********************************************************************* */ + /** + * -------------------------------------------------------------------------- + * RELATIONSHIPS + * -------------------------------------------------------------------------- + */ // M20 -> creator loaded as a proxy and fetched immediately property @@ -397,9 +411,11 @@ component fetch ="join" lazy ="true"; - /* ********************************************************************* - ** CALCULATED FIELDS - ********************************************************************* */ + /** + * -------------------------------------------------------------------------- + * CALCULATED FIELDS + * -------------------------------------------------------------------------- + */ property name ="numberOfHits" @@ -423,9 +439,11 @@ component formula="select count(*) from cb_contentVersion versions where versions.FK_contentID=contentID" default="0"; - /* ********************************************************************* - ** PK + CONSTRAINTS + STATIC VARS - ********************************************************************* */ + /** + * -------------------------------------------------------------------------- + * MEMENTIFIER + CONSTRAINTS + * -------------------------------------------------------------------------- + */ this.pk = "contentID"; @@ -585,10 +603,6 @@ component "title" : { required : true, size : "1..200" } }; - /* ********************************************************************* - ** PUBLIC FUNCTIONS - ********************************************************************* */ - /** * Base constructor */ @@ -613,8 +627,10 @@ component */ function onDIComplete(){ // Load up content helpers - variables.wirebox.getInstance( dsl : "coldbox:moduleSettings:contentbox" ) - .contentHelpers.each( function( thisHelper ){ + variables.wirebox + .getInstance( dsl: "coldbox:moduleSettings:contentbox" ) + .contentHelpers + .each( function( thisHelper ){ includeMixin( arguments.thisHelper ); } ); } @@ -715,9 +731,7 @@ component * Get the total number of active versions this content object has */ numeric function getNumberOfActiveVersions(){ - return ( - isLoaded() ? variables.contentVersionService.getNumberOfVersions( getContentId(), true ) : 0 - ); + return ( isLoaded() ? variables.contentVersionService.getNumberOfVersions( getContentId(), true ) : 0 ); } /** @@ -726,9 +740,9 @@ component * deactivates the previous version. Persisting is done by the handler/service not by * this method. * - * @content The incoming content string to store as the new version content + * @content The incoming content string to store as the new version content * @changelog The changelog commit message, defaults to empty string - * @author The author object that is making the edit + * @author The author object that is making the edit * @isPreview Is this a preview version or a real version * * @return The same content object @@ -740,13 +754,9 @@ component boolean isPreview = false ){ // lock it for new content creation to avoid version overlaps - lock - name ="contentbox.addNewContentVersion.#getSlug()#" - type ="exclusive" - timeout ="10" - throwOnTimeout =true { + lock name="contentbox.addNewContentVersion.#getSlug()#" type="exclusive" timeout="10" throwOnTimeout=true { // get a new version object with our incoming content + relationships - var oNewVersion= variables.contentVersionService.new( { + var oNewVersion = variables.contentVersionService.new( { content : arguments.content, changelog : arguments.changelog, author : arguments.author, @@ -928,7 +938,7 @@ component /** * Shortcut to get a custom field value * - * @key The custom field key to get + * @key The custom field key to get * @defaultValue The default value if the key is not found. */ any function getCustomField( required key, defaultValue ){ @@ -1043,11 +1053,7 @@ component .count(); // Have we passed the limit? - if ( - ( versionCounts + 1 ) GT variables.settingService.getSetting( - "cb_versions_max_history" - ) - ) { + if ( ( versionCounts + 1 ) GT variables.settingService.getSetting( "cb_versions_max_history" ) ) { var oldestVersion = contentVersionService .newCriteria() .isEq( "relatedContent.contentID", getContentID() ) @@ -1199,21 +1205,32 @@ component * Bit that denotes if the content has expired or not, in order to be expired the content must have been published as well */ boolean function isExpired(){ - return ( isContentPublished() AND !isNull( expireDate ) AND expireDate lte now() ) ? true : false; + return ( + isContentPublished() AND + !isNull( variables.expireDate ) AND + dateCompare( variables.expireDate, now() ) lte 0 + ) ? true : false; } /** * Bit that denotes if the content has been published or not */ boolean function isContentPublished(){ - return ( getIsPublished() AND !isNull( publishedDate ) AND getPublishedDate() LTE now() ) ? true : false; + return ( + getIsPublished() AND + !isNull( variables.publishedDate ) AND + dateCompare( variables.publishedDate, now() ) lte 0 + ) ? true : false; } /** * Bit that denotes if the content has been published or not in the future */ boolean function isPublishedInFuture(){ - return ( getIsPublished() AND getPublishedDate() GT now() ) ? true : false; + return ( + getIsPublished() AND + dateCompare( variables.publishedDate, now() ) eq 1 + ) ? true : false; } /** @@ -1230,12 +1247,12 @@ component * - Prepare for cloning of entire hierarchies * - Make sure categories are cloned * - * @author The author doing the cloning - * @original The original content object that will be cloned into this content object - * @originalService The ContentBox content service object - * @publish Publish pages or leave as drafts + * @author The author doing the cloning + * @original The original content object that will be cloned into this content object + * @originalService The ContentBox content service object + * @publish Publish pages or leave as drafts * @originalSlugRoot The original slug that will be replaced in all cloned content - * @newSlugRoot The new slug root that will be replaced in all cloned content + * @newSlugRoot The new slug root that will be replaced in all cloned content */ BaseContent function prepareForClone( required any author, @@ -1306,9 +1323,7 @@ component arguments.original .getCategories() .each( function( thisCategory ){ - addCategories( - variables.categoryService.getOrCreate( arguments.thisCategory, getSite() ) - ); + addCategories( variables.categoryService.getOrCreate( arguments.thisCategory, getSite() ) ); } ); // now clone children @@ -1322,11 +1337,8 @@ component parent : this, creator : author, title : arguments.thisChild.getTitle(), - slug : this.getSlug() & "/" & listLast( - arguments.thisChild.getSlug(), - "/" - ), - site : getSite() + slug : this.getSlug() & "/" & listLast( arguments.thisChild.getSlug(), "/" ), + site : getSite() } ) // now deep clone until no more child is left behind. .prepareForClone( @@ -1399,10 +1411,7 @@ component if ( isNull( publishedDate ) ) { return ""; } - return dateFormat( publishedDate, this.DATE_FORMAT ) & " " & timeFormat( - publishedDate, - this.TIME_FORMAT - ); + return dateFormat( publishedDate, this.DATE_FORMAT ) & " " & timeFormat( publishedDate, this.TIME_FORMAT ); } /** @@ -1412,10 +1421,7 @@ component if ( isNull( expireDate ) ) { return "N/A"; } - return dateFormat( expireDate, this.DATE_FORMAT ) & " " & timeFormat( - expireDate, - this.TIME_FORMAT - ); + return dateFormat( expireDate, this.DATE_FORMAT ) & " " & timeFormat( expireDate, this.TIME_FORMAT ); } /** @@ -1565,9 +1571,7 @@ component cacheKey, variables.renderedContent, ( getCacheTimeout() eq 0 ? settings.cb_content_cachingTimeout : getCacheTimeout() ), - ( - getCacheLastAccessTimeout() eq 0 ? settings.cb_content_cachingTimeoutIdle : getCacheLastAccessTimeout() - ) + ( getCacheLastAccessTimeout() eq 0 ? settings.cb_content_cachingTimeoutIdle : getCacheLastAccessTimeout() ) ); } @@ -1584,10 +1588,7 @@ component // render content out, prepare builder var builder = createObject( "java", "java.lang.StringBuilder" ).init( arguments.content ); // announce renderings with data, so content renderers can process them - interceptorService.announce( - "cb_onContentRendering", - { builder : builder, content : this } - ); + interceptorService.announce( "cb_onContentRendering", { builder : builder, content : this } ); // return processed content return builder.toString(); } From 23136375af4911d888c0d21c07ce3baed2d565ff Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 16 Dec 2021 15:38:44 -0600 Subject: [PATCH 028/100] CONTENTBOX-1363 #resolve Consolidate and encapsulate the usage of date/time methods for publish/expire date in the base content --- .../contentbox/models/BaseEntityMethods.cfc | 31 ++++---- .../contentbox/models/content/BaseContent.cfc | 78 +++++++++---------- .../handlers/baseContentHandler.cfc | 13 ++-- .../contentbox-ckeditor/models/CKHelper.cfc | 32 -------- .../editor/sidebar/PublishingPanel.cfm | 34 +++----- 5 files changed, 68 insertions(+), 120 deletions(-) delete mode 100755 modules/contentbox/modules/contentbox-admin/modules/contentbox-ckeditor/models/CKHelper.cfc diff --git a/modules/contentbox/models/BaseEntityMethods.cfc b/modules/contentbox/models/BaseEntityMethods.cfc index 4c27a811e0..018a47b3b6 100644 --- a/modules/contentbox/models/BaseEntityMethods.cfc +++ b/modules/contentbox/models/BaseEntityMethods.cfc @@ -68,10 +68,7 @@ component { if ( isNull( this.memento.baseIncluded ) ) { // Incorporate default includes for the base class. if ( !isNull( this.memento.defaultIncludes ) ) { - this.memento.defaultIncludes.append( - [ this.pk, "createdDate", "modifiedDate" ], - true - ); + this.memento.defaultIncludes.append( [ this.pk, "createdDate", "modifiedDate" ], true ); } // Incorporate default excludes for the base class. if ( !isNull( this.memento.defaultExcludes ) ) { @@ -89,9 +86,7 @@ component { function getEntityName(){ if ( isNull( variables.entityName ) ) { var md = getMetadata( this ); - variables.entityName = ( - md.keyExists( "entityName" ) ? md.entityName : listLast( md.name, "." ) - ); + variables.entityName = ( md.keyExists( "entityName" ) ? md.entityName : listLast( md.name, "." ) ); } return variables.entityName; @@ -101,7 +96,7 @@ component { * Append an incoming array of properties to a memento list target * * @collection The array to append - * @target The target to append to: defaultIncludes, defaultExcludes, neverInclude, defaults, etc. + * @target The target to append to: defaultIncludes, defaultExcludes, neverInclude, defaults, etc. */ function appendToMemento( required collection, target = "defaultIncludes" ){ var filtered = arguments.collection.filter( function( item ){ @@ -142,12 +137,12 @@ component { } /** - * Get formatted createdDate + * Get the created date in the default or specific date/time format + * + * @dateFormat The date format to use, defaulted by ContentBox to mmm dd, yyyy + * @timeFormat The time format to use, defaulted by ContentBox to HH:mm:ss z */ - string function getDisplayCreatedDate( - dateFormat = this.DATE_FORMAT, - timeFormat = this.TIME_FORMAT - ){ + string function getDisplayCreatedDate( dateFormat = this.DATE_FORMAT, timeFormat = this.TIME_FORMAT ){ if ( isNull( variables.createdDate ) ) { return ""; } @@ -158,12 +153,12 @@ component { } /** - * Get formatted modified date + * Get the modified date in the default or specific date/time format + * + * @dateFormat The date format to use, defaulted by ContentBox to mmm dd, yyyy + * @timeFormat The time format to use, defaulted by ContentBox to HH:mm:ss z */ - string function getDisplayModifiedDate( - dateFormat = this.DATE_FORMAT, - timeFormat = this.TIME_FORMAT - ){ + string function getDisplayModifiedDate( dateFormat = this.DATE_FORMAT, timeFormat = this.TIME_FORMAT ){ if ( isNull( variables.modifiedDate ) ) { return ""; } diff --git a/modules/contentbox/models/content/BaseContent.cfc b/modules/contentbox/models/content/BaseContent.cfc index 97dc9289b3..c9ffa840f7 100644 --- a/modules/contentbox/models/content/BaseContent.cfc +++ b/modules/contentbox/models/content/BaseContent.cfc @@ -1208,6 +1208,7 @@ component return ( isContentPublished() AND !isNull( variables.expireDate ) AND + len( variables.expireDate ) AND // In case of some odd empty string cases dateCompare( variables.expireDate, now() ) lte 0 ) ? true : false; } @@ -1362,66 +1363,63 @@ component } /** - * Get's the published date of the content object in UI format. - * If no publish date is found, we use now() + * This method retrieves the time of the publishing for the content object in UTC timezone. + * The format expected back is {hour}:{minute}. If the publish date is null an empty string is returned. * - * @showTime Show time on return string or not + * @return The published date time as {hour}:{minute}. */ - string function getPublishedDateForEditor( boolean showTime = false ){ - var pDate = getPublishedDate(); - if ( isNull( pDate ) ) { - pDate = now(); - } - - // get formatted date - var fDate = dateFormat( pDate, this.DATE_FORMAT ); - if ( arguments.showTime ) { - fDate &= " " & timeFormat( pDate, this.TIME_FORMAT ); + string function getPublishedDateTime(){ + if ( isNull( variables.publishedDate ) || !len( variables.publishedDate ) ) { + return ""; } - - return fDate; + return hour( variables.publishedDate ) & ":" & minute( variables.publishedDate ); } /** - * Get the expire date for the content object in UI format - * If no expire date is found, we return an empty string + * This method retrieves the time of the expiration for the content object in UTC timezone. + * The format expected back is {hour}:{minute}. If the expire date is null an empty string is returned. * - * @showTime Show time on return string or not + * @return The expire date time as {hour}:{minute}. */ - string function getExpireDateForEditor( boolean showTime = false ){ - var pDate = getExpireDate(); - if ( isNull( pDate ) ) { - pDate = ""; - } - - // get formatted date - var fDate = dateFormat( pDate, this.DATE_FORMAT ); - if ( arguments.showTime ) { - fDate &= " " & timeFormat( pDate, this.TIME_FORMAT ); + string function getExpireDateTime(){ + if ( isNull( variables.expireDate ) || !len( variables.expireDate ) ) { + return ""; } - - return fDate; + return hour( variables.expireDate ) & ":" & minute( variables.expireDate ); } /** - * Get display publishedDate + * Get the published date using the default date format and time format + * If the publish date is null or empty an empty string is returned. + * + * @dateFormat The date format to use, defaulted by ContentBox to mmm dd, yyyy + * @timeFormat The time format to use, defaulted by ContentBox to HH:mm:ss z */ - string function getDisplayPublishedDate(){ - var publishedDate = getPublishedDate(); - if ( isNull( publishedDate ) ) { + string function getDisplayPublishedDate( dateFormat = this.DATE_FORMAT, timeFormat = this.TIME_FORMAT ){ + if ( isNull( variables.publishedDate ) || !len( variables.publishedDate ) ) { return ""; } - return dateFormat( publishedDate, this.DATE_FORMAT ) & " " & timeFormat( publishedDate, this.TIME_FORMAT ); + return dateFormat( variables.publishedDate, arguments.dateFormat ) & " " & timeFormat( + variables.publishedDate, + arguments.timeFormat + ); } /** - * Get formatted expireDate + * Get the expire date using the default date format and time format + * If the expire date is null or empty an empty string is returned. + * + * @dateFormat The date format to use, defaulted by ContentBox to mmm dd, yyyy + * @timeFormat The time format to use, defaulted by ContentBox to HH:mm:ss z */ - string function getDisplayExpireDate(){ - if ( isNull( expireDate ) ) { - return "N/A"; + string function getDisplayExpireDate( dateFormat = this.DATE_FORMAT, timeFormat = this.TIME_FORMAT ){ + if ( isNull( variables.expireDate ) || !len( variables.expireDate ) ) { + return ""; } - return dateFormat( expireDate, this.DATE_FORMAT ) & " " & timeFormat( expireDate, this.TIME_FORMAT ); + return dateFormat( variables.expireDate, arguments.dateFormat ) & " " & timeFormat( + variables.expireDate, + arguments.timeFormat + ); } /** diff --git a/modules/contentbox/modules/contentbox-admin/handlers/baseContentHandler.cfc b/modules/contentbox/modules/contentbox-admin/handlers/baseContentHandler.cfc index 083967ded5..adf8284c15 100644 --- a/modules/contentbox/modules/contentbox-admin/handlers/baseContentHandler.cfc +++ b/modules/contentbox/modules/contentbox-admin/handlers/baseContentHandler.cfc @@ -15,7 +15,6 @@ component extends="baseHandler" { property name="authorService" inject="authorService@contentbox"; property name="themeService" inject="themeService@contentbox"; - property name="CKHelper" inject="CKHelper@contentbox-ckeditor"; property name="HTMLHelper" inject="HTMLHelper@coldbox"; property name="categoryService" inject="categoryService@contentbox"; property name="customFieldService" inject="customFieldService@contentbox"; @@ -275,8 +274,6 @@ component extends="baseHandler" { sortOrder: "slug asc", siteID : prc.oCurrentSite.getsiteID() ); - // CK Editor Helper - prc.ckHelper = variables.CKHelper; // Get All registered editors so we can display them prc.editors = variables.editorService.getRegisteredEditorsMap(); // Get User's default editor @@ -319,7 +316,7 @@ component extends="baseHandler" { * Save Content * * @adminPermission The admin permission to apply for publishing, eg: ENTRIES_ADMIN, PAGES_ADMIN - * @relocateTo Where to relocate to when saving is done + * @relocateTo Where to relocate to when saving is done */ function save( event, @@ -699,11 +696,11 @@ component extends="baseHandler" { /** * Content pager viewlet. Used for embedding a table visualizer of content according to arguments * - * @authorId The author to filter the viewlet on. By default we show all content by all authors - * @parent Do we want to root the content at a specific parent not or not, by default we do not - * @max The maximum number of records to show, default is using the settings maxrows + * @authorId The author to filter the viewlet on. By default we show all content by all authors + * @parent Do we want to root the content at a specific parent not or not, by default we do not + * @max The maximum number of records to show, default is using the settings maxrows * @pagination Show pagination caroussel or not, default is true - * @latest Show the latest content ordering or by natural ordering + * @latest Show the latest content ordering or by natural ordering * * @return HTML */ diff --git a/modules/contentbox/modules/contentbox-admin/modules/contentbox-ckeditor/models/CKHelper.cfc b/modules/contentbox/modules/contentbox-admin/modules/contentbox-ckeditor/models/CKHelper.cfc deleted file mode 100755 index e1cef24e63..0000000000 --- a/modules/contentbox/modules/contentbox-admin/modules/contentbox-ckeditor/models/CKHelper.cfc +++ /dev/null @@ -1,32 +0,0 @@ -/** - * ContentBox - A Modular Content Platform - * Copyright since 2012 by Ortus Solutions, Corp - * www.ortussolutions.com/products/contentbox - * --- - * Helps with CK Editor operations - */ -component singleton { - - CKHelper function init(){ - return this; - } - - string function toCKDate( required inDate ){ - return dateFormat( arguments.inDate, "yyyy-mm-dd" ); - } - - string function ckHour( required inDate ){ - if ( isNull( inDate ) ) { - inDate = now(); - } - return timeFormat( arguments.inDate, "HH" ); - } - - string function ckMinute( required inDate ){ - if ( isNull( inDate ) ) { - inDate = now(); - } - return timeFormat( arguments.inDate, "mm" ); - } - -} diff --git a/modules/contentbox/modules/contentbox-admin/views/_components/editor/sidebar/PublishingPanel.cfm b/modules/contentbox/modules/contentbox-admin/views/_components/editor/sidebar/PublishingPanel.cfm index fc826b5154..9feb93ffcf 100644 --- a/modules/contentbox/modules/contentbox-admin/views/_components/editor/sidebar/PublishingPanel.cfm +++ b/modules/contentbox/modules/contentbox-admin/views/_components/editor/sidebar/PublishingPanel.cfm @@ -49,15 +49,6 @@
- - theTime = ""; - hour = prc.ckHelper.ckHour( prc.oContent.getPublishedDateForEditor( showTime=true ) ); - minute = prc.ckHelper.ckMinute( prc.oContent.getPublishedDateForEditor( showTime=true ) ); - if( len( hour ) && len( minute ) ) { - theTime = hour & ":" & minute; - } - -
@@ -105,18 +96,17 @@
- - theTime = ""; - hour = prc.ckHelper.ckHour( prc.oContent.getExpireDateForEditor(showTime=true) ); - minute = prc.ckHelper.ckMinute( prc.oContent.getExpireDateForEditor(showTime=true) ); - if( len( hour ) && len( minute ) ) { - theTime = hour & ":" & minute; - } - -
-
- +
+ @@ -213,4 +203,4 @@
Saving...
- \ No newline at end of file + From 47d9b5d2d9895901f29270201ebd6f9efbfcccbd Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 16 Dec 2021 15:45:19 -0600 Subject: [PATCH 029/100] CONTENTBOX-1363 Consolidate and encapsulate the usage of date/time methods for publish/expire date in the base content --- .../views/_components/editor/sidebar/PublishingPanel.cfm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/contentbox/modules/contentbox-admin/views/_components/editor/sidebar/PublishingPanel.cfm b/modules/contentbox/modules/contentbox-admin/views/_components/editor/sidebar/PublishingPanel.cfm index 9feb93ffcf..c7b18c009f 100644 --- a/modules/contentbox/modules/contentbox-admin/views/_components/editor/sidebar/PublishingPanel.cfm +++ b/modules/contentbox/modules/contentbox-admin/views/_components/editor/sidebar/PublishingPanel.cfm @@ -39,7 +39,7 @@ #html.inputField( size = "9", name = "publishedDate", - value = prc.oContent.getPublishedDateForEditor(), + value = prc.oContent.getDisplayPublishedDate(), class = "form-control datepicker" )# @@ -86,7 +86,7 @@ #html.inputField( size = "9", name = "expireDate", - value = prc.oContent.getExpireDateForEditor(), + value = prc.oContent.getDisplayExpireDate(), class = "form-control datepicker" )# From fa4524b4f272643c33f3e67d654d7c2e305bb7c9 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 16 Dec 2021 16:04:30 -0600 Subject: [PATCH 030/100] fixing date formats for UI control. --- .../contentbox/models/content/BaseContent.cfc | 20 +++++++++++++++++-- .../editor/sidebar/PublishingPanel.cfm | 10 ++++++++-- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/modules/contentbox/models/content/BaseContent.cfc b/modules/contentbox/models/content/BaseContent.cfc index c9ffa840f7..a2fa144608 100644 --- a/modules/contentbox/models/content/BaseContent.cfc +++ b/modules/contentbox/models/content/BaseContent.cfc @@ -1394,11 +1394,19 @@ component * * @dateFormat The date format to use, defaulted by ContentBox to mmm dd, yyyy * @timeFormat The time format to use, defaulted by ContentBox to HH:mm:ss z + * @showTime Show the time or just the date */ - string function getDisplayPublishedDate( dateFormat = this.DATE_FORMAT, timeFormat = this.TIME_FORMAT ){ + string function getDisplayPublishedDate( + dateFormat = this.DATE_FORMAT, + timeFormat = this.TIME_FORMAT, + boolean showTime = true + ){ if ( isNull( variables.publishedDate ) || !len( variables.publishedDate ) ) { return ""; } + if ( !arguments.showTime ) { + return dateFormat( variables.publishedDate, arguments.dateFormat ); + } return dateFormat( variables.publishedDate, arguments.dateFormat ) & " " & timeFormat( variables.publishedDate, arguments.timeFormat @@ -1411,11 +1419,19 @@ component * * @dateFormat The date format to use, defaulted by ContentBox to mmm dd, yyyy * @timeFormat The time format to use, defaulted by ContentBox to HH:mm:ss z + * @showTime Show the time or just the date */ - string function getDisplayExpireDate( dateFormat = this.DATE_FORMAT, timeFormat = this.TIME_FORMAT ){ + string function getDisplayExpireDate( + dateFormat = this.DATE_FORMAT, + timeFormat = this.TIME_FORMAT, + boolean showTime = true + ){ if ( isNull( variables.expireDate ) || !len( variables.expireDate ) ) { return ""; } + if ( !arguments.showTime ) { + return dateFormat( variables.expireDate, arguments.dateFormat ); + } return dateFormat( variables.expireDate, arguments.dateFormat ) & " " & timeFormat( variables.expireDate, arguments.timeFormat diff --git a/modules/contentbox/modules/contentbox-admin/views/_components/editor/sidebar/PublishingPanel.cfm b/modules/contentbox/modules/contentbox-admin/views/_components/editor/sidebar/PublishingPanel.cfm index c7b18c009f..abee219331 100644 --- a/modules/contentbox/modules/contentbox-admin/views/_components/editor/sidebar/PublishingPanel.cfm +++ b/modules/contentbox/modules/contentbox-admin/views/_components/editor/sidebar/PublishingPanel.cfm @@ -1,4 +1,10 @@ + + // writeDump( var=[ + // prc.oContent.getPublishedDate() + // ], top = 5 ); + // abort; +
Date: Fri, 17 Dec 2021 14:53:46 -0500 Subject: [PATCH 031/100] formatting --- modules/contentbox/models/system/CBHelper.cfc | 295 ++++++++---------- 1 file changed, 124 insertions(+), 171 deletions(-) diff --git a/modules/contentbox/models/system/CBHelper.cfc b/modules/contentbox/models/system/CBHelper.cfc index eb0713cdb3..45e78beb6a 100644 --- a/modules/contentbox/models/system/CBHelper.cfc +++ b/modules/contentbox/models/system/CBHelper.cfc @@ -95,7 +95,7 @@ component accessors="true" singleton threadSafe { /** * Get a global setting value by key or by default value * - * @key The setting key to get + * @key The setting key to get * @defaultValue The default value to return if not found * * @throw InvalidSettingException @@ -121,7 +121,7 @@ component accessors="true" singleton threadSafe { /** * Get a site setting value by key or by default value * - * @key The setting key to get + * @key The setting key to get * @defaultValue The default value to return if not found * * @throws InvalidSettingException @@ -183,19 +183,16 @@ component accessors="true" singleton threadSafe { /** * Get a published content store and return its latest active content * - * @slug The content slug to retrieve + * @slug The content slug to retrieve * @defaultValue The default value to use if the content element not found. - * @siteID The site to get it from, defaults to current site + * @siteID The site to get it from, defaults to current site */ function contentStore( required slug, defaultValue = "", string siteID = site().getsiteID() ){ - var content = variables.contentStoreService.findBySlug( - slug : arguments.slug, - siteID: arguments.siteID - ); + var content = variables.contentStoreService.findBySlug( slug: arguments.slug, siteID: arguments.siteID ); // Render if the object is loaded return ( !content.isLoaded() ? arguments.defaultValue : content.renderContent() ); @@ -249,7 +246,7 @@ component accessors="true" singleton threadSafe { /** * Get a theme setting * - * @key The name of the theme setting + * @key The name of the theme setting * @defaultValue The default value if the layout setting does not exist */ function themeSetting( required key, defaultValue ){ @@ -397,10 +394,10 @@ component accessors="true" singleton threadSafe { * automatically for you on the UI module. However, you can use it a-la-carte if you are building * ajax or module extensions * - * @layout An optional layout to set for you in the request. - * @title Optional request page metadata title + * @layout An optional layout to set for you in the request. + * @title Optional request page metadata title * @description Optional request page metadata description - * @keywords Optional request page metadata keywords + * @keywords Optional request page metadata keywords */ CBHelper function prepareUIRequest( string layout, @@ -437,9 +434,7 @@ component accessors="true" singleton threadSafe { prc.oCurrentSite = variables.siteService.discoverSite(); // Place global cb options on scope prc.cbSettings = variables.settingService.getAllSettings(); - prc.cbSiteSettings = variables.settingService.getAllSiteSettings( - prc.oCurrentSite.getSlug() - ); + prc.cbSiteSettings = variables.settingService.getAllSiteSettings( prc.oCurrentSite.getSlug() ); // Place the default layout on scope prc.cbTheme = prc.oCurrentSite.getActiveTheme(); prc.cbThemeRecord = variables.themeService.getThemeRecord( prc.cbTheme ); @@ -743,7 +738,7 @@ component accessors="true" singleton threadSafe { /** * Get a current page's or blog entrie's custom field by key, you can pass a default value if not found - * @key The custom field key + * @key The custom field key * @defaultValue The default value to return if not found */ any function getCustomField( required key, defaultValue ){ @@ -1089,16 +1084,10 @@ component accessors="true" singleton threadSafe { function getOpenGraphMeta(){ var content = ""; savecontent variable="content" { - writeOutput( - "#chr( 10 )#" - ); - writeOutput( - "#chr( 10 )#" - ); + writeOutput( "#chr( 10 )#" ); + writeOutput( "#chr( 10 )#" ); if ( len( getContentURL() ) ) { - writeOutput( - "#chr( 10 )#" - ); + writeOutput( "#chr( 10 )#" ); } if ( len( getContentURL() ) ) { writeOutput( @@ -1202,10 +1191,10 @@ component accessors="true" singleton threadSafe { /** * Build out ContentBox module links * - * @module The module to link this URL to - * @to The handler action combination to link to + * @module The module to link this URL to + * @to The handler action combination to link to * @queryString The query string to append in SES format - * @ssl Create the link in SSL or not + * @ssl Create the link in SSL or not */ function buildModuleLink( required string module, @@ -1247,18 +1236,18 @@ component accessors="true" singleton threadSafe { /** * Relocate to a ContentBox module event * - * @module The module to link this URL to - * @event The name of the event to run, if not passed, then it will use the default event found in your configuration file - * @URL The full URL you would like to relocate to instead of an event: ex: URL='http://www.google.com' - * @URI The relative URI you would like to relocate to instead of an event: ex: URI='/mypath/awesome/here' - * @queryString The query string to append, if needed. If in SES mode it will be translated to convention name value pairs - * @persist What request collection keys to persist in flash ram - * @persistStruct A structure key-value pairs to persist in flash ram - * @addToken Wether to add the tokens or not. Default is false - * @ssl Whether to relocate in SSL or not - * @baseURL Use this baseURL instead of the index.cfm that is used by default. You can use this for ssl or any full base url you would like to use. Ex: https://mysite.com/index.cfm + * @module The module to link this URL to + * @event The name of the event to run, if not passed, then it will use the default event found in your configuration file + * @URL The full URL you would like to relocate to instead of an event: ex: URL='http://www.google.com' + * @URI The relative URI you would like to relocate to instead of an event: ex: URI='/mypath/awesome/here' + * @queryString The query string to append, if needed. If in SES mode it will be translated to convention name value pairs + * @persist What request collection keys to persist in flash ram + * @persistStruct A structure key-value pairs to persist in flash ram + * @addToken Wether to add the tokens or not. Default is false + * @ssl Whether to relocate in SSL or not + * @baseURL Use this baseURL instead of the index.cfm that is used by default. You can use this for ssl or any full base url you would like to use. Ex: https://mysite.com/index.cfm * @postProcessExempt Do not fire the postProcess interceptors - * @statusCode The status code to use in the relocation + * @statusCode The status code to use in the relocation */ function moduleRelocate( required string module, @@ -1282,13 +1271,10 @@ component accessors="true" singleton threadSafe { * Link to the admin * * @event An optional event to link to - * @ssl Use SSL or not, defaults to event context. + * @ssl Use SSL or not, defaults to event context. */ function linkAdmin( event = "", boolean ssl = getRequestContext().isSSL() ){ - return getRequestContext().buildLink( - to = adminRoot() & ".#arguments.event#", - ssl = arguments.ssl - ); + return getRequestContext().buildLink( to = adminRoot() & ".#arguments.event#", ssl = arguments.ssl ); } /** @@ -1297,10 +1283,7 @@ component accessors="true" singleton threadSafe { * @ssl Use SSL or not, defaults to event context. */ function linkAdminLogout( boolean ssl = getRequestContext().isSSL() ){ - return getRequestContext().buildLink( - to = adminRoot() & "/security/doLogout", - ssl = arguments.ssl - ); + return getRequestContext().buildLink( to = adminRoot() & "/security/doLogout", ssl = arguments.ssl ); } /** @@ -1309,10 +1292,7 @@ component accessors="true" singleton threadSafe { * @ssl Use SSL or not, defaults to event context. */ function linkAdminLogin( boolean ssl = getRequestContext().isSSL() ){ - return getRequestContext().buildLink( - to = adminRoot() & "/security/login", - ssl = arguments.ssl - ); + return getRequestContext().buildLink( to = adminRoot() & "/security/login", ssl = arguments.ssl ); } /** @@ -1351,8 +1331,8 @@ component accessors="true" singleton threadSafe { * Link to RSS feeds that ContentBox generates, by default it is the recent updates feed * @category You can optionally pass the category to filter on * @comments A boolean flag that determines if you want the comments RSS feed - * @entry You can optionally pass the entry to filter the comment's RSS feed - * @ssl Use SSL or not, defaults to false. + * @entry You can optionally pass the entry to filter the comment's RSS feed + * @ssl Use SSL or not, defaults to false. */ function linkRSS( category, @@ -1386,8 +1366,8 @@ component accessors="true" singleton threadSafe { * * @category The category to filter on * @comments Do comments RSS feeds - * @slug The content slug to filter on when using comments - * @ssl Use SSL or not, defaults to false. + * @slug The content slug to filter on when using comments + * @ssl Use SSL or not, defaults to false. */ function linkSiteRSS( any category, @@ -1423,8 +1403,8 @@ component accessors="true" singleton threadSafe { * Link to the ContentBox Page RSS Feeds * @category The category to filter on * @comments Page comments or not, defaults to false - * @page The page you want to filter on - * @ssl Use SSL or not, defaults to false. + * @page The page you want to filter on + * @ssl Use SSL or not, defaults to false. */ function linkPageRSS( any category, @@ -1460,7 +1440,7 @@ component accessors="true" singleton threadSafe { * Link to a specific filtered category view of blog entries * * @category The category object or slug to link to - * @ssl Use SSL or not, defaults to false. + * @ssl Use SSL or not, defaults to false. */ function linkCategory( required any category, boolean ssl = getRequestContext().isSSL() ){ var categorySlug = ""; @@ -1477,22 +1457,19 @@ component accessors="true" singleton threadSafe { * Link to a specific filtered category view of blog entries * * @categorySlug The category slug as a string to link to - * @ssl Use SSL or not, defaults to false. + * @ssl Use SSL or not, defaults to false. */ - function linkCategoryWithSlug( - required string categorySlug, - boolean ssl = getRequestContext().isSSL() - ){ + function linkCategoryWithSlug( required string categorySlug, boolean ssl = getRequestContext().isSSL() ){ return linkBlog() & "/category/#arguments.categorySlug#"; } /** * Link to a specific filtered archive of entries * - * @year The year of the archive + * @year The year of the archive * @month The month of the archive - * @day The day of the archive - * @ssl Use SSL or not, defaults to false. + * @day The day of the archive + * @ssl Use SSL or not, defaults to false. */ function linkArchive( year, @@ -1546,18 +1523,15 @@ component accessors="true" singleton threadSafe { * Link to the ContentBox Content Subscription unsubscribe URL * @token The token to use for unsubscribing */ - function linkContentUnsubscribe( - required string token, - boolean ssl = getRequestContext().isSSL() - ){ + function linkContentUnsubscribe( required string token, boolean ssl = getRequestContext().isSSL() ){ return siteRoot() & sep() & "__unsubscribe/#arguments.token#"; } /** * Link to a specific blog entry's page * - * @entry The entry to link to - * @ssl Use SSL or not, defaults to false. + * @entry The entry to link to + * @ssl Use SSL or not, defaults to false. * @format The format output of the content default is HTML bu you can pass pdf,print or doc. */ function linkEntry( @@ -1582,8 +1556,8 @@ component accessors="true" singleton threadSafe { /** * Link to a specific entry's page using a slug only * - * @slug The entry slug to link to - * @ssl Use SSL or not, defaults to false. + * @slug The entry slug to link to + * @ssl Use SSL or not, defaults to false. * @format The format output of the content default is HTML bu you can pass pdf,print or doc. */ function linkEntryWithSlug( @@ -1603,8 +1577,8 @@ component accessors="true" singleton threadSafe { * Link to a specific content object * * @content The content object to link to - * @ssl Use SSL or not, defaults to false. - * @format The format output of the content default is HTML but you can pass pdf,print or doc. + * @ssl Use SSL or not, defaults to false. + * @format The format output of the content default is HTML but you can pass pdf,print or doc. */ function linkContent( required content, @@ -1630,8 +1604,8 @@ component accessors="true" singleton threadSafe { /** * Link to a specific page * - * @page The page to link to. This can be a simple value or a page object - * @ssl Use SSL or not, defaults to false. + * @page The page to link to. This can be a simple value or a page object + * @ssl Use SSL or not, defaults to false. * @format The format extension output of the content default is HTML but you can pass pdf, print or doc. * * @return The link to this page @@ -1660,8 +1634,8 @@ component accessors="true" singleton threadSafe { /** * Link to a specific page using a slug only * - * @slug The page slug to link to - * @ssl Use SSL or not, defaults to false. + * @slug The page slug to link to + * @ssl Use SSL or not, defaults to false. * @format The format output of the content default is HTML bu you can pass pdf,print or doc. */ function linkPageWithSlug( @@ -1681,7 +1655,7 @@ component accessors="true" singleton threadSafe { * Create a link to a specific comment in a page or in an entry * * @comment The comment to link to - * @ssl Use SSL or not, defaults to false. + * @ssl Use SSL or not, defaults to false. */ function linkComment( required comment, boolean ssl = getRequestContext().isSSL() ){ var xeh = ""; @@ -1698,7 +1672,7 @@ component accessors="true" singleton threadSafe { /** * Create a link to an entry's or page's comments section * @content The entry or page to link to its comments - * @ssl Use SSL or not, defaults to false. + * @ssl Use SSL or not, defaults to false. */ function linkComments( required content, boolean ssl = getRequestContext().isSSL() ){ var xeh = ""; @@ -1715,7 +1689,7 @@ component accessors="true" singleton threadSafe { * Link to the commenting post action, this is where comments are submitted to * * @content The entry or page to link to its comments - * @ssl Use SSL or not, defaults to false. + * @ssl Use SSL or not, defaults to false. * * @return The URL to submit to. */ @@ -1808,9 +1782,9 @@ component accessors="true" singleton threadSafe { /** * Render out entries in the home page by using our ColdBox collection rendering - * @template The name of the template to use, by default it looks in the 'templates/entry.cfm' convention, no '.cfm' please + * @template The name of the template to use, by default it looks in the 'templates/entry.cfm' convention, no '.cfm' please * @collectionAs The name of the iterating object in the template, by default it is called 'entry' - * @args A structure of name-value pairs to pass to the template + * @args A structure of name-value pairs to pass to the template */ function quickEntries( string template = "entry", @@ -1830,9 +1804,9 @@ component accessors="true" singleton threadSafe { /** * Render out an entry using your pre-defined 'entry' template - * @template The name of the template to use, by default it looks in the 'templates/entry.cfm' convention, no '.cfm' please + * @template The name of the template to use, by default it looks in the 'templates/entry.cfm' convention, no '.cfm' please * @collectionAs The name of the iterating object in the template, by default it is called 'entry' - * @args A structure of name-value pairs to pass to the template + * @args A structure of name-value pairs to pass to the template */ function quickEntry( string template = "entry", @@ -1853,10 +1827,10 @@ component accessors="true" singleton threadSafe { /** * Render out categories anywhere using ColdBox collection rendering * - * @template The name of the template to use, by default it looks in the 'templates/category.cfm' convention, no '.cfm' please + * @template The name of the template to use, by default it looks in the 'templates/category.cfm' convention, no '.cfm' please * @collectionAs The name of the iterating object in the template, by default it is called 'category' - * @args A structure of name-value pairs to pass to the template - * @isPublic Return public categories by default. False, return private categories, null return all categories. + * @args A structure of name-value pairs to pass to the template + * @isPublic Return public categories by default. False, return private categories, null return all categories. */ function quickCategories( string template = "category", @@ -1877,9 +1851,9 @@ component accessors="true" singleton threadSafe { /** * Render out related content anywhere using ColdBox collection rendering - * @template The name of the template to use, by default it looks in the 'templates/relatedContent.cfm' convention, no '.cfm' please + * @template The name of the template to use, by default it looks in the 'templates/relatedContent.cfm' convention, no '.cfm' please * @collectionAs The name of the iterating object in the template, by default it is called 'relatedContent' - * @args A structure of name-value pairs to pass to the template + * @args A structure of name-value pairs to pass to the template */ function quickRelatedContent( string template = "relatedContent", @@ -1907,9 +1881,7 @@ component accessors="true" singleton threadSafe { savecontent variable="content" { writeOutput( "
    " ); for ( var thisField in customFields ) { - writeOutput( - "
  • #thisField#: #customFields[ thisField ]#
  • " - ); + writeOutput( "
  • #thisField#: #customFields[ thisField ]#
  • " ); } writeOutput( "
" ); } @@ -1919,9 +1891,9 @@ component accessors="true" singleton threadSafe { /** * Render out comments anywhere using ColdBox collection rendering - * @template The name of the template to use, by default it looks in the 'templates/comment.cfm' convention, no '.cfm' please + * @template The name of the template to use, by default it looks in the 'templates/comment.cfm' convention, no '.cfm' please * @collectionAs The name of the iterating object in the template, by default it is called 'comment' - * @args A structure of name-value pairs to pass to the template + * @args A structure of name-value pairs to pass to the template */ function quickComments( string template = "comment", @@ -1942,7 +1914,7 @@ component accessors="true" singleton threadSafe { /** * Renders out an author's avatar * @author The author object to render an avatar from - * @size The size of the gravatar, by default we use 25 pixels + * @size The size of the gravatar, by default we use 25 pixels */ string function quickAvatar( required author, @@ -1967,20 +1939,20 @@ component accessors="true" singleton threadSafe { /** * QuickView is a proxy to ColdBox's renderview method with the addition of prefixing the location of the view according to the * theme you are using. All the arguments are the same as `renderView()'s` methods - * @view The view in the theme to render - * @cache Cache the output or not - * @cacheTimeout The time in minutes to cache the view + * @view The view in the theme to render + * @cache Cache the output or not + * @cacheTimeout The time in minutes to cache the view * @cacheLastAccessTimeout The time in minutes the view will be removed from cache if idle or requested - * @cacheSuffix The suffix to add into the cache entry for this view rendering - * @cacheProvider The provider to cache this view in, defaults to 'template' - * @module The module to render the view from explicitly - * @args A struct of arguments to pass into the view for rendering, will be available as 'args' in the view. - * @collection A collection to use by this Renderer to render the view as many times as the items in the collection (Array or Query) - * @collectionAs The name of the collection variable in the partial rendering. If not passed, we will use the name of the view by convention - * @collectionStartRow The start row to limit the collection rendering with - * @collectionMaxRows The max rows to iterate over the collection rendering with - * @collectionDelim A string to delimit the collection renderings by - * @prePostExempt If true, pre/post view interceptors will not be fired. By default they do fire + * @cacheSuffix The suffix to add into the cache entry for this view rendering + * @cacheProvider The provider to cache this view in, defaults to 'template' + * @module The module to render the view from explicitly + * @args A struct of arguments to pass into the view for rendering, will be available as 'args' in the view. + * @collection A collection to use by this Renderer to render the view as many times as the items in the collection (Array or Query) + * @collectionAs The name of the collection variable in the partial rendering. If not passed, we will use the name of the view by convention + * @collectionStartRow The start row to limit the collection rendering with + * @collectionMaxRows The max rows to iterate over the collection rendering with + * @collectionDelim A string to delimit the collection renderings by + * @prePostExempt If true, pre/post view interceptors will not be fired. By default they do fire */ function quickView( required view, @@ -2006,11 +1978,11 @@ component accessors="true" singleton threadSafe { /** * QuickLayout is a proxy to ColdBox's renderLayout method with the addition of prefixing the location of the layout according to the * layout theme you are using. All the arguments are the same as renderLayout()'s methods - * @layout The layout to render out - * @view The view to render within this layout - * @module The module to explicitly render this layout from - * @args An optional set of arguments that will be available to this layouts/view rendering ONLY - * @viewModule The module to explicitly render the view from + * @layout The layout to render out + * @view The view to render within this layout + * @module The module to explicitly render this layout from + * @args An optional set of arguments that will be available to this layouts/view rendering ONLY + * @viewModule The module to explicitly render the view from * @prePostExempt If true, pre/post layout interceptors will not be fired. By default they do fire */ function quickLayout( @@ -2046,8 +2018,8 @@ component accessors="true" singleton threadSafe { /** * Build out a menu from the defined menus in ContentBox. * - * @slug The menu slug to build - * @type The type either 'html' or 'data', default is HTML + * @slug The menu slug to build + * @type The type either 'html' or 'data', default is HTML * @slugCache The cache of menu slugs already used in this request * * @return HTML of the menu or a struct representing the menu @@ -2072,9 +2044,9 @@ component accessors="true" singleton threadSafe { /** * Builds out a custom menu - * @menu The root menu object that should be rendered + * @menu The root menu object that should be rendered * @menu.doc_generic contentbox.models.menu.Menu - * @slugCache The cache of menu slugs already used in this request + * @slugCache The cache of menu slugs already used in this request */ public string function buildProviderMenu( required any menu, required array slugCache = [] ){ var listType = arguments.menu.getListType(); @@ -2099,8 +2071,8 @@ component accessors="true" singleton threadSafe { /** * Builds out a level of a custom menu - * @items An array of menu items for this level - * @listType The type of list to create (derived from owning menu) + * @items An array of menu items for this level + * @listType The type of list to create (derived from owning menu) * @slugCache The cache of menu slugs already used in this request */ private string function buildProviderMenuLevel( @@ -2141,14 +2113,14 @@ component accessors="true" singleton threadSafe { /** * Render out a quick menu for root level pages - * @excludes The list of pages to exclude from the menu - * @type The type of menu, valid choices are: ul,ol,li,data,none - * @typeClass The CSS class(es) to add to the type tag, defaults to 'submenu' - * @separator Used if type eq none, to separate the list of href's - * @levels The number of levels to nest hierarchical pages, by default it does only 1 level, * does all levels + * @excludes The list of pages to exclude from the menu + * @type The type of menu, valid choices are: ul,ol,li,data,none + * @typeClass The CSS class(es) to add to the type tag, defaults to 'submenu' + * @separator Used if type eq none, to separate the list of href's + * @levels The number of levels to nest hierarchical pages, by default it does only 1 level, * does all levels * @elementClass The name of the CSS class to attach to the menu
  • element - * @parentClass The name of the CSS class to attach to the menu
  • element when it has nested elements, by default it is 'parent' - * @activeClass The name of the CSS class to attach to the menu
  • element when that element is the current page you are on, by default it is 'active' + * @parentClass The name of the CSS class to attach to the menu
  • element when it has nested elements, by default it is 'parent' + * @activeClass The name of the CSS class to attach to the menu
  • element when that element is the current page you are on, by default it is 'active' */ function rootMenu( excludes = "", @@ -2176,16 +2148,16 @@ component accessors="true" singleton threadSafe { /** * Create a sub page menu for a given page or current page * - * @page Optional page to create menu for, else look for current page, this can be a page object or a page slug - * @excludes The list of pages to exclude from the menu - * @type The type of menu, valid choices are: ul,ol,li,none - * @typeClass The CSS class(es) to add to the type tag, defaults to 'submenu' - * @separator Used if type eq none, to separate the list of href's - * @showNone Shows a 'No Sub Pages' message or not - * @levels The number of levels to nest hierarchical pages, by default it does only 1 level, * does all levels - * @elementClass The name of the CSS class to attach to the menu
  • element - * @parentClass The name of the CSS class to attach to the menu
  • element when it has nested elements, by default it is 'parent' - * @activeClass The name of the CSS class to attach to the menu
  • element when that element is the current page you are on, by default it is 'active' + * @page Optional page to create menu for, else look for current page, this can be a page object or a page slug + * @excludes The list of pages to exclude from the menu + * @type The type of menu, valid choices are: ul,ol,li,none + * @typeClass The CSS class(es) to add to the type tag, defaults to 'submenu' + * @separator Used if type eq none, to separate the list of href's + * @showNone Shows a 'No Sub Pages' message or not + * @levels The number of levels to nest hierarchical pages, by default it does only 1 level, * does all levels + * @elementClass The name of the CSS class to attach to the menu
  • element + * @parentClass The name of the CSS class to attach to the menu
  • element when it has nested elements, by default it is 'parent' + * @activeClass The name of the CSS class to attach to the menu
  • element when that element is the current page you are on, by default it is 'active' * @activeShowChildren If true, then we will show the children of the active menu element, else we just show the active element */ function subPageMenu( @@ -2248,7 +2220,7 @@ component accessors="true" singleton threadSafe { /** * Create breadcrumbs for a UI page - * @page Optional page to create link for, else look for current page + * @page Optional page to create link for, else look for current page * @separator Breadcrumb separator, defaults to '>' */ function breadCrumbs( any page, string separator = ">" ){ @@ -2256,9 +2228,7 @@ component accessors="true" singleton threadSafe { if ( !structKeyExists( arguments, "page" ) ) { arguments.page = getCurrentPage(); } - return wirebox - .getInstance( "PageBreadcrumbVisitor@contentbox-ui" ) - .visit( arguments.page, arguments.separator ); + return wirebox.getInstance( "PageBreadcrumbVisitor@contentbox-ui" ).visit( arguments.page, arguments.separator ); } /************************************** UTILITIES *********************************************/ @@ -2279,11 +2249,11 @@ component accessors="true" singleton threadSafe { /** * Retrieve i18n resources - * @resource The resource (key) to retrieve from a loaded bundle or pass a @bundle + * @resource The resource (key) to retrieve from a loaded bundle or pass a @bundle * @defaultValue A default value to send back if the resource (key) not found - * @locale Pass in which locale to take the resource from. By default it uses the user's current set locale - * @values An array, struct or simple string of value replacements to use on the resource string - * @bundle The bundle alias to use to get the resource from when using multiple resource bundles. By default the bundle name used is 'default' + * @locale Pass in which locale to take the resource from. By default it uses the user's current set locale + * @values An array, struct or simple string of value replacements to use on the resource string + * @bundle The bundle alias to use to get the resource from when using multiple resource bundles. By default the bundle name used is 'default' */ any function r( required string resource, @@ -2358,10 +2328,7 @@ component accessors="true" singleton threadSafe { // If this is subnav, add ancestry trail while ( locPage.hasParent() ) { locPage = locPage.getParent(); - pageAncestorContentIDs = listAppend( - pageAncestorContentIDs, - locPage.getContentID() - ); + pageAncestorContentIDs = listAppend( pageAncestorContentIDs, locPage.getContentID() ); } } @@ -2382,18 +2349,11 @@ component accessors="true" singleton threadSafe { } classText = duplicate( arguments.elementClass ); - if ( - !len( arguments.excludes ) OR !listFindNoCase( - arguments.excludes, - pageResults.content[ x ][ "title" ] - ) - ) { + if ( !len( arguments.excludes ) OR !listFindNoCase( arguments.excludes, pageResults.content[ x ][ "title" ] ) ) { // Do we need to nest? try { var doNesting = ( - arguments.currentLevel lt arguments.levels AND pageResults.content[ x ][ - "numberOfChildren" - ] > 0 + arguments.currentLevel lt arguments.levels AND pageResults.content[ x ][ "numberOfChildren" ] > 0 ); } catch ( any e ) { writeDump( var = callStackGet() ); @@ -2404,10 +2364,7 @@ component accessors="true" singleton threadSafe { // Is element active (or one of its decendants) var isElementActive = currentPageID eq pageResults.content[ x ][ "contentID" ]; var isElementActiveAncestor = ( - listFindNoCase( - pageAncestorContentIDs, - pageResults.content[ x ][ "contentID" ] - ) + listFindNoCase( pageAncestorContentIDs, pageResults.content[ x ][ "contentID" ] ) ); // class = active? Then add to class text if ( isElementActive ) { @@ -2447,9 +2404,7 @@ component accessors="true" singleton threadSafe { } // Do we nest active and activeShowChildren flag is activated? else if ( - activeShowChildren AND ( isElementActive OR isElementActiveAncestor ) AND pageResults.content[ - x - ].hasChild() + activeShowChildren AND ( isElementActive OR isElementActiveAncestor ) AND pageResults.content[ x ].hasChild() ) { // Setup Parent class, we are going down the wormhole arrayAppend( classText, arguments.parentClass ); @@ -2512,9 +2467,7 @@ component accessors="true" singleton threadSafe { } // Do we nest active and activeShowChildren flag is activated? else if ( - activeShowChildren AND isElementActive AND pageResults.content[ x ][ - "numberOfChildren" - ] > 0 + activeShowChildren AND isElementActive AND pageResults.content[ x ][ "numberOfChildren" ] > 0 ) { pageData.subPageMenu = buildMenu( pageRecords = pageService.findPublishedContent( From b316aa40a587956d37dc4cd707fc679b06c766f6 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Fri, 17 Dec 2021 14:54:03 -0500 Subject: [PATCH 032/100] . causing issues with id's in jquery --- .../views/home/filelisting.cfm | 103 ++++++++++-------- .../views/home/indexHelper.cfm | 4 +- 2 files changed, 58 insertions(+), 49 deletions(-) diff --git a/modules/contentbox/modules/contentbox-admin/modules/contentbox-filebrowser/views/home/filelisting.cfm b/modules/contentbox/modules/contentbox-admin/modules/contentbox-filebrowser/views/home/filelisting.cfm index 3f555f0e65..bd79e57fcb 100644 --- a/modules/contentbox/modules/contentbox-admin/modules/contentbox-filebrowser/views/home/filelisting.cfm +++ b/modules/contentbox/modules/contentbox-admin/modules/contentbox-filebrowser/views/home/filelisting.cfm @@ -33,8 +33,7 @@ return URLOut; } function validQuickView( ext ){ - if( listFindNoCase( "png,jpg,jpeg,bmp,gif", ext ) ){ return "true"; } - return "false"; + return ( listFindNoCase( "png,jpg,jpeg,bmp,gif", arguments.ext ) ? true : false ); } function getImageFile( ext ){ switch( arguments.ext ){ @@ -121,7 +120,7 @@ - + @@ -256,99 +255,109 @@
  • -
    \ No newline at end of file + From 2c948a850808dbb1d6cdb0208f0fbb6dd7c5b07b Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 13 Jan 2022 14:58:08 +0100 Subject: [PATCH 033/100] Create FUNDING.YML --- .github/FUNDING.YML | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/FUNDING.YML diff --git a/.github/FUNDING.YML b/.github/FUNDING.YML new file mode 100644 index 0000000000..7e59d13360 --- /dev/null +++ b/.github/FUNDING.YML @@ -0,0 +1 @@ +patreon: ortussolutions From 54d8824f042c2562751db6fd2c7c36e015e11cf3 Mon Sep 17 00:00:00 2001 From: Jon Clausen Date: Thu, 20 Jan 2022 17:52:05 -0500 Subject: [PATCH 034/100] Prevent the first breadcrumb from being preceded with separator The first breadcrumb should not be preceded by a separator --- .../modules/contentbox-ui/models/PageBreadcrumbVisitor.cfc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/contentbox/modules/contentbox-ui/models/PageBreadcrumbVisitor.cfc b/modules/contentbox/modules/contentbox-ui/models/PageBreadcrumbVisitor.cfc index 04475e3708..d5166372f2 100755 --- a/modules/contentbox/modules/contentbox-ui/models/PageBreadcrumbVisitor.cfc +++ b/modules/contentbox/modules/contentbox-ui/models/PageBreadcrumbVisitor.cfc @@ -31,7 +31,7 @@ component singleton { // check if page slug is home, to ignore it if ( arguments.page.getSlug() NEQ CBHelper.getHomePage() ) { - bc &= "#arguments.separator# #arguments.page.getTitle()# + bc &= "#( len(bc) ? arguments.separator : "")# #arguments.page.getTitle()# "; } From 2eafb5c64b15ca431a132e24425aea23590fbceb Mon Sep 17 00:00:00 2001 From: jclausen Date: Thu, 20 Jan 2022 22:54:28 +0000 Subject: [PATCH 035/100] Apply cfformat changes --- config/CacheBox.cfc | 20 +- config/Coldbox.cfc | 155 ++++++++------- config/Router.cfc | 18 +- config/Scheduler.cfc | 7 +- config/WireBox.cfc | 41 ++-- .../contentbox-installer/handlers/Home.cfc | 4 +- .../models/InstallerService.cfc | 22 +-- modules/contentbox/config/Scheduler.cfc | 10 +- .../2020_08_24_150933_v5Upgrade.cfc | 6 +- .../models/comments/CommentService.cfc | 81 +++----- .../contentbox/models/content/BaseContent.cfc | 3 + .../contentbox/models/content/Category.cfc | 8 +- .../models/content/CategoryService.cfc | 57 +++--- .../models/content/ContentService.cfc | 187 +++++++----------- .../models/content/ContentStore.cfc | 10 +- .../models/content/ContentStoreService.cfc | 39 ++-- .../models/content/ContentVersion.cfc | 4 +- .../models/content/ContentVersionService.cfc | 6 +- modules/contentbox/models/content/Entry.cfc | 20 +- .../models/content/EntryService.cfc | 43 ++-- modules/contentbox/models/content/Page.cfc | 20 +- .../contentbox/models/content/PageService.cfc | 49 +++-- .../models/content/StatsService.cfc | 9 +- .../models/content/renderers/BaseRenderer.cfc | 5 +- .../content/renderers/MarkdownRenderer.cfc | 7 +- .../content/renderers/SettingRenderer.cfc | 7 +- .../content/renderers/WidgetRenderer.cfc | 13 +- .../content/util/ContentCacheCleanup.cfc | 64 ++---- .../models/exporters/ContentBoxExporter.cfc | 24 +-- .../models/exporters/StaticExporter.cfc | 55 +++--- .../models/importers/BlogCFCImporter.cfc | 24 +-- .../models/importers/ContentBoxImporter.cfc | 19 +- .../models/importers/MachBlogImporter.cfc | 5 +- .../models/importers/MangoImporter.cfc | 9 +- .../models/importers/WordpressImporter.cfc | 5 +- .../models/media/CFContentMediaProvider.cfc | 2 + .../models/media/ForwardMediaProvider.cfc | 2 + .../models/media/IMediaProvider.cfc | 2 + .../models/media/RelocationMediaProvider.cfc | 2 + .../models/menu/MenuItemService.cfc | 40 ++-- .../contentbox/models/menu/MenuService.cfc | 47 ++--- .../models/menu/item/BaseMenuItem.cfc | 1 + .../models/menu/item/ContentMenuItem.cfc | 1 + .../models/menu/item/SubMenuItem.cfc | 1 + .../models/menu/providers/ContentProvider.cfc | 6 +- .../models/menu/providers/FreeProvider.cfc | 6 +- .../models/menu/providers/JSProvider.cfc | 6 +- .../models/menu/providers/MediaProvider.cfc | 6 +- .../models/menu/providers/SubMenuProvider.cfc | 6 +- .../models/menu/providers/URLProvider.cfc | 6 +- .../models/modules/ModuleService.cfc | 4 +- modules/contentbox/models/rss/RSSService.cfc | 36 ++-- modules/contentbox/models/search/DBSearch.cfc | 1 + modules/contentbox/models/security/Author.cfc | 37 ++-- .../models/security/AuthorService.cfc | 84 +++----- .../models/security/ISecurityService.cfc | 12 +- .../models/security/JwtSecurityValidator.cfc | 17 +- .../models/security/LoginTracker.cfc | 10 +- .../models/security/LoginTrackerService.cfc | 2 + .../security/PermissionGroupService.cfc | 34 ++-- .../models/security/PermissionService.cfc | 54 ++--- .../models/security/RateLimiter.cfc | 41 ++-- modules/contentbox/models/security/Role.cfc | 5 +- .../models/security/RoleService.cfc | 30 ++- .../models/security/SecurityRuleService.cfc | 32 +-- .../models/security/SecurityService.cfc | 69 +++---- .../models/security/SecurityValidator.cfc | 11 +- .../security/twofactor/ITwoFactorProvider.cfc | 5 +- .../security/twofactor/TwoFactorService.cfc | 26 ++- modules/contentbox/models/system/CBHelper.cfc | 54 +++-- .../models/system/EmailTemplateHelper.cfc | 22 ++- .../models/system/NotificationService.cfc | 43 ++-- .../models/system/SettingService.cfc | 64 +++--- modules/contentbox/models/system/Site.cfc | 8 +- .../contentbox/models/system/SiteService.cfc | 84 +++----- .../contentbox/models/ui/AdminMenuService.cfc | 148 +++++++------- modules/contentbox/models/ui/Avatar.cfc | 2 +- modules/contentbox/models/ui/BaseWidget.cfc | 10 +- modules/contentbox/models/ui/Paging.cfc | 15 +- modules/contentbox/models/ui/ThemeService.cfc | 26 +-- .../contentbox/models/ui/WidgetService.cfc | 11 +- .../models/ui/editors/EditorService.cfc | 2 + modules/contentbox/models/util/DateUtil.cfc | 2 +- modules/contentbox/models/util/ZipUtil.cfc | 115 +++-------- .../contentbox-admin/handlers/authors.cfc | 7 + .../contentbox-admin/handlers/baseHandler.cfc | 2 +- .../contentbox-admin/handlers/comments.cfc | 54 ++--- .../contentbox-admin/handlers/content.cfc | 35 ++-- .../contentbox-admin/handlers/dashboard.cfc | 6 + .../contentbox-admin/handlers/menus.cfc | 6 + .../handlers/permissionGroups.cfc | 8 +- .../contentbox-admin/handlers/permissions.cfc | 20 +- .../contentbox-admin/handlers/roles.cfc | 32 +-- .../contentbox-admin/handlers/settings.cfc | 6 + .../contentbox-admin/handlers/versions.cfc | 5 +- .../models/ui/BootstrapFileUpload.cfc | 15 +- .../models/ui/PageBreadcrumbVisitor.cfc | 1 + .../contentbox-ckeditor/models/CKEditor.cfc | 5 +- .../contentbox-filebrowser/handlers/Home.cfc | 4 +- .../models/MarkdownEditor.cfc | 6 +- .../models/EmailTwoFactorProvider.cfc | 5 +- .../contentbox-api-v1/handlers/auth.cfc | 4 +- .../contentbox-api-v1/handlers/authors.cfc | 10 +- .../handlers/baseContentHandler.cfc | 4 +- .../handlers/baseHandler.cfc | 15 +- .../contentbox-api-v1/handlers/categories.cfc | 6 +- .../contentbox-api-v1/handlers/comments.cfc | 4 +- .../handlers/contentStore.cfc | 10 +- .../contentbox-api-v1/handlers/entries.cfc | 10 +- .../contentbox-api-v1/handlers/menus.cfc | 10 +- .../contentbox-api-v1/handlers/pages.cfc | 10 +- .../contentbox-api-v1/handlers/settings.cfc | 2 +- .../handlers/siteSettings.cfc | 2 +- .../contentbox-api-v1/handlers/sites.cfc | 10 +- .../contentbox-api-v1/handlers/versions.cfc | 6 +- .../contentbox-ui/handlers/content.cfc | 14 +- .../modules/contentbox-ui/handlers/page.cfc | 34 ++-- .../models/PageBreadcrumbVisitor.cfc | 5 +- .../contentbox-sitemap/handlers/main.cfc | 1 + .../modules_user/Hello/widgets/Hello.cfc | 1 + modules/contentbox/seeders/BaseSeeder.cfc | 2 +- modules/contentbox/themes/default/Theme.cfc | 2 + modules/contentbox/widgets/Archives.cfc | 15 +- modules/contentbox/widgets/Categories.cfc | 8 +- modules/contentbox/widgets/ContentStore.cfc | 12 +- modules/contentbox/widgets/EntryInclude.cfc | 6 +- modules/contentbox/widgets/Menu.cfc | 11 +- modules/contentbox/widgets/Meta.cfc | 9 +- modules/contentbox/widgets/PageInclude.cfc | 6 +- modules/contentbox/widgets/RSS.cfc | 14 +- modules/contentbox/widgets/RecentComments.cfc | 7 +- modules/contentbox/widgets/RecentEntries.cfc | 18 +- modules/contentbox/widgets/RecentPages.cfc | 18 +- modules/contentbox/widgets/RelatedContent.cfc | 15 +- modules/contentbox/widgets/Relocate.cfc | 6 +- modules/contentbox/widgets/Renderview.cfc | 14 +- modules/contentbox/widgets/SearchForm.cfc | 15 +- modules/contentbox/widgets/SubPageMenu.cfc | 17 +- modules/contentbox/widgets/Viewlet.cfc | 18 +- tests/specs/contentbox-api/AuthorsSpec.cfc | 72 ++----- tests/specs/contentbox-api/CategoriesSpec.cfc | 18 +- .../specs/contentbox-api/ContentStoreSpec.cfc | 151 ++++---------- tests/specs/contentbox-api/EntriesSpec.cfc | 137 +++---------- tests/specs/contentbox-api/PagesSpec.cfc | 156 ++++----------- tests/specs/contentbox-api/SitesSpec.cfc | 69 ++----- tests/specs/contentbox-api/authSpec.cfc | 57 ++---- .../unit/comments/CommentsServiceTest.cfc | 18 +- .../unit/content/BaseContentTest.cfc | 8 +- .../content/ContentVersionServiceTest.cfc | 4 +- .../unit/content/EntryServiceTest.cfc | 9 +- .../contentbox/unit/security/AuthorTest.cfc | 4 +- .../twofactor/TwoFactorServiceTest.cfc | 11 +- .../unit/ui/AdminMenuServiceTest.cfc | 5 +- 153 files changed, 1434 insertions(+), 2179 deletions(-) diff --git a/config/CacheBox.cfc b/config/CacheBox.cfc index e52294346f..afa2e9eb34 100755 --- a/config/CacheBox.cfc +++ b/config/CacheBox.cfc @@ -5,13 +5,12 @@ * --- * CacheBox Configuration */ -component{ +component { /** - * Configure CacheBox for ColdBox Application Operation - */ + * Configure CacheBox for ColdBox Application Operation + */ function configure(){ - /** * -------------------------------------------------------------------------- * CacheBox Configuration (https://cachebox.ortusbooks.com) @@ -27,18 +26,17 @@ component{ * All timeouts are in minutes */ defaultCache : { - objectDefaultTimeout : 120, //two hours default - objectDefaultLastAccessTimeout : 30, //30 minutes idle time + objectDefaultTimeout : 120, // two hours default + objectDefaultLastAccessTimeout : 30, // 30 minutes idle time useLastAccessTimeouts : true, reapFrequency : 5, freeMemoryPercentageThreshold : 0, evictionPolicy : "LRU", evictCount : 5, maxObjects : 5000, - objectStore : "ConcurrentStore", //guaranteed objects + objectStore : "ConcurrentStore", // guaranteed objects coldboxEnabled : true }, - /** * -------------------------------------------------------------------------- * Custom Cache Regions @@ -65,7 +63,7 @@ component{ evictionPolicy : "LRU", evictCount : 5, maxObjects : 5000, - objectStore : "ConcurrentSoftReferenceStore" //memory sensitive + objectStore : "ConcurrentSoftReferenceStore" // memory sensitive } }, /** @@ -75,7 +73,7 @@ component{ * Sessions are managed by CacheBox and not CFML so we can distribute to any * cache provider. */ - sessions : { + sessions : { provider : "coldbox.system.cache.providers.CacheBoxColdBoxProvider", properties : { objectDefaultTimeout : 60, @@ -93,4 +91,4 @@ component{ }; } -} \ No newline at end of file +} diff --git a/config/Coldbox.cfc b/config/Coldbox.cfc index 5492212bde..8013d07f07 100755 --- a/config/Coldbox.cfc +++ b/config/Coldbox.cfc @@ -85,13 +85,11 @@ component { */ logBox = { // Define Appenders - appenders : { - coldboxTracer : { class : "coldbox.system.logging.appenders.ConsoleAppender" } - }, + appenders : { coldboxTracer : { class : "coldbox.system.logging.appenders.ConsoleAppender" } }, // Root Logger - root : { levelmax : "INFO", appenders : "*" }, + root : { levelmax : "INFO", appenders : "*" }, // Implicit Level Categories - info : [ "coldbox.system", "contentbox" ] + info : [ "coldbox.system", "contentbox" ] }; /** @@ -145,7 +143,6 @@ component { * } */ moduleSettings = { - /** * -------------------------------------------------------------------------- * ContentBox Runtime Config @@ -153,19 +150,17 @@ component { */ contentbox : { // Array of mixins (eg: /includes/contentHelpers.cfm) to inject into all content objects - "contentHelpers" = [], + "contentHelpers" : [], // Setting Overrides - "settings" : { + "settings" : { // Global settings - "global" : { - }, + "global" : {}, // Site specific settings according to site slug - "sites" : { - // siteSlug : { ... } + "sites" : { + // siteSlug : { ... } } } }, - /** * -------------------------------------------------------------------------- * ColdBox Storages @@ -176,9 +171,9 @@ component { // Cache Storage Settings cacheStorage : { // The CacheBox registered cache to store data in - cachename : "sessions", + cachename : "sessions", // The default timeout of the session bucket, defaults to 60 minutes - timeout : getSystemSetting( "COLDBOX_SESSION_TIMEOUT", 60 ), + timeout : getSystemSetting( "COLDBOX_SESSION_TIMEOUT", 60 ), // The identifierProvider is a closure/udf that will return a unique identifier according to your rules // If you do not provide one, then we will search in session, cookie and url for the ColdFusion identifier. // identifierProvider : function(){} @@ -188,23 +183,22 @@ component { cookieStorage : { // If browser does not support Secure Sockets Layer (SSL) security, the cookie is not sent. // To use the cookie, the page must be accessed using the https protocol. - secure : false, + secure : false, // If yes, sets cookie as httponly so that it cannot be accessed using JavaScripts - httpOnly : true, + httpOnly : true, // Domain in which cookie is valid and to which cookie content can be sent from the user's system. By default, the cookie // is only available to the server that set it. Use this attribute to make the cookie available to other servers - domain : "", + domain : "", // Use encryption of values - useEncryption : false, + useEncryption : false, // The unique seeding key to use: keep it secret, keep it safe - encryptionSeed : "", + encryptionSeed : "", // The algorithm to use: https://cfdocs.org/encrypt encryptionAlgorithm : "BLOWFISH", // The encryption encoding to use - encryptionEncoding : "HEX" + encryptionEncoding : "HEX" } }, - /** * ColdBox cborm configurations https://forgebox.io/view/cborm */ @@ -219,38 +213,36 @@ component { }, resources : { // Enable the ORM Resource Event Loader - eventLoader : true, + eventLoader : true, // Prefix to use on all the registered pre/post{Entity}{Action} events - eventPrefix : "cb_", + eventPrefix : "cb_", // Pagination max rows - maxRows : 25, + maxRows : 25, // Pagination max row limit: 0 = no limit - maxRowsLimit : 500 + maxRowsLimit : 500 } }, - /** * Mementifier settings: https://forgebox.io/view/mementifier */ mementifier : { // Turn on to use the ISO8601 date/time formatting on all processed date/time properites, else use the masks - iso8601Format = true, + iso8601Format : true, // The default date mask to use for date properties - dateMask = "yyyy-MM-dd", + dateMask : "yyyy-MM-dd", // The default time mask to use for date properties - timeMask = "HH:mm: ss", + timeMask : "HH:mm: ss", // Enable orm auto default includes: If true and an object doesn't have any `memento` struct defined // this module will create it with all properties and relationships it can find for the target entity // leveraging the cborm module. - ormAutoIncludes = true, + ormAutoIncludes : true, // The default value for relationships/getters which return null - nullDefaultValue = '', + nullDefaultValue : "", // Don't check for getters before invoking them - trustedGetters = false, + trustedGetters : false, // If not empty, convert all date/times to the specific timezone - convertToTimezone = "UTC" + convertToTimezone : "UTC" }, - /** * ColdBox Security Module Global Settings */ @@ -283,31 +275,31 @@ component { // JWT Settings "jwt" : { // The issuer authority for the tokens, placed in the `iss` claim - "issuer" : "contentbox", + "issuer" : "contentbox", // The jwt secret encoding key to use - "secretKey" : getSystemSetting( "JWT_SECRET", "" ), + "secretKey" : getSystemSetting( "JWT_SECRET", "" ), // by default it uses the authorization bearer header, but you can also pass a custom one as well or as an rc variable. - "customAuthHeader" : "x-auth-token", + "customAuthHeader" : "x-auth-token", // The expiration in minutes for the jwt tokens - "expiration" : 60, + "expiration" : 60, // If true, enables refresh tokens, longer lived tokens (not implemented yet) - "enableRefreshTokens" : true, + "enableRefreshTokens" : true, // The default expiration for refresh tokens, defaults to 7 days - "refreshExpiration" : 10080, + "refreshExpiration" : 10080, // The custom header to inspect for refresh tokens - "customRefreshHeader" : "x-refresh-token", + "customRefreshHeader" : "x-refresh-token", // If enabled, the JWT validator will inspect the request for refresh tokens and expired access tokens // It will then automatically refresh them for you and return them back as // response headers in the same request according to the `customRefreshHeader` and `customAuthHeader` "enableAutoRefreshValidator" : true, // Enable the POST > /cbsecurity/refreshtoken API endpoint - "enableRefreshEndpoint" : false, + "enableRefreshEndpoint" : false, // encryption algorithm to use, valid algorithms are: HS256, HS384, and HS512 - "algorithm" : "HS512", + "algorithm" : "HS512", // Which claims neds to be present on the jwt token or `TokenInvalidException` upon verification and decoding - "requiredClaims" : [], + "requiredClaims" : [], // The token storage settings - "tokenStorage" : { + "tokenStorage" : { // enable or not, default is true "enabled" : true, // A cache key prefix to use when storing the tokens @@ -324,7 +316,6 @@ component { } } // end jwt config }, // end security config - /** * cbSwagger Documentation for Headless CMS */ @@ -367,15 +358,15 @@ component { }, // An array of Server Objects, which provide connectivity information to a target server. If the servers property is not provided, or is an empty array, the default value would be a Server Object with a url value of /. // https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#serverObject - "servers" : [ + "servers" : [ { - "url" : "http://127.0.0.1:8589", + "url" : "http://127.0.0.1:8589", "description" : "Development Server" } ], // An element to hold various schemas for the specification. // https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#componentsObject - "components" : { + "components" : { // Define your security schemes here // https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#securitySchemeObject "securitySchemes" : { @@ -393,7 +384,7 @@ component { }, "BearerAuth" : { "type" : "http", - "description" : "User your JWT in the bearer Authorization header", + "description" : "User your JWT in the bearer Authorization header", "scheme" : "bearer", "bearerFormat" : "JWT" } @@ -401,29 +392,53 @@ component { }, // A declaration of which security mechanisms can be used across the API. // https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#securityRequirementObject - "security" : [ + "security" : [ { "ApiKeyAuth" : [] }, { "ApiKeyQueryAuth" : [] }, { "BearerAuth" : [] } ], // A list of tags used by the specification with additional metadata. // https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#tagObject - "tags" : [ + "tags" : [ { "name" : "Authors", "description" : "Author operations" }, - { "name" : "Authentication", "description" : "Authentication operations" }, - { "name" : "Categories", "description" : "Category operations" }, - { "name" : "Comments", "description" : "Comment operations" }, - { "name" : "ContentStore", "description" : "Content store operations" }, - { "name" : "Entries", "description" : "Blog entry operations" }, + { + "name" : "Authentication", + "description" : "Authentication operations" + }, + { + "name" : "Categories", + "description" : "Category operations" + }, + { + "name" : "Comments", + "description" : "Comment operations" + }, + { + "name" : "ContentStore", + "description" : "Content store operations" + }, + { + "name" : "Entries", + "description" : "Blog entry operations" + }, { "name" : "Menus", "description" : "Menu operations" }, { "name" : "Pages", "description" : "Pages operations" }, { "name" : "Sites", "description" : "Site operations" }, - { "name" : "Settings", "description" : "Global setting operations" }, - { "name" : "Versions", "description" : "Content versions operations" } + { + "name" : "Settings", + "description" : "Global setting operations" + }, + { + "name" : "Versions", + "description" : "Content versions operations" + } ], // Additional external documentation. // https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#externalDocumentationObject - "externalDocs" : { "description" : "Find more info here", "url" : "https://contentbox.ortusbooks.com" } + "externalDocs" : { + "description" : "Find more info here", + "url" : "https://contentbox.ortusbooks.com" + } } }; } @@ -440,13 +455,16 @@ component { // No Singletons for easy testing wirebox = { - //singletonReload : true + // singletonReload : true }; // debugging file logbox.appenders.files = { class : "coldbox.system.logging.appenders.RollingFileAppender", - properties : { filename : "contentbox", filePath : "/cbapp/config/logs/app" } + properties : { + filename : "contentbox", + filePath : "/cbapp/config/logs/app" + } }; // Mail settings for writing to log files instead of sending mail on dev. @@ -459,17 +477,17 @@ component { variables.modulesettings.cbdebugger = { // This flag enables/disables the tracking of request data to our storage facilities // To disable all tracking, turn this master key off - enabled : getSystemSetting( "CBDEBUGGER_ENABLED", false ), + enabled : getSystemSetting( "CBDEBUGGER_ENABLED", false ), // This setting controls if you will activate the debugger for visualizations ONLY // The debugger will still track requests even in non debug mode. - debugMode : true, + debugMode : true, // The URL password to use to activate it on demand debugPassword : "cb", // Request Tracker Options requestTracker : { storage : "cachebox", cacheName : "template", - trackDebuggerEvents : false, + trackDebuggerEvents : false, // Expand by default the tracker panel or not expanded : false, // Slow request threshold in milliseconds, if execution time is above it, we mark those transactions as red @@ -532,10 +550,7 @@ component { // Log the binding parameters logParams : false }, - async : { - enabled : true, - expanded : false - } + async : { enabled : true, expanded : false } }; // Specific Debugging + Logging diff --git a/config/Router.cfc b/config/Router.cfc index 106c7a0a99..13457821b6 100644 --- a/config/Router.cfc +++ b/config/Router.cfc @@ -1,15 +1,15 @@ /** -* ContentBox - A Modular Content Platform -* Copyright since 2012 by Ortus Solutions, Corp -* www.ortussolutions.com/products/contentbox -* --- -* Application Router -*/ -component{ + * ContentBox - A Modular Content Platform + * Copyright since 2012 by Ortus Solutions, Corp + * www.ortussolutions.com/products/contentbox + * --- + * Application Router + */ +component { function configure(){ // Configuration - setValidExtensions( 'xml,json,jsont,rss,html,htm,cfm,print,pdf,doc,txt' ); + setValidExtensions( "xml,json,jsont,rss,html,htm,cfm,print,pdf,doc,txt" ); // Process Full Rewrites then true, else false and an `index.cfm` will always be included in URLs setFullRewrites( false ); @@ -27,4 +27,4 @@ component{ route( ":handler/:action" ).end(); } -} \ No newline at end of file +} diff --git a/config/Scheduler.cfc b/config/Scheduler.cfc index b153f1a310..edeea671ff 100644 --- a/config/Scheduler.cfc +++ b/config/Scheduler.cfc @@ -22,7 +22,6 @@ component { * You register tasks with the task() method and get back a ColdBoxScheduledTask object * that you can use to register your tasks configurations. */ - } /** @@ -41,7 +40,7 @@ component { /** * Called whenever ANY task fails * - * @task The task that got executed + * @task The task that got executed * @exception The ColdFusion exception object */ function onAnyTaskError( required task, required exception ){ @@ -54,7 +53,7 @@ component { /** * Called whenever ANY task succeeds * - * @task The task that got executed + * @task The task that got executed * @result The result (if any) that the task produced */ function onAnyTaskSuccess( required task, result ){ @@ -76,7 +75,7 @@ component { /** * Called after ANY task runs * - * @task The task that got executed + * @task The task that got executed * @result The result (if any) that the task produced */ function afterAnyTask( required task, result ){ diff --git a/config/WireBox.cfc b/config/WireBox.cfc index 3151e8bb34..e8b80d7a67 100755 --- a/config/WireBox.cfc +++ b/config/WireBox.cfc @@ -5,13 +5,12 @@ * --- * WireBox Configuration */ -component extends="coldbox.system.ioc.config.Binder"{ +component extends="coldbox.system.ioc.config.Binder" { /** - * Configure WireBox, that's it! - */ + * Configure WireBox, that's it! + */ function configure(){ - /** * -------------------------------------------------------------------------- * WireBox Configuration (https://wirebox.ortusbooks.com) @@ -21,38 +20,30 @@ component extends="coldbox.system.ioc.config.Binder"{ wireBox = { // Scope registration, automatically register a wirebox injector instance on any CF scope // By default it registeres itself on application scope - scopeRegistration = { - enabled = true, - scope = "application", // server, cluster, session, application - key = "wireBox" + scopeRegistration : { + enabled : true, + scope : "application", // server, cluster, session, application + key : "wireBox" }, - // DSL Namespace registrations - customDSL = { - // namespace = "mapping name" + customDSL : { + // namespace = "mapping name" }, - // Custom Storage Scopes - customScopes = { - // annotationName = "mapping name" + customScopes : { + // annotationName = "mapping name" }, - // Package scan locations - scanLocations = [], - + scanLocations : [], // Stop Recursions - stopRecursions = [], - + stopRecursions : [], // Parent Injector to assign to the configured injector, this must be an object reference - parentInjector = "", - + parentInjector : "", // Register all event listeners here, they are created in the specified order - listeners = [ - { class = "coldbox.system.aop.Mixer" } - ] + listeners : [ { class : "coldbox.system.aop.Mixer" } ] }; // Map Bindings below } -} \ No newline at end of file +} diff --git a/modules/contentbox-installer/handlers/Home.cfc b/modules/contentbox-installer/handlers/Home.cfc index 246620e858..86898b6305 100644 --- a/modules/contentbox-installer/handlers/Home.cfc +++ b/modules/contentbox-installer/handlers/Home.cfc @@ -49,9 +49,7 @@ component cache=false { function install( event, rc, prc ){ // Verify installed? if ( variables.settingService.isCBReady() ) { - getInstance( "messagebox@cbMessagebox" ).warn( - cb.r( "validation.alreadyinstalled@installer" ) - ); + getInstance( "messagebox@cbMessagebox" ).warn( cb.r( "validation.alreadyinstalled@installer" ) ); relocate( prc.adminEntryPoint ); } // start installation diff --git a/modules/contentbox-installer/models/InstallerService.cfc b/modules/contentbox-installer/models/InstallerService.cfc index 0e7d3f1618..64d338e4e8 100755 --- a/modules/contentbox-installer/models/InstallerService.cfc +++ b/modules/contentbox-installer/models/InstallerService.cfc @@ -139,7 +139,7 @@ component accessors="true" { * Create global settings from setup * * @setup The setup object - * @site The site object + * @site The site object */ function createSettings( required setup, required site ){ var settings = { @@ -167,6 +167,7 @@ component accessors="true" { /** * Create security rules + * * @setup The setup object */ function createSecurityRules( required setup ){ @@ -189,6 +190,7 @@ component accessors="true" { /** * Process ColdBox Passwords + * * @setup The setup object */ function processColdBoxPasswords( required setup ){ @@ -205,6 +207,7 @@ component accessors="true" { /** * Process Rewrite Scripts + * * @setup The setup object */ function processRewrite( required setup ){ @@ -242,6 +245,7 @@ component accessors="true" { /** * Create permissions + * * @setup The setup object */ function createPermissions( required setup ){ @@ -305,6 +309,7 @@ component accessors="true" { /** * Create roles and return the admin + * * @setup The setup object */ function createRoles( required setup ){ @@ -312,9 +317,7 @@ component accessors="true" { createPermissions( arguments.setup ); // Create Editor - var oRole = roleService.new( - properties = { role : "Editor", description : "A ContentBox editor" } - ); + var oRole = roleService.new( properties = { role : "Editor", description : "A ContentBox editor" } ); // Add Editor Permissions oRole.addPermission( permissions[ "COMMENTS_ADMIN" ] ); oRole.addPermission( permissions[ "CONTENTSTORE_EDITOR" ] ); @@ -360,7 +363,7 @@ component accessors="true" { /** * Create author * - * @setup The setup object + * @setup The setup object * @adminRole The role of the admin string */ function createAuthor( required setup, required adminRole ){ @@ -375,16 +378,13 @@ component accessors="true" { /** * Create Sample Data * - * @setup The setup object + * @setup The setup object * @author The author created - * @site The default site + * @site The default site */ function createSampleData( required setup, required author, required site ){ // create a few categories - variables.categoryService.createCategories( - "News, ColdFusion, ColdBox, ContentBox", - arguments.site - ); + variables.categoryService.createCategories( "News, ColdFusion, ColdBox, ContentBox", arguments.site ); // create some blog entries var entry = entryService.new( diff --git a/modules/contentbox/config/Scheduler.cfc b/modules/contentbox/config/Scheduler.cfc index 6c89dbc67b..7ed70d03bb 100644 --- a/modules/contentbox/config/Scheduler.cfc +++ b/modules/contentbox/config/Scheduler.cfc @@ -35,9 +35,7 @@ component { ); if ( commentExpirationDays > 0 ) { - log.info( - "Starting to expire comments on site: #arguments.thisSite.getSlug()#..." - ); + log.info( "Starting to expire comments on site: #arguments.thisSite.getSlug()#..." ); // now we have the green light to find and kill any old, moderated comments getInstance( "commentService@contentbox" ).deleteUnApproved( @@ -76,7 +74,7 @@ component { /** * Called whenever ANY task fails * - * @task The task that got executed + * @task The task that got executed * @exception The ColdFusion exception object */ function onAnyTaskError( required task, required exception ){ @@ -89,7 +87,7 @@ component { /** * Called whenever ANY task succeeds * - * @task The task that got executed + * @task The task that got executed * @result The result (if any) that the task produced */ function onAnyTaskSuccess( required task, result ){ @@ -111,7 +109,7 @@ component { /** * Called after ANY task runs * - * @task The task that got executed + * @task The task that got executed * @result The result (if any) that the task produced */ function afterAnyTask( required task, result ){ diff --git a/modules/contentbox/migrations/2020_08_24_150933_v5Upgrade.cfc b/modules/contentbox/migrations/2020_08_24_150933_v5Upgrade.cfc index 69d816a81c..f5d722d7b1 100755 --- a/modules/contentbox/migrations/2020_08_24_150933_v5Upgrade.cfc +++ b/modules/contentbox/migrations/2020_08_24_150933_v5Upgrade.cfc @@ -39,11 +39,11 @@ component { } private function isContentBox4(){ - try{ + try { return !hasColumn( "cb_setting", "FK_siteID" ); - } catch( any e ){ + } catch ( any e ) { // check if we don't have a database yet. - if( findNoCase( "there is no table", e.message ) ){ + if ( findNoCase( "there is no table", e.message ) ) { return false; } else { rethrow; diff --git a/modules/contentbox/models/comments/CommentService.cfc b/modules/contentbox/models/comments/CommentService.cfc index fbc96a06ae..c78f451736 100755 --- a/modules/contentbox/models/comments/CommentService.cfc +++ b/modules/contentbox/models/comments/CommentService.cfc @@ -28,7 +28,7 @@ component extends="cborm.models.VirtualEntityService" singleton { /** * Get the total comment counts by content object * - * @contentId The content id to filter on + * @contentId The content id to filter on * @isApproved If passed, use it to filter on */ numeric function getTotalCountByContent( string contentId = "", boolean isApproved ){ @@ -48,8 +48,7 @@ component extends="cborm.models.VirtualEntityService" singleton { numeric function getTotalCount( string siteID = "" ){ return newCriteria() .when( len( arguments.siteID ), function( c ){ - c.joinTo( "relatedContent", "relatedContent" ) - .isEq( "relatedContent.site.siteID", siteID ); + c.joinTo( "relatedContent", "relatedContent" ).isEq( "relatedContent.site.siteID", siteID ); } ) .count(); } @@ -63,8 +62,7 @@ component extends="cborm.models.VirtualEntityService" singleton { return newCriteria() .isTrue( "isApproved" ) .when( len( arguments.siteID ), function( c ){ - c.joinTo( "relatedContent", "relatedContent" ) - .isEq( "relatedContent.site.siteID", siteID ); + c.joinTo( "relatedContent", "relatedContent" ).isEq( "relatedContent.site.siteID", siteID ); } ) .count(); } @@ -78,8 +76,7 @@ component extends="cborm.models.VirtualEntityService" singleton { return newCriteria() .isFalse( "isApproved" ) .when( len( arguments.siteID ), function( c ){ - c.joinTo( "relatedContent", "relatedContent" ) - .isEq( "relatedContent.site.siteID", siteID ); + c.joinTo( "relatedContent", "relatedContent" ).isEq( "relatedContent.site.siteID", siteID ); } ) .count(); } @@ -87,12 +84,12 @@ component extends="cborm.models.VirtualEntityService" singleton { /** * Comment listing for UI of approved comments, returns struct of results=[comments,count] * - * @contentID The content ID to filter on + * @contentID The content ID to filter on * @contentType The content type discriminator to filter on - * @max The maximum number of records to return, 0 means all - * @offset The offset in the paging, 0 means 0 - * @sortOrder Sort the comments asc or desc, by default it is desc - * @siteID The site to filter on if needed + * @max The maximum number of records to return, 0 means all + * @offset The offset in the paging, 0 means 0 + * @sortOrder Sort the comments asc or desc, by default it is desc + * @siteID The site to filter on if needed * * @return struct with { comments, count } */ @@ -118,8 +115,7 @@ component extends="cborm.models.VirtualEntityService" singleton { } ) // Site Filter .when( len( arguments.siteID ), function( c ){ - c.joinTo( "relatedContent", "relatedContent" ) - .isEq( "relatedContent.site.siteID", siteID ); + c.joinTo( "relatedContent", "relatedContent" ).isEq( "relatedContent.site.siteID", siteID ); } ); // run criteria query and projections count @@ -159,10 +155,9 @@ component extends="cborm.models.VirtualEntityService" singleton { * Save a comment according to our rules and process it. Returns a structure of information * results = [moderated:boolean,messages:array] * - * @comment The comment to try to save + * @comment The comment to try to save * @loggedInUser The current logged in user making the comment. If no logged in User, this is a non-persisted entity - * - * @result Return a struct of : { moderated:boolean, messages : array } + * @result Return a struct of : { moderated:boolean, messages : array } */ struct function saveComment( required comment, required loggedInUser ){ transaction { @@ -238,9 +233,7 @@ component extends="cborm.models.VirtualEntityService" singleton { // don't send email if the comment author is also subscribed... if ( subscriber.getSubscriberEmail() != commentAuthorEmail ) { // get mail payload - bodyTokens[ "unsubscribeURL" ] = CBHelper.linkContentUnsubscribe( - subscription.getSubscriptionToken() - ); + bodyTokens[ "unsubscribeURL" ] = CBHelper.linkContentUnsubscribe( subscription.getSubscriptionToken() ); // Send it baby! var mail = variables.mailService.newMail( @@ -275,7 +268,8 @@ component extends="cborm.models.VirtualEntityService" singleton { /** * Run moderation rules on an incoming comment and set of contentbox settings. If this method returns a false then the comment is moderated * and can continue to be saved. If returns false, then it is blocked and must NOT be saved. - * @comment Comment to moderate check + * + * @comment Comment to moderate check * @settings The contentbox settings to moderate against */ private boolean function runModerationRules( required comment, required settings ){ @@ -291,11 +285,7 @@ component extends="cborm.models.VirtualEntityService" singleton { } // Check if user has already an approved comment. If they do, then approve them - if ( - inSettings.cb_comments_moderation_whitelist AND userHasPreviousAcceptedComment( - inComment.getAuthorEmail() - ) - ) { + if ( inSettings.cb_comments_moderation_whitelist AND userHasPreviousAcceptedComment( inComment.getAuthorEmail() ) ) { inComment.setIsApproved( true ); return true; } @@ -358,6 +348,7 @@ component extends="cborm.models.VirtualEntityService" singleton { /** * Check if the user has already a comment in the system + * * @email The email address to check. */ private boolean function userHasPreviousAcceptedComment( required email ){ @@ -368,7 +359,7 @@ component extends="cborm.models.VirtualEntityService" singleton { /** * Send a notification email for comments * - * @comment Comment to moderate check + * @comment Comment to moderate check * @siteSettings The contentbox site settings to moderate against */ private void function sendNotificationEmails( required comment, required siteSettings ){ @@ -394,18 +385,9 @@ component extends="cborm.models.VirtualEntityService" singleton { // get mail payload var bodyTokens = inComment.getMemento(); bodyTokens[ "whoisURL" ] = settings.cb_comments_whoisURL; - bodyTokens[ "commentURL" ] = CBHelper.linkComment( - comment = inComment, - ssl = site.getIsSSL() - ); - bodyTokens[ "deleteURL" ] = CBHelper.linkAdmin( - event = "comments.moderate", - ssl = settings.cb_admin_ssl - ) & "?commentID=#inComment.getCommentID()#"; - bodyTokens[ "approveURL" ] = CBHelper.linkAdmin( - event = "comments.moderate", - ssl = settings.cb_admin_ssl - ) & "?commentID=#inComment.getCommentID()#"; + bodyTokens[ "commentURL" ] = CBHelper.linkComment( comment = inComment, ssl = site.getIsSSL() ); + bodyTokens[ "deleteURL" ] = CBHelper.linkAdmin( event = "comments.moderate", ssl = settings.cb_admin_ssl ) & "?commentID=#inComment.getCommentID()#"; + bodyTokens[ "approveURL" ] = CBHelper.linkAdmin( event = "comments.moderate", ssl = settings.cb_admin_ssl ) & "?commentID=#inComment.getCommentID()#"; bodyTokens[ "contentURL" ] = CBHelper.linkContent( content = inComment.getRelatedContent(), ssl = site.getIsSSL() @@ -413,9 +395,7 @@ component extends="cborm.models.VirtualEntityService" singleton { bodyTokens[ "contentTitle" ] = inComment.getParentTitle(); // Moderation Email? Comment is moderated? - if ( - inComment.getIsApproved() eq false AND arguments.siteSettings.cb_comments_moderation_notify - ) { + if ( inComment.getIsApproved() eq false AND arguments.siteSettings.cb_comments_moderation_notify ) { subject = "New comment needs moderation on post: #bodyTokens.contentTitle#"; template = "comment_moderation"; } else { @@ -455,13 +435,13 @@ component extends="cborm.models.VirtualEntityService" singleton { /** * comment search returns struct with keys [comments,count] * - * @search Search query + * @search Search query * @isApproved approved bit - * @contentID matching content id - * @max max records - * @offset offset for pagination - * @sortOrder The sort order, defaults to `createdDate DESC` - * @siteID The site to filter on if needed + * @contentID matching content id + * @max max records + * @offset offset for pagination + * @sortOrder The sort order, defaults to `createdDate DESC` + * @siteID The site to filter on if needed * * @return struct with { comments, count } */ @@ -499,8 +479,7 @@ component extends="cborm.models.VirtualEntityService" singleton { // Site Filter if ( len( arguments.siteID ) ) { - c.joinTo( "relatedContent", "relatedContent" ) - .isEq( "relatedContent.site.siteID", arguments.siteID ); + c.joinTo( "relatedContent", "relatedContent" ).isEq( "relatedContent.site.siteID", arguments.siteID ); } // run criteria query and projections count @@ -519,7 +498,7 @@ component extends="cborm.models.VirtualEntityService" singleton { * Bulk Updates * * @commentID The list or array of ID's to bulk update - * @status The status either 'approve' or 'moderate' + * @status The status either 'approve' or 'moderate' * * @return CommentService */ diff --git a/modules/contentbox/models/content/BaseContent.cfc b/modules/contentbox/models/content/BaseContent.cfc index a2fa144608..dc788df2da 100644 --- a/modules/contentbox/models/content/BaseContent.cfc +++ b/modules/contentbox/models/content/BaseContent.cfc @@ -853,6 +853,7 @@ component /** * Inflates from comma-delimited list (or array) of id's + * * @relatedContent The list or array of relatedContent ids */ BaseContent function inflateRelatedContent( required any relatedContent ){ @@ -1459,6 +1460,7 @@ component /** * add published timestamp to property + * * @timeString The joined time string (e.g., 12:00) */ any function addJoinedPublishedTime( required string timeString ){ @@ -1492,6 +1494,7 @@ component /** * add expired timestamp to property + * * @timeString The joined time string (e.g., 12:00) */ any function addJoinedExpiredTime( required string timeString ){ diff --git a/modules/contentbox/models/content/Category.cfc b/modules/contentbox/models/content/Category.cfc index 6b2f7700cf..1b2ee13b82 100755 --- a/modules/contentbox/models/content/Category.cfc +++ b/modules/contentbox/models/content/Category.cfc @@ -195,9 +195,7 @@ component numeric function getNumberOfPublishedContentStore(){ // Caching per load basis if ( !len( variables.numberOfPublishedContentStore ) ) { - variables.numberOfPublishedContentStore = getNumberOfPublishedContent( - variables.contentStoreService - ); + variables.numberOfPublishedContentStore = getNumberOfPublishedContent( variables.contentStoreService ); } return variables.numberOfPublishedContentStore; } @@ -208,9 +206,7 @@ component numeric function getNumberOfPublishedEntries(){ // Caching per load basis if ( !len( variables.numberOfPublishedEntries ) ) { - variables.numberOfPublishedEntries = getNumberOfPublishedContent( - variables.entryService - ); + variables.numberOfPublishedEntries = getNumberOfPublishedContent( variables.entryService ); } return variables.numberOfPublishedEntries; } diff --git a/modules/contentbox/models/content/CategoryService.cfc b/modules/contentbox/models/content/CategoryService.cfc index c0bc7569ee..0dc10fcdee 100755 --- a/modules/contentbox/models/content/CategoryService.cfc +++ b/modules/contentbox/models/content/CategoryService.cfc @@ -25,11 +25,11 @@ component extends="cborm.models.VirtualEntityService" singleton { /** * Category search with filters * - * @search The search term for the name - * @siteID The site id to filter on - * @isPublic Filter on this public (true) / private (false) or all (null) - * @max The max records - * @offset The offset to use + * @search The search term for the name + * @siteID The site id to filter on + * @isPublic Filter on this public (true) / private (false) or all (null) + * @max The max records + * @offset The offset to use * @sortOrder The sort order * * @return struct of { count, categories } @@ -74,7 +74,7 @@ component extends="cborm.models.VirtualEntityService" singleton { * If it exists, it returns it, else it creates it and returns it. * * @category The target category object to check - * @site The target site this category should be created in + * @site The target site this category should be created in * * @return The target site category */ @@ -106,7 +106,7 @@ component extends="cborm.models.VirtualEntityService" singleton { * If it exists, it returns it, else it creates it and returns it. * * @category The target category slug to check - * @site The target site this category should be created in + * @site The target site this category should be created in * * @return The target site category object */ @@ -151,9 +151,9 @@ component extends="cborm.models.VirtualEntityService" singleton { * * @category The category object * - * @throws UniqueCategoryException - * * @return The saved category + * + * @throws UniqueCategoryException */ function save( required category ){ return super.save( arguments.category ); @@ -162,9 +162,9 @@ component extends="cborm.models.VirtualEntityService" singleton { /** * Verify an incoming slug is unique or not * - * @slug The slug to search for uniqueness + * @slug The slug to search for uniqueness * @categoryId Limit the search to the passed categoryId usually for updates - * @siteID The site to filter on + * @siteID The site to filter on * * @return True if the slug is unique or false if it's already used */ @@ -188,8 +188,8 @@ component extends="cborm.models.VirtualEntityService" singleton { * Create categories via a comma delimited list and return the entities created * * @categories A list or array of categories to create - * @site The site to attach them to, this must be a site object - * @isPublic Create public or private categories + * @site The site to attach them to, this must be a site object + * @isPublic Create public or private categories */ array function createCategories( required categories, @@ -306,7 +306,7 @@ component extends="cborm.models.VirtualEntityService" singleton { /** * Get an array of names of all categories in the system or by site * - * @siteId The site to filter the names from + * @siteId The site to filter the names from * @isPublic If passed, show by this filter, else all categories */ array function getAllNames( string siteID = "", boolean isPublic ){ @@ -324,7 +324,7 @@ component extends="cborm.models.VirtualEntityService" singleton { /** * Get an array of slugs of all categories in the system * - * @siteId The site to filter the names from + * @siteId The site to filter the names from * @isPublic If passed, show by this filter, else all categories */ array function getAllSlugs( string siteID = "", boolean isPublic ){ @@ -343,11 +343,11 @@ component extends="cborm.models.VirtualEntityService" singleton { * Import data from a ContentBox JSON file. Returns the import log * * @importFile The json file to import - * @override Override content if found in the database, defaults to false - * - * @throws InvalidImportFormat + * @override Override content if found in the database, defaults to false * * @return The console log of the import + * + * @throws InvalidImportFormat */ string function importFromFile( required importFile, boolean override = false ){ var data = fileRead( arguments.importFile ); @@ -356,10 +356,7 @@ component extends="cborm.models.VirtualEntityService" singleton { ); if ( !isJSON( data ) ) { - throw( - message = "Cannot import file as the contents is not JSON", - type = "InvalidImportFormat" - ); + throw( message = "Cannot import file as the contents is not JSON", type = "InvalidImportFormat" ); } // deserialize packet: Should be array of { settingID, name, value } @@ -374,12 +371,12 @@ component extends="cborm.models.VirtualEntityService" singleton { * Import data from an array of structures or a single structure of data * * @importData A struct or array of data to import - * @override Override content if found in the database, defaults to false - * @importLog The import log buffer - * - * @throws InvalidImportFormat + * @override Override content if found in the database, defaults to false + * @importLog The import log buffer * * @return The console log of the import + * + * @throws InvalidImportFormat */ string function importFromData( required importData, @@ -417,14 +414,10 @@ component extends="cborm.models.VirtualEntityService" singleton { arguments.importLog.append( "New category imported: #thisCategory.slug#
    " ); arrayAppend( allCategories, oCategory ); } else if ( oCategory.isLoaded() and arguments.override ) { - arguments.importLog.append( - "Persisted category overriden: #thisCategory.slug#
    " - ); + arguments.importLog.append( "Persisted category overriden: #thisCategory.slug#
    " ); arrayAppend( allCategories, oCategory ); } else { - arguments.importLog.append( - "Skipping persisted category: #thisCategory.slug#
    " - ); + arguments.importLog.append( "Skipping persisted category: #thisCategory.slug#
    " ); } } // end import loop diff --git a/modules/contentbox/models/content/ContentService.cfc b/modules/contentbox/models/content/ContentService.cfc index b14153df07..fa0d263197 100755 --- a/modules/contentbox/models/content/ContentService.cfc +++ b/modules/contentbox/models/content/ContentService.cfc @@ -41,7 +41,7 @@ component extends="cborm.models.VirtualEntityService" singleton { /** * Get the total content counts according to the passed filters * - * @siteID The site to filter on + * @siteID The site to filter on * @categoryId The category Id to filter on */ numeric function getTotalContentCount( siteID = "", categoryId = "" ){ @@ -106,7 +106,7 @@ component extends="cborm.models.VirtualEntityService" singleton { /** * Clear a specific page wrapper caches according to slug prefix * - * @slug The slug partial to clean on + * @slug The slug partial to clean on * @async Run it asynchronously or not, defaults to false */ ContentService function clearPageWrapperCaches( required any slug, boolean async = false ){ @@ -123,7 +123,7 @@ component extends="cborm.models.VirtualEntityService" singleton { /** * Clear a page wrapper cache for a specific content object * - * @slug The slug to clear + * @slug The slug to clear * @async Run it asynchronously or not, defaults to false */ ContentService function clearPageWrapper( required any slug, boolean async = false ){ @@ -136,20 +136,20 @@ component extends="cborm.models.VirtualEntityService" singleton { /** * Searches published content with cool paramters, remember published content only * - * @searchTerm The search term to search - * @max The maximum number of records to paginate - * @offset The offset in the pagination - * @asQuery Return as query or array of objects, defaults to array of objects - * @sortOrder The sorting of the search results, defaults to publishedDate DESC - * @isPublished Search for published, non-published or both content objects [true, false, 'all'] + * @searchTerm The search term to search + * @max The maximum number of records to paginate + * @offset The offset in the pagination + * @asQuery Return as query or array of objects, defaults to array of objects + * @sortOrder The sorting of the search results, defaults to publishedDate DESC + * @isPublished Search for published, non-published or both content objects [true, false, 'all'] * @searchActiveContent Search only content titles or both title and active content. Defaults to both. - * @contentTypes Limit search to list of content types (comma-delimited). Leave blank to search all content types - * @excludeIDs List of IDs to exclude from search - * @showInSearch If true, it makes sure content has been stored as searchable, defaults to null, which means it searches no matter what this bit says - * @siteID The site ID to filter on - * @propertyList A list of properties to retrieve as a projection instead of array of objects + * @contentTypes Limit search to list of content types (comma-delimited). Leave blank to search all content types + * @excludeIDs List of IDs to exclude from search + * @showInSearch If true, it makes sure content has been stored as searchable, defaults to null, which means it searches no matter what this bit says + * @siteID The site ID to filter on + * @propertyList A list of properties to retrieve as a projection instead of array of objects * - * @returns struct = { content, count } + * @return struct = { content, count } */ function searchContent( any searchTerm = "", @@ -176,10 +176,7 @@ component extends="cborm.models.VirtualEntityService" singleton { // Published eq true evaluate other params if ( arguments.isPublished ) { c.isLt( "publishedDate", now() ) - .$or( - c.restrictions.isNull( "expireDate" ), - c.restrictions.isGT( "expireDate", now() ) - ) + .$or( c.restrictions.isNull( "expireDate" ), c.restrictions.isGT( "expireDate", now() ) ) .isEq( "passwordProtection", "" ); } } @@ -247,7 +244,7 @@ component extends="cborm.models.VirtualEntityService" singleton { /** * Get an id from a slug of a content object * - * @slug The slug to search an ID for. + * @slug The slug to search an ID for. * @siteID The site this slug belongs to * * @return The id of the content object or empty string if not found @@ -268,9 +265,9 @@ component extends="cborm.models.VirtualEntityService" singleton { /** * This utility tries to get the content type by id/slug or fails * - * @throws EntityNotFound - * * @return The found entity + * + * @throws EntityNotFound */ function getByIdOrSlugOrFail( required id ){ var c = newCriteria(); @@ -283,10 +280,7 @@ component extends="cborm.models.VirtualEntityService" singleton { .get(); if ( isNull( oEntity ) ) { - throw( - message = "No entity found for ID/Slug #arguments.id.toString()#", - type = "EntityNotFound" - ); + throw( message = "No entity found for ID/Slug #arguments.id.toString()#", type = "EntityNotFound" ); } return oEntity; @@ -296,9 +290,9 @@ component extends="cborm.models.VirtualEntityService" singleton { * Find a published content object by slug and published unpublished flags, if not found it returns * a new content object * - * @slug The slug to search + * @slug The slug to search * @showUnpublished To also show unpublished content, defaults to false. - * @siteID The site this slug belongs to + * @siteID The site this slug belongs to * * @return The content object or a new unpersisted content object */ @@ -315,10 +309,7 @@ component extends="cborm.models.VirtualEntityService" singleton { .when( !showUnpublished, function( c ){ c.isTrue( "isPublished" ) .isLT( "publishedDate", now() ) - .$or( - c.restrictions.isNull( "expireDate" ), - c.restrictions.isGT( "expireDate", now() ) - ); + .$or( c.restrictions.isNull( "expireDate" ), c.restrictions.isGT( "expireDate", now() ) ); } ) .get(); @@ -329,9 +320,9 @@ component extends="cborm.models.VirtualEntityService" singleton { /** * Verify an incoming slug is unique or not * - * @slug The slug to search for uniqueness - * @contentID Limit the search to the passed contentID usually for updates - * @siteID The site to filter on + * @slug The slug to search for uniqueness + * @contentID Limit the search to the passed contentID usually for updates + * @siteID The site to filter on * @contentType The content type uniqueness * * @return True if the slug is unique or false if it's already used @@ -397,18 +388,18 @@ component extends="cborm.models.VirtualEntityService" singleton { /** * Find published content objects by different filters and output formats * - * @max The maximum number of records to paginate - * @offset The offset in the pagination + * @max The maximum number of records to paginate + * @offset The offset in the pagination * @searchTerm The search term to search - * @category The category to filter the content on - * @asQuery Return as query or array of objects, defaults to array of objects - * @sortOrder how we need to sort the results - * @parent The parentID or parent entity to filter on, don't pass or pass an empty value to ignore, defaults to 'all' + * @category The category to filter the content on + * @asQuery Return as query or array of objects, defaults to array of objects + * @sortOrder how we need to sort the results + * @parent The parentID or parent entity to filter on, don't pass or pass an empty value to ignore, defaults to 'all' * @slugPrefix If passed, this will do a hierarchical search according to this slug prefix. Remember that all hierarchical content's slug field contains its hierarchy: /products/awesome/product1. This prefix will be appended with a `/` - * @siteID If passed, filter by site id + * @siteID If passed, filter by site id * @properties The list of properties to project on instead of giving you full object graphs - * @authorID The authorID to filter on - * @criteria The criteria object to use if passed, else we create a new one. + * @authorID The authorID to filter on + * @criteria The criteria object to use if passed, else we create a new one. * @slugSearch If passed, we will search for content items with this field as a full text search on slugs * * @return struct as { count, content } @@ -449,18 +440,13 @@ component extends="cborm.models.VirtualEntityService" singleton { // only published pages c.isTrue( "isPublished" ) .isLT( "publishedDate", now() ) - .$or( - c.restrictions.isNull( "expireDate" ), - c.restrictions.isGT( "expireDate", now() ) - ) + .$or( c.restrictions.isNull( "expireDate" ), c.restrictions.isGT( "expireDate", now() ) ) // only non-password pages .isEq( "passwordProtection", "" ) // Category Filter .when( len( arguments.category ), function( c ){ // create association with categories by slug. - arguments.c - .joinTo( "categories", "cats" ) - .isIn( "cats.slug", listToArray( category ) ); + arguments.c.joinTo( "categories", "cats" ).isIn( "cats.slug", listToArray( category ) ); } ) // Search Criteria .when( len( arguments.searchTerm ), function( c ){ @@ -526,7 +512,7 @@ component extends="cborm.models.VirtualEntityService" singleton { * Bulk Publish Status Updates * * @contentID The list or array of ID's to bulk update - * @status The status either 'publish' or 'draft' + * @status The status either 'publish' or 'draft' */ any function bulkPublishStatus( required any contentID, required any status ){ var publish = false; @@ -553,7 +539,7 @@ component extends="cborm.models.VirtualEntityService" singleton { * Get all the expired content in the system by filters * * @author The author filtering if passed. - * @max The maximum number of records to return + * @max The maximum number of records to return * @offset The pagination offset * @siteID The site to filter on */ @@ -596,7 +582,7 @@ component extends="cborm.models.VirtualEntityService" singleton { * Get all the future published content in the system by filters * * @author The author filtering if passed. - * @max The maximum number of records to return + * @max The maximum number of records to return * @offset The pagination offset * @siteID The site to filter on */ @@ -636,10 +622,10 @@ component extends="cborm.models.VirtualEntityService" singleton { /** * Get latest edits according to criteria * - * @author The author object to use for retrieval - * @isPublished If passed, check if content is published or in draft mode. Else defaults to all states - * @max The maximum number of records to return - * @siteID The site to get edits from + * @author The author object to use for retrieval + * @isPublished If passed, check if content is published or in draft mode. Else defaults to all states + * @max The maximum number of records to return + * @siteID The site to get edits from */ array function getLatestEdits( any author, @@ -672,7 +658,7 @@ component extends="cborm.models.VirtualEntityService" singleton { /** * Get the top visited content entries * - * @max The maximum to retrieve, defaults to 5 entries + * @max The maximum to retrieve, defaults to 5 entries * @siteID The site to filter on */ array function getTopVisitedContent( numeric max = 5, string siteID = "" ){ @@ -687,7 +673,7 @@ component extends="cborm.models.VirtualEntityService" singleton { /** * Get the top commented content entries * - * @max The maximum to retrieve, defaults to 5 entries + * @max The maximum to retrieve, defaults to 5 entries * @siteID The site to filter on */ array function getTopCommentedContent( numeric max = 5, string siteID = "" ){ @@ -727,11 +713,11 @@ component extends="cborm.models.VirtualEntityService" singleton { * Import data from a ContentBox JSON file. Returns the import log * * @importFile The json file to import - * @override Override content if found in the database, defaults to false - * - * @throws InvalidImportFormat + * @override Override content if found in the database, defaults to false * * @return The console log of the import + * + * @throws InvalidImportFormat */ string function importFromFile( required importFile, boolean override = false ){ var data = fileRead( arguments.importFile ); @@ -740,10 +726,7 @@ component extends="cborm.models.VirtualEntityService" singleton { ); if ( !isJSON( data ) ) { - throw( - message: "Cannot import file as the contents is not JSON", - type : "InvalidImportFormat" - ); + throw( message: "Cannot import file as the contents is not JSON", type: "InvalidImportFormat" ); } // deserialize packet: Should be array of { settingID, name, value } @@ -758,9 +741,9 @@ component extends="cborm.models.VirtualEntityService" singleton { * Import data from an array of structures or a single structure of data * * @importData A struct or array of data to import - * @override Override content if found in the database, defaults to false - * @importLog The import log buffer - * @site If passed, we use this specific site, else we discover it via content data + * @override Override content if found in the database, defaults to false + * @importLog The import log buffer + * @site If passed, we use this specific site, else we discover it via content data * * @return The console log of the import */ @@ -788,9 +771,7 @@ component extends="cborm.models.VirtualEntityService" singleton { for ( var thisContent in arguments.importData ) { // Determine Site if not passed from import data if ( isNull( arguments.site ) ) { - logThis( - "+ Site not passed, inflating from import data (#thisContent.site.slug#)" - ); + logThis( "+ Site not passed, inflating from import data (#thisContent.site.slug#)" ); arguments.site = siteService.getBySlugOrFail( thisContent.site.slug ); } @@ -810,9 +791,7 @@ component extends="cborm.models.VirtualEntityService" singleton { // Save content if ( !arrayLen( arguments.importData ) ) { - logThis( - "No content imported as none where found or able to be overriden from the import file." - ); + logThis( "No content imported as none where found or able to be overriden from the import file." ); } } // end transaction @@ -824,11 +803,11 @@ component extends="cborm.models.VirtualEntityService" singleton { * Import a content object from a ContentBox JSON structure * * @contentData The content structure inflated from JSON - * @importLog The string builder import log - * @parent If the inflated content object has a parent then it can be linked directly, no inflating necessary. Usually for recursions - * @newContent Map of new content by slug; useful for avoiding new content collisions with recusive relationships - * @site The site we are using for the content - * @override Are we overriding persisted data or not? + * @importLog The string builder import log + * @parent If the inflated content object has a parent then it can be linked directly, no inflating necessary. Usually for recursions + * @newContent Map of new content by slug; useful for avoiding new content collisions with recusive relationships + * @site The site we are using for the content + * @override Are we overriding persisted data or not? * * @return The content object representing the struct */ @@ -951,9 +930,7 @@ component extends="cborm.models.VirtualEntityService" singleton { relatedContent : oContent } ) ); - logThis( - "+ Custom field (#thisCF.key#) imported for : (#thisContent.contentType#:#thisContent.slug#)" - ); + logThis( "+ Custom field (#thisCF.key#) imported for : (#thisContent.contentType#:#thisContent.slug#)" ); } } @@ -982,13 +959,9 @@ component extends="cborm.models.VirtualEntityService" singleton { if ( structCount( thisContent.stats ) && thisContent.stats.hits > 0 ) { if ( oContent.hasStats() ) { oContent.getStats().setHits( thisContent.stats.hits ); - logThis( - "+ Content stats found and updated for : (#thisContent.contentType#:#thisContent.slug#)" - ); + logThis( "+ Content stats found and updated for : (#thisContent.contentType#:#thisContent.slug#)" ); } else { - logThis( - "+ Content stats imported for : (#thisContent.contentType#:#thisContent.slug#)" - ); + logThis( "+ Content stats imported for : (#thisContent.contentType#:#thisContent.slug#)" ); variables.statsService.save( variables.statsService.new( { hits : thisContent.stats.hits, relatedContent : oContent } ) ); @@ -1033,10 +1006,7 @@ component extends="cborm.models.VirtualEntityService" singleton { for ( var thisRelatedContent in thisContent.relatedContent ) { // if content has already been inflated as part of another process, just use that instance so we don't collide keys if ( structKeyExists( arguments.newContent, thisRelatedContent.slug ) ) { - arrayAppend( - allRelatedContent, - arguments.newContent[ thisRelatedContent.slug ] - ); + arrayAppend( allRelatedContent, arguments.newContent[ thisRelatedContent.slug ] ); logThis( "+ Related content (#thisRelatedContent.slug#) already imported, linking to : (#thisContent.contentType#:#thisContent.slug#)" ); @@ -1079,9 +1049,7 @@ component extends="cborm.models.VirtualEntityService" singleton { .setRelatedContent( oContent ); } ) ); - logThis( - "+ Content comments imported to: (#thisContent.contentType#:#thisContent.slug#)" - ); + logThis( "+ Content comments imported to: (#thisContent.contentType#:#thisContent.slug#)" ); } // SUBSCRIPTIONS @@ -1119,9 +1087,7 @@ component extends="cborm.models.VirtualEntityService" singleton { ); } // oContent.setCommentSubscriptions( allSubscriptions ); - logThis( - "+ Content comment subscriptions imported to: (#thisContent.contentType#:#thisContent.slug#)" - ); + logThis( "+ Content comment subscriptions imported to: (#thisContent.contentType#:#thisContent.slug#)" ); } // CONTENT VERSIONS @@ -1141,9 +1107,7 @@ component extends="cborm.models.VirtualEntityService" singleton { composeRelationships = false ); var oEditor = variables.authorService.findByEmail( thisVersion.author.email ); - return oVersion - .setAuthor( isNull( oEditor ) ? oAuthor : oEditor ) - .setRelatedContent( oContent ); + return oVersion.setAuthor( isNull( oEditor ) ? oAuthor : oEditor ).setRelatedContent( oContent ); } ) ); } @@ -1155,7 +1119,7 @@ component extends="cborm.models.VirtualEntityService" singleton { * Update a content's hits with some async flava * * @content A content object or id to update the hits on - * @async Async or not + * @async Async or not */ ContentService function updateHits( required content, boolean async = true ){ // Inflate it if it's just an ID @@ -1179,10 +1143,10 @@ component extends="cborm.models.VirtualEntityService" singleton { /** * Returns an array of [contentID, title, slug, createdDate, modifiedDate, featuredImageURL] structures of all the content in the system * - * @sortOrder The sort ordering of the results - * @isPublished Show all content or true/false published content + * @sortOrder The sort ordering of the results + * @isPublished Show all content or true/false published content * @showInSearch Show all content or true/false showInSearch flag - * @siteID The site id to use to filter on + * @siteID The site id to use to filter on * * @return Array of content data {contentID, title, slug, createdDate, modifiedDate, featuredImageURL} */ @@ -1205,10 +1169,7 @@ component extends="cborm.models.VirtualEntityService" singleton { // Published eq true evaluate other params if ( arguments.isPublished ) { c.isLt( "publishedDate", now() ) - .$or( - c.restrictions.isNull( "expireDate" ), - c.restrictions.isGT( "expireDate", now() ) - ) + .$or( c.restrictions.isNull( "expireDate" ), c.restrictions.isGT( "expireDate", now() ) ) .isEq( "passwordProtection", "" ); } } @@ -1229,9 +1190,7 @@ component extends="cborm.models.VirtualEntityService" singleton { } return c - .withProjections( - property = "contentID,title,slug,createdDate,modifiedDate,featuredImageURL" - ) + .withProjections( property = "contentID,title,slug,createdDate,modifiedDate,featuredImageURL" ) .asStruct() .list( sortOrder = arguments.sortOrder ); } diff --git a/modules/contentbox/models/content/ContentStore.cfc b/modules/contentbox/models/content/ContentStore.cfc index 95eebdc04b..b803ab111b 100755 --- a/modules/contentbox/models/content/ContentStore.cfc +++ b/modules/contentbox/models/content/ContentStore.cfc @@ -78,12 +78,12 @@ component /** * Wipe primary key, and descendant keys, and prepare for cloning of entire hierarchies * - * @author The author doing the cloning - * @original The original content object that will be cloned into this content object - * @originalService The ContentBox content service object - * @publish Publish pages or leave as drafts + * @author The author doing the cloning + * @original The original content object that will be cloned into this content object + * @originalService The ContentBox content service object + * @publish Publish pages or leave as drafts * @originalSlugRoot The original slug that will be replaced in all cloned content - * @newSlugRoot The new slug root that will be replaced in all cloned content + * @newSlugRoot The new slug root that will be replaced in all cloned content */ BaseContent function prepareForClone( required any author, diff --git a/modules/contentbox/models/content/ContentStoreService.cfc b/modules/contentbox/models/content/ContentStoreService.cfc index 6235cc1047..e68ea18a7c 100755 --- a/modules/contentbox/models/content/ContentStoreService.cfc +++ b/modules/contentbox/models/content/ContentStoreService.cfc @@ -24,10 +24,10 @@ component extends="ContentService" singleton { * Save the content store object and if an original slug is passed, we will update the entire * hierarchy if the slug changed. * - * @content The content store object + * @content The content store object * @originalSlug If an original slug is passed, then we need to update hierarchy slugs. * - * @returns ContentStoreService + * @return ContentStoreService */ function save( required any content, string originalSlug = "" ){ transaction { @@ -36,9 +36,7 @@ component extends="ContentService" singleton { // Update all affected child pages if any on slug updates, much like nested set updates its nodes, we update our slugs if ( structKeyExists( arguments, "originalSlug" ) AND len( arguments.originalSlug ) ) { - var entriesInNeed = newCriteria() - .like( "slug", "#arguments.originalSlug#/%" ) - .list(); + var entriesInNeed = newCriteria().like( "slug", "#arguments.originalSlug#/%" ).list(); for ( var thisContent in entriesInNeed ) { thisContent.setSlug( replaceNoCase( @@ -58,22 +56,22 @@ component extends="ContentService" singleton { /** * Search for content store items according to many filters * - * @search The search term to search on - * @isPublished Boolean bit to search if page is published or not, pass 'any' or not to ignore. - * @author The authorID to filter on, pass 'all' to ignore filter - * @parent The parentID or parent entity to filter on, don't pass or pass an empty value to ignore, defaults to 'all' - * @creator The creatorID to filter on, don't pass or pass an empty value to ignore, defaults to 'all' - * @category The categorie(s) to filter on. You can also pass 'all' or 'none' - * @max The maximum records to return - * @offset The offset on the pagination - * @sortOrder Sorting of the results, defaults to page title asc + * @search The search term to search on + * @isPublished Boolean bit to search if page is published or not, pass 'any' or not to ignore. + * @author The authorID to filter on, pass 'all' to ignore filter + * @parent The parentID or parent entity to filter on, don't pass or pass an empty value to ignore, defaults to 'all' + * @creator The creatorID to filter on, don't pass or pass an empty value to ignore, defaults to 'all' + * @category The categorie(s) to filter on. You can also pass 'all' or 'none' + * @max The maximum records to return + * @offset The offset on the pagination + * @sortOrder Sorting of the results, defaults to page title asc * @searchActiveContent If true, it searches title and content on the page, else it just searches on title - * @showInSearch If true, it makes sure content has been stored as searchable, defaults to false, which means it searches no matter what this bit says - * @slugPrefix If passed, this will do a hierarchical search according to this slug prefix. Remember that all hierarchical content's slug field contains its hierarchy: /products/awesome/product1. This prefix will be appended with a `/` - * @siteID The site ID to filter on - * @propertyList A list of properties to retrieve as a projection instead of array of objects + * @showInSearch If true, it makes sure content has been stored as searchable, defaults to false, which means it searches no matter what this bit says + * @slugPrefix If passed, this will do a hierarchical search according to this slug prefix. Remember that all hierarchical content's slug field contains its hierarchy: /products/awesome/product1. This prefix will be appended with a `/` + * @siteID The site ID to filter on + * @propertyList A list of properties to retrieve as a projection instead of array of objects * - * @returns struct = { content, count } + * @return struct = { content, count } */ struct function search( string search = "", @@ -178,8 +176,7 @@ component extends="ContentService" singleton { // With categories else { // search the association - c.createAlias( "categories", "cats" ) - .isIn( "cats.categoryID", [ arguments.category ] ); + c.createAlias( "categories", "cats" ).isIn( "cats.categoryID", [ arguments.category ] ); } } diff --git a/modules/contentbox/models/content/ContentVersion.cfc b/modules/contentbox/models/content/ContentVersion.cfc index 7b46e46e52..e4e1c6b8d7 100755 --- a/modules/contentbox/models/content/ContentVersion.cfc +++ b/modules/contentbox/models/content/ContentVersion.cfc @@ -201,9 +201,7 @@ component timeout ="10" { if ( NOT len( variables.renderedContent ) ) { // else render content out, prepare builder - var builder = createObject( "java", "java.lang.StringBuilder" ).init( - variables.content - ); + var builder = createObject( "java", "java.lang.StringBuilder" ).init( variables.content ); // announce renderings with data, so content renderers can process them variables.interceptorService.announce( "cb_onContentRendering", diff --git a/modules/contentbox/models/content/ContentVersionService.cfc b/modules/contentbox/models/content/ContentVersionService.cfc index b4a65ae89d..eee95b5891 100755 --- a/modules/contentbox/models/content/ContentVersionService.cfc +++ b/modules/contentbox/models/content/ContentVersionService.cfc @@ -21,7 +21,7 @@ component extends="cborm.models.VirtualEntityService" singleton { * Get the total version counts by content object and if the versions are active or not or all * * @contentId The content id to count on - * @isActive If passed, it evaluated the total using active or non-active versions. If not passed, it does them all + * @isActive If passed, it evaluated the total using active or non-active versions. If not passed, it does them all * * @return The number of versions a content object has by filters */ @@ -60,8 +60,8 @@ component extends="cborm.models.VirtualEntityService" singleton { * Find all the versions related to the passed content Id * * @contentID The content id to get the versions for - * @max Maximum records to get - * @offset The pagination offset + * @max Maximum records to get + * @offset The pagination offset * * @return struct of { count : numeric, versions : array} */ diff --git a/modules/contentbox/models/content/Entry.cfc b/modules/contentbox/models/content/Entry.cfc index 0073d27e01..427a048afa 100755 --- a/modules/contentbox/models/content/Entry.cfc +++ b/modules/contentbox/models/content/Entry.cfc @@ -79,16 +79,10 @@ component any function renderExcerpt(){ // Check if we need to translate if ( NOT len( variables.renderedExcerpt ) ) { - lock - name ="contentbox.excerptrendering.#getContentID()#" - type ="exclusive" - throwontimeout="true" - timeout ="10" { + lock name="contentbox.excerptrendering.#getContentID()#" type="exclusive" throwontimeout="true" timeout="10" { if ( NOT len( variables.renderedExcerpt ) ) { // render excerpt out, prepare builder - var builder = createObject( "java", "java.lang.StringBuilder" ).init( - getExcerpt() - ); + var builder = createObject( "java", "java.lang.StringBuilder" ).init( getExcerpt() ); // announce renderings with data, so content renderers can process them variables.interceptorService.announce( "cb_onContentRendering", @@ -106,12 +100,12 @@ component /** * Wipe primary key, and descendant keys, and prepare for cloning of entire hierarchies * - * @author The author doing the cloning - * @original The original content object that will be cloned into this content object - * @originalService The ContentBox content service object - * @publish Publish pages or leave as drafts + * @author The author doing the cloning + * @original The original content object that will be cloned into this content object + * @originalService The ContentBox content service object + * @publish Publish pages or leave as drafts * @originalSlugRoot The original slug that will be replaced in all cloned content - * @newSlugRoot The new slug root that will be replaced in all cloned content + * @newSlugRoot The new slug root that will be replaced in all cloned content */ BaseContent function prepareForClone( required any author, diff --git a/modules/contentbox/models/content/EntryService.cfc b/modules/contentbox/models/content/EntryService.cfc index 9f575be938..7e9b7be9e8 100755 --- a/modules/contentbox/models/content/EntryService.cfc +++ b/modules/contentbox/models/content/EntryService.cfc @@ -23,7 +23,7 @@ component extends="ContentService" singleton { /** * Save an entry * - * @entry The entry to save or update + * @entry The entry to save or update * @originalSlug The original slug if the save is an update * * @return Saved entry @@ -35,20 +35,20 @@ component extends="ContentService" singleton { /** * Search for blog entries according to many filters * - * @search The search term to search on - * @isPublished Boolean bit to search if page is published or not, pass 'any' or not to ignore. Default is `any` - * @author The authorID to filter on, pass 'all' to ignore filter - * @creator The creatorID to filter on, don't pass or pass an empty value to ignore, defaults to 'all' - * @category The categorie(s) to filter on. You can also pass 'all' or 'none' - * @max The maximum records to return - * @offset The offset on the pagination - * @sortOrder Sorting of the results, defaults to page title asc + * @search The search term to search on + * @isPublished Boolean bit to search if page is published or not, pass 'any' or not to ignore. Default is `any` + * @author The authorID to filter on, pass 'all' to ignore filter + * @creator The creatorID to filter on, don't pass or pass an empty value to ignore, defaults to 'all' + * @category The categorie(s) to filter on. You can also pass 'all' or 'none' + * @max The maximum records to return + * @offset The offset on the pagination + * @sortOrder Sorting of the results, defaults to page title asc * @searchActiveContent If true, it searches title and content on the page, else it just searches on title - * @showInSearch If true, it makes sure content has been stored as searchable, defaults to false, which means it searches no matter what this bit says - * @siteId The site ID to filter on - * @propertyList A list of properties to retrieve as a projection instead of array of objects + * @showInSearch If true, it makes sure content has been stored as searchable, defaults to false, which means it searches no matter what this bit says + * @siteId The site ID to filter on + * @propertyList A list of properties to retrieve as a projection instead of array of objects * - * @returns struct of { entries, count } + * @return struct of { entries, count } */ struct function search( string search = "", @@ -118,8 +118,7 @@ component extends="ContentService" singleton { // With categories else { // search the association - c.createAlias( "categories", "cats" ) - .isIn( "cats.categoryID", [ arguments.category ] ); + c.createAlias( "categories", "cats" ).isIn( "cats.categoryID", [ arguments.category ] ); } } // Site Filter @@ -178,15 +177,15 @@ component extends="ContentService" singleton { /** * Find published entries by date filters * - * @year The year to filter on - * @month The month to filter on - * @day The day to filter on - * @max The maximum records to return - * @offset The offset on the pagination + * @year The year to filter on + * @month The month to filter on + * @day The day to filter on + * @max The maximum records to return + * @offset The offset on the pagination * @asQuery Return query or array of structs - * @siteId The site ID to filter on + * @siteId The site ID to filter on * - * @returns struct of { entries, count } + * @return struct of { entries, count } */ function findPublishedEntriesByDate( numeric year = 0, diff --git a/modules/contentbox/models/content/Page.cfc b/modules/contentbox/models/content/Page.cfc index 60dba9fa69..43bff1d9ec 100755 --- a/modules/contentbox/models/content/Page.cfc +++ b/modules/contentbox/models/content/Page.cfc @@ -152,16 +152,10 @@ component any function renderExcerpt(){ // Check if we need to translate if ( NOT len( variables.renderedExcerpt ) ) { - lock - name ="contentbox.excerptrendering.#getContentID()#" - type ="exclusive" - throwontimeout="true" - timeout ="10" { + lock name="contentbox.excerptrendering.#getContentID()#" type="exclusive" throwontimeout="true" timeout="10" { if ( NOT len( variables.renderedExcerpt ) ) { // render excerpt out, prepare builder - var builder = createObject( "java", "java.lang.StringBuilder" ).init( - getExcerpt() - ); + var builder = createObject( "java", "java.lang.StringBuilder" ).init( getExcerpt() ); // announce renderings with data, so content renderers can process them variables.interceptorService.announce( "cb_onContentRendering", @@ -212,12 +206,12 @@ component /** * Wipe primary key, and descendant keys, and prepare for cloning of entire hierarchies * - * @author The author doing the cloning - * @original The original content object that will be cloned into this content object - * @originalService The ContentBox content service object - * @publish Publish pages or leave as drafts + * @author The author doing the cloning + * @original The original content object that will be cloned into this content object + * @originalService The ContentBox content service object + * @publish Publish pages or leave as drafts * @originalSlugRoot The original slug that will be replaced in all cloned content - * @newSlugRoot The new slug root that will be replaced in all cloned content + * @newSlugRoot The new slug root that will be replaced in all cloned content */ BaseContent function prepareForClone( required any author, diff --git a/modules/contentbox/models/content/PageService.cfc b/modules/contentbox/models/content/PageService.cfc index 4be0dc5ade..fd6b928922 100755 --- a/modules/contentbox/models/content/PageService.cfc +++ b/modules/contentbox/models/content/PageService.cfc @@ -23,7 +23,7 @@ component extends="ContentService" singleton { /** * Save a page and do necessary updates to the hierarchies if there is a slug change * - * @page The page to save or update + * @page The page to save or update * @originalSlug If an original slug is passed, then we need to update hierarchy slugs. * * @return Saved page @@ -55,21 +55,21 @@ component extends="ContentService" singleton { /** * Search for pages according to many filters * - * @search The search term to search on - * @isPublished Boolean bit to search if page is published or not, pass 'any' or not to ignore. - * @author The authorID to filter on, pass 'all' to ignore filter - * @parent The parentID to filter on, don't pass or pass an empty value to ignore, defaults to 'all' - * @creator The creatorID to filter on, don't pass or pass an empty value to ignore, defaults to 'all' - * @category The categorie(s) to filter on. You can also pass 'all' or 'none' - * @max The maximum records to return - * @offset The offset on the pagination - * @sortOrder Sorting of the results, defaults to page title asc + * @search The search term to search on + * @isPublished Boolean bit to search if page is published or not, pass 'any' or not to ignore. + * @author The authorID to filter on, pass 'all' to ignore filter + * @parent The parentID to filter on, don't pass or pass an empty value to ignore, defaults to 'all' + * @creator The creatorID to filter on, don't pass or pass an empty value to ignore, defaults to 'all' + * @category The categorie(s) to filter on. You can also pass 'all' or 'none' + * @max The maximum records to return + * @offset The offset on the pagination + * @sortOrder Sorting of the results, defaults to page title asc * @searchActiveContent If true, it searches title and content on the page, else it just searches on title - * @showInSearch If true, it makes sure content has been stored as searchable, defaults to false, which means it searches no matter what this bit says - * @siteID The site ID to filter on - * @propertyList A list of properties to retrieve as a projection instead of array of objects + * @showInSearch If true, it makes sure content has been stored as searchable, defaults to false, which means it searches no matter what this bit says + * @siteID The site ID to filter on + * @propertyList A list of properties to retrieve as a projection instead of array of objects * - * @returns struct = { pages, count } + * @return struct = { pages, count } */ struct function search( string search = "", @@ -165,8 +165,7 @@ component extends="ContentService" singleton { // With categories else { // search the association - c.createAlias( "categories", "cats" ) - .isIn( "cats.categoryID", [ arguments.category ] ); + c.createAlias( "categories", "cats" ).isIn( "cats.categoryID", [ arguments.category ] ); } } @@ -204,18 +203,18 @@ component extends="ContentService" singleton { /** * Find published pages using different filters and output formats. * - * @max The maximum number of records to paginate - * @offset The offset in the pagination + * @max The maximum number of records to paginate + * @offset The offset in the pagination * @searchTerm The search term to search - * @category The category to filter the content on - * @asQuery Return as query or array of objects, defaults to array of objects - * @sortOrder how we need to sort the results - * @parent The parentID or parent entity to filter on, don't pass or pass an empty value to ignore, defaults to 'all' + * @category The category to filter the content on + * @asQuery Return as query or array of objects, defaults to array of objects + * @sortOrder how we need to sort the results + * @parent The parentID or parent entity to filter on, don't pass or pass an empty value to ignore, defaults to 'all' * @slugPrefix If passed, this will do a hierarchical search according to this slug prefix. Remember that all hierarchical content's slug field contains its hierarchy: /products/awesome/product1. This prefix will be appended with a `/` - * @siteID If passed, filter by site id + * @siteID If passed, filter by site id * @properties The list of properties to project on instead of giving you full object graphs - * @authorID The authorID to filter on - * @criteria The criteria object to use if passed, else we create a new one. + * @authorID The authorID to filter on + * @criteria The criteria object to use if passed, else we create a new one. * @showInMenu If passed, it limits the search to this content property * @slugSearch If passed, we will search for content items with this field as a full text search on slugs * diff --git a/modules/contentbox/models/content/StatsService.cfc b/modules/contentbox/models/content/StatsService.cfc index a3ed9ab9bf..45b0b3282a 100644 --- a/modules/contentbox/models/content/StatsService.cfc +++ b/modules/contentbox/models/content/StatsService.cfc @@ -42,10 +42,7 @@ component extends="cborm.models.VirtualEntityService" singleton { */ function isUserAgentABot(){ var userAgent = lCase( CGI.http_user_agent ); - var aBotRegex = listToArray( - settingService.getSetting( "cb_content_bot_regex" ), - chr( 13 ) - ); + var aBotRegex = listToArray( settingService.getSetting( "cb_content_bot_regex" ), chr( 13 ) ); // iterate and try to match for ( var thisBot in aBotRegex ) { if ( arrayLen( reMatch( thisBot, userAgent ) ) gt 0 ) { @@ -79,9 +76,7 @@ component extends="cborm.models.VirtualEntityService" singleton { if ( variables.settingService.getSetting( "cb_content_hit_count" ) ) { try { // try to match a bot? or ignored bots? - if ( - variables.settingService.getSetting( "cb_content_hit_ignore_bots" ) OR !isUserAgentABot() - ) { + if ( variables.settingService.getSetting( "cb_content_hit_ignore_bots" ) OR !isUserAgentABot() ) { var q = new Query( sql = "UPDATE cb_stats SET hits = hits + 1, diff --git a/modules/contentbox/models/content/renderers/BaseRenderer.cfc b/modules/contentbox/models/content/renderers/BaseRenderer.cfc index 7e23c29ad2..597e257481 100644 --- a/modules/contentbox/models/content/renderers/BaseRenderer.cfc +++ b/modules/contentbox/models/content/renderers/BaseRenderer.cfc @@ -19,8 +19,9 @@ component accessors="true" { /** * Replace values of `indexOf` operations on the incoming string builder with a targeted replaceWith - * @builder The Java string builder - * @indexOf The string to search for + * + * @builder The Java string builder + * @indexOf The string to search for * @replaceWith The string to replace with * * @return The string builder. diff --git a/modules/contentbox/models/content/renderers/MarkdownRenderer.cfc b/modules/contentbox/models/content/renderers/MarkdownRenderer.cfc index 93f11dafe4..6d4e462e1b 100644 --- a/modules/contentbox/models/content/renderers/MarkdownRenderer.cfc +++ b/modules/contentbox/models/content/renderers/MarkdownRenderer.cfc @@ -2,9 +2,10 @@ * Copyright 2009 ColdBox Framework by Luis Majano and Ortus Solutions, Corp * www.coldboxframework.com | www.luismajano.com | www.ortussolutions.com * --- - * @author Luis Majano * This interceptor listens to ContentBox content renderings and it will * translate content within ContentBox from Markdown to HTML + * + * @author Luis Majano */ component extends="coldbox.system.Interceptor" { @@ -36,9 +37,7 @@ component extends="coldbox.system.Interceptor" { results ); } else if ( log.canDebug() ) { - log.debug( - "Skipping Markdown translation as content markup is #arguments.data.content.getMarkup()#" - ); + log.debug( "Skipping Markdown translation as content markup is #arguments.data.content.getMarkup()#" ); } } diff --git a/modules/contentbox/models/content/renderers/SettingRenderer.cfc b/modules/contentbox/models/content/renderers/SettingRenderer.cfc index c2f1b94ecf..a23f1d0796 100755 --- a/modules/contentbox/models/content/renderers/SettingRenderer.cfc +++ b/modules/contentbox/models/content/renderers/SettingRenderer.cfc @@ -31,7 +31,7 @@ component accessors="true" extends="BaseRenderer" { * * @builder java.lang.StringBuilder that contains all the content to manipulate * @content The content object that requested translation - * @event The ColdBox event + * @event The ColdBox event */ private function translateContent( required builder, @@ -75,10 +75,7 @@ component accessors="true" extends="BaseRenderer" { bundle = listLast( resource, "@" ); resource = listFirst( resource, "@" ); } - thisValue = variables.cbResourceService.getResource( - resource = resource, - bundle = bundle - ); + thisValue = variables.cbResourceService.getResource( resource = resource, bundle = bundle ); } // Normal Setting else { diff --git a/modules/contentbox/models/content/renderers/WidgetRenderer.cfc b/modules/contentbox/models/content/renderers/WidgetRenderer.cfc index 062faaa124..1c268ebb42 100755 --- a/modules/contentbox/models/content/renderers/WidgetRenderer.cfc +++ b/modules/contentbox/models/content/renderers/WidgetRenderer.cfc @@ -82,9 +82,7 @@ component accessors="true" extends="BaseRenderer" { // lucee 4.5 split due to invoke bug if ( server.keyExists( "lucee" ) and server.lucee.version.getToken( 1, "." ) == 4 ) { - widgetContent = evaluate( - "oWidget.#oWidgetMethod#( argumentCollection=tagAttributes )" - ); + widgetContent = evaluate( "oWidget.#oWidgetMethod#( argumentCollection=tagAttributes )" ); } else { // Render out the widgets widgetContent = invoke( oWidget, oWidgetMethod, tagAttributes ); @@ -214,10 +212,7 @@ component accessors="true" extends="BaseRenderer" { ); oWidgetMethod = getToken( widgetName, 2, "." ); } else if ( isModuleWidget ) { - oWidget = widgetService.getWidget( - name = widgetName & "@" & moduleName, - type = "module" - ); + oWidget = widgetService.getWidget( name = widgetName & "@" & moduleName, type = "module" ); oWidgetMethod = widgetArgs.widgetUDF; } else if ( isThemeWidget ) { oWidget = widgetService.getWidget( name = widgetName, type = "theme" ); @@ -232,9 +227,7 @@ component accessors="true" extends="BaseRenderer" { // lucee 4.5 split due to invoke bug if ( server.keyExists( "lucee" ) and server.lucee.version.getToken( 1, "." ) == 4 ) { - widgetContent = evaluate( - "oWidget.#oWidgetMethod#( argumentCollection=widgetArgs )" - ); + widgetContent = evaluate( "oWidget.#oWidgetMethod#( argumentCollection=widgetArgs )" ); } else { // Render out the widgets widgetContent = invoke( oWidget, oWidgetMethod, widgetArgs ); diff --git a/modules/contentbox/models/content/util/ContentCacheCleanup.cfc b/modules/contentbox/models/content/util/ContentCacheCleanup.cfc index 07af69769e..7f7f1cd605 100644 --- a/modules/contentbox/models/content/util/ContentCacheCleanup.cfc +++ b/modules/contentbox/models/content/util/ContentCacheCleanup.cfc @@ -13,20 +13,17 @@ component extends="coldbox.system.Interceptor" { * Listen when comments are posted. * * @event The request context - * @data Intercept data + * @data Intercept data */ function cbui_onCommentPost( event, data ){ - doCacheCleanup( - arguments.data.content.buildContentCacheCleanupKey(), - arguments.data.content - ); + doCacheCleanup( arguments.data.content.buildContentCacheCleanupKey(), arguments.data.content ); } /** * Listen when comments are moderated * * @event The request context - * @data Intercept data + * @data Intercept data */ function cbadmin_onCommentStatusUpdate( event, data ){ variables.commentService @@ -43,92 +40,71 @@ component extends="coldbox.system.Interceptor" { * Listen when comments are removed * * @event The request context - * @data Intercept data + * @data Intercept data */ function cbadmin_preCommentRemove( event, data ){ var oComment = variables.commentService.get( arguments.data.commentID ); - doCacheCleanup( - oComment.getRelatedContent().buildContentCacheCleanupKey(), - oComment.getRelatedContent() - ); + doCacheCleanup( oComment.getRelatedContent().buildContentCacheCleanupKey(), oComment.getRelatedContent() ); } /** * Listen when entries are saved * * @event The request context - * @data Intercept data + * @data Intercept data */ function cbadmin_postEntrySave( event, data ){ - doCacheCleanup( - arguments.data.content.buildContentCacheCleanupKey(), - arguments.data.content - ); + doCacheCleanup( arguments.data.content.buildContentCacheCleanupKey(), arguments.data.content ); } /** * Listen when entries are removed * * @event The request context - * @data Intercept data + * @data Intercept data */ function cbadmin_preEntryRemove( event, data ){ - doCacheCleanup( - arguments.data.content.buildContentCacheCleanupKey(), - arguments.data.content - ); + doCacheCleanup( arguments.data.content.buildContentCacheCleanupKey(), arguments.data.content ); } /** * Listen when pages are saved * * @event The request context - * @data Intercept data + * @data Intercept data */ function cbadmin_postPageSave( event, data ){ - doCacheCleanup( - arguments.data.content.buildContentCacheCleanupKey(), - arguments.data.content - ); + doCacheCleanup( arguments.data.content.buildContentCacheCleanupKey(), arguments.data.content ); } /** * Listen when pages are removed * * @event The request context - * @data Intercept data + * @data Intercept data */ function cbadmin_prePageRemove( event, data ){ - doCacheCleanup( - arguments.data.content.buildContentCacheCleanupKey(), - arguments.data.content - ); + doCacheCleanup( arguments.data.content.buildContentCacheCleanupKey(), arguments.data.content ); } /** * Listen when a content store item is saved * * @event The request context - * @data Intercept data + * @data Intercept data */ function cbadmin_postContentStoreSave( event, data ){ - doCacheCleanup( - arguments.data.content.buildContentCacheCleanupKey(), - arguments.data.content - ); + doCacheCleanup( arguments.data.content.buildContentCacheCleanupKey(), arguments.data.content ); } /** * Listen when a content store item is removed * * @event The request context - * @data Intercept data + * @data Intercept data */ function cbadmin_preContentStoreRemove( event, data ){ - doCacheCleanup( - arguments.data.content.buildContentCacheCleanupKey(), - arguments.data.content - ); + doCacheCleanup( arguments.data.content.buildContentCacheCleanupKey(), arguments.data.content ); } /*********************************************************************************************************/ @@ -139,7 +115,7 @@ component extends="coldbox.system.Interceptor" { * Clear the content caches according to incoming key and content object * * @cacheKey The cache key to use - * @content The content object + * @content The content object */ private function doCacheCleanup( required string cacheKey, any content ){ // Log it @@ -158,9 +134,7 @@ component extends="coldbox.system.Interceptor" { variables.log.info( "+ Cleared content translation caches for: #arguments.cacheKey#" ); // clear content wrapper caches - var blogPrefix = ( - arguments.content.getContentType() eq "Entry" ? "#settings.cb_site_blog_entrypoint#/" : "" - ); + var blogPrefix = ( arguments.content.getContentType() eq "Entry" ? "#settings.cb_site_blog_entrypoint#/" : "" ); var wrapperKey = "#blogPrefix##arguments.content.getSlug()#"; variables.contentService.clearPageWrapperCaches( slug = wrapperKey, async = true ); // log it diff --git a/modules/contentbox/models/exporters/ContentBoxExporter.cfc b/modules/contentbox/models/exporters/ContentBoxExporter.cfc index fda6fa784a..7877adcc6a 100644 --- a/modules/contentbox/models/exporters/ContentBoxExporter.cfc +++ b/modules/contentbox/models/exporters/ContentBoxExporter.cfc @@ -154,11 +154,9 @@ component accessors=true { priority : 1 }, "medialibrary" : { - fileName : "medialibrary", - displayName : "Media Library", - directory : expandPath( - variables.settingService.getSetting( "cb_media_directoryRoot" ) - ), + fileName : "medialibrary", + displayName : "Media Library", + directory : expandPath( variables.settingService.getSetting( "cb_media_directoryRoot" ) ), includeFiles : "*", type : "folder", extension : "", @@ -215,17 +213,15 @@ component accessors=true { exporter.setFileName( config.def.fileName ); exporter.setDisplayName( config.def.displayName ); exporter.setContent( - variables[ config.def.service ].getAllForExport( - variables.siteService.getCurrentWorkingSite() - ) + variables[ config.def.service ].getAllForExport( variables.siteService.getCurrentWorkingSite() ) ); exporter.setPriority( config.def.priority ); break; // add file exporter case "file": - var includedFiles = !isBoolean( arguments.targets[ key ] ) && listLen( - arguments.targets[ key ] - ) ? arguments.targets[ key ] : "*"; + var includedFiles = !isBoolean( arguments.targets[ key ] ) && listLen( arguments.targets[ key ] ) ? arguments.targets[ + key + ] : "*"; var exporter = wirebox.getInstance( "fileExporter@contentbox" ); exporter.setFileName( config.def.fileName ); exporter.setDisplayName( config.def.displayName ); @@ -385,14 +381,14 @@ component accessors=true { * Creates descriptor structure */ private struct function buildDescriptor(){ - var loggedInUser = variables.securityService.getAuthorSession(); - var descriptor = {}; + var loggedInUser = variables.securityService.getAuthorSession(); + var descriptor = {}; // set static descriptor values descriptor[ "exportDate" ] = now(); descriptor[ "exportedBy" ] = "#loggedInUser.getFullName()# (#loggedInUser.getUsername()#)"; descriptor[ "content" ] = {}; - descriptor[ "site" ] = variables.siteService.getCurrentWorkingSite().getMemento(); + descriptor[ "site" ] = variables.siteService.getCurrentWorkingSite().getMemento(); // add dynamic content for ( var exporter in variables.exporters ) { diff --git a/modules/contentbox/models/exporters/StaticExporter.cfc b/modules/contentbox/models/exporters/StaticExporter.cfc index cf1167bfa3..84471b7712 100644 --- a/modules/contentbox/models/exporters/StaticExporter.cfc +++ b/modules/contentbox/models/exporters/StaticExporter.cfc @@ -28,13 +28,14 @@ component accessors=true threadSafe singleton { /** * Export static site with several exporting options. The end result is the location of the generated site + * * @exportDirectory The directory to export to, defaults to the temp site creation - * @includeBlog Flag to include the blog or not in the static site export - * @modifiedDate From when to export content, defaults to ALL - * @event Request Context - * @rc RC - * @prc PRC - * @site The site to export + * @includeBlog Flag to include the blog or not in the static site export + * @modifiedDate From when to export content, defaults to ALL + * @event Request Context + * @rc RC + * @prc PRC + * @site The site to export * * @return struct with keys: { exportLog:builder, exportDirectory, exportArchive } */ @@ -160,10 +161,7 @@ component accessors=true threadSafe singleton { if ( arguments.includeBlog ) { var aEntries = variables.entryService.search( siteID: arguments.site.getSiteID() ); // Put all categories in prc for processing - prc.categories = variables.categoryService.search( - isPublic: true, - siteId : arguments.site.getSiteId() - ).categories; + prc.categories = variables.categoryService.search( isPublic: true, siteId: arguments.site.getSiteId() ).categories; // Process all entries for ( var thisEntry in aEntries.entries ) { // put in scope for fake access @@ -189,10 +187,7 @@ component accessors=true threadSafe singleton { ); // Announce export - interceptorService.announce( - "cbadmin_postStaticSiteExport", - { options : arguments, results : results } - ); + interceptorService.announce( "cbadmin_postStaticSiteExport", { options : arguments, results : results } ); // Remove creation Folder now directoryDelete( arguments.exportDirectory, true ); @@ -205,12 +200,12 @@ component accessors=true threadSafe singleton { /** * Process a static entry export * - * @content The content object - * @event Request Context - * @rc RC - * @prc PRC + * @content The content object + * @event Request Context + * @rc RC + * @prc PRC * @exportDir The location of export - * @settings All of the ContentBox Settings + * @settings All of the ContentBox Settings */ private function processStaticEntry( required content, @@ -260,22 +255,19 @@ component accessors=true threadSafe singleton { directoryCreate( exportDir & "/" & arguments.content.getSlug() ); } // Write it out - fileWrite( - arguments.exportDir & "/" & arguments.content.getSlug() & "/index.html", - outputContent - ); + fileWrite( arguments.exportDir & "/" & arguments.content.getSlug() & "/index.html", outputContent ); }; /** * Process a static page export * - * @content The content object - * @isHome Is this the home page - * @event Request Context - * @rc RC - * @prc PRC + * @content The content object + * @isHome Is this the home page + * @event Request Context + * @rc RC + * @prc PRC * @exportDir The location of export - * @settings All of the ContentBox Settings + * @settings All of the ContentBox Settings */ private function processStaticPage( required content, @@ -335,10 +327,7 @@ component accessors=true threadSafe singleton { if ( arguments.isHome ) { fileWrite( arguments.exportDir & "/index.html", outputContent ); } else { - fileWrite( - arguments.exportDir & "/" & arguments.content.getSlug() & "/index.html", - outputContent - ); + fileWrite( arguments.exportDir & "/" & arguments.content.getSlug() & "/index.html", outputContent ); } // Do we have children diff --git a/modules/contentbox/models/importers/BlogCFCImporter.cfc b/modules/contentbox/models/importers/BlogCFCImporter.cfc index a9ae50d543..89491aa3ae 100644 --- a/modules/contentbox/models/importers/BlogCFCImporter.cfc +++ b/modules/contentbox/models/importers/BlogCFCImporter.cfc @@ -232,10 +232,7 @@ component implements="contentbox.models.importers.ICBImporter" { ).execute().getResult(); var aCategories = []; for ( var y = 1; y lte qCategories.recordcount; y++ ) { - arrayAppend( - aCategories, - categoryService.get( catMap[ qCategories.categoryId[ y ] ] ) - ); + arrayAppend( aCategories, categoryService.get( catMap[ qCategories.categoryId[ y ] ] ) ); } entry.setCategories( aCategories ); entitySave( entry ); @@ -324,11 +321,8 @@ component implements="contentbox.models.importers.ICBImporter" { // find all images in a given entry and save them to the media manager // ------------------------------------------------------------------------------------------------ private string function findImages( required string content ){ - var images = reMatchNoCase( "(?i)src=""[^>]*[^>](.*)(gif|jpg|png)""\1", arguments.content ); - var images1 = reMatchNoCase( - "(?i)href=""[^>]*[^>](.*)(gif|jpg|png)""\1", - arguments.content - ); + var images = reMatchNoCase( "(?i)src=""[^>]*[^>](.*)(gif|jpg|png)""\1", arguments.content ); + var images1 = reMatchNoCase( "(?i)href=""[^>]*[^>](.*)(gif|jpg|png)""\1", arguments.content ); var pattern = createObject( "java", "java.util.regex.Pattern" ); var exp = "(?<=\=\"" )([^""])+(?=\"" )"; var mediaPath = expandPath( settingService.getSetting( "cb_media_directoryRoot" ) ); @@ -355,11 +349,7 @@ component implements="contentbox.models.importers.ICBImporter" { httpService.setGetAsBinary( "yes" ); var result = httpService.send().getPrefix(); fileWrite( mediaPath & "\blogImages\" & fileName, result.fileContent ); - arguments.content = replaceNoCase( - arguments.content, - urlObj, - newUrl & fileName - ); + arguments.content = replaceNoCase( arguments.content, urlObj, newUrl & fileName ); } } } @@ -379,11 +369,7 @@ component implements="contentbox.models.importers.ICBImporter" { httpService.setGetAsBinary( "yes" ); var result = httpService.send().getPrefix(); fileWrite( mediaPath & "\blogImages\" & fileName, result.fileContent ); - arguments.content = replaceNoCase( - arguments.content, - urlObj, - newUrl & fileName - ); + arguments.content = replaceNoCase( arguments.content, urlObj, newUrl & fileName ); } } } diff --git a/modules/contentbox/models/importers/ContentBoxImporter.cfc b/modules/contentbox/models/importers/ContentBoxImporter.cfc index 957f203f8d..640bffff8f 100644 --- a/modules/contentbox/models/importers/ContentBoxImporter.cfc +++ b/modules/contentbox/models/importers/ContentBoxImporter.cfc @@ -89,13 +89,10 @@ component accessors=true { variables.filePathMappings = { "Email Templates" : contentBoxPath & "/email_templates", "Themes" : customPath & "/_themes", - "Media Library" : expandPath( - settingService.getSetting( "cb_media_directoryRoot" ) - ), - "Modules" : customPath & "/_modules", - "Widgets" : customPath & "/_widgets" + "Media Library" : expandPath( settingService.getSetting( "cb_media_directoryRoot" ) ), + "Modules" : customPath & "/_modules", + "Widgets" : customPath & "/_widgets" }; - } catch ( any e ) { log.error( "Error processing ContentBox import package: #e.message# #e.detail#", e ); } @@ -121,6 +118,7 @@ component accessors=true { /** * Method which analyzes the uploaded package and determines whether or not the descriptor file documents what is being uploaded + * * @importFile.hint The uploaded .cbox package */ public boolean function isValid(){ @@ -142,6 +140,7 @@ component accessors=true { /** * Main method for processing import + * * @overrideContent.hint Whether or not to override existing content with uploaded data (default=false) */ public string function execute( required boolean overrideContent = false ){ @@ -158,7 +157,7 @@ component accessors=true { var descriptorContents = getDescriptorContents( true ); // prioritize keys - var priorityOrder = structSort( + var priorityOrder = structSort( descriptorContents.content, "numeric", "asc", @@ -166,7 +165,7 @@ component accessors=true { ); // Start import transaction - transaction{ + transaction { for ( key in priorityOrder ) { var content = descriptorContents.content[ key ]; var filePath = getTempDirectory() & content.filename; @@ -193,7 +192,8 @@ component accessors=true { importLog.append( "Finished extracting #content.name#...
    " ); } } - } // end governing import transaction + } + // end governing import transaction var flattendImportLog = importLog.toString(); log.info( flattendImportLog ); @@ -202,6 +202,7 @@ component accessors=true { /** * Determines if passed file name exists in zip collection + * * @fileName.hint The file name to validate */ private boolean function hasFile( required string fileName ){ diff --git a/modules/contentbox/models/importers/MachBlogImporter.cfc b/modules/contentbox/models/importers/MachBlogImporter.cfc index 175ba9f9e6..efb738a66a 100644 --- a/modules/contentbox/models/importers/MachBlogImporter.cfc +++ b/modules/contentbox/models/importers/MachBlogImporter.cfc @@ -161,10 +161,7 @@ component implements="ICBImporter" { ).execute().getResult(); var aCategories = []; for ( var y = 1; y lte qCategories.recordcount; y++ ) { - arrayAppend( - aCategories, - categoryService.get( catMap[ qCategories.category_id[ y ] ] ) - ); + arrayAppend( aCategories, categoryService.get( catMap[ qCategories.category_id[ y ] ] ) ); } entry.setCategories( aCategories ); diff --git a/modules/contentbox/models/importers/MangoImporter.cfc b/modules/contentbox/models/importers/MangoImporter.cfc index 72af91cc80..b8564f4325 100644 --- a/modules/contentbox/models/importers/MangoImporter.cfc +++ b/modules/contentbox/models/importers/MangoImporter.cfc @@ -91,9 +91,7 @@ component implements="contentbox.models.importers.ICBImporter" { password : bcrypt.hashPassword( defaultPassword ), isActive : 1, firstName : listFirst( q.name[ x ], " " ), - lastName : trim( - replaceNoCase( q.name[ x ], listFirst( q.name[ x ], " " ), "" ) - ) + lastName : trim( replaceNoCase( q.name[ x ], listFirst( q.name[ x ], " " ), "" ) ) }; var author = authorService.new( properties = props ); author.setRole( defaultRole ); @@ -273,10 +271,7 @@ component implements="contentbox.models.importers.ICBImporter" { ).execute().getResult(); var aCategories = []; for ( var y = 1; y lte qCategories.recordcount; y++ ) { - arrayAppend( - aCategories, - categoryService.get( catMap[ qCategories.category_id[ y ] ] ) - ); + arrayAppend( aCategories, categoryService.get( catMap[ qCategories.category_id[ y ] ] ) ); } entry.setCategories( aCategories ); diff --git a/modules/contentbox/models/importers/WordpressImporter.cfc b/modules/contentbox/models/importers/WordpressImporter.cfc index ce3b77c366..e5e4603d11 100644 --- a/modules/contentbox/models/importers/WordpressImporter.cfc +++ b/modules/contentbox/models/importers/WordpressImporter.cfc @@ -320,10 +320,7 @@ component implements="contentbox.models.importers.ICBImporter" { ).execute().getResult(); var aCategories = []; for ( var y = 1; y lte qCategories.recordcount; y++ ) { - arrayAppend( - aCategories, - categoryService.get( catMap[ qCategories.term_id[ y ] ] ) - ); + arrayAppend( aCategories, categoryService.get( catMap[ qCategories.term_id[ y ] ] ) ); } entry.setCategories( aCategories ); diff --git a/modules/contentbox/models/media/CFContentMediaProvider.cfc b/modules/contentbox/models/media/CFContentMediaProvider.cfc index 9807db5ab0..c20146e580 100644 --- a/modules/contentbox/models/media/CFContentMediaProvider.cfc +++ b/modules/contentbox/models/media/CFContentMediaProvider.cfc @@ -46,6 +46,7 @@ component /** * Validate if a media requested exists + * * @mediaPath.hint the media path to verify if it exists */ boolean function mediaExists( required mediaPath ){ @@ -54,6 +55,7 @@ component /** * Deliver the media + * * @mediaPath.hint the media path to deliver back to the user */ any function deliverMedia( required mediaPath ){ diff --git a/modules/contentbox/models/media/ForwardMediaProvider.cfc b/modules/contentbox/models/media/ForwardMediaProvider.cfc index 9486a36177..360ad4cdc8 100644 --- a/modules/contentbox/models/media/ForwardMediaProvider.cfc +++ b/modules/contentbox/models/media/ForwardMediaProvider.cfc @@ -46,6 +46,7 @@ component /** * Validate if a media requested exists + * * @mediaPath.hint the media path to verify if it exists */ boolean function mediaExists( required mediaPath ){ @@ -54,6 +55,7 @@ component /** * Deliver the media + * * @mediaPath.hint the media path to deliver back to the user */ any function deliverMedia( required mediaPath ){ diff --git a/modules/contentbox/models/media/IMediaProvider.cfc b/modules/contentbox/models/media/IMediaProvider.cfc index 4897eb0eb7..24dea60a2b 100644 --- a/modules/contentbox/models/media/IMediaProvider.cfc +++ b/modules/contentbox/models/media/IMediaProvider.cfc @@ -24,12 +24,14 @@ interface { /** * Validate if a media requested exists + * * @mediaPath.hint the media path to verify if it exists */ boolean function mediaExists( required mediaPath ); /** * Deliver the media + * * @mediaPath.hint the media path to deliver back to the user */ any function deliverMedia( required mediaPath ); diff --git a/modules/contentbox/models/media/RelocationMediaProvider.cfc b/modules/contentbox/models/media/RelocationMediaProvider.cfc index f5c5a91a6c..286b5d85b3 100644 --- a/modules/contentbox/models/media/RelocationMediaProvider.cfc +++ b/modules/contentbox/models/media/RelocationMediaProvider.cfc @@ -46,6 +46,7 @@ component /** * Validate if a media requested exists + * * @mediaPath.hint the media path to verify if it exists */ boolean function mediaExists( required mediaPath ){ @@ -54,6 +55,7 @@ component /** * Deliver the media + * * @mediaPath.hint the media path to deliver back to the user */ any function deliverMedia( required mediaPath ){ diff --git a/modules/contentbox/models/menu/MenuItemService.cfc b/modules/contentbox/models/menu/MenuItemService.cfc index b5d29c131e..59d259d679 100644 --- a/modules/contentbox/models/menu/MenuItemService.cfc +++ b/modules/contentbox/models/menu/MenuItemService.cfc @@ -51,47 +51,28 @@ component * Runs after constructor to complete DI */ function onDIComplete(){ - registerProvider( - type = "URL", - providerPath = "contentbox.models.menu.providers.URLProvider" - ); - registerProvider( - type = "Content", - providerPath = "contentbox.models.menu.providers.ContentProvider" - ); - registerProvider( - type = "JS", - providerPath = "contentbox.models.menu.providers.JSProvider" - ); - registerProvider( - type = "Media", - providerPath = "contentbox.models.menu.providers.MediaProvider" - ); - registerProvider( - type = "SubMenu", - providerPath = "contentbox.models.menu.providers.SubMenuProvider" - ); - registerProvider( - type = "Free", - providerPath = "contentbox.models.menu.providers.FreeProvider" - ); + registerProvider( type = "URL", providerPath = "contentbox.models.menu.providers.URLProvider" ); + registerProvider( type = "Content", providerPath = "contentbox.models.menu.providers.ContentProvider" ); + registerProvider( type = "JS", providerPath = "contentbox.models.menu.providers.JSProvider" ); + registerProvider( type = "Media", providerPath = "contentbox.models.menu.providers.MediaProvider" ); + registerProvider( type = "SubMenu", providerPath = "contentbox.models.menu.providers.SubMenuProvider" ); + registerProvider( type = "Free", providerPath = "contentbox.models.menu.providers.FreeProvider" ); } /** * Registers a provider with the service - * @type.hint The type of provider + * + * @type.hint The type of provider * @providerPath.hint Logical path for getting instance of provider */ - public MenuItemService function registerProvider( - required string type, - required string providerPath - ){ + public MenuItemService function registerProvider( required string type, required string providerPath ){ variables.providers[ arguments.type ] = wirebox.getInstance( arguments.providerPath ); return this; } /** * Unregisters a provider with the service + * * @type.hint The type of provider */ public MenuItemService function unRegisterProvider( required string type ){ @@ -101,6 +82,7 @@ component /** * Retrieves a registered provider + * * @type.hint The type of provider */ public any function getProvider( required string type ){ diff --git a/modules/contentbox/models/menu/MenuService.cfc b/modules/contentbox/models/menu/MenuService.cfc index f09e4830e9..bde3975fea 100644 --- a/modules/contentbox/models/menu/MenuService.cfc +++ b/modules/contentbox/models/menu/MenuService.cfc @@ -28,7 +28,7 @@ component /** * Save a menu and do necessary updates * - * @menu The menu to save or update + * @menu The menu to save or update * @originalSlug If an original slug is passed, then we need to update hierarchy slugs. * * @return The saved menu @@ -41,11 +41,11 @@ component * Menu search using different filters and return options * * @searchTerm Search in firstname, lastname and email fields - * @max The max returned objects - * @offset The offset for pagination - * @asQuery Query or objects - * @sortOrder The sort order to apply - * @siteID The site to filter on + * @max The max returned objects + * @offset The offset for pagination + * @asQuery Query or objects + * @sortOrder The sort order to apply + * @siteID The site to filter on */ function search( string searchTerm = "", @@ -86,7 +86,7 @@ component /** * Find a menu object by slug, if not found it returns a new menu object * - * @slug The slug to search + * @slug The slug to search * @siteID The site this slug is on * * @return The menu found or a new menu blank @@ -132,11 +132,11 @@ component * Import data from a ContentBox JSON file. Returns the import log * * @importFile The json file to import - * @override Override content if found in the database, defaults to false - * - * @throws InvalidImportFormat + * @override Override content if found in the database, defaults to false * * @return The console log of the import + * + * @throws InvalidImportFormat */ string function importFromFile( required importFile, boolean override = false ){ var data = fileRead( arguments.importFile ); @@ -145,10 +145,7 @@ component ); if ( !isJSON( data ) ) { - throw( - message = "Cannot import file as the contents is not JSON", - type = "InvalidImportFormat" - ); + throw( message = "Cannot import file as the contents is not JSON", type = "InvalidImportFormat" ); } // deserialize packet: Should be array of { settingID, name, value } return importFromData( @@ -162,9 +159,9 @@ component * Import data from an array of structures or a single structure of data * * @importData A struct or array of data to import - * @override Override content if found in the database, defaults to false - * @importLog The import log buffer - * @site If passed, we use this specific site, else we discover it via content data + * @override Override content if found in the database, defaults to false + * @importLog The import log buffer + * @site If passed, we use this specific site, else we discover it via content data * * @return The console log of the import */ @@ -192,9 +189,7 @@ component for ( var thisMenu in arguments.importData ) { // Determine Site if not passed from import data if ( isNull( arguments.site ) ) { - logThis( - "+ Site not sent via arguments, inflating from menu data (#thisMenu.site.slug#)" - ); + logThis( "+ Site not sent via arguments, inflating from menu data (#thisMenu.site.slug#)" ); arguments.site = siteService.getBySlugOrFail( thisMenu.site.slug ); } @@ -241,9 +236,7 @@ component // Save them? if ( !arrayLen( arguments.importData ) ) { - logThis( - "No menus imported as none where found or able to be overriden from the import file." - ); + logThis( "No menus imported as none where found or able to be overriden from the import file." ); } } // end for transaction @@ -253,9 +246,10 @@ component /** * Builds editable menu for interface - * @menu the menu to parse + * + * @menu the menu to parse * @menuString build-up string for menu content - * @inChild flag for whether the content item is being evaluated as itself, or as a child of another item + * @inChild flag for whether the content item is being evaluated as itself, or as a child of another item */ public String function buildEditableMenu( required array menu, @@ -306,7 +300,7 @@ component /** * Verify an incoming slug is unique or not * - * @slug The slug to search for uniqueness + * @slug The slug to search for uniqueness * @menuID Limit the search to the passed menuID usually for updates * @siteID The site to filter on */ @@ -328,6 +322,7 @@ component /** * Get a unique slug hash + * * @slug The slug to make unique */ private function getUniqueSlugHash( required string slug ){ diff --git a/modules/contentbox/models/menu/item/BaseMenuItem.cfc b/modules/contentbox/models/menu/item/BaseMenuItem.cfc index 8fc3e33fdb..8fa8ddb7cd 100644 --- a/modules/contentbox/models/menu/item/BaseMenuItem.cfc +++ b/modules/contentbox/models/menu/item/BaseMenuItem.cfc @@ -258,6 +258,7 @@ component /** * Available precheck to determine display-ability of menu item + * * @options.hint Additional arguments to be used in the method */ public boolean function canDisplay( required struct options = {} ){ diff --git a/modules/contentbox/models/menu/item/ContentMenuItem.cfc b/modules/contentbox/models/menu/item/ContentMenuItem.cfc index cc8c3ef25c..23ff5aa37f 100644 --- a/modules/contentbox/models/menu/item/ContentMenuItem.cfc +++ b/modules/contentbox/models/menu/item/ContentMenuItem.cfc @@ -73,6 +73,7 @@ component /** * Available precheck to determine display-ability of menu item + * * @options.hint Additional arguments to be used in the method */ public boolean function canDisplay( required struct options = {} ){ diff --git a/modules/contentbox/models/menu/item/SubMenuItem.cfc b/modules/contentbox/models/menu/item/SubMenuItem.cfc index 91bbe668a3..58048f52b7 100644 --- a/modules/contentbox/models/menu/item/SubMenuItem.cfc +++ b/modules/contentbox/models/menu/item/SubMenuItem.cfc @@ -52,6 +52,7 @@ component /** * Available precheck to determine display-ability of menu item + * * @options.hint Additional arguments to be used in the method */ public boolean function canDisplay( required struct options = {} ){ diff --git a/modules/contentbox/models/menu/providers/ContentProvider.cfc b/modules/contentbox/models/menu/providers/ContentProvider.cfc index 9ecdf059d1..191a6702be 100644 --- a/modules/contentbox/models/menu/providers/ContentProvider.cfc +++ b/modules/contentbox/models/menu/providers/ContentProvider.cfc @@ -37,8 +37,9 @@ component /** * Retrieves template for use in admin screens for this type of menu item provider + * * @menuItem.hint The menu item object - * @options.hint Additional arguments to be used in the method + * @options.hint Additional arguments to be used in the method */ public string function getAdminTemplate( required any menuItem, required struct options = {} ){ var prc = requestService.getContext().getCollection( private = true ); @@ -67,8 +68,9 @@ component /** * Retrieves template for use in rendering menu item on the site + * * @menuItem.hint The menu item object - * @options.hint Additional arguments to be used in the method + * @options.hint Additional arguments to be used in the method */ public string function getDisplayTemplate( required any menuItem, required struct options = {} ){ var content = contentService.findBySlug( arguments.menuItem.getContentSlug() ); diff --git a/modules/contentbox/models/menu/providers/FreeProvider.cfc b/modules/contentbox/models/menu/providers/FreeProvider.cfc index 176953b364..45f3b5d7df 100644 --- a/modules/contentbox/models/menu/providers/FreeProvider.cfc +++ b/modules/contentbox/models/menu/providers/FreeProvider.cfc @@ -29,8 +29,9 @@ component /** * Retrieves template for use in admin screens for this type of menu item provider + * * @menuItem.hint The menu item object - * @options.hint Additional arguments to be used in the method + * @options.hint Additional arguments to be used in the method */ public string function getAdminTemplate( required any menuItem, required struct options = {} ){ return ""; @@ -38,8 +39,9 @@ component /** * Retrieves template for use in rendering menu item on the site + * * @menuItem.hint The menu item object - * @options.hint Additional arguments to be used in the method + * @options.hint Additional arguments to be used in the method */ public string function getDisplayTemplate( required any menuItem, required struct options = {} ){ var viewArgs = { diff --git a/modules/contentbox/models/menu/providers/JSProvider.cfc b/modules/contentbox/models/menu/providers/JSProvider.cfc index 23bb2a8f7c..196d9579fc 100644 --- a/modules/contentbox/models/menu/providers/JSProvider.cfc +++ b/modules/contentbox/models/menu/providers/JSProvider.cfc @@ -28,8 +28,9 @@ component } /** * Retrieves template for use in admin screens for this type of menu item provider + * * @menuItem.hint The menu item object - * @options.hint Additional arguments to be used in the method + * @options.hint Additional arguments to be used in the method */ public string function getAdminTemplate( required any menuItem, required struct options = {} ){ var viewArgs = { menuItem : arguments.menuItem }; @@ -42,8 +43,9 @@ component /** * Retrieves template for use in rendering menu item on the site + * * @menuItem.hint The menu item object - * @options.hint Additional arguments to be used in the method + * @options.hint Additional arguments to be used in the method */ public string function getDisplayTemplate( required any menuItem, required struct options = {} ){ var viewArgs = { menuItem : arguments.menuItem }; diff --git a/modules/contentbox/models/menu/providers/MediaProvider.cfc b/modules/contentbox/models/menu/providers/MediaProvider.cfc index 2f829af2e6..d43da01977 100644 --- a/modules/contentbox/models/menu/providers/MediaProvider.cfc +++ b/modules/contentbox/models/menu/providers/MediaProvider.cfc @@ -34,8 +34,9 @@ component } /** * Retrieves template for use in admin screens for this type of menu item provider + * * @menuItem.hint The menu item object - * @options.hint Additional arguments to be used in the method + * @options.hint Additional arguments to be used in the method */ public string function getAdminTemplate( required any menuItem, required struct options = {} ){ var viewArgs = { @@ -50,8 +51,9 @@ component } /** * Retrieves template for use in rendering menu item on the site + * * @menuItem.hint The menu item object - * @options.hint Additional arguments to be used in the method + * @options.hint Additional arguments to be used in the method */ public string function getDisplayTemplate( required any menuItem, required struct options = {} ){ var viewArgs = { menuItem : arguments.menuItem }; diff --git a/modules/contentbox/models/menu/providers/SubMenuProvider.cfc b/modules/contentbox/models/menu/providers/SubMenuProvider.cfc index 51fb567d4c..4bd479a1f9 100644 --- a/modules/contentbox/models/menu/providers/SubMenuProvider.cfc +++ b/modules/contentbox/models/menu/providers/SubMenuProvider.cfc @@ -35,8 +35,9 @@ component } /** * Retrieves template for use in admin screens for this type of menu item provider + * * @menuItem.hint The menu item object - * @options.hint Additional arguments to be used in the method + * @options.hint Additional arguments to be used in the method */ public string function getAdminTemplate( required any menuItem, required struct options = {} ){ var rc = requestService.getContext().getCollection(); @@ -58,8 +59,9 @@ component } /** * Retrieves template for use in rendering menu item on the site + * * @menuItem.hint The menu item object - * @options.hint Additional arguments to be used in the method + * @options.hint Additional arguments to be used in the method */ public string function getDisplayTemplate( required any menuItem, required struct options = {} ){ var viewArgs = { diff --git a/modules/contentbox/models/menu/providers/URLProvider.cfc b/modules/contentbox/models/menu/providers/URLProvider.cfc index 8d47040b54..16f1411d99 100644 --- a/modules/contentbox/models/menu/providers/URLProvider.cfc +++ b/modules/contentbox/models/menu/providers/URLProvider.cfc @@ -29,8 +29,9 @@ component /** * Retrieves template for use in admin screens for this type of menu item provider + * * @menuItem.hint The menu item object - * @options.hint Additional arguments to be used in the method + * @options.hint Additional arguments to be used in the method */ public string function getAdminTemplate( required any menuItem, required struct options = {} ){ var viewArgs = { menuItem : arguments.menuItem }; @@ -43,8 +44,9 @@ component /** * Retrieves template for use in rendering menu item on the site + * * @menuItem.hint The menu item object - * @options.hint Additional arguments to be used in the method + * @options.hint Additional arguments to be used in the method */ public string function getDisplayTemplate( required any menuItem, required struct options = {} ){ var viewArgs = { diff --git a/modules/contentbox/models/modules/ModuleService.cfc b/modules/contentbox/models/modules/ModuleService.cfc index 9aac2d5606..be26d7edbd 100644 --- a/modules/contentbox/models/modules/ModuleService.cfc +++ b/modules/contentbox/models/modules/ModuleService.cfc @@ -100,7 +100,7 @@ component /** * Populate module from Module Configuration CFC and returns the module * - * @model The module object + * @model The module object * @config The config object to populate with * * @return The module populated @@ -131,7 +131,7 @@ component /** * Find modules in ContentBox using the active criteria or `any` * - * @isActive The active criteria, true, false or any for all modules + * @isActive The active criteria, true, false or any for all modules * @moduleType The module type criteria * * @return struct:{ count:numeric, modules:array of objects } diff --git a/modules/contentbox/models/rss/RSSService.cfc b/modules/contentbox/models/rss/RSSService.cfc index 409df8dbe0..96ceba7852 100755 --- a/modules/contentbox/models/rss/RSSService.cfc +++ b/modules/contentbox/models/rss/RSSService.cfc @@ -20,7 +20,7 @@ component singleton { * Constructor * * @settingService.inject id:settingService@contentbox - * @cacheBox.inject cachebox + * @cacheBox.inject cachebox */ RSSService function init( required settingService, required cacheBox ){ // Dependencies @@ -40,7 +40,7 @@ component singleton { * Clean RSS caches asynchronously * * @comments Clear comment caches or not, defaults to false - * @slug The content slug to clear on + * @slug The content slug to clear on */ RSSService function clearCaches( boolean comments = false, string slug = "" ){ var cacheKey = ""; @@ -76,11 +76,11 @@ component singleton { /** * Build RSS feeds for contentbox content objects * - * @slug The page or entry slug to filter on. - * @comments Retrieve the comments RSS feed or content feed, defaults to false - * @category Filter the content feed with categories + * @slug The page or entry slug to filter on. + * @comments Retrieve the comments RSS feed or content feed, defaults to false + * @category Filter the content feed with categories * @contentType The contentType to build an RSS feed on. Empty is for the site. Available content types are [page,entry] - * @siteID The site Id to filter on + * @siteID The site Id to filter on */ function getRSS( string slug = "", @@ -166,7 +166,7 @@ component singleton { * Build entries feeds * * @category The category to filter on - * @siteID The site to filter on + * @siteID The site to filter on */ private function buildEntryFeed( string category = "", string siteID = "" ){ var settings = settingService.getAllSettings(); @@ -210,10 +210,8 @@ component singleton { qEntries.guid_string[ i ] = variables.CBHelper.linkEntry( qEntries.slug[ i ] ); ; qEntries.author[ i ] = "#entryResults.content[ i ].getAuthorEmail()# (#entryResults.content[ i ].getAuthorName()#)"; - qEntries.linkComments[ i ] = variables.CBHelper.linkComments( - entryResults.content[ i ] - ); - qEntries.categories[ i ] = entryResults.content[ i ].getCategoriesList(); + qEntries.linkComments[ i ] = variables.CBHelper.linkComments( entryResults.content[ i ] ); + qEntries.categories[ i ] = entryResults.content[ i ].getCategoriesList(); if ( entryResults.content[ i ].hasExcerpt() ) { qEntries.content[ i ] = entryResults.content[ i ].renderExcerpt(); } else { @@ -240,7 +238,7 @@ component singleton { * Build pages feeds * * @category The category to filter on - * @siteID The site to filter on + * @siteID The site to filter on */ private function buildPageFeed( string category = "", string siteID = "" ){ var settings = settingService.getAllSettings(); @@ -311,7 +309,7 @@ component singleton { * Build content feeds * * @category The category to filter on - * @siteID The site to filter on + * @siteID The site to filter on */ private function buildContentFeed( string category = "", string siteID = "" ){ var settings = variables.settingService.getAllSettings(); @@ -350,12 +348,8 @@ component singleton { // Attach permalinks for ( var i = 1; i lte contentResults.count; i++ ) { // Check for empty authors, just in case. - var authorEmail = len( contentResults.content[ i ].getAuthorEmail() ) ? contentResults.content[ - i - ].getAuthorEmail() : "nobody@nobody.com"; - var authorName = len( contentResults.content[ i ].getAuthorName() ) ? contentResults.content[ - i - ].getAuthorName() : "nobody"; + var authorEmail = len( contentResults.content[ i ].getAuthorEmail() ) ? contentResults.content[ i ].getAuthorEmail() : "nobody@nobody.com"; + var authorName = len( contentResults.content[ i ].getAuthorName() ) ? contentResults.content[ i ].getAuthorName() : "nobody"; // build URL to entry qContent.link[ i ] = CBHelper.linkContent( contentResults.content[ i ] ); @@ -384,9 +378,9 @@ component singleton { /** * Build comment feeds according to filtering elements * - * @slug The content slug to filter on + * @slug The content slug to filter on * @contentType The content type discriminator to filter on - * @siteID The site to filter on + * @siteID The site to filter on */ private function buildCommentFeed( string slug = "", diff --git a/modules/contentbox/models/search/DBSearch.cfc b/modules/contentbox/models/search/DBSearch.cfc index a75f331413..7a275f72b3 100644 --- a/modules/contentbox/models/search/DBSearch.cfc +++ b/modules/contentbox/models/search/DBSearch.cfc @@ -165,6 +165,7 @@ component accessors="true" singleton { /** * Utility function to help you highlight search terms in content + * * @term The search term * @content The content searched */ diff --git a/modules/contentbox/models/security/Author.cfc b/modules/contentbox/models/security/Author.cfc index 0d0aa26830..56070660cf 100644 --- a/modules/contentbox/models/security/Author.cfc +++ b/modules/contentbox/models/security/Author.cfc @@ -324,6 +324,7 @@ component /** * Check for permission + * * @slug The permission slug or list of slugs to validate the user has. If it's a list then they are ORed together */ boolean function checkPermission( required slug ){ @@ -349,6 +350,7 @@ component /** * This utility function checks if a slug is in any permission group this user belongs to. + * * @slug The slug to check */ boolean function checkGroupPermissions( required slug ){ @@ -410,6 +412,7 @@ component /** * Override the setPermissions + * * @permissions The permissions array to override */ Author function setPermissions( required array permissions ){ @@ -479,10 +482,7 @@ component var lastLogin = getLastLogin(); if ( NOT isNull( lastLogin ) ) { - return dateFormat( lastLogin, arguments.dateFormat ) & " " & timeFormat( - lastLogin, - arguments.timeFormat - ); + return dateFormat( lastLogin, arguments.dateFormat ) & " " & timeFormat( lastLogin, arguments.timeFormat ); } return "Never Logged In"; @@ -492,14 +492,11 @@ component /** * Store a preferences structure or JSON data in the user prefernces + * * @preferences.hint A struct of data or a JSON packet to store */ Author function setPreferences( required any preferences ){ - lock - name ="user.#getAuthorID()#.preferences" - type ="exclusive" - throwontimeout="true" - timeout ="5" { + lock name="user.#getAuthorID()#.preferences" type="exclusive" throwontimeout="true" timeout="5" { if ( isStruct( arguments.preferences ) ) { arguments.preferences = serializeJSON( arguments.preferences ); } @@ -513,14 +510,8 @@ component * Get all user preferences in inflated format */ struct function getAllPreferences(){ - lock - name ="user.#getAuthorID()#.preferences" - type ="readonly" - throwontimeout="true" - timeout ="5" { - return ( - !isNull( preferences ) AND isJSON( preferences ) ? deserializeJSON( preferences ) : structNew() - ); + lock name="user.#getAuthorID()#.preferences" type="readonly" throwontimeout="true" timeout="5" { + return ( !isNull( preferences ) AND isJSON( preferences ) ? deserializeJSON( preferences ) : structNew() ); } } @@ -529,12 +520,8 @@ component */ any function getPreference( required name, defaultValue ){ // get preference - lock - name ="user.#getAuthorID()#.preferences" - type ="readonly" - throwontimeout ="true" - timeout ="5" { - var allPreferences= getAllPreferences(); + lock name="user.#getAuthorID()#.preferences" type="readonly" throwontimeout="true" timeout="5" { + var allPreferences = getAllPreferences(); if ( structKeyExists( allPreferences, arguments.name ) ) { return allPreferences[ arguments.name ]; } @@ -599,9 +586,7 @@ component * @size The size of the avatar, defaults to 40 */ string function getAvatarLink( numeric size = 40 ){ - return ( - isNull( getEmail() ) ? "" : variables.avatar.generateLink( getEmail(), arguments.size ) - ); + return ( isNull( getEmail() ) ? "" : variables.avatar.generateLink( getEmail(), arguments.size ) ); } /** diff --git a/modules/contentbox/models/security/AuthorService.cfc b/modules/contentbox/models/security/AuthorService.cfc index d3a97a836f..ceaaca8da0 100755 --- a/modules/contentbox/models/security/AuthorService.cfc +++ b/modules/contentbox/models/security/AuthorService.cfc @@ -168,7 +168,7 @@ component * This function will encrypt an incoming target string using bcrypt and compare it with another bcrypt string * * @incoming Incoming string - * @target Target check + * @target Target check * * @return true if they match */ @@ -203,7 +203,8 @@ component /** * Save an author with extra pizazz! - * @author The author object + * + * @author The author object * @passwordChange Are we changing the password * * @return Author @@ -212,9 +213,7 @@ component // bcrypt password if new author if ( !arguments.author.isLoaded() OR arguments.passwordChange ) { // bcrypt the incoming password - arguments.author.setPassword( - variables.bcrypt.hashPassword( arguments.author.getPassword() ) - ); + arguments.author.setPassword( variables.bcrypt.hashPassword( arguments.author.getPassword() ) ); } // save the author @@ -224,15 +223,15 @@ component /** * Author search by many criteria. * - * @searchTerm Search in firstname, lastname and email fields - * @isActive Search with active bit - * @role Apply a role filter - * @max The max returned objects - * @offset The offset for pagination - * @asQuery Query or objects - * @sortOrder The sort order to apply - * @permissionGroups Single or list of permissiong groups to search on - * @twoFactorAuth Two factor auth or any + * @searchTerm Search in firstname, lastname and email fields + * @isActive Search with active bit + * @role Apply a role filter + * @max The max returned objects + * @offset The offset for pagination + * @asQuery Query or objects + * @sortOrder The sort order to apply + * @permissionGroups Single or list of permissiong groups to search on + * @twoFactorAuth Two factor auth or any * * @return {authors:array, count:numeric} */ @@ -277,10 +276,7 @@ component // permission groups filter if ( structKeyExists( arguments, "permissionGroups" ) AND arguments.permissionGroups NEQ "any" ) { c.createAlias( "permissionGroups", "permissionGroups" ) - .isIn( - "permissionGroups.permissionGroupID", - listToArray( arguments.permissionGroups ) - ); + .isIn( "permissionGroups.permissionGroupID", listToArray( arguments.permissionGroups ) ); } // run criteria query and projections count @@ -336,10 +332,7 @@ component .get(); if ( isNull( oAuthor ) ) { - throw( - type = "EntityNotFound", - message = "Author not found with id (#encodeForHTML( arguments.id )#)" - ); + throw( type = "EntityNotFound", message = "Author not found with id (#encodeForHTML( arguments.id )#)" ); } return oAuthor; } @@ -379,11 +372,11 @@ component * Import data from a ContentBox JSON file. Returns the import log * * @importFile The json file to import - * @override Override content if found in the database, defaults to false - * - * @throws InvalidImportFormat + * @override Override content if found in the database, defaults to false * * @return The console log of the import + * + * @throws InvalidImportFormat */ string function importFromFile( required importFile, boolean override = false ){ var data = fileRead( arguments.importFile ); @@ -392,10 +385,7 @@ component ); if ( !isJSON( data ) ) { - throw( - message = "Cannot import file as the contents is not JSON", - type = "InvalidImportFormat" - ); + throw( message = "Cannot import file as the contents is not JSON", type = "InvalidImportFormat" ); } // deserialize packet: Should be array of { settingID, name, value } @@ -410,12 +400,12 @@ component * Import data from an array of structures or a single structure of data * * @importData A struct or array of data to import - * @override Override content if found in the database, defaults to false - * @importLog The import log buffer - * - * @throws RoleNotFoundException - Whenever you try to import an author with an invalid role + * @override Override content if found in the database, defaults to false + * @importLog The import log buffer * * @return The console log of the import + * + * @throws RoleNotFoundException - Whenever you try to import an author with an invalid role */ string function importFromData( required importData, @@ -449,10 +439,8 @@ component // Create permissions that don't exist first var allPermissions = []; for ( var thisPermission in thisUser.permissions ) { - var oPerm = variables.permissionService.findByPermission( - thisPermission.permission - ); - oPerm = ( + var oPerm = variables.permissionService.findByPermission( thisPermission.permission ); + oPerm = ( isNull( oPerm ) ? getBeanPopulator().populateFromStruct( target = variables.permissionService.new(), memento = thisPermission, @@ -461,10 +449,7 @@ component ); // save oPerm if new only if ( !oPerm.isLoaded() ) { - variables.permissionService.save( - entity = oPerm, - transactional = false - ); + variables.permissionService.save( entity = oPerm, transactional = false ); } // append to add. arrayAppend( allPermissions, oPerm ); @@ -485,10 +470,7 @@ component ); // save oGroup if new only if ( !oGroup.isLoaded() ) { - variables.permissionGroupService.save( - entity = oGroup, - transactional = false - ); + variables.permissionGroupService.save( entity = oGroup, transactional = false ); } // Add to author oUser.addPermissionGroup( oGroup ); @@ -498,9 +480,7 @@ component var oRole = variables.roleService.findByRole( thisUser.role.role ); if ( !isNull( oRole ) ) { oUser.setRole( oRole ); - arguments.importLog.append( - "User role found and linked: #thisUser.role.role#
    " - ); + arguments.importLog.append( "User role found and linked: #thisUser.role.role#
    " ); } else { throw( message: "The role to import (#encodeForHTML( thisUser.role.role )#) does not exist in the system. Create it or import it first.", @@ -513,9 +493,7 @@ component arguments.importLog.append( "New user imported: #thisUser.username#
    " ); arrayAppend( allUsers, oUser ); } else if ( oUser.isLoaded() and arguments.override ) { - arguments.importLog.append( - "Persisted user overriden: #thisUser.username#
    " - ); + arguments.importLog.append( "Persisted user overriden: #thisUser.username#
    " ); arrayAppend( allUsers, oUser ); } else { arguments.importLog.append( "Skipping persisted user: #thisUser.username#
    " ); @@ -549,9 +527,7 @@ component var token = variables.securityService.generateResetToken( arguments.author ); var settings = variables.settingService.getAllSettings(); var defaultSite = variables.siteService.getDefaultSite(); - var adminUrl = variables.requestService - .getContext() - .buildLink( to: "/cbadmin", ssl: settings.cb_admin_ssl ); + var adminUrl = variables.requestService.getContext().buildLink( to: "/cbadmin", ssl: settings.cb_admin_ssl ); // get mail payload var bodyTokens = { diff --git a/modules/contentbox/models/security/ISecurityService.cfc b/modules/contentbox/models/security/ISecurityService.cfc index 3376d3b474..6791fe312c 100755 --- a/modules/contentbox/models/security/ISecurityService.cfc +++ b/modules/contentbox/models/security/ISecurityService.cfc @@ -10,7 +10,7 @@ interface { /** * Validates if a user can access an event. Called via the cbSecurity module. * - * @rule The security rule being tested for + * @rule The security rule being tested for * @controller The ColdBox controller calling the validation */ boolean function validateSecurity( struct rule, securedValue, any controller ); @@ -38,13 +38,13 @@ interface { * * For our RESTFul API, we can do an authenticate and login at the same time. * - * @username The username to validate - * @password The password to validate + * @username The username to validate + * @password The password to validate * @logThemIn If true, we will log them in automatically, else it will be the caller's job to do so via the `login()` method. * - * @throws InvalidCredentials - * * @return User : The logged in user object + * + * @throws InvalidCredentials */ Author function authenticate( required username, @@ -64,7 +64,7 @@ interface { /** * Resets a user's password. * - * @returns {error:boolean, messages:string} + * @return {error:boolean, messages:string} */ struct function resetUserPassword( required token, diff --git a/modules/contentbox/models/security/JwtSecurityValidator.cfc b/modules/contentbox/models/security/JwtSecurityValidator.cfc index 601d4fae95..3af3baab9c 100644 --- a/modules/contentbox/models/security/JwtSecurityValidator.cfc +++ b/modules/contentbox/models/security/JwtSecurityValidator.cfc @@ -39,16 +39,13 @@ component extends="cbsecurity.models.jwt.JwtService" singleton { * @return { allow:boolean, type:authentication|authorization, messages:string } */ struct function annotationValidator( required securedValue, required controller ){ - return validateSecurity( - securedValue: arguments.securedValue, - controller : arguments.controller - ); + return validateSecurity( securedValue: arguments.securedValue, controller: arguments.controller ); } /** * Validates if a user can access an event. Called via the cbSecurity module. * - * @rule The security rule being tested for + * @rule The security rule being tested for * @controller The ColdBox controller calling the validation * * @return Validation struct of: { allow:boolean, type:(authentication|authorization), messages } @@ -78,14 +75,8 @@ component extends="cbsecurity.models.jwt.JwtService" singleton { // Send back as headers now that they are refreshed variables.requestService .getContext() - .setHTTPHeader( - name : variables.settings.jwt.customAuthHeader, - value: newTokens.access_token - ) - .setHTTPHeader( - name : variables.settings.jwt.customRefreshHeader, - value: newTokens.refresh_token - ); + .setHTTPHeader( name: variables.settings.jwt.customAuthHeader, value: newTokens.access_token ) + .setHTTPHeader( name: variables.settings.jwt.customRefreshHeader, value: newTokens.refresh_token ); } else { // Error out as normal results.messages = e.type & ":" & e.message; diff --git a/modules/contentbox/models/security/LoginTracker.cfc b/modules/contentbox/models/security/LoginTracker.cfc index 7e3cb79cba..5a86c0de1f 100644 --- a/modules/contentbox/models/security/LoginTracker.cfc +++ b/modules/contentbox/models/security/LoginTracker.cfc @@ -52,20 +52,14 @@ component extends="coldbox.system.Interceptor" { var aBlockUsernames = loginTrackerService.findAllByValue( realUsername ); prc.oBlockByIP = ( arrayLen( aBlockIps ) ? aBlockIps[ 1 ] : loginTrackerService.new() ); - prc.oBlockByUsername = ( - arrayLen( aBlockUsernames ) ? aBlockUsernames[ 1 ] : loginTrackerService.new() - ); + prc.oBlockByUsername = ( arrayLen( aBlockUsernames ) ? aBlockUsernames[ 1 ] : loginTrackerService.new() ); // do checks to prevent login var isBlocked = false; // which reason? var byIP = false; // do checks by username and IP - if ( - !isNull( prc.oBlockByUsername ) and loginTrackerService.isBlocked( - prc.oBlockByUsername - ) - ) { + if ( !isNull( prc.oBlockByUsername ) and loginTrackerService.isBlocked( prc.oBlockByUsername ) ) { isBlocked = true; } if ( !isNull( prc.oBlockByIP ) and loginTrackerService.isBlocked( prc.oBlockByIP ) ) { diff --git a/modules/contentbox/models/security/LoginTrackerService.cfc b/modules/contentbox/models/security/LoginTrackerService.cfc index bf1242e43a..074fa7d561 100644 --- a/modules/contentbox/models/security/LoginTrackerService.cfc +++ b/modules/contentbox/models/security/LoginTrackerService.cfc @@ -23,6 +23,7 @@ component extends="cborm.models.VirtualEntityService" singleton { /** * Verify if an attempt is being blocked or not + * * @attempt The login attempt object */ boolean function isblocked( LoginAttempt attempt ){ @@ -58,6 +59,7 @@ component extends="cborm.models.VirtualEntityService" singleton { /** * Get the last successful logins + * * @max How many to retrieve */ function getLastLogins( required numeric max ){ diff --git a/modules/contentbox/models/security/PermissionGroupService.cfc b/modules/contentbox/models/security/PermissionGroupService.cfc index 84f6054550..6a4b6b64d8 100755 --- a/modules/contentbox/models/security/PermissionGroupService.cfc +++ b/modules/contentbox/models/security/PermissionGroupService.cfc @@ -34,11 +34,11 @@ component extends="cborm.models.VirtualEntityService" singleton { * Import data from a ContentBox JSON file. Returns the import log * * @importFile The json file to import - * @override Override content if found in the database, defaults to false - * - * @throws InvalidImportFormat + * @override Override content if found in the database, defaults to false * * @return The console log of the import + * + * @throws InvalidImportFormat */ string function importFromFile( required importFile, boolean override = false ){ var data = fileRead( arguments.importFile ); @@ -47,10 +47,7 @@ component extends="cborm.models.VirtualEntityService" singleton { ); if ( !isJSON( data ) ) { - throw( - message = "Cannot import file as the contents is not JSON", - type = "InvalidImportFormat" - ); + throw( message = "Cannot import file as the contents is not JSON", type = "InvalidImportFormat" ); } // deserialize packet: Should be array of { settingID, name, value } @@ -65,8 +62,8 @@ component extends="cborm.models.VirtualEntityService" singleton { * Import data from an array of structures or a single structure of data * * @importData A struct or array of data to import - * @override Override content if found in the database, defaults to false - * @importLog The import log buffer + * @override Override content if found in the database, defaults to false + * @importLog The import log buffer * * @return The console log of the import */ @@ -102,10 +99,8 @@ component extends="cborm.models.VirtualEntityService" singleton { // Create permissions that don't exist first var allPermissions = []; for ( var thisPermission in thisGroup.permissions ) { - var oPerm = variables.permissionService.findByPermission( - thisPermission.permission - ); - oPerm = ( + var oPerm = variables.permissionService.findByPermission( thisPermission.permission ); + oPerm = ( isNull( oPerm ) ? getBeanPopulator().populateFromStruct( target = variables.permissionService.new(), memento = thisPermission, @@ -114,10 +109,7 @@ component extends="cborm.models.VirtualEntityService" singleton { ); // save oPerm if new only if ( !oPerm.isLoaded() ) { - variables.permissionService.save( - entity = oPerm, - transactional = false - ); + variables.permissionService.save( entity = oPerm, transactional = false ); } // append to add. arrayAppend( allPermissions, oPerm ); @@ -128,14 +120,10 @@ component extends="cborm.models.VirtualEntityService" singleton { // if new or persisted with override then save. if ( !oGroup.isLoaded() ) { - arguments.importLog.append( - "New permission group imported: #thisGroup.name#
    " - ); + arguments.importLog.append( "New permission group imported: #thisGroup.name#
    " ); arrayAppend( allGroups, oGroup ); } else if ( oGroup.isLoaded() and arguments.override ) { - arguments.importLog.append( - "Persisted permission group overriden: #thisGroup.name#
    " - ); + arguments.importLog.append( "Persisted permission group overriden: #thisGroup.name#
    " ); arrayAppend( allGroups, oGroup ); } else { arguments.importLog.append( "Skipping permission group: #thisGroup.name#
    " ); diff --git a/modules/contentbox/models/security/PermissionService.cfc b/modules/contentbox/models/security/PermissionService.cfc index 3f3ab7a7f4..48db2a14d1 100755 --- a/modules/contentbox/models/security/PermissionService.cfc +++ b/modules/contentbox/models/security/PermissionService.cfc @@ -22,15 +22,14 @@ component extends="cborm.models.VirtualEntityService" singleton { /** * Delete a Permission which also removes itself from all many-to-many relationships + * * @permissionID The permission ID to remove */ boolean function deletePermission( required permissionID ){ transaction { // We do SQL deletions as those relationships are not bi-directional // delete role relationships - var q = new Query( - sql = "delete from cb_rolePermissions where FK_permissionID = :permissionID" - ); + var q = new Query( sql = "delete from cb_rolePermissions where FK_permissionID = :permissionID" ); q.addParam( name = "permissionID", value = arguments.permissionID, @@ -38,9 +37,7 @@ component extends="cborm.models.VirtualEntityService" singleton { ); q.execute(); // delete user relationships - var q = new Query( - sql = "delete from cb_authorPermissions where FK_permissionID = :permissionID" - ); + var q = new Query( sql = "delete from cb_authorPermissions where FK_permissionID = :permissionID" ); q.addParam( name = "permissionID", value = arguments.permissionID, @@ -48,9 +45,7 @@ component extends="cborm.models.VirtualEntityService" singleton { ); q.execute(); // delete permission now - var q = new Query( - sql = "delete from cb_permission where permissionID = :permissionID" - ); + var q = new Query( sql = "delete from cb_permission where permissionID = :permissionID" ); q.addParam( name = "permissionID", value = arguments.permissionID, @@ -69,19 +64,13 @@ component extends="cborm.models.VirtualEntityService" singleton { */ array function getAllForExport(){ return newCriteria() - .withProjections( - property = "permissionID,permission,description,createdDate,modifiedDate,isDeleted" - ) + .withProjections( property = "permissionID,permission,description,createdDate,modifiedDate,isDeleted" ) .asStruct() .list( sortOrder = "permission" ) // output conversions .map( function( item ){ item[ "createdDate" ] = variables.dateUtil.toUTC( item[ "createdDate" ], "", "UTC" ); - item[ "modifiedDate" ] = variables.dateUtil.toUTC( - item[ "modifiedDate" ], - "", - "UTC" - ); + item[ "modifiedDate" ] = variables.dateUtil.toUTC( item[ "modifiedDate" ], "", "UTC" ); return item; } ); } @@ -90,11 +79,11 @@ component extends="cborm.models.VirtualEntityService" singleton { * Import data from a ContentBox JSON file. Returns the import log * * @importFile The json file to import - * @override Override content if found in the database, defaults to false - * - * @throws InvalidImportFormat + * @override Override content if found in the database, defaults to false * * @return The console log of the import + * + * @throws InvalidImportFormat */ string function importFromFile( required importFile, boolean override = false ){ var data = fileRead( arguments.importFile ); @@ -103,10 +92,7 @@ component extends="cborm.models.VirtualEntityService" singleton { ); if ( !isJSON( data ) ) { - throw( - message = "Cannot import file as the contents is not JSON", - type = "InvalidImportFormat" - ); + throw( message = "Cannot import file as the contents is not JSON", type = "InvalidImportFormat" ); } // deserialize packet: Should be array of { settingID, name, value } @@ -121,12 +107,12 @@ component extends="cborm.models.VirtualEntityService" singleton { * Import data from an array of structures or a single structure of data * * @importData A struct or array of data to import - * @override Override content if found in the database, defaults to false - * @importLog The import log buffer - * - * @throws InvalidImportFormat + * @override Override content if found in the database, defaults to false + * @importLog The import log buffer * * @return The console log of the import + * + * @throws InvalidImportFormat */ string function importFromData( required importData, @@ -157,19 +143,13 @@ component extends="cborm.models.VirtualEntityService" singleton { // if new or persisted with override then save. if ( !oPermission.isLoaded() ) { - arguments.importLog.append( - "New permission imported: #thisPermission.permission#
    " - ); + arguments.importLog.append( "New permission imported: #thisPermission.permission#
    " ); arrayAppend( allPermissions, oPermission ); } else if ( oPermission.isLoaded() and arguments.override ) { - arguments.importLog.append( - "Permission overriden: #thisPermission.permission#
    " - ); + arguments.importLog.append( "Permission overriden: #thisPermission.permission#
    " ); arrayAppend( allPermissions, oPermission ); } else { - arguments.importLog.append( - "Permission skipped: #thisPermission.permission#
    " - ); + arguments.importLog.append( "Permission skipped: #thisPermission.permission#
    " ); } } // end import loop diff --git a/modules/contentbox/models/security/RateLimiter.cfc b/modules/contentbox/models/security/RateLimiter.cfc index d2b2218950..1ed508c3da 100755 --- a/modules/contentbox/models/security/RateLimiter.cfc +++ b/modules/contentbox/models/security/RateLimiter.cfc @@ -26,9 +26,7 @@ component extends="coldbox.system.Interceptor" { var allSettings = variables.settingService.getAllSettings(); // If turned off, just exist - if ( - !structKeyExists( allSettings, "cb_security_rate_limiter" ) || allSettings.cb_security_rate_limiter == false - ) { + if ( !structKeyExists( allSettings, "cb_security_rate_limiter" ) || allSettings.cb_security_rate_limiter == false ) { return false; } @@ -48,10 +46,11 @@ component extends="coldbox.system.Interceptor" { * Written by Charlie Arehart, charlie@carehart.org, in 2009, updated 2012, modified by Luis Majano 2016 * - Throttles requests made more than "count" times within "duration" seconds from single IP. * - Duck typed for performance - * @count The throttle counter - * @duration The time in seconds to limit - * @event The request context object - * @settings The settings structure + * + * @count The throttle counter + * @duration The time in seconds to limit + * @event The request context object + * @settings The settings structure */ private function limiter( count, duration, event, settings ){ // Get real IP address of requester @@ -59,11 +58,7 @@ component extends="coldbox.system.Interceptor" { // If first time visit, create record. if ( !structKeyExists( variables.limitData, realIP ) ) { - lock - name ="cb-ratelimiter-#hash( realIP )#" - type ="exclusive" - throwontimeout="true" - timeout ="5" { + lock name="cb-ratelimiter-#hash( realIP )#" type="exclusive" throwontimeout="true" timeout="5" { if ( !structKeyExists( variables.limitData, realIP ) ) { variables.limitData[ realIP ] = { attempts : 1, lastAttempt : now() }; return this; @@ -91,11 +86,7 @@ component extends="coldbox.system.Interceptor" { } // Log attempt - lock - name ="cb-ratelimiter-#hash( realIP )#" - type ="exclusive" - throwontimeout="true" - timeout ="5" { + lock name="cb-ratelimiter-#hash( realIP )#" type="exclusive" throwontimeout="true" timeout="5" { targetData.attempts++; targetData.lastAttempt = now(); } @@ -130,24 +121,16 @@ component extends="coldbox.system.Interceptor" { abort; } else { // Log attempt - lock - name ="cb-ratelimiter-#hash( realIP )#" - type ="exclusive" - throwontimeout="true" - timeout ="5" { + lock name="cb-ratelimiter-#hash( realIP )#" type="exclusive" throwontimeout="true" timeout="5" { targetData.attempts++; targetData.lastAttempt = now(); } } } else { // Reset attempts counter, since we are in the safe zone, just log the last attempt timestamp - lock - name ="cb-ratelimiter-#hash( realIP )#" - type ="exclusive" - throwontimeout ="true" - timeout ="5" { - targetData.attempts = 0; - targetData.lastAttempt= now(); + lock name="cb-ratelimiter-#hash( realIP )#" type="exclusive" throwontimeout="true" timeout="5" { + targetData.attempts = 0; + targetData.lastAttempt = now(); } } diff --git a/modules/contentbox/models/security/Role.cfc b/modules/contentbox/models/security/Role.cfc index 771f40851c..2ef737dd57 100644 --- a/modules/contentbox/models/security/Role.cfc +++ b/modules/contentbox/models/security/Role.cfc @@ -81,9 +81,7 @@ component name ="numberOfPermissions" formula="select count(*) from cb_rolePermissions as rolePermissions where rolePermissions.FK_roleID=roleID"; - property - name ="numberOfAuthors" - formula="select count(*) from cb_author as author where author.FK_roleID=roleID"; + property name="numberOfAuthors" formula="select count(*) from cb_author as author where author.FK_roleID=roleID"; /* ********************************************************************* ** NON PERSISTED PROPERTIES @@ -133,6 +131,7 @@ component /** * Check for permission + * * @slug.hint The permission slug or list of slugs to validate the role has. If it's a list then they are ORed together */ boolean function checkPermission( required slug ){ diff --git a/modules/contentbox/models/security/RoleService.cfc b/modules/contentbox/models/security/RoleService.cfc index 68f65e0328..3e509b0967 100755 --- a/modules/contentbox/models/security/RoleService.cfc +++ b/modules/contentbox/models/security/RoleService.cfc @@ -34,11 +34,11 @@ component extends="cborm.models.VirtualEntityService" singleton { * Import data from a ContentBox JSON file. Returns the import log * * @importFile The json file to import - * @override Override content if found in the database, defaults to false - * - * @throws InvalidImportFormat + * @override Override content if found in the database, defaults to false * * @return The console log of the import + * + * @throws InvalidImportFormat */ string function importFromFile( required importFile, boolean override = false ){ var data = fileRead( arguments.importFile ); @@ -47,10 +47,7 @@ component extends="cborm.models.VirtualEntityService" singleton { ); if ( !isJSON( data ) ) { - throw( - message = "Cannot import file as the contents is not JSON", - type = "InvalidImportFormat" - ); + throw( message = "Cannot import file as the contents is not JSON", type = "InvalidImportFormat" ); } // deserialize packet: Should be array of { settingID, name, value } @@ -65,12 +62,12 @@ component extends="cborm.models.VirtualEntityService" singleton { * Import data from an array of structures or a single structure of data * * @importData A struct or array of data to import - * @override Override content if found in the database, defaults to false - * @importLog The import log buffer - * - * @throws InvalidImportFormat + * @override Override content if found in the database, defaults to false + * @importLog The import log buffer * * @return The console log of the import + * + * @throws InvalidImportFormat */ string function importFromData( required importData, @@ -104,10 +101,8 @@ component extends="cborm.models.VirtualEntityService" singleton { // Create permissions that don't exist first var allPermissions = []; for ( var thisPermission in thisRole.permissions ) { - var oPerm = variables.permissionService.findByPermission( - thisPermission.permission - ); - oPerm = ( + var oPerm = variables.permissionService.findByPermission( thisPermission.permission ); + oPerm = ( isNull( oPerm ) ? getBeanPopulator().populateFromStruct( target = variables.permissionService.new(), memento = thisPermission, @@ -116,10 +111,7 @@ component extends="cborm.models.VirtualEntityService" singleton { ); // save oPerm if new only if ( !oPerm.isLoaded() ) { - variables.permissionService.save( - entity = oPerm, - transactional = false - ); + variables.permissionService.save( entity = oPerm, transactional = false ); } // append to add. arrayAppend( allPermissions, oPerm ); diff --git a/modules/contentbox/models/security/SecurityRuleService.cfc b/modules/contentbox/models/security/SecurityRuleService.cfc index 48377288e5..d19a72d73c 100755 --- a/modules/contentbox/models/security/SecurityRuleService.cfc +++ b/modules/contentbox/models/security/SecurityRuleService.cfc @@ -25,10 +25,7 @@ component extends="cborm.models.VirtualEntityService" singleton { * Get the maximum used order */ numeric function getMaxOrder(){ - var q = executeQuery( - query = "select max( sr.order ) from cbSecurityRule as sr", - asQuery = false - ); + var q = executeQuery( query = "select max( sr.order ) from cbSecurityRule as sr", asQuery = false ); if ( arrayIsDefined( q, 1 ) ) { return q[ 1 ]; } @@ -107,11 +104,11 @@ component extends="cborm.models.VirtualEntityService" singleton { * Import data from a ContentBox JSON file. Returns the import log * * @importFile The json file to import - * @override Override content if found in the database, defaults to false - * - * @throws InvalidImportFormat + * @override Override content if found in the database, defaults to false * * @return The console log of the import + * + * @throws InvalidImportFormat */ string function importFromFile( required importFile, boolean override = false ){ var data = fileRead( arguments.importFile ); @@ -120,10 +117,7 @@ component extends="cborm.models.VirtualEntityService" singleton { ); if ( !isJSON( data ) ) { - throw( - message = "Cannot import file as the contents is not JSON", - type = "InvalidImportFormat" - ); + throw( message = "Cannot import file as the contents is not JSON", type = "InvalidImportFormat" ); } // deserialize packet: Should be array of { settingID, name, value } @@ -138,8 +132,8 @@ component extends="cborm.models.VirtualEntityService" singleton { * Import data from an array of structures or a single structure of data * * @importData A struct or array of data to import - * @override Override content if found in the database, defaults to false - * @importLog The import log buffer + * @override Override content if found in the database, defaults to false + * @importLog The import log buffer * * @return The console log of the import */ @@ -181,19 +175,13 @@ component extends="cborm.models.VirtualEntityService" singleton { // if new or persisted with override then save. if ( !oRule.isLoaded() ) { - arguments.importLog.append( - "New security rule imported: #thisRule.toString()#
    " - ); + arguments.importLog.append( "New security rule imported: #thisRule.toString()#
    " ); arrayAppend( allRules, oRule ); } else if ( oRule.isLoaded() and arguments.override ) { - arguments.importLog.append( - "Persisted security rule overriden: #thisRule.toString()#
    " - ); + arguments.importLog.append( "Persisted security rule overriden: #thisRule.toString()#
    " ); arrayAppend( allRules, oRule ); } else { - arguments.importLog.append( - "Skipping persisted security rule: #thisRule.toString()#
    " - ); + arguments.importLog.append( "Skipping persisted security rule: #thisRule.toString()#
    " ); } } // end import loop diff --git a/modules/contentbox/models/security/SecurityService.cfc b/modules/contentbox/models/security/SecurityService.cfc index 4400dce0ac..2483c98882 100755 --- a/modules/contentbox/models/security/SecurityService.cfc +++ b/modules/contentbox/models/security/SecurityService.cfc @@ -66,10 +66,7 @@ component singleton { */ Author function getAuthorSession(){ // Check if valid author id in session or request respectively - var oAuthor = variables.requestStorage.get( - variables.AUTHOR_KEY, - variables.authorService.new() - ); + var oAuthor = variables.requestStorage.get( variables.AUTHOR_KEY, variables.authorService.new() ); if ( oAuthor.isLoggedIn() ) { return oAuthor; } @@ -139,13 +136,13 @@ component singleton { * * For our RESTFul API, we can do an authenticate and login at the same time. * - * @username The username to validate - * @password The password to validate + * @username The username to validate + * @password The password to validate * @logThemIn If true, we will log them in automatically, else it will be the caller's job to do so via the `login()` method. * - * @throws InvalidCredentials - * * @return User : The logged in user object + * + * @throws InvalidCredentials */ Author function authenticate( required username, @@ -165,10 +162,7 @@ component singleton { // Validate password using bcrypt try { - var isSamePassword = variables.bcrypt.checkPassword( - arguments.password, - oAuthor.getPassword() - ); + var isSamePassword = variables.bcrypt.checkPassword( arguments.password, oAuthor.getPassword() ); } catch ( any e ) { var isSamePassword = false; } @@ -208,11 +202,9 @@ component singleton { * @author The author to create the reset token for. */ string function generateResetToken( required Author author ){ - var tokenTimeout = variables.settingService.getSetting( - "cb_security_password_reset_expiration" - ); + var tokenTimeout = variables.settingService.getSetting( "cb_security_password_reset_expiration" ); // Store Security Token For X minutes - var token = hash( arguments.author.getEmail() & arguments.author.getAuthorID() & now() ); + var token = hash( arguments.author.getEmail() & arguments.author.getAuthorID() & now() ); cache.set( "reset-token-#token#", arguments.author.getAuthorID(), @@ -225,9 +217,10 @@ component singleton { /** * Send password reminder email, this verifies that the email is valid and they must click on the token * link in order to reset their password. - * @author The author to send the reminder to - * @adminIssued Was this reset issued by a user or an admin - * @issuer The admin that issued the reset + * + * @author The author to send the reminder to + * @adminIssued Was this reset issued by a user or an admin + * @issuer The admin that issued the reset * * @return The mailing results of the password reminder: struct. */ @@ -249,10 +242,7 @@ component singleton { ip : getRealIP(), linkTimeout : settings.cb_security_password_reset_expiration, siteName : defaultSite.getName(), - linkToken : CBHelper.linkAdmin( - event = "security.verifyReset", - ssl = settings.cb_admin_ssl - ) & "?token=#token#", + linkToken : CBHelper.linkAdmin( event = "security.verifyReset", ssl = settings.cb_admin_ssl ) & "?token=#token#", issuedBy : "", issuedEmail : "" }; @@ -298,9 +288,10 @@ component singleton { /** * This function validates an incoming pw reset token to figure out their user. * The token is not removed just yet. It will be removed once the password has been reset. + * * @token The security token * - * @returns {error, author} + * @return {error, author} */ struct function validateResetToken( required token ){ var results = { "error" : false, "author" : "" }; @@ -325,8 +316,9 @@ component singleton { /** * Resets a user's password. - * @token Security token - * @author The author you are reseting the password for + * + * @token Security token + * @author The author you are reseting the password for * @password The password you have chosen * * @return {error:boolean, messages:string} @@ -402,7 +394,8 @@ component singleton { /** * Check to authorize a user to view a content entry or page - * @content The content object + * + * @content The content object * @password The password to check */ boolean function authorizeContent( required content, required password ){ @@ -421,13 +414,11 @@ component singleton { /** * Checks Whether a content entry or page is protected and user has credentials for it + * * @content The content object to check */ boolean function isContentViewable( required content ){ - var protectedHash = cacheStorage.get( - "protection-#hash( arguments.content.getSlug() )#", - "" - ); + var protectedHash = cacheStorage.get( "protection-#hash( arguments.content.getSlug() )#", "" ); // check hash against validated content if ( compare( protectedHash, getContentProtectedHash( arguments.content ) ) EQ 0 ) { return true; @@ -437,13 +428,11 @@ component singleton { /** * Get password content protected salt + * * @content The content object */ private string function getContentProtectedHash( required content ){ - return hash( - arguments.content.getSlug() & arguments.content.getPasswordProtection(), - "SHA-256" - ); + return hash( arguments.content.getSlug() & arguments.content.getPasswordProtection(), "SHA-256" ); } /** @@ -473,10 +462,7 @@ component singleton { return decryptIt( cookieValue ); } catch ( Any e ) { // Errors on decryption - log.error( - "Error decrypting Keep Me Logged in key: #e.message# #e.detail#", - cookieValue - ); + log.error( "Error decrypting Keep Me Logged in key: #e.message# #e.detail#", cookieValue ); cookieStorage.delete( "contentbox_keep_logged_in" ); return ""; } @@ -484,8 +470,9 @@ component singleton { /** * Set remember me cookie + * * @username The username to store - * @days The days to store + * @days The days to store */ SecurityService function setRememberMe( required username, required numeric days = 0 ){ // If the user now only wants to be remembered for this session, remove any existing cookies. @@ -522,6 +509,7 @@ component singleton { /** * ContentBox encryption + * * @encValue value to encrypt */ string function encryptIt( required encValue ){ @@ -539,6 +527,7 @@ component singleton { /** * ContentBox Decryption + * * @decValue value to decrypt */ string function decryptIt( required decValue ){ diff --git a/modules/contentbox/models/security/SecurityValidator.cfc b/modules/contentbox/models/security/SecurityValidator.cfc index a04142f531..ba74f8fb50 100644 --- a/modules/contentbox/models/security/SecurityValidator.cfc +++ b/modules/contentbox/models/security/SecurityValidator.cfc @@ -43,16 +43,13 @@ component singleton { * @return { allow:boolean, type:authentication|authorization, messages:string } */ struct function annotationValidator( required securedValue, required controller ){ - return validateSecurity( - securedValue: arguments.securedValue, - controller : arguments.controller - ); + return validateSecurity( securedValue: arguments.securedValue, controller: arguments.controller ); } /** * Validates if a user can access an event. Called via the cbSecurity module. * - * @rule The security rule being tested for + * @rule The security rule being tested for * @controller The ColdBox controller calling the validation * * @return Validation struct of: { allow:boolean, type:(authentication|authorization), messages } @@ -115,9 +112,7 @@ component singleton { .getWireBox() .getInstance( "messagebox@cbmessagebox" ) .setMessage( - type: ( - structKeyExists( rule, "messageType" ) && len( rule.messageType ) ? rule.messageType : "info" - ), + type : ( structKeyExists( rule, "messageType" ) && len( rule.messageType ) ? rule.messageType : "info" ), message: rule.message ); } diff --git a/modules/contentbox/models/security/twofactor/ITwoFactorProvider.cfc b/modules/contentbox/models/security/twofactor/ITwoFactorProvider.cfc index 9de7970bee..84457a057c 100644 --- a/modules/contentbox/models/security/twofactor/ITwoFactorProvider.cfc +++ b/modules/contentbox/models/security/twofactor/ITwoFactorProvider.cfc @@ -52,7 +52,7 @@ interface { * Leverage the default provider to verify a challenge for the specific user. * The return is a structure containing an error flag and a messages string. * - * @code The verification code + * @code The verification code * @author The author to verify challenge * * @return struct:{ error:boolean, messages:string } @@ -63,9 +63,8 @@ interface { * This method is called once a two factor challenge is accepted and valid. * Meaning the user has completed the validation and will be logged in to ContentBox now. * - * @code The verification code + * @code The verification code * @author The author to verify challenge - * */ function finalize( required string code, required author ); diff --git a/modules/contentbox/models/security/twofactor/TwoFactorService.cfc b/modules/contentbox/models/security/twofactor/TwoFactorService.cfc index bcd738abf6..9e68425d9c 100644 --- a/modules/contentbox/models/security/twofactor/TwoFactorService.cfc +++ b/modules/contentbox/models/security/twofactor/TwoFactorService.cfc @@ -25,6 +25,7 @@ component accessors="true" threadSafe singleton { /** * Constructor + * * @wirebox.inject wirebox */ TwoFactorService function init( required wirebox ){ @@ -68,6 +69,7 @@ component accessors="true" threadSafe singleton { /** * Register a new two factor authenticator in ContentBox + * * @provider The provider instance to register */ TwoFactorService function registerProvider( @@ -79,6 +81,7 @@ component accessors="true" threadSafe singleton { /** * UnRegister a provider in ContentBox + * * @name The name of the provider to unregister */ TwoFactorService function unRegisterProvider( required name ){ @@ -113,6 +116,7 @@ component accessors="true" threadSafe singleton { /** * Get a registered provider instance + * * @name The name of the provider */ contentbox.models.security.twofactor.ITwoFactorProvider function getProvider( required name ){ @@ -121,6 +125,7 @@ component accessors="true" threadSafe singleton { /** * Check if an provider exists or not + * * @name The name of the provider */ boolean function hasProvider( required name ){ @@ -129,6 +134,7 @@ component accessors="true" threadSafe singleton { /** * Set a trusted device cookie for a user, usually called if the two factor authentication was valid. + * * @trustedID The trusted ID to track in the tracking cookie */ TwoFactorService function setTrustedDevice( required trustedID ){ @@ -142,13 +148,11 @@ component accessors="true" threadSafe singleton { /** * Verify if the incoming trusted ID is valid + * * @trustedID The trusted ID to verify */ boolean function isTrustedDevice( required trustedID ){ - var cookieValue = cookieStorage.get( - name = variables.TRUSTED_DEVICE_COOKIE, - defaultValue = "" - ); + var cookieValue = cookieStorage.get( name = variables.TRUSTED_DEVICE_COOKIE, defaultValue = "" ); try { // decrypt the target id @@ -169,6 +173,7 @@ component accessors="true" threadSafe singleton { /** * Can we challenge this author for two factor authentication + * * @author The author to challenge or not */ boolean function canChallenge( required author ){ @@ -182,11 +187,7 @@ component accessors="true" threadSafe singleton { arguments.author.getIs2FactorAuth() ) { // Verify if using trusted device options and if device is trusted - if ( - oProvider.allowTrustedDevice() AND isTrustedDevice( - arguments.author.getAuthorID() - ) - ) { + if ( oProvider.allowTrustedDevice() AND isTrustedDevice( arguments.author.getAuthorID() ) ) { results = false; } else { results = true; @@ -213,16 +214,13 @@ component accessors="true" threadSafe singleton { * Leverage the default provider to verify a challenge for the specific user. * The return is a structure containing an error flag and a messages string. * - * @code The verification code + * @code The verification code * @author The author to verify challenge * * @return struct:{ error:boolean, messages:string } */ struct function verifyChallenge( required string code, required author ){ - return getProvider( getDefaultProvider() ).verifyChallenge( - arguments.code, - arguments.author - ); + return getProvider( getDefaultProvider() ).verifyChallenge( arguments.code, arguments.author ); } } diff --git a/modules/contentbox/models/system/CBHelper.cfc b/modules/contentbox/models/system/CBHelper.cfc index 45e78beb6a..2a88a78309 100644 --- a/modules/contentbox/models/system/CBHelper.cfc +++ b/modules/contentbox/models/system/CBHelper.cfc @@ -97,8 +97,7 @@ component accessors="true" singleton threadSafe { * * @key The setting key to get * @defaultValue The default value to return if not found - * - * @throw InvalidSettingException + * @throw InvalidSettingException */ any function setting( required key, defaultValue ){ var prc = getPrivateRequestCollection(); @@ -558,8 +557,9 @@ component accessors="true" singleton threadSafe { /** * Get the index page entries, else throws exception * - * @throws ContentBox.CBHelper.InvalidEntriesContext * @return array of entries + * + * @throws ContentBox.CBHelper.InvalidEntriesContext */ any function getCurrentEntries(){ var prc = getRequestCollection( private = true ); @@ -607,8 +607,9 @@ component accessors="true" singleton threadSafe { /** * Get the viewed entry if in entry view, else throws exception * - * @throws ContentBox.CBHelper.InvalidEntryContext * @return Entry + * + * @throws ContentBox.CBHelper.InvalidEntryContext */ any function getCurrentEntry(){ var prc = getRequestCollection( private = true ); @@ -625,8 +626,9 @@ component accessors="true" singleton threadSafe { /** * Get the viewed page if in page view, else throws exception * - * @throws ContentBox.CBHelper.InvalidPageContext * @return Page + * + * @throws ContentBox.CBHelper.InvalidPageContext */ any function getCurrentPage(){ var prc = getRequestCollection( private = true ); @@ -643,8 +645,9 @@ component accessors="true" singleton threadSafe { /** * Get the viewed page's or entry's comments, else throw exception * - * @throws ContentBox.CBHelper.InvalidCommentContext * @return array of comments + * + * @throws ContentBox.CBHelper.InvalidCommentContext */ any function getCurrentComments(){ var prc = getRequestCollection( private = true ); @@ -713,6 +716,7 @@ component accessors="true" singleton threadSafe { /** * Get the current page or entries related content array + * * @return array */ any function getCurrentRelatedContent(){ @@ -738,6 +742,7 @@ component accessors="true" singleton threadSafe { /** * Get a current page's or blog entrie's custom field by key, you can pass a default value if not found + * * @key The custom field key * @defaultValue The default value to return if not found */ @@ -770,6 +775,7 @@ component accessors="true" singleton threadSafe { /** * Set the Meta Title for the request + * * @title - The new title */ function setMetaTitle( required string title ){ @@ -793,6 +799,7 @@ component accessors="true" singleton threadSafe { /** * Set the Meta Description for the request + * * @description - The new Description */ function setMetaDescription( required string description ){ @@ -816,6 +823,7 @@ component accessors="true" singleton threadSafe { /** * Set the Meta Keywords for the request + * * @keywords - The new Keywords */ function setMetaKeywords( required string keywords ){ @@ -939,6 +947,7 @@ component accessors="true" singleton threadSafe { /** * Set the Meta Canonical URL for the request + * * @url - The new url */ function setMetaURL( required string url ){ @@ -989,6 +998,7 @@ component accessors="true" singleton threadSafe { /** * Set the Meta ImageURL for the request + * * @ImageURL - The new ImageURL */ function setMetaImageURL( required string ImageURL ){ @@ -1035,6 +1045,7 @@ component accessors="true" singleton threadSafe { /** * Set the Meta OGType for the request + * * @OGType - The new OGType */ function setMetaOGType( required string OGType ){ @@ -1141,6 +1152,7 @@ component accessors="true" singleton threadSafe { /** * Get the curent search results object + * * @return contentbox.models.search.SearchResults */ function getSearchResults(){ @@ -1280,7 +1292,7 @@ component accessors="true" singleton threadSafe { /** * Link to the admin logout * - * @ssl Use SSL or not, defaults to event context. + * @ssl Use SSL or not, defaults to event context. */ function linkAdminLogout( boolean ssl = getRequestContext().isSSL() ){ return getRequestContext().buildLink( to = adminRoot() & "/security/doLogout", ssl = arguments.ssl ); @@ -1289,7 +1301,7 @@ component accessors="true" singleton threadSafe { /** * Link to the admin login * - * @ssl Use SSL or not, defaults to event context. + * @ssl Use SSL or not, defaults to event context. */ function linkAdminLogin( boolean ssl = getRequestContext().isSSL() ){ return getRequestContext().buildLink( to = adminRoot() & "/security/login", ssl = arguments.ssl ); @@ -1329,6 +1341,7 @@ component accessors="true" singleton threadSafe { /** * Link to RSS feeds that ContentBox generates, by default it is the recent updates feed + * * @category You can optionally pass the category to filter on * @comments A boolean flag that determines if you want the comments RSS feed * @entry You can optionally pass the entry to filter the comment's RSS feed @@ -1401,6 +1414,7 @@ component accessors="true" singleton threadSafe { /** * Link to the ContentBox Page RSS Feeds + * * @category The category to filter on * @comments Page comments or not, defaults to false * @page The page you want to filter on @@ -1495,7 +1509,7 @@ component accessors="true" singleton threadSafe { /** * Link to the search route for this blog * - * @ssl Use SSL or not, defaults to false. + * @ssl Use SSL or not, defaults to false. */ function linkSearch( boolean ssl = getRequestContext().isSSL() ){ return linkBlog() & "/search"; @@ -1504,7 +1518,7 @@ component accessors="true" singleton threadSafe { /** * Link to the content search route * - * @ssl Use SSL or not, defaults to false. + * @ssl Use SSL or not, defaults to false. */ function linkContentSearch( boolean ssl = getRequestContext().isSSL() ){ return siteRoot() & sep() & "__search"; @@ -1513,7 +1527,7 @@ component accessors="true" singleton threadSafe { /** * Link to the content subscription route * - * @ssl Use SSL or not, defaults to false. + * @ssl Use SSL or not, defaults to false. */ function linkContentSubscription( boolean ssl = getRequestContext().isSSL() ){ return siteRoot() & sep() & "__subscribe"; @@ -1521,6 +1535,7 @@ component accessors="true" singleton threadSafe { /** * Link to the ContentBox Content Subscription unsubscribe URL + * * @token The token to use for unsubscribing */ function linkContentUnsubscribe( required string token, boolean ssl = getRequestContext().isSSL() ){ @@ -1671,6 +1686,7 @@ component accessors="true" singleton threadSafe { /** * Create a link to an entry's or page's comments section + * * @content The entry or page to link to its comments * @ssl Use SSL or not, defaults to false. */ @@ -1703,6 +1719,7 @@ component accessors="true" singleton threadSafe { /** * Link to the __changeLang route, this is where the fwLocale is changed + * * @lang The iso language code */ function linkLanguageChange( string lang = "en_US" ){ @@ -1782,6 +1799,7 @@ component accessors="true" singleton threadSafe { /** * Render out entries in the home page by using our ColdBox collection rendering + * * @template The name of the template to use, by default it looks in the 'templates/entry.cfm' convention, no '.cfm' please * @collectionAs The name of the iterating object in the template, by default it is called 'entry' * @args A structure of name-value pairs to pass to the template @@ -1804,6 +1822,7 @@ component accessors="true" singleton threadSafe { /** * Render out an entry using your pre-defined 'entry' template + * * @template The name of the template to use, by default it looks in the 'templates/entry.cfm' convention, no '.cfm' please * @collectionAs The name of the iterating object in the template, by default it is called 'entry' * @args A structure of name-value pairs to pass to the template @@ -1851,6 +1870,7 @@ component accessors="true" singleton threadSafe { /** * Render out related content anywhere using ColdBox collection rendering + * * @template The name of the template to use, by default it looks in the 'templates/relatedContent.cfm' convention, no '.cfm' please * @collectionAs The name of the iterating object in the template, by default it is called 'relatedContent' * @args A structure of name-value pairs to pass to the template @@ -1891,6 +1911,7 @@ component accessors="true" singleton threadSafe { /** * Render out comments anywhere using ColdBox collection rendering + * * @template The name of the template to use, by default it looks in the 'templates/comment.cfm' convention, no '.cfm' please * @collectionAs The name of the iterating object in the template, by default it is called 'comment' * @args A structure of name-value pairs to pass to the template @@ -1913,6 +1934,7 @@ component accessors="true" singleton threadSafe { /** * Renders out an author's avatar + * * @author The author object to render an avatar from * @size The size of the gravatar, by default we use 25 pixels */ @@ -1939,6 +1961,7 @@ component accessors="true" singleton threadSafe { /** * QuickView is a proxy to ColdBox's renderview method with the addition of prefixing the location of the view according to the * theme you are using. All the arguments are the same as `renderView()'s` methods + * * @view The view in the theme to render * @cache Cache the output or not * @cacheTimeout The time in minutes to cache the view @@ -1978,6 +2001,7 @@ component accessors="true" singleton threadSafe { /** * QuickLayout is a proxy to ColdBox's renderLayout method with the addition of prefixing the location of the layout according to the * layout theme you are using. All the arguments are the same as renderLayout()'s methods + * * @layout The layout to render out * @view The view to render within this layout * @module The module to explicitly render this layout from @@ -1999,6 +2023,7 @@ component accessors="true" singleton threadSafe { /** * quickCommentForm will build a standard ContentBox Comment Form according to the CommentForm widget + * * @content The content this comment form will be linked to, page or entry */ function quickCommentForm( required content ){ @@ -2007,6 +2032,7 @@ component accessors="true" singleton threadSafe { /** * Render the incoming event's main view, basically a proxy to ColdBox's controller.getRenderer().renderView(). + * * @args */ function mainView( struct args = structNew() ){ @@ -2044,6 +2070,7 @@ component accessors="true" singleton threadSafe { /** * Builds out a custom menu + * * @menu The root menu object that should be rendered * @menu.doc_generic contentbox.models.menu.Menu * @slugCache The cache of menu slugs already used in this request @@ -2071,6 +2098,7 @@ component accessors="true" singleton threadSafe { /** * Builds out a level of a custom menu + * * @items An array of menu items for this level * @listType The type of list to create (derived from owning menu) * @slugCache The cache of menu slugs already used in this request @@ -2113,6 +2141,7 @@ component accessors="true" singleton threadSafe { /** * Render out a quick menu for root level pages + * * @excludes The list of pages to exclude from the menu * @type The type of menu, valid choices are: ul,ol,li,data,none * @typeClass The CSS class(es) to add to the type tag, defaults to 'submenu' @@ -2199,6 +2228,7 @@ component accessors="true" singleton threadSafe { /** * Create an href to a page's parent + * * @page Optional page to create link for, else look for current page * @text The optional text to use for the link, else it uses the page's title */ @@ -2220,6 +2250,7 @@ component accessors="true" singleton threadSafe { /** * Create breadcrumbs for a UI page + * * @page Optional page to create link for, else look for current page * @separator Breadcrumb separator, defaults to '>' */ @@ -2249,6 +2280,7 @@ component accessors="true" singleton threadSafe { /** * Retrieve i18n resources + * * @resource The resource (key) to retrieve from a loaded bundle or pass a @bundle * @defaultValue A default value to send back if the resource (key) not found * @locale Pass in which locale to take the resource from. By default it uses the user's current set locale diff --git a/modules/contentbox/models/system/EmailTemplateHelper.cfc b/modules/contentbox/models/system/EmailTemplateHelper.cfc index 5e3f48a013..d7c101cce5 100644 --- a/modules/contentbox/models/system/EmailTemplateHelper.cfc +++ b/modules/contentbox/models/system/EmailTemplateHelper.cfc @@ -39,13 +39,14 @@ component singleton { /** * Create a divider - * @paddingTop.hint Top padding - * @paddingRight.hint Right padding + * + * @paddingTop.hint Top padding + * @paddingRight.hint Right padding * @paddingBottom.hint Bottom padding - * @paddingLeft.hint Left padding - * @borderColor.hint Border color - * @borderStyle.hint Border style - * @borderWidth.hint Border width + * @paddingLeft.hint Left padding + * @borderColor.hint Border color + * @borderStyle.hint Border style + * @borderWidth.hint Border width */ public string function divider( required numeric paddingTop = 18, @@ -84,9 +85,10 @@ return dividerContent; /** * Create a heading - * @content.hint Content for the heading - * @level.hint The heading level - * @color.hint Text color + * + * @content.hint Content for the heading + * @level.hint The heading level + * @color.hint Text color * @fontSize.hint Heading font size */ public string function heading( @@ -111,6 +113,7 @@ return text( /** * Create a text area + * * @content.hint Content for the text area * @callout.hint If true, will wrap content in a callout box */ @@ -153,6 +156,7 @@ return textContent; /** * Create a button bar + * * @buttons.hint Array of buttons to add to the button bar */ public string function buttonBar( required Array buttons ){ diff --git a/modules/contentbox/models/system/NotificationService.cfc b/modules/contentbox/models/system/NotificationService.cfc index bcbd15232c..b92be4281c 100755 --- a/modules/contentbox/models/system/NotificationService.cfc +++ b/modules/contentbox/models/system/NotificationService.cfc @@ -29,8 +29,8 @@ component extends="coldbox.system.Interceptor" accessors="true" { /** * Listen to when authors are created in the system. * - * @event ColdBox Event - * @data Intercept Data + * @event ColdBox Event + * @data Intercept Data * @buffer Output buffer */ function cbadmin_postNewAuthorSave( event, data, buffer ){ @@ -89,8 +89,8 @@ component extends="coldbox.system.Interceptor" accessors="true" { /** * Listen to when authors are removed * - * @event ColdBox Event - * @data Intercept Data + * @event ColdBox Event + * @data Intercept Data * @buffer Output buffer */ function cbadmin_preAuthorRemove( event, data, buffer ){ @@ -144,8 +144,8 @@ component extends="coldbox.system.Interceptor" accessors="true" { /** * Listen to when entries are saved * - * @event ColdBox Event - * @data Intercept Data + * @event ColdBox Event + * @data Intercept Data * @buffer Output buffer */ function cbadmin_postEntrySave( event, data, buffer ){ @@ -182,9 +182,7 @@ component extends="coldbox.system.Interceptor" accessors="true" { if ( entry.hasExcerpt() ) { bodyTokens.entryExcerpt = entry.renderExcerpt(); } else { - bodyTokens.entryExcerpt = entry.renderContentSilent( - entry.getActiveContent().getContent() - ); + bodyTokens.entryExcerpt = entry.renderContentSilent( entry.getActiveContent().getContent() ); } var mail = variables.mailservice.newMail( @@ -217,8 +215,8 @@ component extends="coldbox.system.Interceptor" accessors="true" { /** * Listen to when entries are removed * - * @event ColdBox Event - * @data Intercept Data + * @event ColdBox Event + * @data Intercept Data * @buffer Output buffer */ function cbadmin_preEntryRemove( event, data, buffer ){ @@ -278,8 +276,8 @@ component extends="coldbox.system.Interceptor" accessors="true" { /** * Listen to when pages are saved * - * @event ColdBox Event - * @data Intercept Data + * @event ColdBox Event + * @data Intercept Data * @buffer Output buffer */ function cbadmin_postPageSave( event, data, buffer ){ @@ -314,9 +312,7 @@ component extends="coldbox.system.Interceptor" accessors="true" { if ( page.hasExcerpt() ) { bodyTokens.pageExcerpt = page.renderExcerpt(); } else { - bodyTokens.pageExcerpt = page.renderContentSilent( - page.getActiveContent().getContent() - ); + bodyTokens.pageExcerpt = page.renderContentSilent( page.getActiveContent().getContent() ); } var mail = variables.mailservice.newMail( @@ -349,8 +345,8 @@ component extends="coldbox.system.Interceptor" accessors="true" { /** * Listen to when pages are removed * - * @event ColdBox Event - * @data Intercept Data + * @event ColdBox Event + * @data Intercept Data * @buffer Output buffer */ function cbadmin_prePageRemove( event, data, buffer ){ @@ -411,8 +407,8 @@ component extends="coldbox.system.Interceptor" accessors="true" { /** * Listen to when contentstore are saved * - * @event ColdBox Event - * @data Intercept Data + * @event ColdBox Event + * @data Intercept Data * @buffer Output buffer */ function cbadmin_postContentStoreSave( event, data, buffer ){ @@ -479,8 +475,8 @@ component extends="coldbox.system.Interceptor" accessors="true" { /** * Listen to when content store objects are removed * - * @event ColdBox Event - * @data Intercept Data + * @event ColdBox Event + * @data Intercept Data * @buffer Output buffer */ function cbadmin_preContentStoreRemove( event, data, buffer ){ @@ -543,9 +539,8 @@ component extends="coldbox.system.Interceptor" accessors="true" { /** * Assemble a list of the notifiers to send a notification to * - * @site The site the notification is from + * @site The site the notification is from * @settings The global settings - * */ private function getNotifiers( required site, required settings ){ var notifiers = ""; diff --git a/modules/contentbox/models/system/SettingService.cfc b/modules/contentbox/models/system/SettingService.cfc index 304ce8b5df..59dcafbddc 100755 --- a/modules/contentbox/models/system/SettingService.cfc +++ b/modules/contentbox/models/system/SettingService.cfc @@ -266,9 +266,7 @@ component } ) // Create the missing global setting .each( function( key, value ){ - variables.log.info( - "- Missing core setting (#arguments.key#) found in pre-flight, adding it!" - ); + variables.log.info( "- Missing core setting (#arguments.key#) found in pre-flight, adding it!" ); entitySave( this.new( { name : arguments.key, @@ -405,11 +403,12 @@ component /** * Get a global setting * - * @name The name of the seting + * @name The name of the seting * @defaultValue The default value if setting not found. * - * @throws SettingNotFoundException * @return The setting value or default value if not found + * + * @throws SettingNotFoundException */ function getSetting( required name, defaultValue ){ var allSettings = getAllSettings(); @@ -435,12 +434,13 @@ component /** * Get a site setting * - * @siteSlug The site to get the setting from - * @name The name of the seting + * @siteSlug The site to get the setting from + * @name The name of the seting * @defaultValue The default value if setting not found. * - * @throws SettingNotFoundException * @return The setting value or default value if not found + * + * @throws SettingNotFoundException */ function getSiteSetting( required siteSlug, required name, defaultValue ){ var allSettings = getAllSiteSettings( arguments.siteSlug ); @@ -475,7 +475,7 @@ component /** * Get all site settings * - * @slug The site slug to use to retrieve the settings + * @slug The site slug to use to retrieve the settings * @force To force clear the cache */ struct function getAllSiteSettings( required siteSlug, boolean force = false ){ @@ -596,14 +596,12 @@ component * This is usually done from the settings display manager * * @memento The struct of settings - * @site Optional site to attach the settings to + * @site Optional site to attach the settings to * * @return SettingService */ SettingService function bulkSave( struct memento, site ){ - var settings = isNull( arguments.site ) ? getAllSettings() : getAllSiteSettings( - arguments.site.getSlug() - ); + var settings = isNull( arguments.site ) ? getAllSettings() : getAllSiteSettings( arguments.site.getSlug() ); var newSettings = []; arguments.memento @@ -675,11 +673,11 @@ component /** * Setting search with filters * - * @search The search term for the name - * @max The max records - * @offset The offset to tuse + * @search The search term for the name + * @max The max records + * @offset The offset to tuse * @sortOrder The sort order - * @siteID The site id to filter on + * @siteID The site id to filter on * * @return struct of { count, settings } */ @@ -725,11 +723,11 @@ component * Import data from a ContentBox JSON file. Returns the import log * * @importFile The json file to import - * @override Override content if found in the database, defaults to false - * - * @throws InvalidImportFormat + * @override Override content if found in the database, defaults to false * * @return The console log of the import + * + * @throws InvalidImportFormat */ string function importFromFile( required importFile, boolean override = false ){ var data = fileRead( arguments.importFile ); @@ -738,10 +736,7 @@ component ); if ( !isJSON( data ) ) { - throw( - message = "Cannot import file as the contents is not JSON", - type = "InvalidImportFormat" - ); + throw( message = "Cannot import file as the contents is not JSON", type = "InvalidImportFormat" ); } // deserialize packet: Should be array of { settingID, name, value } @@ -756,12 +751,12 @@ component * Import data from an array of structures or a single structure of data * * @importData A struct or array of data to import - * @override Override content if found in the database, defaults to false - * @importLog The import log buffer - * - * @throws InvalidImportFormat + * @override Override content if found in the database, defaults to false + * @importLog The import log buffer * * @return The console log of the import + * + * @throws InvalidImportFormat */ string function importFromData( required importData, @@ -805,14 +800,10 @@ component arguments.importLog.append( "New setting imported: #thisSetting.name#
    " ); arrayAppend( allSettings, oSetting ); } else if ( oSetting.isLoaded() and arguments.override ) { - arguments.importLog.append( - "Persisted setting overriden: #thisSetting.name#
    " - ); + arguments.importLog.append( "Persisted setting overriden: #thisSetting.name#
    " ); arrayAppend( allSettings, oSetting ); } else { - arguments.importLog.append( - "Skipping persisted setting: #thisSetting.name#
    " - ); + arguments.importLog.append( "Skipping persisted setting: #thisSetting.name#
    " ); } } // end import loop @@ -834,6 +825,7 @@ component /** * Get the cache provider object to be used for settings + * * @return coldbox.system.cache.ICacheProvider */ function getSettingsCacheProvider(){ @@ -885,9 +877,7 @@ component // iterate and override for ( var thisKey in environmentSettings ) { if ( reFindNoCase( "^contentbox\_", thisKey ) ) { - overrides[ reReplaceNoCase( thisKey, "^contentbox\_", "" ) ] = environmentSettings[ - thisKey - ]; + overrides[ reReplaceNoCase( thisKey, "^contentbox\_", "" ) ] = environmentSettings[ thisKey ]; } } diff --git a/modules/contentbox/models/system/Site.cfc b/modules/contentbox/models/system/Site.cfc index fbe9e50daf..f58090d26d 100644 --- a/modules/contentbox/models/system/Site.cfc +++ b/modules/contentbox/models/system/Site.cfc @@ -524,10 +524,10 @@ component } /** - * @override * We make sure we only return pages that have no parent to simulate the root hierarchy. * - * @root Show only root level pages if enabled + * @override + * @root Show only root level pages if enabled */ function getPages( boolean root = true ){ if ( !arguments.root ) { @@ -539,10 +539,10 @@ component } /** - * @override * We make sure we only return contentStore that have no parent to simulate the root hierarchy. * - * @root Show only root level contentStore if enabled + * @override + * @root Show only root level contentStore if enabled */ function getContentStore( boolean root = true ){ if ( !arguments.root ) { diff --git a/modules/contentbox/models/system/SiteService.cfc b/modules/contentbox/models/system/SiteService.cfc index 6c069eda9e..74f12d0737 100644 --- a/modules/contentbox/models/system/SiteService.cfc +++ b/modules/contentbox/models/system/SiteService.cfc @@ -53,10 +53,7 @@ component * if none is set, we use the `default` site. */ function getCurrentWorkingsiteID(){ - return variables.cookieStorage.get( - name : "contentbox_admin_current_site", - defaultValue: getDefaultsiteID() - ); + return variables.cookieStorage.get( name: "contentbox_admin_current_site", defaultValue: getDefaultsiteID() ); } /** @@ -89,7 +86,7 @@ component * Save a site object in the system. If the site is a new site, * we make sure all proper settings are created and configured. * - * @site A persisted or new site object + * @site A persisted or new site object * @transactional Transaction the call or leave as is, useful for imports, bulk saves, etc. */ Site function save( required site, boolean transactional = true ){ @@ -136,10 +133,7 @@ component super.save( arguments.site ); // Activate the site's theme - variables.themeService.startupTheme( - name: arguments.site.getActiveTheme(), - site: arguments.site - ); + variables.themeService.startupTheme( name: arguments.site.getActiveTheme(), site: arguments.site ); // Create media root folder for the site ensureSiteMediaFolder( arguments.site ); @@ -242,10 +236,7 @@ component return site; } - throw( - type : "EntityNotFound", - message: "No site with ID #arguments.siteID.toString()# found" - ); + throw( type: "EntityNotFound", message: "No site with ID #arguments.siteID.toString()# found" ); } /** @@ -262,10 +253,7 @@ component return site; } - throw( - type : "EntityNotFound", - message: "No site with slug #arguments.slug.toString()# found" - ); + throw( type: "EntityNotFound", message: "No site with slug #arguments.slug.toString()# found" ); } /** @@ -286,10 +274,7 @@ component if ( structKeyExists( variables.loadedModules, "contentbox-admin" ) && - findNoCase( - variables.loadedModules[ "contentbox-admin" ].entryPoint, - event.getCurrentRoutedUrl() - ) + findNoCase( variables.loadedModules[ "contentbox-admin" ].entryPoint, event.getCurrentRoutedUrl() ) ) { return getCurrentWorkingSite(); } @@ -347,11 +332,11 @@ component * Import data from a ContentBox JSON file. Returns the import log * * @importFile The json file to import - * @override Override content if found in the database, defaults to false - * - * @throws InvalidImportFormat + * @override Override content if found in the database, defaults to false * * @return The console log of the import + * + * @throws InvalidImportFormat */ string function importFromFile( required importFile, boolean override = false ){ var data = fileRead( arguments.importFile ); @@ -360,10 +345,7 @@ component ); if ( !isJSON( data ) ) { - throw( - message: "Cannot import file as the contents is not JSON", - type : "InvalidImportFormat" - ); + throw( message: "Cannot import file as the contents is not JSON", type: "InvalidImportFormat" ); } variables.logger.info( "Site import from file requested." ); @@ -380,8 +362,8 @@ component * Import data from an array of structures or a single structure of data * * @importData A struct or array of data to import - * @override Override content if found in the database, defaults to false - * @importLog The import log buffer + * @override Override content if found in the database, defaults to false + * @importLog The import log buffer * * @return The console log of the import */ @@ -395,9 +377,7 @@ component arguments.importData = [ arguments.importData ]; } - variables.logger.info( - "+ Site import will try to import (#arrayLen( arguments.importData )#) sites." - ); + variables.logger.info( "+ Site import will try to import (#arrayLen( arguments.importData )#) sites." ); transaction { // iterate and import @@ -445,10 +425,10 @@ component /** * Import a site into ContentBox. * - * @site The site object that will be used to import - * @memento The site memento that we will import + * @site The site object that will be used to import + * @memento The site memento that we will import * @importLog The string buffer that represents the import log - * @override Override content if found in the database, defaults to false + * @override Override content if found in the database, defaults to false */ function importSite( required site, @@ -515,9 +495,7 @@ component if ( arrayLen( siteData.categories ) ) { oSite.setCategories( siteData.categories.map( function( thisCategory ){ - logThis( - "+ Importing category: (#thisCategory.slug#) to site #oSite.getSlug()#" - ); + logThis( "+ Importing category: (#thisCategory.slug#) to site #oSite.getSlug()#" ); if ( oSite.isLoaded() ) { return variables.categoryService.getOrCreateBySlug( category: thisCategory.slug, @@ -536,15 +514,11 @@ component // Note it for persistence so we can do the rest of the relationships this.save( oSite ); - logThis( - "+ Site (#oSite.getSlug()#) saved to session, starting to import content now..." - ); + logThis( "+ Site (#oSite.getSlug()#) saved to session, starting to import content now..." ); // IMPORT MENUS if ( arrayLen( siteData.menus ) ) { - logThis( - "+ Importing menus (#arrayLen( siteData.menus )#) to site #arguments.site.getSlug()#" - ); + logThis( "+ Importing menus (#arrayLen( siteData.menus )#) to site #arguments.site.getSlug()#" ); getWireBox() .getInstance( "menuService@contentbox" ) .importFromData( @@ -554,18 +528,14 @@ component site : oSite ); - logThis( - "+ Imported (#arrayLen( siteData.menus )#) menus to site #arguments.site.getSlug()#" - ); + logThis( "+ Imported (#arrayLen( siteData.menus )#) menus to site #arguments.site.getSlug()#" ); } else { logThis( "!! No menus found on import data, skipping..." ); } // IMPORT ENTRIES if ( arrayLen( siteData.entries ) ) { - logThis( - "+ Importing entries (#arrayLen( siteData.entries )#) to site #arguments.site.getSlug()#" - ); + logThis( "+ Importing entries (#arrayLen( siteData.entries )#) to site #arguments.site.getSlug()#" ); getWireBox() .getInstance( "entryService@contentbox" ) .importFromData( @@ -574,18 +544,14 @@ component importLog : arguments.importLog, site : oSite ); - logThis( - "+ Imported (#arrayLen( siteData.entries )#) entries to site #arguments.site.getSlug()#" - ); + logThis( "+ Imported (#arrayLen( siteData.entries )#) entries to site #arguments.site.getSlug()#" ); } else { logThis( "!! No entries found on import data, skipping..." ); } // IMPORT PAGES if ( arrayLen( siteData.pages ) ) { - logThis( - "+ Importing pages (#arrayLen( siteData.pages )#) to site #arguments.site.getSlug()#" - ); + logThis( "+ Importing pages (#arrayLen( siteData.pages )#) to site #arguments.site.getSlug()#" ); getWireBox() .getInstance( "pageService@contentbox" ) .importFromData( @@ -595,9 +561,7 @@ component site : oSite ); - logThis( - "+ Imported (#arrayLen( siteData.pages )#) pages to site #arguments.site.getSlug()#" - ); + logThis( "+ Imported (#arrayLen( siteData.pages )#) pages to site #arguments.site.getSlug()#" ); } else { logThis( "!! No pages found on import data, skipping..." ); } diff --git a/modules/contentbox/models/ui/AdminMenuService.cfc b/modules/contentbox/models/ui/AdminMenuService.cfc index a351670d13..0acaf8ef7b 100755 --- a/modules/contentbox/models/ui/AdminMenuService.cfc +++ b/modules/contentbox/models/ui/AdminMenuService.cfc @@ -64,10 +64,10 @@ component accessors="true" threadSafe singleton { /** * Constructor * - * @requestService The ColdBox request service + * @requestService The ColdBox request service * @requestService.inject coldbox:requestService - * @coldbox ColdBox Handler - * @coldbox.inject coldbox + * @coldbox ColdBox Handler + * @coldbox.inject coldbox */ AdminMenuService function init( required requestService, required coldbox ){ // init menu array @@ -104,8 +104,9 @@ component accessors="true" threadSafe singleton { /** * Build LI attributes + * * @event The event context - * @menu The menu struct + * @menu The menu struct */ function buildLIAttributes( required any event, required any menu ){ var attributes = { "class" : "#menu.class#", "data-name" : "#menu.name#" }; @@ -120,8 +121,9 @@ component accessors="true" threadSafe singleton { /** * Build Item Attributes - * @event The event context - * @menu The menu struct + * + * @event The event context + * @menu The menu struct * @structDefaults The struct defaults for the item */ function buildItemAttributes( @@ -129,9 +131,7 @@ component accessors="true" threadSafe singleton { required any menu, structDefaults = {} ){ - var attributes = { - "class" : structKeyExists( structDefaults, "class" ) ? structDefaults.class : "" - }; + var attributes = { "class" : structKeyExists( structDefaults, "class" ) ? structDefaults.class : "" }; if ( len( arguments.menu.itemClass ) ) { attributes.class &= " #arguments.menu.itemClass#"; @@ -179,6 +179,7 @@ component accessors="true" threadSafe singleton { /** * Create the attribute list + * * @attributes The struct of attributes to build the list from */ function createAttributeList( required struct attributes ){ @@ -281,7 +282,8 @@ component accessors="true" threadSafe singleton { /** * Dynamic href's due to cgi host or site changes. * This expects a menu.href_to or menu.href_jsAction to exist. - * @menu The menu info + * + * @menu The menu info * @event The request context */ function buildLink( required menu, required event ){ @@ -594,10 +596,10 @@ addSubMenu( /** * Build out ContentBox module links * - * @module The module name - * @to The link + * @module The module name + * @to The link * @queryString The query string - * @ssl Using ssl or not + * @ssl Using ssl or not */ function buildModuleLink( required string module, @@ -627,6 +629,7 @@ addSubMenu( /** * Use a header menu + * * @name The name of the header menu */ AdminMenuService function withHeaderMenu( required name ){ @@ -636,18 +639,19 @@ addSubMenu( /** * Add top level menus - * @name The unique name for this top level menu - * @label The label for the menu item, this can be a closure/udf and it will be called at generation - * @title The optional title element - * @href The href, if any to locate when clicked, this can be a closure/udf and it will be called at generation - * @target The target to execute the link in, default is same page. + * + * @name The unique name for this top level menu + * @label The label for the menu item, this can be a closure/udf and it will be called at generation + * @title The optional title element + * @href The href, if any to locate when clicked, this can be a closure/udf and it will be called at generation + * @target The target to execute the link in, default is same page. * @permissions The list of permissions needed to view this menu - * @data A structure of data attributes to add to the link - * @class A CSS class list to append to the element - * @id An id to apply to the element - * @itemType The type of element to create (e.g., a tag, button, etc.) - * @itemClass A CSS class list to append to the element - * @itemId An id to apply to the item element + * @data A structure of data attributes to add to the link + * @class A CSS class list to append to the element + * @id An id to apply to the element + * @itemType The type of element to create (e.g., a tag, button, etc.) + * @itemClass A CSS class list to append to the element + * @itemId An id to apply to the item element */ AdminMenuService function addTopMenu( required name, @@ -680,18 +684,19 @@ addSubMenu( /** * Add header top level menu - * @name The unique name for this header level menu - * @label The label for the menu item, this can be a closure/udf and it will be called at generation - * @title The optional title element - * @href The href, if any to locate when clicked, this can be a closure/udf and it will be called at generation - * @target The target to execute the link in, default is same page. + * + * @name The unique name for this header level menu + * @label The label for the menu item, this can be a closure/udf and it will be called at generation + * @title The optional title element + * @href The href, if any to locate when clicked, this can be a closure/udf and it will be called at generation + * @target The target to execute the link in, default is same page. * @permissions The list of permissions needed to view this menu - * @data A structure of data attributes to add to the link - * @class A CSS class list to append to the element - * @id An id to apply to the element - * @itemType The type of element to create (e.g., a tag, button, etc.) - * @itemClass A CSS class list to append to the element - * @itemId An id to apply to the item element + * @data A structure of data attributes to add to the link + * @class A CSS class list to append to the element + * @id An id to apply to the element + * @itemType The type of element to create (e.g., a tag, button, etc.) + * @itemClass A CSS class list to append to the element + * @itemId An id to apply to the item element */ AdminMenuService function addHeaderMenu( required name, @@ -725,19 +730,20 @@ addSubMenu( /** * Add a sub level menu - * @topMenu The optional top menu name to add this sub level menu to or if concatenated then it uses that one. - * @name The unique name for this sub level menu - * @label The label for the menu item, this can be a closure/udf and it will be called at generation - * @title The optional title element - * @href The href, if any to locate when clicked, this can be a closure/udf and it will be called at generation - * @target The target to execute the link in, default is same page. + * + * @topMenu The optional top menu name to add this sub level menu to or if concatenated then it uses that one. + * @name The unique name for this sub level menu + * @label The label for the menu item, this can be a closure/udf and it will be called at generation + * @title The optional title element + * @href The href, if any to locate when clicked, this can be a closure/udf and it will be called at generation + * @target The target to execute the link in, default is same page. * @permissions The list of permissions needed to view this menu - * @data A structure of data attributes to add to the link - * @class A CSS class list to append to the element - * @id An id to apply to the element - * @itemType The type of element to create (e.g., a tag, button, etc.) - * @itemClass A CSS class list to append to the element - * @itemId An id to apply to the item element + * @data A structure of data attributes to add to the link + * @class A CSS class list to append to the element + * @id An id to apply to the element + * @itemType The type of element to create (e.g., a tag, button, etc.) + * @itemClass A CSS class list to append to the element + * @itemId An id to apply to the item element */ AdminMenuService function addSubMenu( topMenu, @@ -766,9 +772,7 @@ addSubMenu( if ( variables.topMenuMap.keyExists( arguments.topMenu ) ) { arrayAppend( variables.topMenuMap[ arguments.topMenu ].submenu, arguments ); } else { - log.warn( - "requested top menu (#arguments.topMenu#) does not exist when calling addSubMenu()" - ); + log.warn( "requested top menu (#arguments.topMenu#) does not exist when calling addSubMenu()" ); } // return return this; @@ -776,19 +780,20 @@ addSubMenu( /** * Add a sub level header menu - * @headerMenu The optional header menu name to add this sub level menu to or if concatenated then it uses that one. - * @name The unique name for this sub level menu - * @label The label for the menu item - * @title The optional title element - * @href The href, if any to locate when clicked - * @target The target to execute the link in, default is same page. + * + * @headerMenu The optional header menu name to add this sub level menu to or if concatenated then it uses that one. + * @name The unique name for this sub level menu + * @label The label for the menu item + * @title The optional title element + * @href The href, if any to locate when clicked + * @target The target to execute the link in, default is same page. * @permissions The list of permissions needed to view this menu - * @data A structure of data attributes to add to the link - * @class A CSS class list to append to the element - * @id An id to apply to the element - * @itemType The type of element to create (e.g., a tag, button, etc.) - * @itemClass A CSS class list to append to the element - * @itemId An id to apply to the item element + * @data A structure of data attributes to add to the link + * @class A CSS class list to append to the element + * @id An id to apply to the element + * @itemType The type of element to create (e.g., a tag, button, etc.) + * @itemClass A CSS class list to append to the element + * @itemId An id to apply to the item element */ AdminMenuService function addHeaderSubMenu( headerMenu, @@ -819,9 +824,7 @@ addSubMenu( if ( headerMenuMap.keyExists( arguments.headerMenu ) ) { arrayAppend( headerMenuMap[ arguments.headerMenu ].submenu, arguments ); } else { - log.warn( - "requested header menu (#arguments.headerMenu#) does not exist when calling addHeaderSubMenu()" - ); + log.warn( "requested header menu (#arguments.headerMenu#) does not exist when calling addHeaderSubMenu()" ); } // return @@ -832,7 +835,7 @@ addSubMenu( * Remove a sub level menu * * @topMenu The optional top menu name to add this sub level menu to or if concatenated then it uses that one. - * @name The unique name for this sub level menu + * @name The unique name for this sub level menu */ AdminMenuService function removeSubMenu( required topMenu, required name ){ // Verify top menu exists, else just return @@ -856,8 +859,9 @@ addSubMenu( /** * Remove a sub level menu from the header + * * @headerMenu The optional header menu name to remove from - * @name The sub menu to remove + * @name The sub menu to remove */ AdminMenuService function removeHeaderSubMenu( required headerMenu, required name ){ // Verify top menu exists, else just return @@ -868,9 +872,7 @@ addSubMenu( return this; } - for ( - var x = 1; x lte arrayLen( variables.headerMenuMap[ arguments.headerMenu ].subMenu ); x++ - ) { + for ( var x = 1; x lte arrayLen( variables.headerMenuMap[ arguments.headerMenu ].subMenu ); x++ ) { if ( variables.headerMenuMap[ arguments.headerMenu ].subMenu[ x ].name eq arguments.name ) { arrayDeleteAt( variables.headerMenuMap[ arguments.headerMenu ].subMenu, x ); break; @@ -908,6 +910,7 @@ addSubMenu( /** * Remove a header top level menu + * * @headerMenu The header menu unique name to remove */ AdminMenuService function removeHeaderMenu( required headerMenu ){ @@ -923,9 +926,7 @@ addSubMenu( } if ( !found ) { - log.warn( - "Header menu: #arguments.headerMenu# not found when calling removeHeaderMenu" - ); + log.warn( "Header menu: #arguments.headerMenu# not found when calling removeHeaderMenu" ); } // return @@ -1002,6 +1003,7 @@ addSubMenu( /** * Generate a flat representation of data elements + * * @data The data struct */ string function parseADataAttributes( required struct data ){ diff --git a/modules/contentbox/models/ui/Avatar.cfc b/modules/contentbox/models/ui/Avatar.cfc index 242745a8aa..37aa0c8829 100755 --- a/modules/contentbox/models/ui/Avatar.cfc +++ b/modules/contentbox/models/ui/Avatar.cfc @@ -32,7 +32,7 @@ component singleton { * Render an avatar image * * @email The email to render - * @size The pixel size, defaults to 80 + * @size The pixel size, defaults to 80 * @class An optional class to add to the img tag produced */ function renderAvatar( diff --git a/modules/contentbox/models/ui/BaseWidget.cfc b/modules/contentbox/models/ui/BaseWidget.cfc index 10a8e0efd3..93b3677422 100644 --- a/modules/contentbox/models/ui/BaseWidget.cfc +++ b/modules/contentbox/models/ui/BaseWidget.cfc @@ -86,10 +86,7 @@ component accessors="true" extends="coldbox.system.FrameworkSupertype" { * @throws BaseClassException */ any function renderIt(){ - throw( - message = "This is a base method that you must implement", - type = "BaseClassException" - ); + throw( message = "This is a base method that you must implement", type = "BaseClassException" ); } /** @@ -112,10 +109,7 @@ component accessors="true" extends="coldbox.system.FrameworkSupertype" { if ( !listContains( "init,onMissingMethod", method.name ) ) { if ( !structKeyExists( method, "access" ) || ( - structKeyExists( method, "access" ) && !listContains( - "private,package", - method.access - ) + structKeyExists( method, "access" ) && !listContains( "private,package", method.access ) ) ) { arrayAppend( publicMethods, method ); diff --git a/modules/contentbox/models/ui/Paging.cfc b/modules/contentbox/models/ui/Paging.cfc index 2641dbe2dd..0ec45a1178 100755 --- a/modules/contentbox/models/ui/Paging.cfc +++ b/modules/contentbox/models/ui/Paging.cfc @@ -3,7 +3,6 @@ * Copyright since 2012 by Ortus Solutions, Corp * www.ortussolutions.com/products/contentbox * --- - * @author Luis Majano * * COLDBOX SETTINGS * - `PagingMaxRows` : The maximum number of rows per page. @@ -38,6 +37,8 @@ * `FoundRows` = The total rows found in the recordset * `link` = The link to use for paging, including a placeholder for the page @page@ * ex: index.cfm?event=users.list&page=@page@ + * + * @author Luis Majano */ component accessors="true" { @@ -51,7 +52,7 @@ component accessors="true" { /** * Constructor * - * @settingService The ContentBox setting service + * @settingService The ContentBox setting service * @settingService.inject settingService@contentbox */ function init( required settingService ){ @@ -67,7 +68,7 @@ component accessors="true" { * Calculate the startrow and maxrow * * @pagingMaxRows You can override the paging max rows here - * @page Which page to bound on, we look into the request context for a `page` if not passed. + * @page Which page to bound on, we look into the request context for a `page` if not passed. * * @return struct of { startrow:numeric, maxrow:numeric } */ @@ -87,11 +88,11 @@ component accessors="true" { /** * Render the pagination tabs UI * - * @foundRows The rows found in the collection to build the pagination for. - * @link The link to use, you must place the `@page@` place holder so the link can be created correctly. ex: /data/page/@page@ + * @foundRows The rows found in the collection to build the pagination for. + * @link The link to use, you must place the `@page@` place holder so the link can be created correctly. ex: /data/page/@page@ * @pagingMaxRows You can override the paging max rows here - * @asList Render the UI as a list of pagination or tabs - * @page The page we are on, if not passed, we look into the request context for a `page` variable. + * @asList Render the UI as a list of pagination or tabs + * @page The page we are on, if not passed, we look into the request context for a `page` variable. */ function renderIt( required numeric foundRows, diff --git a/modules/contentbox/models/ui/ThemeService.cfc b/modules/contentbox/models/ui/ThemeService.cfc index 4a7a996871..f4ed0332e9 100644 --- a/modules/contentbox/models/ui/ThemeService.cfc +++ b/modules/contentbox/models/ui/ThemeService.cfc @@ -157,9 +157,9 @@ component accessors="true" threadSafe singleton { /** * Startup a theme in the system, processes interceptions, modules, widgets, etc * - * @name The name of the theme to activate + * @name The name of the theme to activate * @processWidgets Process widget registration on activation, defaults to true. - * @site The site id or object we are starting up this theme for + * @site The site id or object we are starting up this theme for */ function startupTheme( required name, @@ -234,8 +234,8 @@ component accessors="true" threadSafe singleton { * Save theme settings as they are coming from form submissions as a struct with a common prefix * cb_theme_{themeName}_{settingName} * - * @name The theme name - * @settings The settings struct + * @name The theme name + * @settings The settings struct * * @return ThemeService */ @@ -395,12 +395,12 @@ component accessors="true" threadSafe singleton { /** * Process a theme record and store appropriate data and cfc registries * - * @name The name of the theme on disk - * @path The path of the theme + * @name The name of the theme on disk + * @path The path of the theme * @invocationPath The invocation path of the theme - * @includePath The include path of the theme - * @type The type of theme it is: core, custom - * @module The module this theme exists under + * @includePath The include path of the theme + * @type The type of theme it is: core, custom + * @module The module this theme exists under */ function processThemeRecord( name, @@ -572,6 +572,7 @@ component accessors="true" threadSafe singleton { /** * Get constraints for setting fields + * * @themeName The name of the theme */ struct function getSettingsConstraints( required themeName ){ @@ -807,7 +808,8 @@ component accessors="true" threadSafe singleton { /** * generateModal - Generate the modal for Theme Setting Help - * @settingName - The name of the setting the Theme Setting Help modal will be created for + * + * @settingName - The name of the setting the Theme Setting Help modal will be created for * @thisSettingMD - The setting struct itself */ function generateModal( required settingName, required thisSettingMD ){ @@ -879,9 +881,9 @@ component accessors="true" threadSafe singleton { /** * Register a theme's settings * - * @name The theme name + * @name The theme name * @settings The settings struct - * @site The site this theme is activated on + * @site The site this theme is activated on * * @return ThemeService */ diff --git a/modules/contentbox/models/ui/WidgetService.cfc b/modules/contentbox/models/ui/WidgetService.cfc index 317c5124c3..f8fffa925c 100644 --- a/modules/contentbox/models/ui/WidgetService.cfc +++ b/modules/contentbox/models/ui/WidgetService.cfc @@ -124,8 +124,9 @@ component accessors="true" singleton threadSafe { /** * Discover the custom location widgets + * * @qRecords The records query to attach yourself to - * @type The type to process + * @type The type to process */ WidgetService function processWidgets( query qRecords = getLoadedWidgets(), type ){ // get core widgets to start with. @@ -201,6 +202,7 @@ component accessors="true" singleton threadSafe { /** * Discover modules widgets and attach records to incoming widget records + * * @qRecords The records query to attach yourself to */ WidgetService function processModuleWidgets( query qRecords = getLoadedWidgets() ){ @@ -256,6 +258,7 @@ component accessors="true" singleton threadSafe { /** * Discover active theme widgets and attach records to incoming widget records + * * @qRecords The records query to attach yourself to */ WidgetService function processThemeWidgets( query qRecords = getLoadedWidgets() ){ @@ -477,6 +480,7 @@ component accessors="true" singleton threadSafe { /** * Rip Extensions from file name + * * @fileName The target to rip */ function ripExtension( required filename ){ @@ -485,9 +489,10 @@ component accessors="true" singleton threadSafe { /** * Get widget rendering arguments - * @udf The target UDF to render out arguments for + * + * @udf The target UDF to render out arguments for * @widget The widget name - * @type The widget type + * @type The widget type * * @return The argument metadata structure */ diff --git a/modules/contentbox/models/ui/editors/EditorService.cfc b/modules/contentbox/models/ui/editors/EditorService.cfc index f0e5113a9d..53edb21b30 100755 --- a/modules/contentbox/models/ui/editors/EditorService.cfc +++ b/modules/contentbox/models/ui/editors/EditorService.cfc @@ -139,6 +139,7 @@ component accessors="true" threadSafe singleton { /** * Check if an editor exists or not + * * @name The name of the editor */ boolean function hasEditor( required name ){ @@ -147,6 +148,7 @@ component accessors="true" threadSafe singleton { /** * Check if an markup exists or not + * * @markup The name of the markup */ boolean function hasMarkup( required markup ){ diff --git a/modules/contentbox/models/util/DateUtil.cfc b/modules/contentbox/models/util/DateUtil.cfc index 50a331eb03..7a02886c1f 100644 --- a/modules/contentbox/models/util/DateUtil.cfc +++ b/modules/contentbox/models/util/DateUtil.cfc @@ -16,8 +16,8 @@ component singleton { /** * Conver the incoming date time to UTC using the dateTimeFormat() method - * @see https://cfdocs.org/datetimeformat * + * @see https://cfdocs.org/datetimeformat * @dateTime The date time object/string to convert */ function toUTC( required dateTime ){ diff --git a/modules/contentbox/models/util/ZipUtil.cfc b/modules/contentbox/models/util/ZipUtil.cfc index bacfc44c18..716071dc4a 100644 --- a/modules/contentbox/models/util/ZipUtil.cfc +++ b/modules/contentbox/models/util/ZipUtil.cfc @@ -65,13 +65,7 @@ - + // This plugin's properties instance = structNew(); @@ -108,12 +102,7 @@ hint ="Add files to a new or an existing Zip file archive." > - + - + /* Default variables */ @@ -197,26 +180,19 @@ entryFile = getFileFromPath( path ); // Remove drive letter from path - if ( - arguments.savePaths EQ "yes" AND right( - listFirst( entryPath, instance.slash ), - 1 - ) EQ ":" - ) + if ( arguments.savePaths EQ "yes" AND right( listFirst( entryPath, instance.slash ), 1 ) EQ ":" ) entryPath = listDeleteAt( entryPath, 1, instance.slash ); // Remove directory from path else if ( arguments.savePaths EQ "no" ) { if ( structKeyExists( arguments, "directory" ) and arguments.directory neq "" ) entryPath = replaceNoCase( entryPath, arguments.directory, "", "ALL" ); - else if ( structKeyExists( arguments, "files" ) and arguments.files neq "" ) - entryPath = ""; + else if ( structKeyExists( arguments, "files" ) and arguments.files neq "" ) entryPath = ""; } // Remove slash at first if ( len( entryPath ) GT 1 AND left( entryPath, 1 ) EQ instance.slash ) entryPath = right( entryPath, len( entryPath ) - 1 ); - else if ( len( entryPath ) EQ 1 AND left( entryPath, 1 ) EQ instance.slash ) - entryPath = ""; + else if ( len( entryPath ) EQ 1 AND left( entryPath, 1 ) EQ instance.slash ) entryPath = ""; // Skip if entry with the same name already exsits try { @@ -266,12 +242,7 @@ hint ="Delete files from an existing Zip file archive." > - + - + - + /* Default variables */ @@ -429,8 +389,7 @@ lastChr = right( arguments.extractPath, 1 ); /* Set an slash at the end of string */ - if ( lastChr NEQ instance.slash ) - arguments.extractPath = arguments.extractPath & instance.slash; + if ( lastChr NEQ instance.slash ) arguments.extractPath = arguments.extractPath & instance.slash; try { /* Open Zip file */ @@ -460,17 +419,17 @@ } /* Set file path */ - if ( arguments.useFolderNames EQ "yes" ){ + if ( arguments.useFolderNames EQ "yes" ) { filePath = arguments.extractPath & name; - } else{ + } else { filePath = arguments.extractPath & getFileFromPath( name ); } // Zip Slip Validation - if (!getCanonicalPath( filePath ).startsWith( getCanonicalPath( arguments.extractPath ) ) ) { + if ( !getCanonicalPath( filePath ).startsWith( getCanonicalPath( arguments.extractPath ) ) ) { throw( - type : "ArchiverException", - message : "Entry is outside of the target destination: #filepath#" + type : "ArchiverException", + message: "Entry is outside of the target destination: #filepath#" ); } @@ -490,9 +449,7 @@ ) ) AND ( - NOT fileExists( filePath ) OR ( - fileExists( filePath ) AND arguments.overwriteFiles EQ "yes" - ) + NOT fileExists( filePath ) OR ( fileExists( filePath ) AND arguments.overwriteFiles EQ "yes" ) ) ) { // Skip if entry contains special characters @@ -543,12 +500,7 @@ hint ="List the content of a specified Zip file." > - + /* Default variables */ @@ -585,8 +537,7 @@ qPacked = entry.getCompressedSize(); qCrc = entry.getCrc(); - if ( qSize GT 0 ) - qRatio = round( evaluate( 100 - ( ( qPacked * 100 ) / qSize ) ) ) & "%"; + if ( qSize GT 0 ) qRatio = round( evaluate( 100 - ( ( qPacked * 100 ) / qSize ) ) ) & "%"; else qRatio = "0%"; for ( i = 1; i LTE arrayLen( cols ); i = i + 1 ) @@ -616,12 +567,7 @@ hint ="Create a new GZip file archive." > - + - + - + /* Loop over directory query */ @@ -805,8 +739,7 @@ path = pathFormat( arguments.directory & instance.slash & dir.name[ i ] ); /* Add file to array */ - if ( dir.type[ i ] eq "file" and dir.name[ i ] neq instance.filename ) - arrayAppend( array, path ); + if ( dir.type[ i ] eq "file" and dir.name[ i ] neq instance.filename ) arrayAppend( array, path ); /* Get files from sub directorys and add them to the array */ else if ( dir.type[ i ] EQ "dir" AND arguments.recurse EQ "yes" ) { diff --git a/modules/contentbox/modules/contentbox-admin/handlers/authors.cfc b/modules/contentbox/modules/contentbox-admin/handlers/authors.cfc index 7f6e2ad5a0..d048128cfe 100755 --- a/modules/contentbox/modules/contentbox-admin/handlers/authors.cfc +++ b/modules/contentbox/modules/contentbox-admin/handlers/authors.cfc @@ -54,6 +54,7 @@ component extends="baseHandler" { /** * List system authors + * * @return html */ function index( event, rc, prc ){ @@ -109,6 +110,7 @@ component extends="baseHandler" { /** * Build out system author's table + filters + * * @return html */ function indexTable( event, rc, prc ){ @@ -198,6 +200,7 @@ component extends="baseHandler" { /** * System username checks + * * @return json */ function usernameCheck( event, rc, prc ){ @@ -215,6 +218,7 @@ component extends="baseHandler" { /** * System email checks + * * @return json */ function emailCheck( event, rc, prc ){ @@ -337,6 +341,7 @@ component extends="baseHandler" { /** * Author editor panel + * * @return html */ function editor( event, rc, prc ){ @@ -411,6 +416,7 @@ component extends="baseHandler" { /** * Shortcut to author profile + * * @return html */ function myprofile( event, rc, prc ){ @@ -765,6 +771,7 @@ component extends="baseHandler" { /** * List author preferences + * * @return view */ private function listPreferences( event, rc, prc ){ diff --git a/modules/contentbox/modules/contentbox-admin/handlers/baseHandler.cfc b/modules/contentbox/modules/contentbox-admin/handlers/baseHandler.cfc index 45561aa3c8..2581eb3d2f 100755 --- a/modules/contentbox/modules/contentbox-admin/handlers/baseHandler.cfc +++ b/modules/contentbox/modules/contentbox-admin/handlers/baseHandler.cfc @@ -33,7 +33,7 @@ component extends="coldbox.system.RestHandler" { /** * Calculate the starting record offset for the incoming page and maxrows per page * - * @page The page to pagination on + * @page The page to pagination on * @maxRows Max rows per page override or use global setting * * @return The page start offset diff --git a/modules/contentbox/modules/contentbox-admin/handlers/comments.cfc b/modules/contentbox/modules/contentbox-admin/handlers/comments.cfc index 70a102c013..f3e4871cd7 100755 --- a/modules/contentbox/modules/contentbox-admin/handlers/comments.cfc +++ b/modules/contentbox/modules/contentbox-admin/handlers/comments.cfc @@ -17,11 +17,11 @@ component extends="baseHandler" { /** * Pre handler * - * @event - * @action + * @event + * @action * @eventArguments - * @rc - * @prc + * @rc + * @prc */ function preHandler( event, action, eventArguments, rc, prc ){ // Tab selection @@ -32,8 +32,8 @@ component extends="baseHandler" { * Main display of comments * * @event - * @rc - * @prc + * @rc + * @prc */ function index( event, rc, prc ){ // params @@ -95,8 +95,8 @@ component extends="baseHandler" { * Submit a status udpate on a comment * * @event - * @rc - * @prc + * @rc + * @prc */ function doStatusUpdate( event, rc, prc ){ // param values @@ -131,8 +131,8 @@ component extends="baseHandler" { * Show the comment editor * * @event - * @rc - * @prc + * @rc + * @prc */ function editor( event, rc, prc ){ // get new or persisted @@ -147,8 +147,8 @@ component extends="baseHandler" { * Show the comment moderator * * @event - * @rc - * @prc + * @rc + * @prc */ function moderate( event, rc, prc ){ // get new or persisted @@ -169,8 +169,8 @@ component extends="baseHandler" { * Comment quick look * * @event - * @rc - * @prc + * @rc + * @prc * * @return HTML */ @@ -185,8 +185,8 @@ component extends="baseHandler" { * Save a comment * * @event - * @rc - * @prc + * @rc + * @prc */ function save( event, rc, prc ){ // populate and get comment @@ -207,8 +207,8 @@ component extends="baseHandler" { * Remove all Moderated comments * * @event - * @rc - * @prc + * @rc + * @prc * * @return JSON or relocation */ @@ -236,8 +236,8 @@ component extends="baseHandler" { * Remove comments from the database * * @event - * @rc - * @prc + * @rc + * @prc * * @return JSON or relocation */ @@ -286,11 +286,11 @@ component extends="baseHandler" { /** * Comment Pager * - * @event - * @rc - * @prc - * @contentID The content ID to filter the comments on, defaults to all - * @max Max number of comments to show, shows the global default + * @event + * @rc + * @prc + * @contentID The content ID to filter the comments on, defaults to all + * @max Max number of comments to show, shows the global default * @pagination Turn pagination on or off */ function pager( @@ -356,8 +356,8 @@ component extends="baseHandler" { * Show comment settings panel * * @event - * @rc - * @prc + * @rc + * @prc */ function settings( event, rc, prc ){ rc.xehSaveSettings = "#prc.cbAdminEntryPoint#.comments.saveSettings"; diff --git a/modules/contentbox/modules/contentbox-admin/handlers/content.cfc b/modules/contentbox/modules/contentbox-admin/handlers/content.cfc index a56664f594..aba367fd64 100755 --- a/modules/contentbox/modules/contentbox-admin/handlers/content.cfc +++ b/modules/contentbox/modules/contentbox-admin/handlers/content.cfc @@ -243,14 +243,15 @@ component extends="baseHandler" { /** * This viewlet shows latest content edits via arguments - * @author The optional author to look for latest edits only - * @author.generic contentbox.models.security.Author - * @isPublished Boolean indicator if you need to search on all published states, only published, or only draft - * @max The maximum number of records, capped at 25 by default - * @showHits Show hit count on content item, defaults to true - * @colorCodings Show content row color codings - * @showPublishedStatus Show published status columns - * @showAuthor Show the author in the table + * + * @author The optional author to look for latest edits only + * @author.generic contentbox.models.security.Author + * @isPublished Boolean indicator if you need to search on all published states, only published, or only draft + * @max The maximum number of records, capped at 25 by default + * @showHits Show hit count on content item, defaults to true + * @colorCodings Show content row color codings + * @showPublishedStatus Show published status columns + * @showAuthor Show the author in the table * * @return html */ @@ -304,15 +305,15 @@ component extends="baseHandler" { /** * This viewlet shows future or expired content using filters. By default it shows future published content * - * @author The optional author to look for latest edits only - * @author.generic contentbox.models.security.Author - * @showExpired Show expired content, defaults to false (future published content) - * @offset The offset when doing pagination - * @max The maximum number of records, capped at 25 by default - * @showHits Show hit count on content item, defaults to true - * @colorCodings Show content row color codings - * @showPublishedStatus Show published status columns - * @showAuthor Show the author in the table + * @author The optional author to look for latest edits only + * @author.generic contentbox.models.security.Author + * @showExpired Show expired content, defaults to false (future published content) + * @offset The offset when doing pagination + * @max The maximum number of records, capped at 25 by default + * @showHits Show hit count on content item, defaults to true + * @colorCodings Show content row color codings + * @showPublishedStatus Show published status columns + * @showAuthor Show the author in the table * * @return html */ diff --git a/modules/contentbox/modules/contentbox-admin/handlers/dashboard.cfc b/modules/contentbox/modules/contentbox-admin/handlers/dashboard.cfc index 2952b90352..a4928ae017 100755 --- a/modules/contentbox/modules/contentbox-admin/handlers/dashboard.cfc +++ b/modules/contentbox/modules/contentbox-admin/handlers/dashboard.cfc @@ -103,6 +103,7 @@ component extends="baseHandler" { /** * Produce the latest currently logged in user drafts + * * @return html */ function latestUserDrafts( event, rc, prc ){ @@ -138,6 +139,7 @@ component extends="baseHandler" { /** * Produce the publish in the future content + * * @return html */ function futurePublishedContent( event, rc, prc ){ @@ -151,6 +153,7 @@ component extends="baseHandler" { /** * Produce the expired content report + * * @return html */ function expiredContent( event, rc, prc ){ @@ -184,6 +187,7 @@ component extends="baseHandler" { /** * Produce the latest system news + * * @return html */ function latestNews( event, rc, prc ){ @@ -208,6 +212,7 @@ component extends="baseHandler" { /** * Produce the latest system logins + * * @return html */ function latestLogins( event, rc, prc ){ @@ -219,6 +224,7 @@ component extends="baseHandler" { /** * delete installer module + * * @return JSON */ function deleteInstaller(){ diff --git a/modules/contentbox/modules/contentbox-admin/handlers/menus.cfc b/modules/contentbox/modules/contentbox-admin/handlers/menus.cfc index c75991486b..b86c8555a7 100644 --- a/modules/contentbox/modules/contentbox-admin/handlers/menus.cfc +++ b/modules/contentbox/modules/contentbox-admin/handlers/menus.cfc @@ -65,6 +65,7 @@ component extends="baseHandler" { /** * slugify remotely + * * @return plain */ function slugify( event, rc, prc ){ @@ -73,6 +74,7 @@ component extends="baseHandler" { /** * Verify if slug is unique + * * @return json */ function slugUnique( event, rc, prc ){ @@ -121,6 +123,7 @@ component extends="baseHandler" { /** * Create a menu Item + * * @return text */ function createMenuItem( event, rc, prc ){ @@ -140,6 +143,7 @@ component extends="baseHandler" { /** * Build out the index table for the async loaded menus + * * @return html */ function menuTable( event, rc, prc ){ @@ -197,6 +201,7 @@ component extends="baseHandler" { /** * Preview the menu built + * * @return text */ function preview( event, rc, prc ){ @@ -262,6 +267,7 @@ component extends="baseHandler" { /** * Export a menu + * * @return json,xml */ function export( event, rc, prc ){ diff --git a/modules/contentbox/modules/contentbox-admin/handlers/permissionGroups.cfc b/modules/contentbox/modules/contentbox-admin/handlers/permissionGroups.cfc index 0b3d6a7ee3..883b6f452f 100755 --- a/modules/contentbox/modules/contentbox-admin/handlers/permissionGroups.cfc +++ b/modules/contentbox/modules/contentbox-admin/handlers/permissionGroups.cfc @@ -14,11 +14,11 @@ component extends="baseHandler" { /** * Pre handler * - * @event - * @action + * @event + * @action * @eventArguments - * @rc - * @prc + * @rc + * @prc */ function preHandler( event, action, eventArguments, rc, prc ){ // Tab control diff --git a/modules/contentbox/modules/contentbox-admin/handlers/permissions.cfc b/modules/contentbox/modules/contentbox-admin/handlers/permissions.cfc index c4622fce0f..e32a02b7c2 100755 --- a/modules/contentbox/modules/contentbox-admin/handlers/permissions.cfc +++ b/modules/contentbox/modules/contentbox-admin/handlers/permissions.cfc @@ -13,11 +13,11 @@ component extends="baseHandler" { /** * Pre handler * - * @event - * @action + * @event + * @action * @eventArguments - * @rc - * @prc + * @rc + * @prc */ function preHandler( event, action, eventArguments, rc, prc ){ // Tab control @@ -28,8 +28,8 @@ component extends="baseHandler" { * Manage permissions * * @event - * @rc - * @prc + * @rc + * @prc */ function index( event, rc, prc ){ // exit Handlers @@ -51,8 +51,8 @@ component extends="baseHandler" { * Save permissions * * @event - * @rc - * @prc + * @rc + * @prc */ function save( event, rc, prc ){ // UCASE permission @@ -83,8 +83,8 @@ component extends="baseHandler" { * Remove permissions * * @event - * @rc - * @prc + * @rc + * @prc */ function remove( event, rc, prc ){ // announce event diff --git a/modules/contentbox/modules/contentbox-admin/handlers/roles.cfc b/modules/contentbox/modules/contentbox-admin/handlers/roles.cfc index 0fc104c50a..b48f809985 100755 --- a/modules/contentbox/modules/contentbox-admin/handlers/roles.cfc +++ b/modules/contentbox/modules/contentbox-admin/handlers/roles.cfc @@ -14,11 +14,11 @@ component extends="baseHandler" { /** * Pre handler * - * @event - * @action + * @event + * @action * @eventArguments - * @rc - * @prc + * @rc + * @prc */ function preHandler( event, action, eventArguments, rc, prc ){ // Tab control @@ -29,8 +29,8 @@ component extends="baseHandler" { * Manage roles * * @event - * @rc - * @prc + * @rc + * @prc */ function index( event, rc, prc ){ // exit Handlers @@ -54,8 +54,8 @@ component extends="baseHandler" { * Save Roles * * @event - * @rc - * @prc + * @rc + * @prc */ function save( event, rc, prc ){ // Inflate the right Permissions according to toggle pattern: permissions_id_toggle @@ -99,8 +99,8 @@ component extends="baseHandler" { * Remove Roles * * @event - * @rc - * @prc + * @rc + * @prc */ function remove( event, rc, prc ){ // announce event @@ -138,8 +138,8 @@ component extends="baseHandler" { * Export a role * * @event - * @rc - * @prc + * @rc + * @prc */ function export( event, rc, prc ){ return variables.roleService.get( event.getValue( "roleID", 0 ) ).getMemento( includes = "permissions" ); @@ -149,8 +149,8 @@ component extends="baseHandler" { * Export all roles * * @event - * @rc - * @prc + * @rc + * @prc */ function exportAll( event, rc, prc ){ param rc.roleID = ""; @@ -170,8 +170,8 @@ component extends="baseHandler" { * Import roles * * @event - * @rc - * @prc + * @rc + * @prc */ function importAll( event, rc, prc ){ event.paramValue( "importFile", "" ); diff --git a/modules/contentbox/modules/contentbox-admin/handlers/settings.cfc b/modules/contentbox/modules/contentbox-admin/handlers/settings.cfc index d0ac3b251e..204554cdfa 100755 --- a/modules/contentbox/modules/contentbox-admin/handlers/settings.cfc +++ b/modules/contentbox/modules/contentbox-admin/handlers/settings.cfc @@ -49,6 +49,7 @@ component extends="baseHandler" { /** * Email Testing of settings + * * @return json */ function emailTest( event, rc, prc ){ @@ -113,6 +114,7 @@ component extends="baseHandler" { /** * Raw settings manager + * * @return html */ function raw( event, rc, prc ){ @@ -140,6 +142,7 @@ component extends="baseHandler" { /** * Present the raw settings table + * * @return html */ function rawtable( event, rc, prc ){ @@ -231,6 +234,7 @@ component extends="baseHandler" { /** * WireBox mapping dump + * * @return html */ function mappingDump( event, rc, prc ){ @@ -310,6 +314,7 @@ component extends="baseHandler" { /** * View settings cached data + * * @return html */ function viewCached( event, rc, prc ){ @@ -324,6 +329,7 @@ component extends="baseHandler" { /** * Display the auth logs manager + * * @return html */ function authLogs( event, rc, prc ){ diff --git a/modules/contentbox/modules/contentbox-admin/handlers/versions.cfc b/modules/contentbox/modules/contentbox-admin/handlers/versions.cfc index 458a2800df..3201f41ff5 100755 --- a/modules/contentbox/modules/contentbox-admin/handlers/versions.cfc +++ b/modules/contentbox/modules/contentbox-admin/handlers/versions.cfc @@ -49,8 +49,9 @@ component extends="baseHandler" { /** * Pager Viewlet for version records - * @contentID The contentID to iterate records on - * @max The maximum records to show + * + * @contentID The contentID to iterate records on + * @max The maximum records to show * @viewFullHistory View full history or partial paginated results */ function pager( diff --git a/modules/contentbox/modules/contentbox-admin/models/ui/BootstrapFileUpload.cfc b/modules/contentbox/modules/contentbox-admin/models/ui/BootstrapFileUpload.cfc index c4a3a58bc7..c2e3209931 100644 --- a/modules/contentbox/modules/contentbox-admin/models/ui/BootstrapFileUpload.cfc +++ b/modules/contentbox/modules/contentbox-admin/models/ui/BootstrapFileUpload.cfc @@ -20,16 +20,17 @@ component { /** * Main method for rendering bootstrap-themed file upload field - * @name The name of the file field to create - * @required Whether or not the field is required (validation) - * @id The id to apply to the file field - * @label If specified, will create a label element with the specified text for the file field - * @columnWidth The number of columns that the field should occupy (bootstrap grid system) - * @useRemoveButton Whether a "remove" button should be created + * + * @name The name of the file field to create + * @required Whether or not the field is required (validation) + * @id The id to apply to the file field + * @label If specified, will create a label element with the specified text for the file field + * @columnWidth The number of columns that the field should occupy (bootstrap grid system) + * @useRemoveButton Whether a "remove" button should be created * @selectButtonText The text to use for the "select" button * @changeButtonText The text to use for the "change" button * @removeButtonText The text to use for the "remove" button - * @accept The accept attribute of the file field + * @accept The accept attribute of the file field */ public string function renderIt( required string name, diff --git a/modules/contentbox/modules/contentbox-admin/models/ui/PageBreadcrumbVisitor.cfc b/modules/contentbox/modules/contentbox-admin/models/ui/PageBreadcrumbVisitor.cfc index 29ecf832bf..f335b74b96 100755 --- a/modules/contentbox/modules/contentbox-admin/models/ui/PageBreadcrumbVisitor.cfc +++ b/modules/contentbox/modules/contentbox-admin/models/ui/PageBreadcrumbVisitor.cfc @@ -16,6 +16,7 @@ component singleton { /** * Visit a page and build hierarchy list + * * @page The page content object */ function visit( required page ){ diff --git a/modules/contentbox/modules/contentbox-admin/modules/contentbox-ckeditor/models/CKEditor.cfc b/modules/contentbox/modules/contentbox-admin/modules/contentbox-ckeditor/models/CKEditor.cfc index eab376546a..aa61c1ade4 100644 --- a/modules/contentbox/modules/contentbox-admin/modules/contentbox-ckeditor/models/CKEditor.cfc +++ b/modules/contentbox/modules/contentbox-admin/modules/contentbox-ckeditor/models/CKEditor.cfc @@ -26,9 +26,10 @@ component /** * Constructor - * @coldbox.inject coldbox + * + * @coldbox.inject coldbox * @settingService.inject settingService@contentbox - * @html.inject HTMLHelper@coldbox + * @html.inject HTMLHelper@coldbox */ function init( required coldbox, diff --git a/modules/contentbox/modules/contentbox-admin/modules/contentbox-filebrowser/handlers/Home.cfc b/modules/contentbox/modules/contentbox-admin/modules/contentbox-filebrowser/handlers/Home.cfc index f10e82dba3..d3d5ceeae2 100644 --- a/modules/contentbox/modules/contentbox-admin/modules/contentbox-filebrowser/handlers/Home.cfc +++ b/modules/contentbox/modules/contentbox-admin/modules/contentbox-filebrowser/handlers/Home.cfc @@ -33,7 +33,7 @@ component extends="cbadmin.handlers.baseHandler" { } /** - * @widget Determines if this will run as a viewlet or normal MVC + * @widget Determines if this will run as a viewlet or normal MVC * @settings A structure of settings for the filebrowser to be overriden with in the viewlet most likely. */ function index( @@ -519,7 +519,7 @@ component extends="cbadmin.handlers.baseHandler" { /** * Load Assets for FileBrowser * - * @force Force the loading of assets on demand + * @force Force the loading of assets on demand * @settings A structure of settings for the filebrowser to be overriden with in the viewlet most likely. */ private function loadAssets( diff --git a/modules/contentbox/modules/contentbox-admin/modules/contentbox-markdowneditor/models/MarkdownEditor.cfc b/modules/contentbox/modules/contentbox-admin/modules/contentbox-markdowneditor/models/MarkdownEditor.cfc index d89c730bd7..2d54e574ba 100644 --- a/modules/contentbox/modules/contentbox-admin/modules/contentbox-markdowneditor/models/MarkdownEditor.cfc +++ b/modules/contentbox/modules/contentbox-admin/modules/contentbox-markdowneditor/models/MarkdownEditor.cfc @@ -16,9 +16,10 @@ component /** * Constructor - * @coldbox.inject coldbox + * + * @coldbox.inject coldbox * @settingService.inject settingService@contentbox - * @html.inject HTMLHelper@coldbox + * @html.inject HTMLHelper@coldbox */ function init( required coldbox, @@ -282,6 +283,7 @@ component /** * Build the toolbar JS according to editor name + * * @editor The editor name to bind the toolbar to */ private function buildToolbarJS( required editor ){ diff --git a/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/modules/contentbox-email-twofactor/models/EmailTwoFactorProvider.cfc b/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/modules/contentbox-email-twofactor/models/EmailTwoFactorProvider.cfc index 6c6ae08f5f..7a93078b1e 100644 --- a/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/modules/contentbox-email-twofactor/models/EmailTwoFactorProvider.cfc +++ b/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/modules/contentbox-email-twofactor/models/EmailTwoFactorProvider.cfc @@ -175,7 +175,7 @@ component /** * Verify the challenge * - * @code The verification code + * @code The verification code * @author The author to verify challenge * * @return struct:{ error:boolean, messages:string } @@ -199,9 +199,8 @@ component * This method is called once a two factor challenge is accepted and valid. * Meaning the user has completed the validation and will be logged in to ContentBox now. * - * @code The verification code + * @code The verification code * @author The author to verify challenge - * */ function finalize( required string code, required author ){ // clear out the codes diff --git a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/auth.cfc b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/auth.cfc index 61a735a841..5bc3ba3193 100644 --- a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/auth.cfc +++ b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/auth.cfc @@ -9,9 +9,9 @@ component extends="baseHandler" { /** * Login to ContentBox and get your JWT Token * - * @tags Authentication + * @tags Authentication * @requestBody contentbox/apidocs/auth/login/requestBody.json - * @responses contentbox/apidocs/auth/login/responses.json + * @responses contentbox/apidocs/auth/login/responses.json */ function login( event, rc, prc ){ param rc.username = ""; diff --git a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/authors.cfc b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/authors.cfc index c75e3f6cc5..3eb62e14ac 100644 --- a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/authors.cfc +++ b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/authors.cfc @@ -20,7 +20,7 @@ component extends="baseHandler" secured="AUTHOR_ADMIN" { * Display all authors according to query options * * @tags Authors - * @x-contentbox-permissions AUTHOR_ADMIN + * @x -contentbox-permissions AUTHOR_ADMIN */ function index( event, rc, prc ){ // Criterias and Filters @@ -54,7 +54,7 @@ component extends="baseHandler" secured="AUTHOR_ADMIN" { * Show an author using the id * * @tags Authors - * @x-contentbox-permissions AUTHOR_ADMIN + * @x -contentbox-permissions AUTHOR_ADMIN */ function show( event, rc, prc ){ param rc.includes = "permissions,permissionGroups,role.permissions"; @@ -69,7 +69,7 @@ component extends="baseHandler" secured="AUTHOR_ADMIN" { * Create an author in ContentBox * * @tags Authors - * @x-contentbox-permissions AUTHOR_ADMIN + * @x -contentbox-permissions AUTHOR_ADMIN */ function create( event, rc, prc ){ // Default set variables for the author @@ -86,7 +86,7 @@ component extends="baseHandler" secured="AUTHOR_ADMIN" { * Update an existing author * * @tags Authors - * @x-contentbox-permissions AUTHOR_ADMIN + * @x -contentbox-permissions AUTHOR_ADMIN */ function update( event, rc, prc ){ // Memento output @@ -104,7 +104,7 @@ component extends="baseHandler" secured="AUTHOR_ADMIN" { * Delete an author using an id * * @tags Authors - * @x-contentbox-permissions AUTHOR_ADMIN + * @x -contentbox-permissions AUTHOR_ADMIN */ function delete( event, rc, prc ){ super.delete( argumentCollection = arguments ); diff --git a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/baseContentHandler.cfc b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/baseContentHandler.cfc index 7bf0bb4758..136a49d14a 100644 --- a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/baseContentHandler.cfc +++ b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/baseContentHandler.cfc @@ -47,8 +47,8 @@ component extends="baseHandler" { /** * Shared method for create and update to be DRY * - * @populate Population arguments - * @validate Validation arguments + * @populate Population arguments + * @validate Validation arguments * @saveMethod The method to use for saving entities * @contenType The type used for permission checks */ diff --git a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/baseHandler.cfc b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/baseHandler.cfc index 82ea6a4546..126ff5981c 100644 --- a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/baseHandler.cfc +++ b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/baseHandler.cfc @@ -1,5 +1,4 @@ /** - * @see https://coldbox-orm.ortusbooks.com/orm-events/automatic-rest-crud * * This is our base handler for our API which is bassed off the cborm resources base handler. * @@ -32,6 +31,8 @@ * * That's it! All resource methods: index, create, show, update, delete will be implemented for you. * You can create more actions or override them as needed. + * + * @see https://coldbox-orm.ortusbooks.com/orm-events/automatic-rest-crud */ component extends="cborm.models.resources.BaseHandler" { @@ -48,7 +49,7 @@ component extends="cborm.models.resources.BaseHandler" { * GET /api/v1/{resource} * * @criteria If you pass a criteria object, then we will use that instead of creating a new one - * @results If you pass in a results struct, it must contain the following: { count:numeric, records: array of objects } + * @results If you pass in a results struct, it must contain the following: { count:numeric, records: array of objects } */ function index( event, rc, prc, criteria, struct results ){ param rc.page = 1; @@ -206,12 +207,12 @@ component extends="cborm.models.resources.BaseHandler" { /** * This utility tries to get the incoming resource by id or slug or fails * - * @id The id/slug identifier to retrieve the entity + * @id The id/slug identifier to retrieve the entity * @prc The ColdBox PRC * - * @throws EntityNotFound - * * @return The found entity + * + * @throws EntityNotFound */ private function getByIdOrSlugOrFail( required id, required prc ){ var c = variables.ormService.newCriteria(); @@ -241,9 +242,9 @@ component extends="cborm.models.resources.BaseHandler" { /** * This utility tries to get a site by id or slug * - * @throws EntityNotFound - * * @return The found site + * + * @throws EntityNotFound */ private function getSiteByIdOrSlugOrFail( required id ){ var c = variables.siteService.newCriteria(); diff --git a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/categories.cfc b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/categories.cfc index d3e4591c9a..672584be48 100644 --- a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/categories.cfc +++ b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/categories.cfc @@ -55,7 +55,7 @@ component extends="baseHandler" { * Create a category * * @tags Categories - * @x-contentbox-permissions CATEGORIES_ADMIN + * @x -contentbox-permissions CATEGORIES_ADMIN */ function create( event, rc, prc ) secured="CATEGORIES_ADMIN"{ super.create( argumentCollection = arguments ); @@ -65,7 +65,7 @@ component extends="baseHandler" { * Update an existing category * * @tags Categories - * @x-contentbox-permissions CATEGORIES_ADMIN + * @x -contentbox-permissions CATEGORIES_ADMIN */ function update( event, rc, prc ) secured="CATEGORIES_ADMIN"{ super.update( argumentCollection = arguments ); @@ -75,7 +75,7 @@ component extends="baseHandler" { * Delete a category using an id or slug * * @tags Categories - * @x-contentbox-permissions CATEGORIES_ADMIN + * @x -contentbox-permissions CATEGORIES_ADMIN */ function delete( event, rc, prc ) secured="CATEGORIES_ADMIN"{ super.delete( argumentCollection = arguments ); diff --git a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/comments.cfc b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/comments.cfc index 54149e6b1a..857ca3dadb 100644 --- a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/comments.cfc +++ b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/comments.cfc @@ -84,7 +84,7 @@ component extends="baseHandler" { * Update an existing comment * * @tags Comments - * @x-contentbox-permissions COMMENTS_ADMIN + * @x -contentbox-permissions COMMENTS_ADMIN */ function update( event, rc, prc ) secured="COMMENTS_ADMIN"{ super.update( argumentCollection = arguments ); @@ -94,7 +94,7 @@ component extends="baseHandler" { * Delete a comment * * @tags Comments - * @x-contentbox-permissions COMMENTS_ADMIN + * @x -contentbox-permissions COMMENTS_ADMIN */ function delete( event, rc, prc ) secured="COMMENTS_ADMIN"{ super.delete( argumentCollection = arguments ); diff --git a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/contentStore.cfc b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/contentStore.cfc index 17e7551a50..16bbf39120 100644 --- a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/contentStore.cfc +++ b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/contentStore.cfc @@ -19,7 +19,7 @@ component extends="baseContentHandler" { * Display all content store items using different filters * * @tags ContentStore - * @x-contentbox-permissions CONTENTSTORE_ADMIN,CONTENTSTORE_EDITOR + * @x -contentbox-permissions CONTENTSTORE_ADMIN,CONTENTSTORE_EDITOR */ function index( event, rc, prc ) secured="CONTENTSTORE_ADMIN,CONTENTSTORE_EDITOR"{ // Paging + Mementifier @@ -65,7 +65,7 @@ component extends="baseContentHandler" { * Show a content store item using the id * * @tags ContentStore - * @x-contentbox-permissions CONTENTSTORE_ADMIN,CONTENTSTORE_EDITOR + * @x -contentbox-permissions CONTENTSTORE_ADMIN,CONTENTSTORE_EDITOR */ function show( event, rc, prc ) secured="CONTENTSTORE_ADMIN,CONTENTSTORE_EDITOR"{ param rc.includes = arrayToList( [ @@ -85,7 +85,7 @@ component extends="baseContentHandler" { * Create a content store item * * @tags ContentStore - * @x-contentbox-permissions CONTENTSTORE_ADMIN,CONTENTSTORE_EDITOR + * @x -contentbox-permissions CONTENTSTORE_ADMIN,CONTENTSTORE_EDITOR */ function create( event, rc, prc ) secured="CONTENTSTORE_ADMIN,CONTENTSTORE_EDITOR"{ // Supersize it @@ -97,7 +97,7 @@ component extends="baseContentHandler" { * Update an existing content store item * * @tags ContentStore - * @x-contentbox-permissions CONTENTSTORE_ADMIN,CONTENTSTORE_EDITOR + * @x -contentbox-permissions CONTENTSTORE_ADMIN,CONTENTSTORE_EDITOR */ function update( event, rc, prc ) secured="CONTENTSTORE_ADMIN,CONTENTSTORE_EDITOR"{ arguments.contentType = "CONTENTSTORE"; @@ -108,7 +108,7 @@ component extends="baseContentHandler" { * Delete a content store item using an id or slug * * @tags ContentStore - * @x-contentbox-permissions CONTENTSTORE_ADMIN + * @x -contentbox-permissions CONTENTSTORE_ADMIN */ function delete( event, rc, prc ) secured="CONTENTSTORE_ADMIN"{ super.delete( argumentCollection = arguments ); diff --git a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/entries.cfc b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/entries.cfc index a55bc70a71..7a6151cbf5 100644 --- a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/entries.cfc +++ b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/entries.cfc @@ -19,7 +19,7 @@ component extends="baseContentHandler" { * Display all entries using different filters * * @tags Entries - * @x-contentbox-permissions ENTRIES_ADMIN,ENTRIES_EDITOR + * @x -contentbox-permissions ENTRIES_ADMIN,ENTRIES_EDITOR */ function index( event, rc, prc ) secured="ENTRIES_ADMIN,ENTRIES_EDITOR"{ param rc.page = 1; @@ -55,7 +55,7 @@ component extends="baseContentHandler" { * Show an entry using the id * * @tags Entries - * @x-contentbox-permissions ENTRIES_ADMIN,ENTRIES_EDITOR + * @x -contentbox-permissions ENTRIES_ADMIN,ENTRIES_EDITOR */ function show( event, rc, prc ) secured="ENTRIES_ADMIN,ENTRIES_EDITOR"{ param rc.includes = arrayToList( [ @@ -75,7 +75,7 @@ component extends="baseContentHandler" { * Create an entry * * @tags Entries - * @x-contentbox-permissions ENTRIES_ADMIN,ENTRIES_EDITOR + * @x -contentbox-permissions ENTRIES_ADMIN,ENTRIES_EDITOR */ function create( event, rc, prc ) secured="ENTRIES_ADMIN,ENTRIES_EDITOR"{ // Supersize it @@ -87,7 +87,7 @@ component extends="baseContentHandler" { * Update an existing entry * * @tags Entries - * @x-contentbox-permissions ENTRIES_ADMIN,ENTRIES_EDITOR + * @x -contentbox-permissions ENTRIES_ADMIN,ENTRIES_EDITOR */ function update( event, rc, prc ) secured="ENTRIES_ADMIN,ENTRIES_EDITOR"{ // Supersize it @@ -99,7 +99,7 @@ component extends="baseContentHandler" { * Delete an entry using an id or slug * * @tags Entries - * @x-contentbox-permissions ENTRIES_ADMIN + * @x -contentbox-permissions ENTRIES_ADMIN */ function delete( event, rc, prc ) secured="ENTRIES_ADMIN"{ super.delete( argumentCollection = arguments ); diff --git a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/menus.cfc b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/menus.cfc index cb1e913a51..99ab7675f9 100644 --- a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/menus.cfc +++ b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/menus.cfc @@ -28,7 +28,7 @@ component extends="baseHandler" secured="MENUS_ADMIN" { * Display all menus * * @tags Menus - * @x-contentbox-permissions MENUS_ADMIN + * @x -contentbox-permissions MENUS_ADMIN */ function index( event, rc, prc ){ // Criterias and Filters @@ -45,7 +45,7 @@ component extends="baseHandler" secured="MENUS_ADMIN" { * Show a category using the id * * @tags Menus - * @x-contentbox-permissions MENUS_ADMIN + * @x -contentbox-permissions MENUS_ADMIN */ function show( event, rc, prc ){ param rc.includes = "rootMenuItems:menuItems"; @@ -58,7 +58,7 @@ component extends="baseHandler" secured="MENUS_ADMIN" { * Create a menu * * @tags Menus - * @x-contentbox-permissions MENUS_ADMIN + * @x -contentbox-permissions MENUS_ADMIN */ function create( event, rc, prc ){ super.create( argumentCollection = arguments ); @@ -68,7 +68,7 @@ component extends="baseHandler" secured="MENUS_ADMIN" { * Update an existing menu * * @tags Menus - * @x-contentbox-permissions MENUS_ADMIN + * @x -contentbox-permissions MENUS_ADMIN */ function update( event, rc, prc ){ super.update( argumentCollection = arguments ); @@ -78,7 +78,7 @@ component extends="baseHandler" secured="MENUS_ADMIN" { * Delete a menu using an id or slug * * @tags Menus - * @x-contentbox-permissions MENUS_ADMIN + * @x -contentbox-permissions MENUS_ADMIN */ function delete( event, rc, prc ){ super.delete( argumentCollection = arguments ); diff --git a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/pages.cfc b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/pages.cfc index 49c5e935a3..316913186a 100644 --- a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/pages.cfc +++ b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/pages.cfc @@ -19,7 +19,7 @@ component extends="baseContentHandler" { * Display all pages using different filters * * @tags Pages - * @x-contentbox-permissions PAGES_ADMIN,PAGES_EDITOR + * @x -contentbox-permissions PAGES_ADMIN,PAGES_EDITOR */ function index( event, rc, prc ) secured="PAGES_ADMIN,PAGES_EDITOR"{ param rc.page = 1; @@ -69,7 +69,7 @@ component extends="baseContentHandler" { * Show an page using the id * * @tags Pages - * @x-contentbox-permissions PAGES_ADMIN,PAGES_EDITOR + * @x -contentbox-permissions PAGES_ADMIN,PAGES_EDITOR */ function show( event, rc, prc ) secured="PAGES_ADMIN,PAGES_EDITOR"{ param rc.includes = arrayToList( [ @@ -89,7 +89,7 @@ component extends="baseContentHandler" { * Create a page * * @tags Pages - * @x-contentbox-permissions PAGES_ADMIN,PAGES_EDITOR + * @x -contentbox-permissions PAGES_ADMIN,PAGES_EDITOR */ function create( event, rc, prc ) secured="PAGES_ADMIN,PAGES_EDITOR"{ // Supersize it @@ -101,7 +101,7 @@ component extends="baseContentHandler" { * Update an existing page * * @tags Pages - * @x-contentbox-permissions PAGES_ADMIN,PAGES_EDITOR + * @x -contentbox-permissions PAGES_ADMIN,PAGES_EDITOR */ function update( event, rc, prc ) secured="PAGES_ADMIN,PAGES_EDITOR"{ // Supersize it @@ -113,7 +113,7 @@ component extends="baseContentHandler" { * Delete a page using an id or slug * * @tags Pages - * @x-contentbox-permissions PAGES_ADMIN + * @x -contentbox-permissions PAGES_ADMIN */ function delete( event, rc, prc ) secured="PAGES_ADMIN"{ super.delete( argumentCollection = arguments ); diff --git a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/settings.cfc b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/settings.cfc index 5de8b21120..31b6d68f4e 100644 --- a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/settings.cfc +++ b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/settings.cfc @@ -16,7 +16,7 @@ component extends="baseHandler" { * Display all system settings * * @tags Settings - * @x-contentbox-permissions SYSTEM_RAW_SETTINGS + * @x -contentbox-permissions SYSTEM_RAW_SETTINGS */ function index( event, rc, prc ) secured="SYSTEM_RAW_SETTINGS"{ event diff --git a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/siteSettings.cfc b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/siteSettings.cfc index e61ad52043..b9c8166f15 100644 --- a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/siteSettings.cfc +++ b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/siteSettings.cfc @@ -12,7 +12,7 @@ component extends="baseHandler" secured="SITES_ADMIN" { * Display all site settings * * @tags Sites - * @x-contentbox-permissions SITES_ADMIN + * @x -contentbox-permissions SITES_ADMIN */ function index( event, rc, prc ){ var siteSettings = variables.settingService.getSettingsContainer().sites; diff --git a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/sites.cfc b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/sites.cfc index 3c5aa1da69..cb004d3152 100644 --- a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/sites.cfc +++ b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/sites.cfc @@ -17,7 +17,7 @@ component extends="baseHandler" secured="SITES_ADMIN" { * Display all sites * * @tags Sites - * @x-contentbox-permissions SITES_ADMIN + * @x -contentbox-permissions SITES_ADMIN */ function index( event, rc, prc ){ // Criterias and Filters @@ -50,7 +50,7 @@ component extends="baseHandler" secured="SITES_ADMIN" { * Show a site using the id * * @tags Sites - * @x-contentbox-permissions SITES_ADMIN + * @x -contentbox-permissions SITES_ADMIN */ function show( event, rc, prc ){ super.show( argumentCollection = arguments ); @@ -60,7 +60,7 @@ component extends="baseHandler" secured="SITES_ADMIN" { * Create a site * * @tags Sites - * @x-contentbox-permissions SITES_ADMIN + * @x -contentbox-permissions SITES_ADMIN */ function create( event, rc, prc ){ // Supersize it @@ -71,7 +71,7 @@ component extends="baseHandler" secured="SITES_ADMIN" { * Update an existing site * * @tags Sites - * @x-contentbox-permissions SITES_ADMIN + * @x -contentbox-permissions SITES_ADMIN */ function update( event, rc, prc ){ // You cannot update site slugs @@ -83,7 +83,7 @@ component extends="baseHandler" secured="SITES_ADMIN" { * Delete a site using an id or slug * * @tags Sites - * @x-contentbox-permissions SITES_ADMIN + * @x -contentbox-permissions SITES_ADMIN */ function delete( event, rc, prc ){ super.delete( argumentCollection = arguments ); diff --git a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/versions.cfc b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/versions.cfc index 2dee3cca02..5eba2b31b3 100644 --- a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/versions.cfc +++ b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/versions.cfc @@ -37,7 +37,7 @@ component * Display all versions for the requested contentype * * @tags Versions - * @x-contentbox-permissions PAGES_ADMIN,PAGES_EDITOR,ENTRIES_ADMIN,ENTRIES_EDITOR,CONTENTSTORE_ADMIN,CONTENTSTORE_EDITOR + * @x -contentbox-permissions PAGES_ADMIN,PAGES_EDITOR,ENTRIES_ADMIN,ENTRIES_EDITOR,CONTENTSTORE_ADMIN,CONTENTSTORE_EDITOR */ function index( event, rc, prc ){ param rc.page = 1; @@ -70,7 +70,7 @@ component * Show a content version individually * * @tags Versions - * @x-contentbox-permissions PAGES_ADMIN,PAGES_EDITOR,ENTRIES_ADMIN,ENTRIES_EDITOR,CONTENTSTORE_ADMIN,CONTENTSTORE_EDITOR + * @x -contentbox-permissions PAGES_ADMIN,PAGES_EDITOR,ENTRIES_ADMIN,ENTRIES_EDITOR,CONTENTSTORE_ADMIN,CONTENTSTORE_EDITOR */ function show( event, rc, prc ){ param rc.includes = "relatedContentSnapshot:relatedContent"; @@ -83,7 +83,7 @@ component * Delete a version from a specific content item * * @tags Versions - * @x-contentbox-permissions VERSIONS_DELETE + * @x -contentbox-permissions VERSIONS_DELETE */ function delete( event, rc, prc ) secured="VERSIONS_DELETE"{ super.delete( argumentCollection = arguments ); diff --git a/modules/contentbox/modules/contentbox-ui/handlers/content.cfc b/modules/contentbox/modules/contentbox-ui/handlers/content.cfc index 4268ac6681..cc99e2dfef 100644 --- a/modules/contentbox/modules/contentbox-ui/handlers/content.cfc +++ b/modules/contentbox/modules/contentbox-ui/handlers/content.cfc @@ -159,11 +159,12 @@ component { /** * Content display around advice that provides caching for content display and multi-format capabilities - * @event Request context - * @rc Request collection - * @prc Private request collection + * + * @event Request context + * @rc Request collection + * @prc Private request collection * @eventArguments Event arguments - * @action The action to wrap + * @action The action to wrap * @contentCaching Wether content caching is enabled or not */ private function wrapContentAdvice( @@ -345,6 +346,7 @@ component { /** * Validate incoming comment post, if not valid, it redirects back + * * @thisContent The content object to validate the comment post for * * @return content handler @@ -423,8 +425,8 @@ component { * Save the comment for a content object * * @thisContent.hint The content object - * @subscribe Subscribing to comments or not - * @prc The prc reference + * @subscribe Subscribing to comments or not + * @prc The prc reference */ private function saveComment( required thisContent, diff --git a/modules/contentbox/modules/contentbox-ui/handlers/page.cfc b/modules/contentbox/modules/contentbox-ui/handlers/page.cfc index 1c0274cc25..c7d10ba23c 100644 --- a/modules/contentbox/modules/contentbox-ui/handlers/page.cfc +++ b/modules/contentbox/modules/contentbox-ui/handlers/page.cfc @@ -20,11 +20,11 @@ component extends="content" { /** * Pre handler for pages * - * @event - * @action + * @event + * @action * @eventArguments - * @rc - * @prc + * @rc + * @prc */ function preHandler( event, action, eventArguments, rc, prc ){ super.preHandler( argumentCollection = arguments ); @@ -34,8 +34,8 @@ component extends="content" { * Preview a page * * @event - * @rc - * @prc + * @rc + * @prc */ function preview( event, rc, prc ){ // Run parent preview @@ -93,9 +93,9 @@ component extends="content" { /** * Around page advice that provides caching and multi-output format * - * @event - * @rc - * @prc + * @event + * @rc + * @prc * @eventArguments */ function aroundIndex( event, rc, prc, eventArguments ){ @@ -110,8 +110,8 @@ component extends="content" { * Present pages in the UI * * @event - * @rc - * @prc + * @rc + * @prc */ function index( event, rc, prc ){ // incoming params @@ -211,8 +211,8 @@ component extends="content" { * Content search * * @event - * @rc - * @prc + * @rc + * @prc * * @return HTML */ @@ -267,8 +267,8 @@ component extends="content" { * RSS Feeds * * @event - * @rc - * @prc + * @rc + * @prc */ function rss( event, rc, prc ){ // params @@ -295,8 +295,8 @@ component extends="content" { * Comment Form Post * * @event - * @rc - * @prc + * @rc + * @prc */ function commentPost( event, rc, prc ){ // incoming params diff --git a/modules/contentbox/modules/contentbox-ui/models/PageBreadcrumbVisitor.cfc b/modules/contentbox/modules/contentbox-ui/models/PageBreadcrumbVisitor.cfc index d5166372f2..c24cd61f4b 100755 --- a/modules/contentbox/modules/contentbox-ui/models/PageBreadcrumbVisitor.cfc +++ b/modules/contentbox/modules/contentbox-ui/models/PageBreadcrumbVisitor.cfc @@ -19,7 +19,8 @@ component singleton { /** * Visit and build out bread crumbs - * @page The page object + * + * @page The page object * @separator The separator to use, defaults to '>' */ function visit( required page, string separator = ">" ){ @@ -31,7 +32,7 @@ component singleton { // check if page slug is home, to ignore it if ( arguments.page.getSlug() NEQ CBHelper.getHomePage() ) { - bc &= "#( len(bc) ? arguments.separator : "")# #arguments.page.getTitle()# + bc &= "#( len( bc ) ? arguments.separator : "" )# #arguments.page.getTitle()# "; } diff --git a/modules/contentbox/modules/contentbox-ui/modules/contentbox-sitemap/handlers/main.cfc b/modules/contentbox/modules/contentbox-ui/modules/contentbox-sitemap/handlers/main.cfc index c606b7d726..257fe0e183 100644 --- a/modules/contentbox/modules/contentbox-ui/modules/contentbox-sitemap/handlers/main.cfc +++ b/modules/contentbox/modules/contentbox-ui/modules/contentbox-sitemap/handlers/main.cfc @@ -81,6 +81,7 @@ component { /** * Single entry point, outputs the sitemap according to the incoming `rc.format` + * * @return { data, contentType } */ private struct function _index( event, rc, prc ){ diff --git a/modules/contentbox/modules_user/Hello/widgets/Hello.cfc b/modules/contentbox/modules_user/Hello/widgets/Hello.cfc index b5865a6091..f341feb6ab 100644 --- a/modules/contentbox/modules_user/Hello/widgets/Hello.cfc +++ b/modules/contentbox/modules_user/Hello/widgets/Hello.cfc @@ -17,6 +17,7 @@ component extends="contentbox.models.ui.BaseWidget" singleton { /** * Give you a nice welcome in Spanish + * * @titleLevel The H{level} to use, by default we use H2 */ any function renderIt( string titleLevel = "2" ){ diff --git a/modules/contentbox/seeders/BaseSeeder.cfc b/modules/contentbox/seeders/BaseSeeder.cfc index 6a805350e5..2f8807ac5a 100644 --- a/modules/contentbox/seeders/BaseSeeder.cfc +++ b/modules/contentbox/seeders/BaseSeeder.cfc @@ -1,4 +1,4 @@ -abstract component { +abstract component { // DI property name="packageService" inject="PackageService"; diff --git a/modules/contentbox/themes/default/Theme.cfc b/modules/contentbox/themes/default/Theme.cfc index 80ab9a0976..4f23bb5d86 100644 --- a/modules/contentbox/themes/default/Theme.cfc +++ b/modules/contentbox/themes/default/Theme.cfc @@ -330,8 +330,10 @@ component { /** * loadHelpFile - helper function for loading html help into a variable for modal + * * @helpFileName - the name of the file to read and return * @helpFilePath - the relative directory for the help files. Defaulting to ./includes/help/ inside the theme. + * * @return the contents of the file or empty string if the file does not exist */ function loadHelpFile( required string helpFileName, string helpFilePath = "includes/help/" ){ diff --git a/modules/contentbox/widgets/Archives.cfc b/modules/contentbox/widgets/Archives.cfc index 8910472746..3e773e024f 100644 --- a/modules/contentbox/widgets/Archives.cfc +++ b/modules/contentbox/widgets/Archives.cfc @@ -24,10 +24,11 @@ component extends="contentbox.models.ui.BaseWidget" singleton { /** * Show the blog archives - * @dropdown.hint Display as a dropdown or a list, default is list + * + * @dropdown.hint Display as a dropdown or a list, default is list * @showPostCount.hint Show post counts or not, default is true - * @title.hint The title to show before the dropdown or list, defaults to H2 - * @titleLevel.hint The H{level} to use, by default we use H2 + * @title.hint The title to show before the dropdown or list, defaults to H2 + * @titleLevel.hint The H{level} to use, by default we use H2 */ any function renderIt( boolean dropdown = false, @@ -72,9 +73,7 @@ component extends="contentbox.models.ui.BaseWidget" singleton { ); // iterate and create for ( var x = 1; x lte arrayLen( arguments.archives ); x++ ) { - var thisDate = arguments.archives[ x ][ "year" ] & "-" & arguments.archives[ x ][ - "month" - ] & "-1"; + var thisDate = arguments.archives[ x ][ "year" ] & "-" & arguments.archives[ x ][ "month" ] & "-1"; writeOutput( "
    - - - -
    - - #html.select( - name : "sslOnly", - options : "Yes,No", - selectedValue : yesNoFormat( prc.oContent.getSSLOnly() ), - class : "form-control input-sm" - )# -
    -
    -
    @@ -139,4 +122,4 @@ #html.hiddenField( name="parentContent", value=prc.parentcontentID )# - \ No newline at end of file + diff --git a/modules/contentbox/modules/contentbox-admin/views/pages/indexTable.cfm b/modules/contentbox/modules/contentbox-admin/views/pages/indexTable.cfm index b392e131cf..e5bb450083 100644 --- a/modules/contentbox/modules/contentbox-admin/views/pages/indexTable.cfm +++ b/modules/contentbox/modules/contentbox-admin/views/pages/indexTable.cfm @@ -112,11 +112,6 @@ - - - - -
    @@ -292,4 +287,4 @@ Total Records: #prc.contentCount# - \ No newline at end of file + diff --git a/modules/contentbox/modules/contentbox-ui/handlers/page.cfc b/modules/contentbox/modules/contentbox-ui/handlers/page.cfc index c7d10ba23c..1eb6853799 100644 --- a/modules/contentbox/modules/contentbox-ui/handlers/page.cfc +++ b/modules/contentbox/modules/contentbox-ui/handlers/page.cfc @@ -20,11 +20,11 @@ component extends="content" { /** * Pre handler for pages * - * @event - * @action + * @event + * @action * @eventArguments - * @rc - * @prc + * @rc + * @prc */ function preHandler( event, action, eventArguments, rc, prc ){ super.preHandler( argumentCollection = arguments ); @@ -34,8 +34,8 @@ component extends="content" { * Preview a page * * @event - * @rc - * @prc + * @rc + * @prc */ function preview( event, rc, prc ){ // Run parent preview @@ -93,9 +93,9 @@ component extends="content" { /** * Around page advice that provides caching and multi-output format * - * @event - * @rc - * @prc + * @event + * @rc + * @prc * @eventArguments */ function aroundIndex( event, rc, prc, eventArguments ){ @@ -110,8 +110,8 @@ component extends="content" { * Present pages in the UI * * @event - * @rc - * @prc + * @rc + * @prc */ function index( event, rc, prc ){ // incoming params @@ -146,12 +146,6 @@ component extends="content" { // Check if loaded and also the ancestry is ok as per hiearchical URls if ( prc.page.isLoaded() ) { - // Verify SSL? - if ( prc.page.getSSLOnly() and !event.isSSL() ) { - log.warn( "Page requested: #incomingURL# without SSL and SSL required. Relocating..." ); - relocate( event = incomingURL, ssl = true ); - return; - } // Record hit variables.pageService.updateHits( prc.page ); // Retrieve Comments @@ -211,8 +205,8 @@ component extends="content" { * Content search * * @event - * @rc - * @prc + * @rc + * @prc * * @return HTML */ @@ -267,8 +261,8 @@ component extends="content" { * RSS Feeds * * @event - * @rc - * @prc + * @rc + * @prc */ function rss( event, rc, prc ){ // params @@ -295,8 +289,8 @@ component extends="content" { * Comment Form Post * * @event - * @rc - * @prc + * @rc + * @prc */ function commentPost( event, rc, prc ){ // incoming params diff --git a/modules/contentbox/seeders/mockdata/pages.json b/modules/contentbox/seeders/mockdata/pages.json index cbdfe54661..ece4df9f70 100644 --- a/modules/contentbox/seeders/mockdata/pages.json +++ b/modules/contentbox/seeders/mockdata/pages.json @@ -5,8 +5,7 @@ "mobileLayout": "", "order": 6, "showInMenu": 1, - "excerpt": "", - "SSLOnly": 0 + "excerpt": "" }, { "contentID": "0e35bbec-a441-11eb-ab6f-0290cc502160", @@ -14,8 +13,7 @@ "mobileLayout": "", "order": 3, "showInMenu": 1, - "excerpt": "", - "SSLOnly": 0 + "excerpt": "" }, { "contentID": "0e35bbec-a441-11eb-ab6f-0290cc502162", @@ -23,8 +21,7 @@ "mobileLayout": "", "order": 5, "showInMenu": 1, - "excerpt": "", - "SSLOnly": 0 + "excerpt": "" }, { "contentID": "0e35bbec-a441-11eb-ab6f-0290cc502189", @@ -32,8 +29,7 @@ "mobileLayout": "", "order": 4, "showInMenu": 1, - "excerpt": "", - "SSLOnly": 0 + "excerpt": "" }, { "contentID": "0e35bbec-a441-11eb-ab6f-0290cc502190", @@ -41,8 +37,7 @@ "mobileLayout": "", "order": 0, "showInMenu": 1, - "excerpt": "", - "SSLOnly": 0 + "excerpt": "" }, { "contentID": "0e35bbec-a441-11eb-ab6f-0290cc502191", @@ -50,8 +45,7 @@ "mobileLayout": "", "order": 0, "showInMenu": 1, - "excerpt": "", - "SSLOnly": 0 + "excerpt": "" }, { "contentID": "0e35bbec-a441-11eb-ab6f-0290cc502192", @@ -59,8 +53,7 @@ "mobileLayout": "", "order": 2, "showInMenu": 0, - "excerpt": "", - "SSLOnly": 0 + "excerpt": "" }, { "contentID": "0e35bbec-a441-11eb-ab6f-0290cc502206", @@ -68,8 +61,7 @@ "mobileLayout": "", "order": 1, "showInMenu": 1, - "excerpt": "", - "SSLOnly": 0 + "excerpt": "" }, { "contentID": "0e35bbec-a441-11eb-ab6f-0290cc502207", @@ -77,8 +69,7 @@ "mobileLayout": "", "order": 2, "showInMenu": 1, - "excerpt": "", - "SSLOnly": 0 + "excerpt": "" }, { "contentID": "0e35bbec-a441-11eb-ab6f-0290cc502208", @@ -86,8 +77,7 @@ "mobileLayout": "", "order": 1, "showInMenu": 1, - "excerpt": "", - "SSLOnly": 0 + "excerpt": "" }, { "contentID": "0e35bbec-a441-11eb-ab6f-0290cc502209", @@ -95,8 +85,7 @@ "mobileLayout": "", "order": 2, "showInMenu": 1, - "excerpt": "", - "SSLOnly": 0 + "excerpt": "" }, { "contentID": "0e35bbec-a441-11eb-ab6f-0290cc502210", @@ -104,8 +93,7 @@ "mobileLayout": "", "order": 6, "showInMenu": 1, - "excerpt": "", - "SSLOnly": 0 + "excerpt": "" }, { "contentID": "0e35bbec-a441-11eb-ab6f-0290cc502211", @@ -113,8 +101,7 @@ "mobileLayout": "", "order": 4, "showInMenu": 1, - "excerpt": "", - "SSLOnly": 0 + "excerpt": "" }, { "contentID": "0e35bbec-a441-11eb-ab6f-0290cc502212", @@ -122,8 +109,7 @@ "mobileLayout": "", "order": 8, "showInMenu": 1, - "excerpt": "", - "SSLOnly": 0 + "excerpt": "" }, { "contentID": "0e35bbec-a441-11eb-ab6f-0290cc502213", @@ -131,8 +117,7 @@ "mobileLayout": "", "order": 1, "showInMenu": 1, - "excerpt": "", - "SSLOnly": 0 + "excerpt": "" }, { "contentID": "0e35bbec-a441-11eb-ab6f-0290cc502214", @@ -140,8 +125,7 @@ "mobileLayout": "", "order": 0, "showInMenu": 1, - "excerpt": "", - "SSLOnly": 0 + "excerpt": "" }, { "contentID": "0e35bbec-a441-11eb-ab6f-0290cc502215", @@ -149,8 +133,7 @@ "mobileLayout": "", "order": 0, "showInMenu": 1, - "excerpt": "", - "SSLOnly": 0 + "excerpt": "" }, { "contentID": "0e35bbec-a441-11eb-ab6f-0290cc502216", @@ -158,8 +141,7 @@ "mobileLayout": "", "order": 0, "showInMenu": 1, - "excerpt": "", - "SSLOnly": 0 + "excerpt": "" }, { "contentID": "0e35bbec-a441-11eb-ab6f-0290cc502217", @@ -167,8 +149,7 @@ "mobileLayout": "", "order": 0, "showInMenu": 1, - "excerpt": "", - "SSLOnly": 0 + "excerpt": "" }, { "contentID": "0e35bbec-a441-11eb-ab6f-0290cc502218", @@ -176,7 +157,6 @@ "mobileLayout": "", "order": 0, "showInMenu": 1, - "excerpt": "", - "SSLOnly": 0 + "excerpt": "" } -] \ No newline at end of file +] diff --git a/tests/resources/sql/mysql/contentbox.sql b/tests/resources/sql/mysql/contentbox.sql index 7e2df9b50a..c5907d19a7 100644 --- a/tests/resources/sql/mysql/contentbox.sql +++ b/tests/resources/sql/mysql/contentbox.sql @@ -7,7 +7,7 @@ # # Host: 127.0.0.1 (MySQL 5.7.22) # Database: contentbox -# Generation Time: 2022-02-18 20:07:54 +0000 +# Generation Time: 2022-02-18 20:12:42 +0000 # ************************************************************ USE `contentbox`; @@ -903,39 +903,37 @@ CREATE TABLE `cb_page` ( `order` int(11) DEFAULT '0', `showInMenu` bit(1) NOT NULL DEFAULT b'1', `excerpt` longtext, - `SSLOnly` bit(1) NOT NULL DEFAULT b'0', `contentID` char(36) CHARACTER SET utf8 NOT NULL, PRIMARY KEY (`contentID`), KEY `idx_showInMenu` (`showInMenu`), - KEY `idx_ssl` (`SSLOnly`), CONSTRAINT `fk_cb_page_contentID` FOREIGN KEY (`contentID`) REFERENCES `cb_content` (`contentID`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; LOCK TABLES `cb_page` WRITE; /*!40000 ALTER TABLE `cb_page` DISABLE KEYS */; -INSERT INTO `cb_page` (`layout`, `mobileLayout`, `order`, `showInMenu`, `excerpt`, `SSLOnly`, `contentID`) +INSERT INTO `cb_page` (`layout`, `mobileLayout`, `order`, `showInMenu`, `excerpt`, `contentID`) VALUES - ('pages','',6,b'1','',b'0','779cd2de-a444-11eb-ab6f-0290cc502ae3'), - ('-no-layout-','',3,b'1','',b'0','779cd432-a444-11eb-ab6f-0290cc502ae3'), - ('pagesNoSidebar','',5,b'1','',b'0','779cd4dc-a444-11eb-ab6f-0290cc502ae3'), - ('pages','',4,b'1','',b'0','779cd806-a444-11eb-ab6f-0290cc502ae3'), - ('pages','',0,b'1','',b'0','779cd8b0-a444-11eb-ab6f-0290cc502ae3'), - ('pages','',0,b'1','',b'0','779cd950-a444-11eb-ab6f-0290cc502ae3'), - ('pages','',2,b'0','',b'0','779cd9fa-a444-11eb-ab6f-0290cc502ae3'), - ('pages','',1,b'1','',b'0','779cdaa4-a444-11eb-ab6f-0290cc502ae3'), - ('pages','',2,b'1','',b'0','779cdb4e-a444-11eb-ab6f-0290cc502ae3'), - ('pages','',1,b'1','',b'0','779cdbee-a444-11eb-ab6f-0290cc502ae3'), - ('pages','',2,b'1','',b'0','779cdc8e-a444-11eb-ab6f-0290cc502ae3'), - ('pages','',6,b'1','',b'0','779cdd38-a444-11eb-ab6f-0290cc502ae3'), - ('pages','',4,b'1','',b'0','779cddd8-a444-11eb-ab6f-0290cc502ae3'), - ('pages','',8,b'1','',b'0','779cde82-a444-11eb-ab6f-0290cc502ae3'), - ('pages','',1,b'1','',b'0','779cdf22-a444-11eb-ab6f-0290cc502ae3'), - ('pages','',0,b'1','',b'0','779cdfc2-a444-11eb-ab6f-0290cc502ae3'), - ('pages','',0,b'1','',b'0','779ce06c-a444-11eb-ab6f-0290cc502ae3'), - ('pages','',0,b'1','',b'0','779ce10c-a444-11eb-ab6f-0290cc502ae3'), - ('pages','',0,b'1','',b'0','779ce1ac-a444-11eb-ab6f-0290cc502ae3'), - ('pages','',0,b'1','',b'0','779ce256-a444-11eb-ab6f-0290cc502ae3'); + ('pages','',6,b'1','','779cd2de-a444-11eb-ab6f-0290cc502ae3'), + ('-no-layout-','',3,b'1','','779cd432-a444-11eb-ab6f-0290cc502ae3'), + ('pagesNoSidebar','',5,b'1','','779cd4dc-a444-11eb-ab6f-0290cc502ae3'), + ('pages','',4,b'1','','779cd806-a444-11eb-ab6f-0290cc502ae3'), + ('pages','',0,b'1','','779cd8b0-a444-11eb-ab6f-0290cc502ae3'), + ('pages','',0,b'1','','779cd950-a444-11eb-ab6f-0290cc502ae3'), + ('pages','',2,b'0','','779cd9fa-a444-11eb-ab6f-0290cc502ae3'), + ('pages','',1,b'1','','779cdaa4-a444-11eb-ab6f-0290cc502ae3'), + ('pages','',2,b'1','','779cdb4e-a444-11eb-ab6f-0290cc502ae3'), + ('pages','',1,b'1','','779cdbee-a444-11eb-ab6f-0290cc502ae3'), + ('pages','',2,b'1','','779cdc8e-a444-11eb-ab6f-0290cc502ae3'), + ('pages','',6,b'1','','779cdd38-a444-11eb-ab6f-0290cc502ae3'), + ('pages','',4,b'1','','779cddd8-a444-11eb-ab6f-0290cc502ae3'), + ('pages','',8,b'1','','779cde82-a444-11eb-ab6f-0290cc502ae3'), + ('pages','',1,b'1','','779cdf22-a444-11eb-ab6f-0290cc502ae3'), + ('pages','',0,b'1','','779cdfc2-a444-11eb-ab6f-0290cc502ae3'), + ('pages','',0,b'1','','779ce06c-a444-11eb-ab6f-0290cc502ae3'), + ('pages','',0,b'1','','779ce10c-a444-11eb-ab6f-0290cc502ae3'), + ('pages','',0,b'1','','779ce1ac-a444-11eb-ab6f-0290cc502ae3'), + ('pages','',0,b'1','','779ce256-a444-11eb-ab6f-0290cc502ae3'); /*!40000 ALTER TABLE `cb_page` ENABLE KEYS */; UNLOCK TABLES; From 59751ec244cf908714d82e73510649df7af47059 Mon Sep 17 00:00:00 2001 From: jclausen Date: Fri, 18 Feb 2022 20:29:35 +0000 Subject: [PATCH 062/100] Apply cfformat changes --- .../models/comments/CommentService.cfc | 6 +--- modules/contentbox/models/system/Site.cfc | 2 +- .../modules/contentbox-ui/handlers/page.cfc | 34 +++++++++---------- modules/contentbox/seeders/BaseSeeder.cfc | 2 +- 4 files changed, 20 insertions(+), 24 deletions(-) diff --git a/modules/contentbox/models/comments/CommentService.cfc b/modules/contentbox/models/comments/CommentService.cfc index 45e885e14f..c78f451736 100755 --- a/modules/contentbox/models/comments/CommentService.cfc +++ b/modules/contentbox/models/comments/CommentService.cfc @@ -285,11 +285,7 @@ component extends="cborm.models.VirtualEntityService" singleton { } // Check if user has already an approved comment. If they do, then approve them - if ( - inSettings.cb_comments_moderation_whitelist AND userHasPreviousAcceptedComment( - inComment.getAuthorEmail() - ) - ) { + if ( inSettings.cb_comments_moderation_whitelist AND userHasPreviousAcceptedComment( inComment.getAuthorEmail() ) ) { inComment.setIsApproved( true ); return true; } diff --git a/modules/contentbox/models/system/Site.cfc b/modules/contentbox/models/system/Site.cfc index 7b3e1992d4..abe8c6e552 100644 --- a/modules/contentbox/models/system/Site.cfc +++ b/modules/contentbox/models/system/Site.cfc @@ -501,7 +501,7 @@ component */ private function getServerPort(){ var headers = getHTTPRequestData( false ).headers; - if( structKeyExists( headers, "x-forwarded-port" ) && len( headers[ "x-forwarded-port" ] ) ){ + if ( structKeyExists( headers, "x-forwarded-port" ) && len( headers[ "x-forwarded-port" ] ) ) { return headers[ "x-forwarded-port" ]; } return cgi.server_port; diff --git a/modules/contentbox/modules/contentbox-ui/handlers/page.cfc b/modules/contentbox/modules/contentbox-ui/handlers/page.cfc index 1eb6853799..0a9bc0c9c0 100644 --- a/modules/contentbox/modules/contentbox-ui/handlers/page.cfc +++ b/modules/contentbox/modules/contentbox-ui/handlers/page.cfc @@ -20,11 +20,11 @@ component extends="content" { /** * Pre handler for pages * - * @event - * @action + * @event + * @action * @eventArguments - * @rc - * @prc + * @rc + * @prc */ function preHandler( event, action, eventArguments, rc, prc ){ super.preHandler( argumentCollection = arguments ); @@ -34,8 +34,8 @@ component extends="content" { * Preview a page * * @event - * @rc - * @prc + * @rc + * @prc */ function preview( event, rc, prc ){ // Run parent preview @@ -93,9 +93,9 @@ component extends="content" { /** * Around page advice that provides caching and multi-output format * - * @event - * @rc - * @prc + * @event + * @rc + * @prc * @eventArguments */ function aroundIndex( event, rc, prc, eventArguments ){ @@ -110,8 +110,8 @@ component extends="content" { * Present pages in the UI * * @event - * @rc - * @prc + * @rc + * @prc */ function index( event, rc, prc ){ // incoming params @@ -205,8 +205,8 @@ component extends="content" { * Content search * * @event - * @rc - * @prc + * @rc + * @prc * * @return HTML */ @@ -261,8 +261,8 @@ component extends="content" { * RSS Feeds * * @event - * @rc - * @prc + * @rc + * @prc */ function rss( event, rc, prc ){ // params @@ -289,8 +289,8 @@ component extends="content" { * Comment Form Post * * @event - * @rc - * @prc + * @rc + * @prc */ function commentPost( event, rc, prc ){ // incoming params diff --git a/modules/contentbox/seeders/BaseSeeder.cfc b/modules/contentbox/seeders/BaseSeeder.cfc index 6441f463fa..bcebbbdb25 100644 --- a/modules/contentbox/seeders/BaseSeeder.cfc +++ b/modules/contentbox/seeders/BaseSeeder.cfc @@ -1,4 +1,4 @@ -abstract component { +abstract component { // DI property name="packageService" inject="PackageService"; From 00805904b57729013469b92e9581f93b1f7cee73 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Wed, 2 Mar 2022 10:08:10 -0600 Subject: [PATCH 063/100] ability to choose version to update to in updater. --- build/patches/5.0.0/Updater.cfc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build/patches/5.0.0/Updater.cfc b/build/patches/5.0.0/Updater.cfc index 12fe76d31c..d1ddc7de74 100644 --- a/build/patches/5.0.0/Updater.cfc +++ b/build/patches/5.0.0/Updater.cfc @@ -28,7 +28,11 @@ component { /** * Run the updater */ - function run(){ + function run( version ){ + // Override the incoming version if needed + if( !isNull( arguments.version ) ){ + variables.targetVersion = arguments.version; + } print.blueLine( "This task will update your ContentBox 4 installation to a ContentBox 5 installation." ) .blueLine( "Please make a backup of your source and your database now. " ) From eafde4e996f58db191b4c5cf786ba3ba877f8949 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Wed, 2 Mar 2022 11:34:41 -0600 Subject: [PATCH 064/100] fixing updater to leverage the 5.1 box scripts --- build/patches/5.0.0/Updater.cfc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/patches/5.0.0/Updater.cfc b/build/patches/5.0.0/Updater.cfc index d1ddc7de74..62682dcfba 100644 --- a/build/patches/5.0.0/Updater.cfc +++ b/build/patches/5.0.0/Updater.cfc @@ -71,7 +71,7 @@ component { // Run Migrations print.blueLine( "Migrating your database to version: #variables.targetVersion#..." ).toConsole(); - command( "migrate up" ).run(); + command( "run-script contentbox:migrate:up" ).run(); print.greenLine( "√ Database migrated! Let's do some code now." ).toConsole(); // Update ColdBox From e67248945b3946d7301276b431b1d849cb4853de Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Wed, 2 Mar 2022 11:35:24 -0600 Subject: [PATCH 065/100] fixing nullable columns on the migrations from v4 --- .../migrations/2020_08_24_150933_v5Upgrade.cfc | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/modules/contentbox/migrations/2020_08_24_150933_v5Upgrade.cfc b/modules/contentbox/migrations/2020_08_24_150933_v5Upgrade.cfc index f5d722d7b1..45c1fe70ac 100755 --- a/modules/contentbox/migrations/2020_08_24_150933_v5Upgrade.cfc +++ b/modules/contentbox/migrations/2020_08_24_150933_v5Upgrade.cfc @@ -97,8 +97,8 @@ component { schema.alter( "cb_content", function( table ){ table.modifyColumn( "title", table.string( "title", 500 ) ); table.modifyColumn( "slug", table.string( "slug", 500 ) ); - table.modifyColumn( "featuredImage", table.string( "featuredImage", 500 ) ); - table.modifyColumn( "featuredImageURL", table.string( "featuredImageURL", 500 ) ); + table.modifyColumn( "featuredImage", table.string( "featuredImage", 500 ).nullable() ); + table.modifyColumn( "featuredImageURL", table.string( "featuredImageURL", 500 ).nullable() ); // Rebuild Indexes table.index( [ "slug" ], "idx_slug" ); table.index( [ "slug", "isPublished" ], "idx_publishedSlug" ); @@ -307,7 +307,7 @@ component { .string( "FK_siteID", 36 ) .references( "siteID" ) .onTable( "cb_site" ) - ) + ); } ); var allSettings = arguments.query @@ -320,7 +320,6 @@ component { return results; }, {} ); - var initialSiteIdentifier = uuidLib.randomUUID().toString(); arguments.query .newQuery() @@ -338,11 +337,11 @@ component { "keywords" : allSettings.cb_site_keywords, "tagline" : allSettings.cb_site_tagline, "domainRegex" : "127\.0\.0\.1", - "isBlogEnabled" : !allSettings.cb_site_disable_blog, - "isSitemapEnabled" : allSettings.cb_site_sitemap, - "poweredByHeader" : allSettings.cb_site_poweredby, - "adminBar" : allSettings.cb_site_adminbar, - "isSSL" : allSettings.cb_admin_ssl, + "isBlogEnabled" : !allSettings.cb_site_disable_blog ? 0 : 1, + "isSitemapEnabled" : allSettings.cb_site_sitemap ? 1 : 0, + "poweredByHeader" : allSettings.cb_site_poweredby ? 1 : 0, + "adminBar" : allSettings.cb_site_adminbar ? 1 : 0, + "isSSL" : allSettings.cb_admin_ssl ? 1 : 0, "activeTheme" : allSettings.cb_site_theme, "domain" : "127.0.0.1", "notificationEmails" : allSettings.cb_site_email From c3bf2f72412be0dfa1c0b7424a68304b6e6e8036 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 3 Mar 2022 11:56:02 -0600 Subject: [PATCH 066/100] fix setup commandbox to do box.zip cleanup --- .github/workflows/ci.yml | 4 ++-- .github/workflows/pr.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6af699822f..753f6519f6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,7 +39,7 @@ jobs: java-version: "11" - name: Setup CommandBox CLI - uses: Ortus-Solutions/setup-commandbox@v2.0.0 + uses: Ortus-Solutions/setup-commandbox@v2.0.1 - name: Setup .env For Runner run: | @@ -178,7 +178,7 @@ jobs: java-version: "11" - name: Setup CommandBox CLI - uses: Ortus-Solutions/setup-commandbox@v2.0.0 + uses: Ortus-Solutions/setup-commandbox@v2.0.1 with: forgeboxAPIKey: ${{ secrets.FORGEBOX_API_TOKEN }} diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 7832754575..f90d660f7b 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -39,7 +39,7 @@ jobs: java-version: "11" - name: Setup CommandBox CLI - uses: Ortus-Solutions/setup-commandbox@v2.0.0 + uses: Ortus-Solutions/setup-commandbox@v2.0.1 - name: Setup .env For Runner run: | From f643b5f220d3fa99c5db0e2350d4901ae2cd98df Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Mon, 7 Mar 2022 16:02:36 -0600 Subject: [PATCH 067/100] CONTENTBOX-1394 Create the migration to remove the page sslOnly bit --- ...3_07_155812_v5.1.0_page_sslonly_removals.cfc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 modules/contentbox/migrations/2022_03_07_155812_v5.1.0_page_sslonly_removals.cfc diff --git a/modules/contentbox/migrations/2022_03_07_155812_v5.1.0_page_sslonly_removals.cfc b/modules/contentbox/migrations/2022_03_07_155812_v5.1.0_page_sslonly_removals.cfc new file mode 100755 index 0000000000..348e70cc29 --- /dev/null +++ b/modules/contentbox/migrations/2022_03_07_155812_v5.1.0_page_sslonly_removals.cfc @@ -0,0 +1,17 @@ +/** + * This migration ... + * + * @see CONTENTBOX-1394 - https://ortussolutions.atlassian.net/browse/CONTENTBOX-1394 + * @version 5.1.0 + * @author Davis Vega + */ +component { + + function up( schema, qb ){ + // Remove the sslonly column from the `cb_page` table + } + + function down( schema, qb ){ + } + +} From 41d6ed30c4e62b8e7df1ff9e9ca2260bd9426fe9 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Mon, 7 Mar 2022 16:27:31 -0600 Subject: [PATCH 068/100] invalid double logic on the disable blog bit for the migration --- modules/contentbox/migrations/2020_08_24_150933_v5Upgrade.cfc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/contentbox/migrations/2020_08_24_150933_v5Upgrade.cfc b/modules/contentbox/migrations/2020_08_24_150933_v5Upgrade.cfc index 45c1fe70ac..824262d19e 100755 --- a/modules/contentbox/migrations/2020_08_24_150933_v5Upgrade.cfc +++ b/modules/contentbox/migrations/2020_08_24_150933_v5Upgrade.cfc @@ -337,7 +337,7 @@ component { "keywords" : allSettings.cb_site_keywords, "tagline" : allSettings.cb_site_tagline, "domainRegex" : "127\.0\.0\.1", - "isBlogEnabled" : !allSettings.cb_site_disable_blog ? 0 : 1, + "isBlogEnabled" : allSettings.cb_site_disable_blog ? 0 : 1, "isSitemapEnabled" : allSettings.cb_site_sitemap ? 1 : 0, "poweredByHeader" : allSettings.cb_site_poweredby ? 1 : 0, "adminBar" : allSettings.cb_site_adminbar ? 1 : 0, From cd559c67608307bedb6249a855a0031cb8b15d85 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Mon, 7 Mar 2022 17:08:11 -0600 Subject: [PATCH 069/100] CONTENTBOX-1397 #resolve Settings should not be cached on a per host basis anymore, since a single instance manages 1 or x number of sites --- modules/contentbox/models/system/SettingService.cfc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/contentbox/models/system/SettingService.cfc b/modules/contentbox/models/system/SettingService.cfc index 59dcafbddc..e771459d24 100755 --- a/modules/contentbox/models/system/SettingService.cfc +++ b/modules/contentbox/models/system/SettingService.cfc @@ -21,6 +21,7 @@ component property name="siteService" inject="siteService@contentbox"; property name="cachebox" inject="cachebox"; property name="moduleSettings" inject="coldbox:setting:modules"; + property name="appName" inject="coldbox:setting:appName"; property name="contentboxSettings" inject="coldbox:moduleSettings:contentbox"; property name="log" inject="logbox:logger:{this}"; @@ -337,10 +338,10 @@ component } /** - * Retrieve a multi-tenant settings cache key + * The static key used for caching all the settings of this installation */ string function getSettingsCacheKey(){ - return "cb-settings-#CGI.HTTP_HOST#"; + return "cb-settings-container-#reReplace( variables.appName, "\s", "-", "all" )#"; } /** From df508f553fe0e4da5a90e832f652e163dcea5476 Mon Sep 17 00:00:00 2001 From: Davis Vega Date: Tue, 8 Mar 2022 08:42:17 -0600 Subject: [PATCH 070/100] I updated the migration to remove the SSLOnly column from cb_paga table --- ...2_03_07_155812_v5.1.0_page_sslonly_removals.cfc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/modules/contentbox/migrations/2022_03_07_155812_v5.1.0_page_sslonly_removals.cfc b/modules/contentbox/migrations/2022_03_07_155812_v5.1.0_page_sslonly_removals.cfc index 348e70cc29..9e50cc2715 100755 --- a/modules/contentbox/migrations/2022_03_07_155812_v5.1.0_page_sslonly_removals.cfc +++ b/modules/contentbox/migrations/2022_03_07_155812_v5.1.0_page_sslonly_removals.cfc @@ -1,5 +1,6 @@ /** - * This migration ... + * This migration will remove the 'SSLOnly' column from the 'cb_page' table because this bit was not nullable, + * had a default value and we won't use it anymore, So we need to remove it, else all page editing will fail. * * @see CONTENTBOX-1394 - https://ortussolutions.atlassian.net/browse/CONTENTBOX-1394 * @version 5.1.0 @@ -9,6 +10,17 @@ component { function up( schema, qb ){ // Remove the sslonly column from the `cb_page` table + transaction { + try { + schema.alter( "cb_page", ( table ) => { + table.dropColumn( "SSLOnly" ); + } ); + }catch ( any e ) { + transactionRollback(); + systemOutput( e.stacktrace, true ); + rethrow; + } + } } function down( schema, qb ){ From 2dd88e290179270c3a0ab288c0a65a4f10934908 Mon Sep 17 00:00:00 2001 From: DavisVega1990 Date: Tue, 8 Mar 2022 14:51:26 +0000 Subject: [PATCH 071/100] Apply cfformat changes --- ...07_155812_v5.1.0_page_sslonly_removals.cfc | 2 +- .../models/comments/CommentService.cfc | 6 +--- modules/contentbox/models/system/Site.cfc | 2 +- .../modules/contentbox-ui/handlers/page.cfc | 34 +++++++++---------- modules/contentbox/seeders/BaseSeeder.cfc | 2 +- 5 files changed, 21 insertions(+), 25 deletions(-) diff --git a/modules/contentbox/migrations/2022_03_07_155812_v5.1.0_page_sslonly_removals.cfc b/modules/contentbox/migrations/2022_03_07_155812_v5.1.0_page_sslonly_removals.cfc index 9e50cc2715..0a92bf59bf 100755 --- a/modules/contentbox/migrations/2022_03_07_155812_v5.1.0_page_sslonly_removals.cfc +++ b/modules/contentbox/migrations/2022_03_07_155812_v5.1.0_page_sslonly_removals.cfc @@ -15,7 +15,7 @@ component { schema.alter( "cb_page", ( table ) => { table.dropColumn( "SSLOnly" ); } ); - }catch ( any e ) { + } catch ( any e ) { transactionRollback(); systemOutput( e.stacktrace, true ); rethrow; diff --git a/modules/contentbox/models/comments/CommentService.cfc b/modules/contentbox/models/comments/CommentService.cfc index 45e885e14f..c78f451736 100755 --- a/modules/contentbox/models/comments/CommentService.cfc +++ b/modules/contentbox/models/comments/CommentService.cfc @@ -285,11 +285,7 @@ component extends="cborm.models.VirtualEntityService" singleton { } // Check if user has already an approved comment. If they do, then approve them - if ( - inSettings.cb_comments_moderation_whitelist AND userHasPreviousAcceptedComment( - inComment.getAuthorEmail() - ) - ) { + if ( inSettings.cb_comments_moderation_whitelist AND userHasPreviousAcceptedComment( inComment.getAuthorEmail() ) ) { inComment.setIsApproved( true ); return true; } diff --git a/modules/contentbox/models/system/Site.cfc b/modules/contentbox/models/system/Site.cfc index 7b3e1992d4..abe8c6e552 100644 --- a/modules/contentbox/models/system/Site.cfc +++ b/modules/contentbox/models/system/Site.cfc @@ -501,7 +501,7 @@ component */ private function getServerPort(){ var headers = getHTTPRequestData( false ).headers; - if( structKeyExists( headers, "x-forwarded-port" ) && len( headers[ "x-forwarded-port" ] ) ){ + if ( structKeyExists( headers, "x-forwarded-port" ) && len( headers[ "x-forwarded-port" ] ) ) { return headers[ "x-forwarded-port" ]; } return cgi.server_port; diff --git a/modules/contentbox/modules/contentbox-ui/handlers/page.cfc b/modules/contentbox/modules/contentbox-ui/handlers/page.cfc index 1eb6853799..0a9bc0c9c0 100644 --- a/modules/contentbox/modules/contentbox-ui/handlers/page.cfc +++ b/modules/contentbox/modules/contentbox-ui/handlers/page.cfc @@ -20,11 +20,11 @@ component extends="content" { /** * Pre handler for pages * - * @event - * @action + * @event + * @action * @eventArguments - * @rc - * @prc + * @rc + * @prc */ function preHandler( event, action, eventArguments, rc, prc ){ super.preHandler( argumentCollection = arguments ); @@ -34,8 +34,8 @@ component extends="content" { * Preview a page * * @event - * @rc - * @prc + * @rc + * @prc */ function preview( event, rc, prc ){ // Run parent preview @@ -93,9 +93,9 @@ component extends="content" { /** * Around page advice that provides caching and multi-output format * - * @event - * @rc - * @prc + * @event + * @rc + * @prc * @eventArguments */ function aroundIndex( event, rc, prc, eventArguments ){ @@ -110,8 +110,8 @@ component extends="content" { * Present pages in the UI * * @event - * @rc - * @prc + * @rc + * @prc */ function index( event, rc, prc ){ // incoming params @@ -205,8 +205,8 @@ component extends="content" { * Content search * * @event - * @rc - * @prc + * @rc + * @prc * * @return HTML */ @@ -261,8 +261,8 @@ component extends="content" { * RSS Feeds * * @event - * @rc - * @prc + * @rc + * @prc */ function rss( event, rc, prc ){ // params @@ -289,8 +289,8 @@ component extends="content" { * Comment Form Post * * @event - * @rc - * @prc + * @rc + * @prc */ function commentPost( event, rc, prc ){ // incoming params diff --git a/modules/contentbox/seeders/BaseSeeder.cfc b/modules/contentbox/seeders/BaseSeeder.cfc index 6441f463fa..bcebbbdb25 100644 --- a/modules/contentbox/seeders/BaseSeeder.cfc +++ b/modules/contentbox/seeders/BaseSeeder.cfc @@ -1,4 +1,4 @@ -abstract component { +abstract component { // DI property name="packageService" inject="PackageService"; From fd6508d2b64a82c2ac0f69bb4810048a6bc9e2b0 Mon Sep 17 00:00:00 2001 From: DavisVega1990 Date: Tue, 8 Mar 2022 14:54:02 +0000 Subject: [PATCH 072/100] Apply cfformat changes --- modules/contentbox/models/comments/CommentService.cfc | 6 +++++- modules/contentbox/seeders/BaseSeeder.cfc | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/contentbox/models/comments/CommentService.cfc b/modules/contentbox/models/comments/CommentService.cfc index c78f451736..45e885e14f 100755 --- a/modules/contentbox/models/comments/CommentService.cfc +++ b/modules/contentbox/models/comments/CommentService.cfc @@ -285,7 +285,11 @@ component extends="cborm.models.VirtualEntityService" singleton { } // Check if user has already an approved comment. If they do, then approve them - if ( inSettings.cb_comments_moderation_whitelist AND userHasPreviousAcceptedComment( inComment.getAuthorEmail() ) ) { + if ( + inSettings.cb_comments_moderation_whitelist AND userHasPreviousAcceptedComment( + inComment.getAuthorEmail() + ) + ) { inComment.setIsApproved( true ); return true; } diff --git a/modules/contentbox/seeders/BaseSeeder.cfc b/modules/contentbox/seeders/BaseSeeder.cfc index bcebbbdb25..6a805350e5 100644 --- a/modules/contentbox/seeders/BaseSeeder.cfc +++ b/modules/contentbox/seeders/BaseSeeder.cfc @@ -1,4 +1,4 @@ -abstract component { +abstract component { // DI property name="packageService" inject="PackageService"; From 2d0b77f7c59d4f9c79fbf678d851a92c3381e55f Mon Sep 17 00:00:00 2001 From: Davis Vega Date: Tue, 8 Mar 2022 09:45:30 -0600 Subject: [PATCH 073/100] I updated the cfsqltype values in each query and I added another delete query to cb_groupPermissions --- .../models/security/PermissionService.cfc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/modules/contentbox/models/security/PermissionService.cfc b/modules/contentbox/models/security/PermissionService.cfc index 48db2a14d1..5d6390f46a 100755 --- a/modules/contentbox/models/security/PermissionService.cfc +++ b/modules/contentbox/models/security/PermissionService.cfc @@ -33,7 +33,7 @@ component extends="cborm.models.VirtualEntityService" singleton { q.addParam( name = "permissionID", value = arguments.permissionID, - cfsqltype = "numeric" + cfsqltype = "varchar" ); q.execute(); // delete user relationships @@ -41,7 +41,15 @@ component extends="cborm.models.VirtualEntityService" singleton { q.addParam( name = "permissionID", value = arguments.permissionID, - cfsqltype = "numeric" + cfsqltype = "varchar" + ); + q.execute(); + // delete group permissions now + var q = new Query( sql = "delete from cb_groupPermissions where FK_permissionID = :permissionID" ); + q.addParam( + name = "permissionID", + value = arguments.permissionID, + cfsqltype = "varchar" ); q.execute(); // delete permission now @@ -49,7 +57,7 @@ component extends="cborm.models.VirtualEntityService" singleton { q.addParam( name = "permissionID", value = arguments.permissionID, - cfsqltype = "numeric" + cfsqltype = "varchar" ); q.execute(); } From cbeaf258b586a1f262fe0198ddc7ce66e99d001d Mon Sep 17 00:00:00 2001 From: DavisVega1990 Date: Tue, 8 Mar 2022 15:46:46 +0000 Subject: [PATCH 074/100] Apply cfformat changes --- modules/contentbox/models/comments/CommentService.cfc | 6 +----- modules/contentbox/seeders/BaseSeeder.cfc | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/modules/contentbox/models/comments/CommentService.cfc b/modules/contentbox/models/comments/CommentService.cfc index 45e885e14f..c78f451736 100755 --- a/modules/contentbox/models/comments/CommentService.cfc +++ b/modules/contentbox/models/comments/CommentService.cfc @@ -285,11 +285,7 @@ component extends="cborm.models.VirtualEntityService" singleton { } // Check if user has already an approved comment. If they do, then approve them - if ( - inSettings.cb_comments_moderation_whitelist AND userHasPreviousAcceptedComment( - inComment.getAuthorEmail() - ) - ) { + if ( inSettings.cb_comments_moderation_whitelist AND userHasPreviousAcceptedComment( inComment.getAuthorEmail() ) ) { inComment.setIsApproved( true ); return true; } diff --git a/modules/contentbox/seeders/BaseSeeder.cfc b/modules/contentbox/seeders/BaseSeeder.cfc index 6a805350e5..2f8807ac5a 100644 --- a/modules/contentbox/seeders/BaseSeeder.cfc +++ b/modules/contentbox/seeders/BaseSeeder.cfc @@ -1,4 +1,4 @@ -abstract component { +abstract component { // DI property name="packageService" inject="PackageService"; From b78fbff3afa1632bd4c125976f8e03e163a2bb02 Mon Sep 17 00:00:00 2001 From: Davis Vega Date: Tue, 8 Mar 2022 13:49:48 -0600 Subject: [PATCH 075/100] I updated the remove methods from Group permissions and roles --- .../handlers/permissionGroups.cfc | 18 +++++++++++------- .../contentbox-admin/handlers/roles.cfc | 15 +++++++++++---- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/modules/contentbox/modules/contentbox-admin/handlers/permissionGroups.cfc b/modules/contentbox/modules/contentbox-admin/handlers/permissionGroups.cfc index 883b6f452f..4b03bf5110 100755 --- a/modules/contentbox/modules/contentbox-admin/handlers/permissionGroups.cfc +++ b/modules/contentbox/modules/contentbox-admin/handlers/permissionGroups.cfc @@ -92,13 +92,17 @@ component extends="baseHandler" { function remove( event, rc, prc ){ // announce event announce( "cbadmin_prePermissionGroupRemove", { permissionGroupID : rc.permissionGroupID } ); - // Get requested role and remove permissions and authors - var oGroup = permissionGroupService - .get( id = rc.permissionGroupID ) - .clearPermissions() - .clearAuthors(); - // finally delete - permissionGroupService.delete( oGroup ); + + var allGroups = permissionGroupService.getAll( rc.permissionGroupID ); + + for(var oGroup in allGroups){ + // Get requested role and remove permissions and authors + oGroup.clearPermissions().clearAuthors(); + + // finally delete + permissionGroupService.delete( oGroup ); + } + // announce event announce( "cbadmin_postPermissionGroupRemove", { permissionGroupID : rc.permissionGroupID } ); // Message diff --git a/modules/contentbox/modules/contentbox-admin/handlers/roles.cfc b/modules/contentbox/modules/contentbox-admin/handlers/roles.cfc index b48f809985..e2a2e1b586 100755 --- a/modules/contentbox/modules/contentbox-admin/handlers/roles.cfc +++ b/modules/contentbox/modules/contentbox-admin/handlers/roles.cfc @@ -105,10 +105,17 @@ component extends="baseHandler" { function remove( event, rc, prc ){ // announce event announce( "cbadmin_preRoleRemove", { roleID : rc.roleID } ); - // Get requested role and remove permissions - var oRole = roleService.get( rc.roleID ).clearPermissions(); - // finally delete - roleService.delete( oRole ); + + var allRoles = roleService.getAll( rc.roleID ); + + for(var oRole in allRoles){ + // Get requested role and remove permissions + oRole.clearPermissions(); + + // finally delete + roleService.delete( oRole ); + } + // announce event announce( "cbadmin_postRoleRemove", { roleID : rc.roleID } ); // Message From 732ec9f92656ef3a0440675227a964f71fd271c6 Mon Sep 17 00:00:00 2001 From: DavisVega1990 Date: Tue, 8 Mar 2022 19:50:59 +0000 Subject: [PATCH 076/100] Apply cfformat changes --- modules/contentbox/models/comments/CommentService.cfc | 6 +----- .../contentbox-admin/handlers/permissionGroups.cfc | 6 +++--- .../modules/contentbox-admin/handlers/roles.cfc | 8 ++++---- modules/contentbox/seeders/BaseSeeder.cfc | 2 +- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/modules/contentbox/models/comments/CommentService.cfc b/modules/contentbox/models/comments/CommentService.cfc index 45e885e14f..c78f451736 100755 --- a/modules/contentbox/models/comments/CommentService.cfc +++ b/modules/contentbox/models/comments/CommentService.cfc @@ -285,11 +285,7 @@ component extends="cborm.models.VirtualEntityService" singleton { } // Check if user has already an approved comment. If they do, then approve them - if ( - inSettings.cb_comments_moderation_whitelist AND userHasPreviousAcceptedComment( - inComment.getAuthorEmail() - ) - ) { + if ( inSettings.cb_comments_moderation_whitelist AND userHasPreviousAcceptedComment( inComment.getAuthorEmail() ) ) { inComment.setIsApproved( true ); return true; } diff --git a/modules/contentbox/modules/contentbox-admin/handlers/permissionGroups.cfc b/modules/contentbox/modules/contentbox-admin/handlers/permissionGroups.cfc index 4b03bf5110..7f8d3b5f0c 100755 --- a/modules/contentbox/modules/contentbox-admin/handlers/permissionGroups.cfc +++ b/modules/contentbox/modules/contentbox-admin/handlers/permissionGroups.cfc @@ -95,12 +95,12 @@ component extends="baseHandler" { var allGroups = permissionGroupService.getAll( rc.permissionGroupID ); - for(var oGroup in allGroups){ + for ( var oGroup in allGroups ) { // Get requested role and remove permissions and authors oGroup.clearPermissions().clearAuthors(); - + // finally delete - permissionGroupService.delete( oGroup ); + permissionGroupService.delete( oGroup ); } // announce event diff --git a/modules/contentbox/modules/contentbox-admin/handlers/roles.cfc b/modules/contentbox/modules/contentbox-admin/handlers/roles.cfc index e2a2e1b586..6df27d5071 100755 --- a/modules/contentbox/modules/contentbox-admin/handlers/roles.cfc +++ b/modules/contentbox/modules/contentbox-admin/handlers/roles.cfc @@ -108,14 +108,14 @@ component extends="baseHandler" { var allRoles = roleService.getAll( rc.roleID ); - for(var oRole in allRoles){ + for ( var oRole in allRoles ) { // Get requested role and remove permissions oRole.clearPermissions(); - + // finally delete - roleService.delete( oRole ); + roleService.delete( oRole ); } - + // announce event announce( "cbadmin_postRoleRemove", { roleID : rc.roleID } ); // Message diff --git a/modules/contentbox/seeders/BaseSeeder.cfc b/modules/contentbox/seeders/BaseSeeder.cfc index 6a805350e5..2f8807ac5a 100644 --- a/modules/contentbox/seeders/BaseSeeder.cfc +++ b/modules/contentbox/seeders/BaseSeeder.cfc @@ -1,4 +1,4 @@ -abstract component { +abstract component { // DI property name="packageService" inject="PackageService"; From 098d0d67ee7b929fcaaf24b26157450012ba1138 Mon Sep 17 00:00:00 2001 From: DavisVega1990 Date: Tue, 8 Mar 2022 19:53:35 +0000 Subject: [PATCH 077/100] Apply cfformat changes --- modules/contentbox/models/comments/CommentService.cfc | 6 +++++- modules/contentbox/seeders/BaseSeeder.cfc | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/contentbox/models/comments/CommentService.cfc b/modules/contentbox/models/comments/CommentService.cfc index c78f451736..45e885e14f 100755 --- a/modules/contentbox/models/comments/CommentService.cfc +++ b/modules/contentbox/models/comments/CommentService.cfc @@ -285,7 +285,11 @@ component extends="cborm.models.VirtualEntityService" singleton { } // Check if user has already an approved comment. If they do, then approve them - if ( inSettings.cb_comments_moderation_whitelist AND userHasPreviousAcceptedComment( inComment.getAuthorEmail() ) ) { + if ( + inSettings.cb_comments_moderation_whitelist AND userHasPreviousAcceptedComment( + inComment.getAuthorEmail() + ) + ) { inComment.setIsApproved( true ); return true; } diff --git a/modules/contentbox/seeders/BaseSeeder.cfc b/modules/contentbox/seeders/BaseSeeder.cfc index 2f8807ac5a..bc9535ba28 100644 --- a/modules/contentbox/seeders/BaseSeeder.cfc +++ b/modules/contentbox/seeders/BaseSeeder.cfc @@ -1,4 +1,4 @@ -abstract component { +abstract component { // DI property name="packageService" inject="PackageService"; From 109f27a1008185b05a7bb5d906a602c6245ee849 Mon Sep 17 00:00:00 2001 From: Davis Vega Date: Tue, 8 Mar 2022 16:38:06 -0600 Subject: [PATCH 078/100] delete the transaction --- ...2_03_07_155812_v5.1.0_page_sslonly_removals.cfc | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/modules/contentbox/migrations/2022_03_07_155812_v5.1.0_page_sslonly_removals.cfc b/modules/contentbox/migrations/2022_03_07_155812_v5.1.0_page_sslonly_removals.cfc index 0a92bf59bf..c399ca8f55 100755 --- a/modules/contentbox/migrations/2022_03_07_155812_v5.1.0_page_sslonly_removals.cfc +++ b/modules/contentbox/migrations/2022_03_07_155812_v5.1.0_page_sslonly_removals.cfc @@ -10,17 +10,9 @@ component { function up( schema, qb ){ // Remove the sslonly column from the `cb_page` table - transaction { - try { - schema.alter( "cb_page", ( table ) => { - table.dropColumn( "SSLOnly" ); - } ); - } catch ( any e ) { - transactionRollback(); - systemOutput( e.stacktrace, true ); - rethrow; - } - } + schema.alter( "cb_page", ( table ) => { + table.dropColumn( "SSLOnly" ); + } ); } function down( schema, qb ){ From 1dc3a6a2b80df5dc9c40b25c5ca03b5c423ed311 Mon Sep 17 00:00:00 2001 From: DavisVega1990 Date: Tue, 8 Mar 2022 22:39:31 +0000 Subject: [PATCH 079/100] Apply cfformat changes --- modules/contentbox/models/comments/CommentService.cfc | 6 +----- modules/contentbox/seeders/BaseSeeder.cfc | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/modules/contentbox/models/comments/CommentService.cfc b/modules/contentbox/models/comments/CommentService.cfc index 45e885e14f..c78f451736 100755 --- a/modules/contentbox/models/comments/CommentService.cfc +++ b/modules/contentbox/models/comments/CommentService.cfc @@ -285,11 +285,7 @@ component extends="cborm.models.VirtualEntityService" singleton { } // Check if user has already an approved comment. If they do, then approve them - if ( - inSettings.cb_comments_moderation_whitelist AND userHasPreviousAcceptedComment( - inComment.getAuthorEmail() - ) - ) { + if ( inSettings.cb_comments_moderation_whitelist AND userHasPreviousAcceptedComment( inComment.getAuthorEmail() ) ) { inComment.setIsApproved( true ); return true; } diff --git a/modules/contentbox/seeders/BaseSeeder.cfc b/modules/contentbox/seeders/BaseSeeder.cfc index 6a805350e5..2f8807ac5a 100644 --- a/modules/contentbox/seeders/BaseSeeder.cfc +++ b/modules/contentbox/seeders/BaseSeeder.cfc @@ -1,4 +1,4 @@ -abstract component { +abstract component { // DI property name="packageService" inject="PackageService"; From 1b421307c3b41b38c506b929c44437934f2dcfee Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Tue, 8 Mar 2022 17:51:56 -0600 Subject: [PATCH 080/100] added gh release and changelog.md --- .github/workflows/gh-release.yml | 19 +++++++++++++++++++ changelog.md | 10 ++++++++++ 2 files changed, 29 insertions(+) create mode 100644 .github/workflows/gh-release.yml create mode 100644 changelog.md diff --git a/.github/workflows/gh-release.yml b/.github/workflows/gh-release.yml new file mode 100644 index 0000000000..5193ae57c8 --- /dev/null +++ b/.github/workflows/gh-release.yml @@ -0,0 +1,19 @@ +# Publish Github Release +name: Github Release + +on: + push: + tags: + - v[0-9]+.* + +jobs: + create-release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: taiki-e/create-gh-release-action@v1.5.0 + with: + # Produced by the build/Build.cfc + changelog: changelog.md + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/changelog.md b/changelog.md new file mode 100644 index 0000000000..0cbd505e2e --- /dev/null +++ b/changelog.md @@ -0,0 +1,10 @@ +# Changelog + +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.0] => 2022-MAR From f4a3b5e111e0e70b7217edfc42548f3c99e734bf Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Tue, 8 Mar 2022 17:52:30 -0600 Subject: [PATCH 081/100] slack channel change --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 753f6519f6..43e47cf42e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -263,7 +263,7 @@ jobs: if: ${{ always() }} uses: rtCamp/action-slack-notify@v2 env: - SLACK_CHANNEL: contentbox + SLACK_CHANNEL: coding SLACK_COLOR: ${{ job.status }} # or a specific color like 'green' or '#ff00ff' SLACK_ICON_EMOJI: ":bell:" SLACK_MESSAGE: 'ContentBox Built with ${{ job.status }}!' From 8b77a41a66fe40a60025f2505e6588e77f9ec103 Mon Sep 17 00:00:00 2001 From: Javier Quintero Date: Fri, 11 Mar 2022 13:18:48 -0600 Subject: [PATCH 082/100] Fix issue when resetting an user passord --- modules/contentbox/models/security/SecurityService.cfc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/contentbox/models/security/SecurityService.cfc b/modules/contentbox/models/security/SecurityService.cfc index 2483c98882..6ef7a14936 100755 --- a/modules/contentbox/models/security/SecurityService.cfc +++ b/modules/contentbox/models/security/SecurityService.cfc @@ -249,7 +249,7 @@ component singleton { // Check if an issuer was passed if ( !isNull( arguments.issuer ) ) { - bodyTokens.issuedBy = arguments.issuer.getName(); + bodyTokens.issuedBy = arguments.issuer.getFullName(); bodyTokens.issuedEmail = arguments.issuer.getEmail(); } From 90c453d73c83e7980a282f62f64383b2d88a63c6 Mon Sep 17 00:00:00 2001 From: quinteroj Date: Fri, 11 Mar 2022 19:19:54 +0000 Subject: [PATCH 083/100] Apply cfformat changes --- modules/contentbox/models/comments/CommentService.cfc | 6 +++++- modules/contentbox/seeders/BaseSeeder.cfc | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/contentbox/models/comments/CommentService.cfc b/modules/contentbox/models/comments/CommentService.cfc index c78f451736..45e885e14f 100755 --- a/modules/contentbox/models/comments/CommentService.cfc +++ b/modules/contentbox/models/comments/CommentService.cfc @@ -285,7 +285,11 @@ component extends="cborm.models.VirtualEntityService" singleton { } // Check if user has already an approved comment. If they do, then approve them - if ( inSettings.cb_comments_moderation_whitelist AND userHasPreviousAcceptedComment( inComment.getAuthorEmail() ) ) { + if ( + inSettings.cb_comments_moderation_whitelist AND userHasPreviousAcceptedComment( + inComment.getAuthorEmail() + ) + ) { inComment.setIsApproved( true ); return true; } diff --git a/modules/contentbox/seeders/BaseSeeder.cfc b/modules/contentbox/seeders/BaseSeeder.cfc index 6441f463fa..bcebbbdb25 100644 --- a/modules/contentbox/seeders/BaseSeeder.cfc +++ b/modules/contentbox/seeders/BaseSeeder.cfc @@ -1,4 +1,4 @@ -abstract component { +abstract component { // DI property name="packageService" inject="PackageService"; From 1f4d0fea21cf41c618bbdb789a0bd3ad172efe9a Mon Sep 17 00:00:00 2001 From: quinteroj Date: Fri, 11 Mar 2022 19:22:12 +0000 Subject: [PATCH 084/100] Apply cfformat changes --- modules/contentbox/models/comments/CommentService.cfc | 6 +----- modules/contentbox/seeders/BaseSeeder.cfc | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/modules/contentbox/models/comments/CommentService.cfc b/modules/contentbox/models/comments/CommentService.cfc index 45e885e14f..c78f451736 100755 --- a/modules/contentbox/models/comments/CommentService.cfc +++ b/modules/contentbox/models/comments/CommentService.cfc @@ -285,11 +285,7 @@ component extends="cborm.models.VirtualEntityService" singleton { } // Check if user has already an approved comment. If they do, then approve them - if ( - inSettings.cb_comments_moderation_whitelist AND userHasPreviousAcceptedComment( - inComment.getAuthorEmail() - ) - ) { + if ( inSettings.cb_comments_moderation_whitelist AND userHasPreviousAcceptedComment( inComment.getAuthorEmail() ) ) { inComment.setIsApproved( true ); return true; } diff --git a/modules/contentbox/seeders/BaseSeeder.cfc b/modules/contentbox/seeders/BaseSeeder.cfc index bcebbbdb25..6a805350e5 100644 --- a/modules/contentbox/seeders/BaseSeeder.cfc +++ b/modules/contentbox/seeders/BaseSeeder.cfc @@ -1,4 +1,4 @@ -abstract component { +abstract component { // DI property name="packageService" inject="PackageService"; From 5c77a94177e102ef37ceab5c7b3b5216b2e09ad5 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Fri, 11 Mar 2022 16:51:49 -0600 Subject: [PATCH 085/100] small update to the contentbox:isntall script --- box.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/box.json b/box.json index 78b0900de0..c76dc382d6 100644 --- a/box.json +++ b/box.json @@ -65,7 +65,7 @@ "cfpm":"echo '\".engines/acf2021/WEB-INF/cfusion/bin/cfpm.sh\"' | run", "cfpm:install":"echo '\".engines/acf2021/WEB-INF/cfusion/bin/cfpm.sh\" install ${1}' | run", "install:2021":"run-script cfpm:install zip,orm,mysql,postgresql,sqlserver,document,feed", - "contentbox:install":"cd modules/contentbox && install", + "contentbox:install":"install && cd modules/contentbox && install", "contentbox:migrate:create":"migrate create name=${1} migrationsDirectory=modules/contentbox/migrations", "contentbox:migrate":"migrate up migrationsDirectory=modules/contentbox/migrations", "contentbox:migrate:up":"run-script contentbox:migrate", From c5991a5aaa77d38c13c46891354cffa274a4e9dd Mon Sep 17 00:00:00 2001 From: lmajano Date: Fri, 11 Mar 2022 23:04:34 +0000 Subject: [PATCH 086/100] Apply cfformat changes --- modules/contentbox/models/comments/CommentService.cfc | 6 +++++- modules/contentbox/seeders/BaseSeeder.cfc | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/contentbox/models/comments/CommentService.cfc b/modules/contentbox/models/comments/CommentService.cfc index c78f451736..45e885e14f 100755 --- a/modules/contentbox/models/comments/CommentService.cfc +++ b/modules/contentbox/models/comments/CommentService.cfc @@ -285,7 +285,11 @@ component extends="cborm.models.VirtualEntityService" singleton { } // Check if user has already an approved comment. If they do, then approve them - if ( inSettings.cb_comments_moderation_whitelist AND userHasPreviousAcceptedComment( inComment.getAuthorEmail() ) ) { + if ( + inSettings.cb_comments_moderation_whitelist AND userHasPreviousAcceptedComment( + inComment.getAuthorEmail() + ) + ) { inComment.setIsApproved( true ); return true; } diff --git a/modules/contentbox/seeders/BaseSeeder.cfc b/modules/contentbox/seeders/BaseSeeder.cfc index bcebbbdb25..6a805350e5 100644 --- a/modules/contentbox/seeders/BaseSeeder.cfc +++ b/modules/contentbox/seeders/BaseSeeder.cfc @@ -1,4 +1,4 @@ -abstract component { +abstract component { // DI property name="packageService" inject="PackageService"; From 94ce22c94e6c448fdf80309c8a4a9a23ecf04af6 Mon Sep 17 00:00:00 2001 From: Daniel Garcia Date: Tue, 15 Mar 2022 19:37:55 -0500 Subject: [PATCH 087/100] Update ContentBoxImporter.cfc Resolves issue with Windows and the slashes causing the descriptor.json not to be found. Also addresses an issue in descriptor.json when priority is null. This fix replaces the null value with 99 so that it can be processed. --- modules/contentbox/models/importers/ContentBoxImporter.cfc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/contentbox/models/importers/ContentBoxImporter.cfc b/modules/contentbox/models/importers/ContentBoxImporter.cfc index 640bffff8f..29c2d02695 100644 --- a/modules/contentbox/models/importers/ContentBoxImporter.cfc +++ b/modules/contentbox/models/importers/ContentBoxImporter.cfc @@ -68,6 +68,10 @@ component accessors=true { var contentBoxPath = variables.moduleSettings[ "contentbox" ].path; var customPath = variables.moduleSettings[ "contentbox-custom" ].path; + fileList = fileList.map( function( item ){ + return item.reReplace( "(\\|\/)", "", "all" ); + } ); + // now set values setFileNames( fileList ); setContentBoxPackagePath( arguments.importFile ); @@ -112,6 +116,7 @@ component accessors=true { overwriteFiles = true ); descriptorContents = fileRead( getTempDirectory() & "descriptor.json" ); + descriptorContents = replaceNoCase( descriptorContents, "null,", "99,", "all" ); } return !arguments.asObject ? descriptorContents : deserializeJSON( descriptorContents ); } From 37d797fe769a0bc5cce685a7111175c1cc4ca24f Mon Sep 17 00:00:00 2001 From: Daniel Garcia Date: Wed, 16 Mar 2022 10:28:46 -0500 Subject: [PATCH 088/100] Prevent running from a users branch --- .github/workflows/pr.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index f90d660f7b..b282c81c64 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -105,6 +105,7 @@ jobs: format: name: Format + if: ${{ env.GITHUB_REPOSITORY == 'ortus-solutions/ContentBox' }} runs-on: ubuntu-20.04 steps: - name: Checkout Repository From 5314ec6682b99b7418acfec9acf11bba3919622f Mon Sep 17 00:00:00 2001 From: Daniel Garcia Date: Wed, 16 Mar 2022 10:30:02 -0500 Subject: [PATCH 089/100] Updated to make more fluent --- .../contentbox/models/importers/ContentBoxImporter.cfc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/modules/contentbox/models/importers/ContentBoxImporter.cfc b/modules/contentbox/models/importers/ContentBoxImporter.cfc index 29c2d02695..216b53dcaf 100644 --- a/modules/contentbox/models/importers/ContentBoxImporter.cfc +++ b/modules/contentbox/models/importers/ContentBoxImporter.cfc @@ -62,16 +62,14 @@ component accessors=true { */ public void function setup( required any importFile ){ try { - var files = variables.zipUtil.list( zipFilePath = arguments.importFile ); + var files = variables.zipUtil.list( zipFilePath = arguments.importFile ); // convert files query to array - var fileList = listToArray( valueList( files.entry ) ); + var fileList = listToArray( valueList( files.entry ) ).map( function( item ){ + return arguments.item.reReplace( "(\\|\/)", "", "all" ); + } ); var contentBoxPath = variables.moduleSettings[ "contentbox" ].path; var customPath = variables.moduleSettings[ "contentbox-custom" ].path; - fileList = fileList.map( function( item ){ - return item.reReplace( "(\\|\/)", "", "all" ); - } ); - // now set values setFileNames( fileList ); setContentBoxPackagePath( arguments.importFile ); From bfd8028c6653b6729e42741b0d056ea34a4a56f1 Mon Sep 17 00:00:00 2001 From: Daniel Garcia Date: Wed, 16 Mar 2022 10:34:37 -0500 Subject: [PATCH 090/100] Moved to commit format changes section --- .github/workflows/pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index b282c81c64..1fcd8c8dd0 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -105,7 +105,6 @@ jobs: format: name: Format - if: ${{ env.GITHUB_REPOSITORY == 'ortus-solutions/ContentBox' }} runs-on: ubuntu-20.04 steps: - name: Checkout Repository @@ -116,6 +115,7 @@ jobs: cmd: run-script format - name: Commit Format Changes + if: ${{ env.GITHUB_REPOSITORY == 'ortus-solutions/ContentBox' }} uses: stefanzweifel/git-auto-commit-action@v4 with: commit_message: Apply cfformat changes From 981482a521a1eb3d7be3000b0b331b1252499564 Mon Sep 17 00:00:00 2001 From: Daniel Garcia Date: Wed, 16 Mar 2022 10:35:54 -0500 Subject: [PATCH 091/100] Build tests --- .github/workflows/pr.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 1fcd8c8dd0..f90d660f7b 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -115,7 +115,6 @@ jobs: cmd: run-script format - name: Commit Format Changes - if: ${{ env.GITHUB_REPOSITORY == 'ortus-solutions/ContentBox' }} uses: stefanzweifel/git-auto-commit-action@v4 with: commit_message: Apply cfformat changes From d5b2d9fb1108b8e9e680b94361f0fb021c9653fe Mon Sep 17 00:00:00 2001 From: Daniel Garcia Date: Wed, 16 Mar 2022 10:40:25 -0500 Subject: [PATCH 092/100] Adding conditional back in --- .github/workflows/pr.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index f90d660f7b..b282c81c64 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -105,6 +105,7 @@ jobs: format: name: Format + if: ${{ env.GITHUB_REPOSITORY == 'ortus-solutions/ContentBox' }} runs-on: ubuntu-20.04 steps: - name: Checkout Repository From 34973f479a41623ff24f039ef81300ed9ec4694d Mon Sep 17 00:00:00 2001 From: Daniel Garcia Date: Wed, 16 Mar 2022 11:18:57 -0500 Subject: [PATCH 093/100] Updated conditional in how its referencing the repo --- .github/workflows/pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index b282c81c64..657b3e6459 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -105,7 +105,7 @@ jobs: format: name: Format - if: ${{ env.GITHUB_REPOSITORY == 'ortus-solutions/ContentBox' }} + if: ${{ github.repository == 'ortus-solutions/ContentBox' }} runs-on: ubuntu-20.04 steps: - name: Checkout Repository From 02d332c773b40ac420dcd0a386bf5a80b64a8004 Mon Sep 17 00:00:00 2001 From: Daniel Garcia Date: Wed, 16 Mar 2022 13:42:20 -0500 Subject: [PATCH 094/100] Removed conditional for now. Will look at again with Jon later. --- .github/workflows/pr.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 657b3e6459..f90d660f7b 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -105,7 +105,6 @@ jobs: format: name: Format - if: ${{ github.repository == 'ortus-solutions/ContentBox' }} runs-on: ubuntu-20.04 steps: - name: Checkout Repository From 2dee527fe29201a70de373cc59a17bde521e5ce5 Mon Sep 17 00:00:00 2001 From: Daniel Garcia Date: Wed, 16 Mar 2022 16:15:05 -0500 Subject: [PATCH 095/100] Setting priority to 0 if NULL. --- modules/contentbox/models/importers/ContentBoxImporter.cfc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/contentbox/models/importers/ContentBoxImporter.cfc b/modules/contentbox/models/importers/ContentBoxImporter.cfc index 216b53dcaf..66befde4e1 100644 --- a/modules/contentbox/models/importers/ContentBoxImporter.cfc +++ b/modules/contentbox/models/importers/ContentBoxImporter.cfc @@ -114,7 +114,7 @@ component accessors=true { overwriteFiles = true ); descriptorContents = fileRead( getTempDirectory() & "descriptor.json" ); - descriptorContents = replaceNoCase( descriptorContents, "null,", "99,", "all" ); + descriptorContents = replaceNoCase( descriptorContents, "null,", "0,", "all" ); } return !arguments.asObject ? descriptorContents : deserializeJSON( descriptorContents ); } From 8e63397acadca5c7839d18f66e6f95e677485d4d Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 17 Mar 2022 13:51:05 -0500 Subject: [PATCH 096/100] CONTENTBOX-1379 #resolve Fail Quietly on ContentBox Module Removal --- .../models/modules/ModuleService.cfc | 20 ++++++++++---- .../contentbox-admin/handlers/modules.cfc | 26 +++++++++---------- 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/modules/contentbox/models/modules/ModuleService.cfc b/modules/contentbox/models/modules/ModuleService.cfc index be26d7edbd..9c8b09c503 100644 --- a/modules/contentbox/models/modules/ModuleService.cfc +++ b/modules/contentbox/models/modules/ModuleService.cfc @@ -75,7 +75,15 @@ component variables.moduleWidgetCache = {}; variables.moduleRegistry = {}; variables.moduleConfigCache = {}; - variables.moduleMap = {}; + /** + * Stores all module information when loaded: + * { + * type : "The module type : core or custom", + * path : The absolute path, + * invocationPath : The invocation path + * } + */ + variables.moduleMap = {}; return this; } @@ -307,10 +315,12 @@ component ModuleService function deleteModule( required name ){ var moduleEntry = variables.moduleMap[ arguments.name ]; - // Try to do an onDelete() callback. - var oConfig = createObject( "component", moduleEntry.invocationPath & ".#name#.ModuleConfig" ); - if ( structKeyExists( oConfig, "onDelete" ) ) { - oConfig.onDelete(); + // Try to do an onDelete() callback if it exists + if ( fileExists( moduleEntry.path & "/#arguments.name#/ModuleConfig.cfc" ) ) { + var oConfig = createObject( "component", moduleEntry.invocationPath & ".#arguments.name#.ModuleConfig" ); + if ( structKeyExists( oConfig, "onDelete" ) ) { + oConfig.onDelete(); + } } // Now delete it diff --git a/modules/contentbox/modules/contentbox-admin/handlers/modules.cfc b/modules/contentbox/modules/contentbox-admin/handlers/modules.cfc index a0ff542a4c..cba8c077ea 100755 --- a/modules/contentbox/modules/contentbox-admin/handlers/modules.cfc +++ b/modules/contentbox/modules/contentbox-admin/handlers/modules.cfc @@ -48,7 +48,7 @@ component extends="baseHandler" { // Check if route is discovered, basically if we get handler => contentbox-ui:page then it was not found if ( routeResults.route.handler == "contentbox-ui:page" ) { - cbMessagebox.warn( "No module where found with the incoming route: #encodeForHTML( routedURL )#" ); + variables.cbMessagebox.warn( "No module where found with the incoming route: #encodeForHTML( routedURL )#" ); return relocate( prc.xehModules ); } @@ -97,11 +97,11 @@ component extends="baseHandler" { // Rescan modules if ( event.valueExists( "rescan" ) ) { - moduleService.startup(); + variables.moduleService.startup(); } // Get all modules - var modules = moduleService.findModules(); + var modules = variables.moduleService.findModules(); prc.modules = modules.modules; prc.modulesCount = modules.count; @@ -113,8 +113,8 @@ component extends="baseHandler" { * Activate a module */ function activate( event, rc, prc ){ - moduleService.activateModule( rc.moduleName ); - cbMessagebox.info( "Modules Activated, woohoo!" ); + variables.moduleService.activateModule( rc.moduleName ); + variables.cbMessagebox.info( "Modules Activated, woohoo!" ); relocate( prc.xehModules ); } @@ -122,8 +122,8 @@ component extends="baseHandler" { * Deactivate a module */ function deactivate( event, rc, prc ){ - moduleService.deactivateModule( rc.moduleName ); - cbMessagebox.info( "Modules Deactivated!" ); + variables.moduleService.deactivateModule( rc.moduleName ); + variables.cbMessagebox.info( "Modules Deactivated!" ); relocate( prc.xehModules ); } @@ -131,8 +131,8 @@ component extends="baseHandler" { * Reset all modules */ function reset( event, rc, prc ){ - moduleService.resetModules(); - cbMessagebox.info( "Modules Reset!" ); + variables.moduleService.resetModules(); + variables.cbMessagebox.info( "Modules Reset!" ); relocate( prc.xehModules ); } @@ -140,8 +140,8 @@ component extends="baseHandler" { * Rescan all modules */ function rescan( event, rc, prc ){ - moduleService.startup(); - cbMessagebox.info( "Modules Rescaned and Revamped!" ); + variables.moduleService.startup(); + variables.cbMessagebox.info( "Modules Rescaned and Revamped!" ); relocate( prc.xehModules ); } @@ -149,8 +149,8 @@ component extends="baseHandler" { * Remove a module */ function remove( event, rc, prc ){ - moduleService.deleteModule( rc.moduleName ); - cbMessagebox.info( "Module Removed Forever!" ); + variables.moduleService.deleteModule( rc.moduleName ); + variables.cbMessagebox.info( "Module Removed Forever!" ); relocate( prc.xehModules ); } From a0a3c7eda1697afb9e62ac45a60678c17950a914 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 17 Mar 2022 14:45:34 -0500 Subject: [PATCH 097/100] CONTENTBOX-1405 #resolve Cloning Fails if Title of Page/entry/contentstore that Contains an Apostrophe --- .../contentbox-admin/views/contentStore/indexTable.cfm | 9 +++++++-- .../contentbox-admin/views/entries/indexTable.cfm | 9 +++++++-- .../modules/contentbox-admin/views/pages/indexTable.cfm | 4 ++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/modules/contentbox/modules/contentbox-admin/views/contentStore/indexTable.cfm b/modules/contentbox/modules/contentbox-admin/views/contentStore/indexTable.cfm index b09c48d701..8628bea392 100644 --- a/modules/contentbox/modules/contentbox-admin/views/contentStore/indexTable.cfm +++ b/modules/contentbox/modules/contentbox-admin/views/contentStore/indexTable.cfm @@ -127,7 +127,12 @@
  • - + Clone
  • @@ -184,4 +189,4 @@ Total Records: #prc.contentCount#
    - \ No newline at end of file + diff --git a/modules/contentbox/modules/contentbox-admin/views/entries/indexTable.cfm b/modules/contentbox/modules/contentbox-admin/views/entries/indexTable.cfm index f0fae1f773..36978f00cc 100644 --- a/modules/contentbox/modules/contentbox-admin/views/entries/indexTable.cfm +++ b/modules/contentbox/modules/contentbox-admin/views/entries/indexTable.cfm @@ -124,7 +124,12 @@
  • - + Clone
  • @@ -196,4 +201,4 @@ Total Records: #prc.contentCount#
    - \ No newline at end of file + diff --git a/modules/contentbox/modules/contentbox-admin/views/pages/indexTable.cfm b/modules/contentbox/modules/contentbox-admin/views/pages/indexTable.cfm index e5bb450083..7b01f79e29 100644 --- a/modules/contentbox/modules/contentbox-admin/views/pages/indexTable.cfm +++ b/modules/contentbox/modules/contentbox-admin/views/pages/indexTable.cfm @@ -186,8 +186,8 @@
  • Clone From e5dd6ee9d3eab478633e2109407b340b80b38b7c Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 17 Mar 2022 17:32:13 -0500 Subject: [PATCH 098/100] CONTENTBOX-1398 #resolve Cloning a Page with Children Produces an Error --- .../contentbox/models/content/BaseContent.cfc | 176 +++++++++--------- .../models/content/ContentStore.cfc | 4 +- modules/contentbox/models/content/Entry.cfc | 4 +- modules/contentbox/models/content/Page.cfc | 4 +- .../contentbox/models/content/PageService.cfc | 2 +- .../handlers/baseContentHandler.cfc | 25 +-- 6 files changed, 108 insertions(+), 107 deletions(-) diff --git a/modules/contentbox/models/content/BaseContent.cfc b/modules/contentbox/models/content/BaseContent.cfc index fdf59ce0dd..0e0ea8c91c 100644 --- a/modules/contentbox/models/content/BaseContent.cfc +++ b/modules/contentbox/models/content/BaseContent.cfc @@ -607,6 +607,7 @@ component variables.contentType = ""; variables.showInSearch = true; variables.renderedContent = ""; + variables.children = []; return this; } @@ -1231,7 +1232,7 @@ component } /** - * Prepare a content object for cloning. This processes several things: + * Clones the object and stores it in the database * * - Wipe primary key, and descendant keys * - Prepare for cloning of entire hierarchies @@ -1244,7 +1245,7 @@ component * @originalSlugRoot The original slug that will be replaced in all cloned content * @newSlugRoot The new slug root that will be replaced in all cloned content */ - BaseContent function prepareForClone( + BaseContent function clone( required any author, required any original, required any originalService, @@ -1252,100 +1253,105 @@ component required any originalSlugRoot, required any newSlugRoot ){ - // Base Content Property cloning - variables.isPublished = arguments.publish; - variables.createdDate = now(); - variables.modifiedDate = variables.createdDate; - variables.HTMLKeywords = arguments.original.getHTMLKeywords(); - variables.HTMLDescription = arguments.original.getHTMLDescription(); - variables.HTMLTitle = arguments.original.getHTMLTitle(); - variables.markup = arguments.original.getMarkup(); - variables.cache = arguments.original.getCache(); - variables.cacheTimeout = arguments.original.getCacheTimeout(); - variables.cacheLastAccessTimeout = arguments.original.getCacheLastAccessTimeout(); - variables.showInSearch = arguments.original.getShowInSearch(); - variables.featuredImage = arguments.original.getFeaturedImage(); - variables.featuredImageURL = arguments.original.getFeaturedImageURL(); - // remove all comments - variables.comments = []; - // Are we publishing? - if ( arguments.publish ) { - variables.publishedDate = now(); - } - // get latest content versioning - var latestContent = arguments.original.getActiveContent().getContent(); - // Original slug updates on all content - latestContent = reReplaceNoCase( - latestContent, - "page\:\[#arguments.originalSlugRoot#\/", - "page:[#arguments.newSlugRoot#/", - "all" - ); + transaction { + // Base Content Property cloning + variables.isPublished = arguments.publish; + variables.createdDate = now(); + variables.modifiedDate = variables.createdDate; + variables.HTMLKeywords = arguments.original.getHTMLKeywords(); + variables.HTMLDescription = arguments.original.getHTMLDescription(); + variables.HTMLTitle = arguments.original.getHTMLTitle(); + variables.markup = arguments.original.getMarkup(); + variables.cache = arguments.original.getCache(); + variables.cacheTimeout = arguments.original.getCacheTimeout(); + variables.cacheLastAccessTimeout = arguments.original.getCacheLastAccessTimeout(); + variables.showInSearch = arguments.original.getShowInSearch(); + variables.featuredImage = arguments.original.getFeaturedImage(); + variables.featuredImageURL = arguments.original.getFeaturedImageURL(); + variables.comments = []; + variables.children = []; + + // Are we publishing? + if ( arguments.publish ) { + variables.publishedDate = now(); + } - // reset versioning, and start with a new one - addNewContentVersion( - content : latestContent, - changelog: "Content Cloned!", - author : arguments.author - ); + // get latest content versioning + var latestContent = arguments.original.getActiveContent().getContent(); + // Original slug updates on all content + latestContent = reReplaceNoCase( + latestContent, + "page\:\[#arguments.originalSlugRoot#\/", + "page:[#arguments.newSlugRoot#/", + "all" + ); - // safe clone custom fields - variables.customFields = arguments.original - .getCustomFields() - .map( function( thisField ){ - return variables.customFieldService - .new( { - key : arguments.thisField.getKey(), - value : arguments.thisField.getValue() - } ) - .setRelatedContent( this ); - } ); + // reset versioning, and start with a new one + addNewContentVersion( + content : latestContent, + changelog: "Content Cloned!", + author : arguments.author + ); - // clone related content - arguments.original - .getRelatedContent() - .each( function( thisRelatedContent ){ - addRelatedContent( arguments.thisRelatedContent ); - } ); + // safe clone custom fields + variables.customFields = arguments.original + .getCustomFields() + .map( function( thisField ){ + return variables.customFieldService + .new( { + key : arguments.thisField.getKey(), + value : arguments.thisField.getValue() + } ) + .setRelatedContent( this ); + } ); - // clone categories - arguments.original - .getCategories() - .each( function( thisCategory ){ - addCategories( variables.categoryService.getOrCreate( arguments.thisCategory, getSite() ) ); - } ); + // clone related content + arguments.original + .getRelatedContent() + .each( function( thisRelatedContent ){ + addRelatedContent( arguments.thisRelatedContent ); + } ); - // now clone children - if ( arguments.original.hasChild() ) { + // clone categories arguments.original - .getChildren() - .each( function( thisChild ){ - // Preapre new Child - var newChild = originalService - .new( { - parent : this, - creator : author, - title : arguments.thisChild.getTitle(), - slug : this.getSlug() & "/" & listLast( arguments.thisChild.getSlug(), "/" ), - site : getSite() - } ) - // now deep clone until no more child is left behind. - .prepareForClone( + .getCategories() + .each( function( thisCategory ){ + addCategories( variables.categoryService.getOrCreate( arguments.thisCategory, getSite() ) ); + } ); + + // now clone children + if ( arguments.original.hasChild() ) { + // Save the parent first to avoid cascade issues + arguments.originalService.save( this ); + // Continue down to clone the original children and attach them + arguments.original + .getChildren() + .each( function( thisChild ){ + // Clone the child + var newChild = originalService + .new( { + creator : author, + title : arguments.thisChild.getTitle(), + slug : listLast( arguments.thisChild.getSlug(), "/" ), + site : getSite() + } ) + .setParent( this ); + + // now deep clone until no more children are left behind. + newChild.clone( author = author, original = arguments.thisChild, originalService = originalService, publish = publish, - originalSlugRoot = originalSlugRoot, - newSlugRoot = newSlugRoot + originalSlugRoot = arguments.thisChild.getSlug(), + newSlugRoot = newChild.getSlug() ); - - // now attach it to this piece of content - addChild( newChild ); - } ); + } ); + } else { + arguments.originalService.save( this ); + } } - - // evict original entity from hibernate cache, just in case - variables.contentService.evict( arguments.original ); + // end of cloning transaction return this; } @@ -1702,6 +1708,8 @@ component } else { // Welcome home papa! variables.parent = arguments.parent; + // I am a ColdBox Daddy! + arguments.parent.addChild( this ); } // Update slug according to parent hierarchy diff --git a/modules/contentbox/models/content/ContentStore.cfc b/modules/contentbox/models/content/ContentStore.cfc index b803ab111b..1c0c847532 100755 --- a/modules/contentbox/models/content/ContentStore.cfc +++ b/modules/contentbox/models/content/ContentStore.cfc @@ -85,7 +85,7 @@ component * @originalSlugRoot The original slug that will be replaced in all cloned content * @newSlugRoot The new slug root that will be replaced in all cloned content */ - BaseContent function prepareForClone( + BaseContent function clone( required any author, required any original, required any originalService, @@ -97,7 +97,7 @@ component setDescription( arguments.original.getDescription() ); setOrder( arguments.original.getOrder() + 1 ); // do core cloning - return super.prepareForClone( argumentCollection = arguments ); + return super.clone( argumentCollection = arguments ); } } diff --git a/modules/contentbox/models/content/Entry.cfc b/modules/contentbox/models/content/Entry.cfc index 427a048afa..301a446d28 100755 --- a/modules/contentbox/models/content/Entry.cfc +++ b/modules/contentbox/models/content/Entry.cfc @@ -107,7 +107,7 @@ component * @originalSlugRoot The original slug that will be replaced in all cloned content * @newSlugRoot The new slug root that will be replaced in all cloned content */ - BaseContent function prepareForClone( + BaseContent function clone( required any author, required any original, required any originalService, @@ -120,7 +120,7 @@ component setExcerpt( arguments.original.getExcerpt() ); } // do core cloning - return super.prepareForClone( argumentCollection = arguments ); + return super.clone( argumentCollection = arguments ); } } diff --git a/modules/contentbox/models/content/Page.cfc b/modules/contentbox/models/content/Page.cfc index 6232cd3e3a..c33cdb79eb 100755 --- a/modules/contentbox/models/content/Page.cfc +++ b/modules/contentbox/models/content/Page.cfc @@ -199,7 +199,7 @@ component * @originalSlugRoot The original slug that will be replaced in all cloned content * @newSlugRoot The new slug root that will be replaced in all cloned content */ - BaseContent function prepareForClone( + BaseContent function clone( required any author, required any original, required any originalService, @@ -216,7 +216,7 @@ component setExcerpt( arguments.original.getExcerpt() ); } // do core cloning - return super.prepareForClone( argumentCollection = arguments ); + return super.clone( argumentCollection = arguments ); } /** diff --git a/modules/contentbox/models/content/PageService.cfc b/modules/contentbox/models/content/PageService.cfc index fd6b928922..af6de080e5 100755 --- a/modules/contentbox/models/content/PageService.cfc +++ b/modules/contentbox/models/content/PageService.cfc @@ -34,7 +34,7 @@ component extends="ContentService" singleton { super.save( arguments.page ); // Update all affected child pages if any on slug updates, much like nested set updates its nodes, we update our slugs - if ( structKeyExists( arguments, "originalSlug" ) AND len( arguments.originalSlug ) ) { + if ( !isNull( arguments.originalSlug ) AND len( arguments.originalSlug ) ) { var pagesInNeed = newCriteria().like( "slug", "#arguments.originalSlug#/%" ).list(); for ( var thisPage in pagesInNeed ) { thisPage.setSlug( diff --git a/modules/contentbox/modules/contentbox-admin/handlers/baseContentHandler.cfc b/modules/contentbox/modules/contentbox-admin/handlers/baseContentHandler.cfc index adf8284c15..450b7ec2b7 100644 --- a/modules/contentbox/modules/contentbox-admin/handlers/baseContentHandler.cfc +++ b/modules/contentbox/modules/contentbox-admin/handlers/baseContentHandler.cfc @@ -495,20 +495,16 @@ component extends="baseHandler" { } // get a clone - var clone = variables.ormService.new( { - title : rc.title, - slug : variables.HTMLHelper.slugify( rc.title ), - creator : prc.oCurrentAuthor, - site : variables.siteService.get( rc.site ) - } ); - - // attach to the original's parent. - if ( original.hasParent() ) { - clone.setParent( original.getParent() ).setSlug( original.getSlug() & "/" & clone.getSlug() ); - } + var clone = variables.ormService + .new( { + title : rc.title, + slug : variables.HTMLHelper.slugify( rc.title ), + creator : prc.oCurrentAuthor, + site : variables.siteService.get( rc.site ) + } ) + .setParent( original.getParent() ); - // prepare descendants for cloning, might take a while if lots of children to copy. - clone.prepareForClone( + clone.clone( author : prc.oCurrentAuthor, original : original, originalService : variables.ormService, @@ -517,9 +513,6 @@ component extends="baseHandler" { newSlugRoot : clone.getSlug() ); - // clone this sucker now! - variables.ormService.save( clone ); - // relocate variables.cbMessageBox.info( "#variables.entity# Cloned!" ); From cae8df8ffbd8907d22239e6719de33722f1482e6 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 17 Mar 2022 17:51:56 -0500 Subject: [PATCH 099/100] CONTENTBOX-1365 #resolve Paginated results in CBAdmin for Page Children returns non-parented results for page 2 --- .../contentbox-admin/includes/js/contentbox-app.js | 8 +++----- .../contentbox-admin/includes/js/contentbox-app.min.js | 2 +- workbench/resources/js/contentList.js | 9 +++------ 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/modules/contentbox/modules/contentbox-admin/includes/js/contentbox-app.js b/modules/contentbox/modules/contentbox-admin/includes/js/contentbox-app.js index aa742cd113..ba32d80218 100644 --- a/modules/contentbox/modules/contentbox-admin/includes/js/contentbox-app.js +++ b/modules/contentbox/modules/contentbox-admin/includes/js/contentbox-app.js @@ -1028,10 +1028,7 @@ const contentListHelper = ( () => { $searchField.keyup( _.debounce( function(){ - var $this = $( this ); - var clearIt = ( $this.val().length > 0 ? false : true ); - // ajax search - contentLoad( { search: $this.val() } ); + contentLoad( { search: $( this ).val() } ); }, 300 ) @@ -1073,7 +1070,7 @@ const contentListHelper = ( () => { contentLoad( { search : $searchField.val(), page : page, - parent : $parentID, + parent : History.getState().data.parent || $parentID, fAuthors : $( "#fAuthors" ).val(), fCategories : $( "#fCategories" ).val(), fStatus : $( "#fStatus" ).val(), @@ -1222,6 +1219,7 @@ const contentListHelper = ( () => { }; } )(); + /** ********************************************************************************* * Copyright since 2005 ColdBox Framework by Luis Majano and Ortus Solutions, Corp diff --git a/modules/contentbox/modules/contentbox-admin/includes/js/contentbox-app.min.js b/modules/contentbox/modules/contentbox-admin/includes/js/contentbox-app.min.js index 13dc8cb11d..d033de161d 100644 --- a/modules/contentbox/modules/contentbox-admin/includes/js/contentbox-app.min.js +++ b/modules/contentbox/modules/contentbox-admin/includes/js/contentbox-app.min.js @@ -1 +1 @@ -function activateNavbarState(){var t=$("#container");$("#toggle-left").bind("click",(function(e){$(window).width()>768&&(sidemenuCollapse=t.hasClass("sidebar-mini")?"no":"yes",$.ajax({url:$("body").attr("data-preferenceURL"),data:{value:sidemenuCollapse,preference:"sidemenuCollapse"},async:!0}))}))}function isMainSidebarOpen(){var t=$("#main-content-sidebar");return void 0!==t.attr("id")&&"block"===t.css("display")}function toggleSidebar(){var t=$("#main-content-sidebar"),e=t.css("display"),a=!1;void 0!==e&&("block"===e?(t.fadeOut(),$("#main-content-sidebar-trigger i").removeClass("fa-minus-square").addClass("fa-plus-square"),$("#main-content-slot").removeClass("col-md-8").addClass("col-md-12")):($("#main-content-sidebar-trigger i").removeClass("fa-plus-square").addClass("fa-minus-square"),t.fadeIn(),$("#main-content-slot").removeClass("col-md-12").addClass("col-md-8"),a=!0),$.ajax({url:$("body").attr("data-preferenceURL"),data:{value:a,preference:"sidebarstate"},async:!0}))}function adminAction(t,e){"null"!=t&&($("#adminActionsIcon").addClass("fa-spin textOrange"),$.post(e,{targetModule:t},(function(t){t.ERROR?adminNotifier("error"," Error running action, check logs!"):adminNotifier("info"," Action Ran, Booya!"),$("#adminActionsIcon").removeClass("fa-spin textOrange")})))}function adminNotifier(t,e,a){switch(toastr.options={closeButton:!0,preventDuplicates:!0,progressBar:!0,showDuration:"300",timeOut:"2000",positionClass:"toast-top-center"},t){case"info":toastr.info(e);break;case"error":toastr.error(e);break;case"success":toastr.success(e);break;case"warning":toastr.warning(e);break;default:toastr.info(e)}}function activateContentSearch(){$nav_search=$("#nav-search"),$nav_search_results=$("#div-search-results"),$nav_search.css("opacity","0.8"),$nav_search.focusin((function(){$(this).animate({opacity:1},500,(function(){}))})).blur((function(){$(this).animate({opacity:.5},500,(function(){}))})),$nav_search.keyup(_.debounce((function(){var t=$(this);t.val().length>1&&$nav_search_results.load($("#nav-search-url").val(),{search:t.val()},(function(t){"none"===$nav_search_results.css("display")&&$nav_search_results.fadeIn().slideDown()}))}),300)),$("body").click((function(t){$(t.target).closest("#div-search").length||closeSearchBox()}))}function closeSearchBox(){$("#div-search-results").slideUp(),$("#nav-search").val("")}function quickLinks(t){"null"!=t&&(window.location=t)}function activateTooltips(){$("[title]").tooltip(toolTipSettings)}function hideAllTooltips(){$(".tooltip").hide()}function toggleFlickers(){$(".flickerMessages").slideToggle(),$(".flickers").fadeOut(3e3)}function closeRemoteModal(){$remoteModal.modal("hide")}function resetContainerForms(t){var e=t.find("form");e.length&&$(e[0]).clearForm()}function closeModal(t){t.modal("hide")}function openModal(t,e,a){t.modal(),$(t).on("hidden.bs.modal",(function(){resetContainerForms($(this))}))}function openRemoteModal(t,e,a,n,o){if(t){var i=$remoteModal,s=$(window).height()-200,r=.85*$(window).width();i.data("url",t),i.data("params",e),i.data("width",void 0!==a?a:r),i.data("height",void 0!==n?n:s);var l=i.data("height");l.search&&-1!==l.search("%")&&(l=l.replace("%","")/100,l=$(window).height()*l),l>s&&(l=s),i.data("height",l),o?(i.data("delay",!0),i.modal()):i.load(t,e,(function(){i.modal()}))}else console.log("URL needed")}function setPreviewSize(t,e){var a=$remoteModal.find(".modal-dialog"),n=($("#previewFrame").length&&$("#previewFrame"),{width:$remoteModal.data("width")}),o={width:e};(!e||o.width>n.width)&&(o={width:n.width}),$remoteModal.find(".header-title").toggle(o.width>600),$(t).siblings(".btn-primary").removeClass("btn-primary").addClass("btn-info"),$(t).removeClass("btn-info").addClass("btn-primary"),a.animate(o,500)}function attachModalListeners(){$remoteModal.on("show.bs.modal",(function(){var t=$remoteModal;t.find(".modal-dialog").css({width:t.data("width"),height:t.data("height")})})),$remoteModal.on("shown.bs.modal",(function(){var t=$remoteModal;t.data("delay")&&t.load(t.data("url"),t.data("params"),(function(){t.find(".modal-dialog").css({width:t.data("width"),height:t.data("height")})}))})),$remoteModal.on("hidden.bs.modal",(function(){var t=$remoteModal;t.html(''),resetContainerForms(t)}))}function activateToggleCheckboxes(){$('input[data-toggle="toggle"]').change((function(){var t=$(this).data("match");$("#"+t).val($(this).prop("checked"))}))}function closeConfirmations(){$confirmIt.modal("hide")}function activateConfirmations(){$confirmIt.find("button").click((function(t){"confirm"===$(this).attr("data-action")&&($confirmIt.find("#confirmItButtons").hide(),$confirmIt.find("#confirmItLoader").fadeIn(),window.location=$confirmIt.data("confirmSrc"))})),$(".confirmIt").click((function(t){$confirmIt.find("#confirmItButtons").fadeIn(),$confirmIt.find("#confirmItLoader").hide(),$confirmIt.data("confirmSrc",$(this).attr("href"));var e=$(this).attr("data-message")?$(this).attr("data-message"):"Are you sure you want to perform this action?",a=$(this).attr("data-title")?$(this).attr("data-title"):"Are you sure?";$confirmIt.find("#confirmItMessage").html(e),$confirmIt.find("#confirmItTitle").html(a),$confirmIt.modal(),t.preventDefault()}))}function popup(t,e,a){var n=750;e&&(minWidth=e),a&&(n=a);var o=screen.width/2-500,i=screen.height/2-n/2;window.open(t,"layoutPreview","resizable=yes,status=yes,location=no,menubar=no,toolbar=no,scrollbars=yes,width=1000,height="+n+",left="+o+",top="+i+",screenX="+o+",screenY="+i)}function to(t){return window.location=t,!1}function checkAll(t,e){$("input[name='"+e+"']").each((function(){this.checked=t}))}function checkByValue(t,e){$("input[name='"+t+"']").each((function(){this.value===e?this.checked=!0:this.checked=!1}))}function getToday(t){return(t=null==t||t)?moment().format("YYYY-MM-DD"):moment().format("DD-MM-YYYY")}function importContent(){var t=$("#importForm");openModal($importDialog,500,350),t.validate({submitHandler:function(e){t.find("#importButtonBar").slideUp(),t.find("#importBarLoader").slideDown(),e.submit()}}),t.find("#closeButton").click((function(t){return closeModal($importDialog),!1})),t.find("#importButton").click((function(e){t.submit()}))}function toggleMoreInfoPanel(t){$("#moreInfo-"+t).toggleClass("hidden"),$("#moreInfoOpenButton-"+t).toggleClass("hidden"),$("#moreInfoCloseButton-"+t).toggleClass("hidden")}function passwordMeter(t){var e=$(this).val();$("#pw_rule_count").html(e.length);var a=$("#passwordRules").data("min-length"),n={lower:REGEX_LOWER.test(e),upper:REGEX_UPPER.test(e),digit:REGEX_DIGIT.test(e),special:REGEX_SPECIAL.test(e)};for(var o in e.length>=a?$("#pw_rule_count").addClass("badge-success"):$("#pw_rule_count").removeClass("badge-success"),n)n[o]?$("#pw_rule_"+o).addClass("badge-success"):$("#pw_rule_"+o).removeClass("badge-success")}function passwordValidator(t){var e=$("#passwordRules").data("min-length"),a=REGEX_LOWER.test(t),n=REGEX_UPPER.test(t),o=REGEX_DIGIT.test(t),i=(REGEX_DIGITS.test(t),REGEX_SPECIAL.test(t));return a&&n&&o&&i&&t.length>=e}function toLocalString(t,e){return new Date(t).toLocaleString(void 0,e||getDefaultDateTimeOptions())}function toLocaleDateString(t,e){return new Date(t).toLocaleDateString(void 0,e||getDefaultDateTimeOptions())}function toLocaleTimeString(t,e){return new Date(t).toLocaleTimeString(void 0,e||getDefaultDateTimeOptions())}function getDefaultDateTimeOptions(){return{dateStyle:"medium",timeStyle:"long"}}function scrollToHash(t){location.hash="#"+t}document.addEventListener("DOMContentLoaded",(()=>{REGEX_LOWER=/[a-z]/,REGEX_UPPER=/[A-Z]/,REGEX_DIGIT=/[0-9]/,REGEX_DIGITS=/[0-9].*[0-9]/,REGEX_SPECIAL=/[^a-zA-Z0-9]/,"no"==$("body").attr("data-showsidebar")&&toggleSidebar(),void 0!==$("#main-content-sidebar").attr("id")&&$("#main-content-sidebar-trigger").fadeIn(),$confirmIt=$("#confirmIt"),$remoteModal=$("#modal"),attachModalListeners(),toolTipSettings={animation:"slide",delay:{show:100,hide:100}},activateContentSearch(),activateConfirmations(),activateTooltips(),activateNavbarState(),activateToggleCheckboxes(),$.validator.setDefaults({ignore:[],highlight:function(t){$(t).closest(".form-group").removeClass("success").addClass("error")},success:function(t){t.text("Field is valid").addClass("valid").closest(".form-group").removeClass("error").addClass("success"),t.remove()},errorPlacement:function(t,e){if($(e).is(":hidden"))return!1;t.appendTo(e.closest("div.controls"))}}),$.fn.resetValidations=function(){var t=this[0].currentForm;return $(t).find(".form-group").each((function(){$(this).removeClass("error").removeClass("success")})),$(t).find(":input").each((function(){$(this).removeClass("error").removeClass("valid")})),this},$.fn.clearForm=function(){if(void 0!==this.data("validator"))return this.data("validator").resetForm(),this.find(":input").each((function(){switch(this.type){case"password":case"hidden":case"select-multiple":case"select-one":case"text":case"textarea":$(this).val("");break;case"checkbox":case"radio":this.checked=!1}})),$(this.data("validator")).resetValidations(),this},$.fn.collect=function(){var t=this.serializeArray(),e={};return $.each(t,(function(t,a){e[a.name]=a.value})),e};setTimeout(toggleFlickers(),5e3);$((function(){var t=$('[href="'+location.hash+'"]');t&&t.tab("show")})),jwerty.key("ctrl+shift+s",(function(){return $("#nav-search").focus(),!1})),$("[data-keybinding]").each((function(){var t=$(this);jwerty.key(t.data("keybinding"),(function(){t.attr("onclick")?t.click():to(t.attr("href"))}))})),$("#main-navbar li.nav-dropdown").each((function(){$(this).find("ul.nav-sub li").length||$(this).hide()})),$(".accordion[data-stateful]").each((function(){var t,e=$(this),a=e.data("stateful");a&&null!==(t=$.cookie(a))&&(e.find(".collapse").removeClass("in"),$("#"+t).addClass("in")),e.bind("shown.bs.collapse",(function(){var t=e.find(".in").attr("id");$.cookie(a,t)}))}))}));var app=function(){var t=function(){$("#toggle-left").tooltip({delay:100})},e=function(){$(".actions > .fa-chevron-down").click((function(){$(this).parent().parent().next().slideToggle("fast"),$(this).toggleClass("fa-chevron-down fa-chevron-up")}))},a=function(){$("#toggle-left").bind("click",(function(t){$("body").removeClass("off-canvas-open");var e=$("#container");$(window).width()>767?$(e).toggleClass("sidebar-mini"):$(e).toggleClass("sidebar-opened")}))},n=function(){$("#toggle-right").click((function(){$(".off-canvas").toggleClass("off-canvas-open")}))},o=function(){Array.prototype.slice.call(document.querySelectorAll(".js-switch")).forEach((function(t){new Switchery(t,{size:"small"})}))},i=function(){$(".actions > .fa-times").click((function(){$(this).parent().parent().parent().fadeOut()}))},s=function(){var t=$(".sidebar .nav");$(t).navgoco({caretHtml:!1,accordion:!0,slide:{duration:400,easing:"swing"}})};return{init:function(){t(),a(),n(),o(),s(),e(),i()},sliders:function(){$(".slider-span").slider()},morrisPie:function(){Morris.Donut({element:"donut-example",data:[{label:"Chrome",value:73},{label:"Firefox",value:71},{label:"Safari",value:69},{label:"Internet Explorer",value:40},{label:"Opera",value:20},{label:"Android Browser",value:10}],colors:["#1abc9c","#293949","#e84c3d","#3598db","#2dcc70","#f1c40f"]})}}}();document.addEventListener("DOMContentLoaded",(()=>{app.init();var t=$("#container");$(window).width()<=768&&!$(t).hasClass("sidebar-mini")&&($("body").removeClass("off-canvas-open"),$(t).toggleClass("sidebar-mini"))}));const contentListHelper=(()=>{const t={"Content-type":"application/json;charset=UTF-8"};var e="",a="",n="",o="",i="",s="",r="",l="",c="",d=t=>{null==t&&(t={}),"search"in t||(t.search=""),"page"in t||(t.page=1),"parent"in t||(t.parent=""),"fAuthors"in t||(t.fAuthors="all"),"fCreators"in t||(t.fCreators="all"),"fCategories"in t||(t.fCategories="all"),"fStatus"in t||(t.fStatus="any"),"showAll"in t||(t.showAll=!1),a.css("opacity",.6);var e={page:t.page,parent:t.parent,fAuthors:t.fAuthors,fCategories:t.fCategories,fStatus:t.fStatus,showAll:t.showAll,fCreators:t.fCreators};e[i]=t.search,a.load(n,e,(function(){a.css("opacity",1),$(this).fadeIn("fast")}))},f=()=>{"all"!=$("#fAuthors").val()||"all"!=$("#fCreators").val()||"all"!=$("#fCategories").val()||"any"!=$("#fStatus").val()?$("#filterBox").addClass("selected"):$("#filterBox").removeClass("selected"),d({fAuthors:$("#fAuthors").val(),fCategories:$("#fCategories").val(),fStatus:$("#fStatus").val(),fCreators:$("#fCreators").val()})},u=t=>{t&&d(),$("#filterBox").removeClass("selected"),$("#fAuthors").val("all"),$("#fCategories").val("all"),$("#fStatus").val("any"),$("#fCreators").val("all")};return{init:t=>{e=t.adminEntryPoint,a=t.tableContainer,n=t.tableURL,o=t.searchField,i=t.searchName,s=t.contentForm,r=t.bulkStatusURL,l=t.cloneDialog,c=t.parentID,History.Adapter.bind(window,"statechange",(function(){d({parent:History.getState().data.parent})})),o.keyup(_.debounce((function(){var t=$(this);t.val().length;d({search:t.val()})}),300)),c.length?d({parent:c}):d({})},contentLoad:d,contentFilter:f,resetFilter:u,contentDrilldown:t=>{u(),null==t&&(t=""),o.val(""),History.pushState({parent:t},document.title,"?parent="+t),scrollToHash("container")},contentShowAll:()=>{u(),d({showAll:!0})},contentPaginate:t=>{d({search:o.val(),page:t,parent:c,fAuthors:$("#fAuthors").val(),fCategories:$("#fCategories").val(),fStatus:$("#fStatus").val(),fCreators:$("#fCreators").val()})},getInfoPanelContent:t=>$("#infoPanel_"+t).html(),activateInfoPanels:()=>{$(".popovers").popover({html:!0,content:function(){return getInfoPanelContent($(this).attr("data-contentID"))},trigger:"hover",placement:"left",title:' Quick Info',delay:{show:200,hide:500}})},activateQuickLook:(t,e)=>{t.find("tr").bind("contextmenu",(function(t){3===t.which&&null!=$(this).attr("data-contentID")&&(openRemoteModal(e+$(this).attr("data-contentID")),t.preventDefault())}))},remove:(t,e)=>{checkAll(!1,e=void 0!==e?e:"contentID"),null!=t&&($("#delete_"+t).removeClass("fa fa-minus-circle").addClass("fa fa-spinner fa-spin"),checkByValue(e,t)),s.submit()},bulkRemove:()=>{s.submit()},exportSelected:t=>{var e=[];$("#contentID:checked").each((function(){e.push($(this).val())})),e.length?(checkAll(!1,"contentID"),window.open(t+"/contentID/"+e)):alert("Please select something to export!")},bulkChangeStatus:(t,e)=>{s.attr("action",r),s.find("#contentStatus").val(t),null!=e&&($("#status_"+recordID).removeClass("fa fa-minus-circle").addClass("fa fa-spinner fa-spin"),checkByValue("contentID",e)),s.submit()},openCloneDialog:(t,e)=>{var a=l.find("#cloneForm");openModal(l,500),a.validate({submitHandler:function(t){l.find("#cloneButtonBar").slideUp(),l.find("#clonerBarLoader").slideDown(),t.submit()}}),a.find("#contentID").val(t),a.find("#title").val(e).focus(),l.find("#cloneButton").click((function(t){a.submit()}))},resetHits:a=>{a.length&&fetch(e+"/content/resetHits",{method:"POST",headers:t,body:JSON.stringify({contentID:a})}).then((t=>t.json())).then((t=>{t.error?alert("Error Reseting Hits: "+t.messages.join(",")):(adminNotifier("info",t.messages.join("
    "),3e3),f())})).catch((t=>{alert("Error Reseting Hits: "+t)}))},resetBulkHits:()=>{var t=[];$("#contentID:checked").each((function(){t.push($(this).val())})),t.length&&resetHits(t.join(","))}}})();function fbCKSelect(t,e,a){if(t.length&&"dir"!==a){var n,o,i=(n=new RegExp("(?:[?&]|&)"+"CKEditorFuncNum"+"=([^&]+)","i"),(o=window.location.search.match(n))&&o.length>1?o[1]:"");window.opener.CKEDITOR.tools.callFunction(i,e),window.close()}else alert("Please select a file first.")}function fbGenericClose(){window.close()}function fbTestChoose(t,e,a){alert("Path: "+t+"\n URL: "+e+"\n Type: "+a)}function fbTestCancel(){alert("Cancel Called")}function fbUpload(){$("#uploadBar").slideToggle()}function fbVerifyActiveView(){let t="#"+$listType.val()+$listFolder.val();$(t).removeClass("btn-more").addClass("btn-default")} \ No newline at end of file +function activateNavbarState(){var t=$("#container");$("#toggle-left").bind("click",(function(e){$(window).width()>768&&(sidemenuCollapse=t.hasClass("sidebar-mini")?"no":"yes",$.ajax({url:$("body").attr("data-preferenceURL"),data:{value:sidemenuCollapse,preference:"sidemenuCollapse"},async:!0}))}))}function isMainSidebarOpen(){var t=$("#main-content-sidebar");return void 0!==t.attr("id")&&"block"===t.css("display")}function toggleSidebar(){var t=$("#main-content-sidebar"),e=t.css("display"),a=!1;void 0!==e&&("block"===e?(t.fadeOut(),$("#main-content-sidebar-trigger i").removeClass("fa-minus-square").addClass("fa-plus-square"),$("#main-content-slot").removeClass("col-md-8").addClass("col-md-12")):($("#main-content-sidebar-trigger i").removeClass("fa-plus-square").addClass("fa-minus-square"),t.fadeIn(),$("#main-content-slot").removeClass("col-md-12").addClass("col-md-8"),a=!0),$.ajax({url:$("body").attr("data-preferenceURL"),data:{value:a,preference:"sidebarstate"},async:!0}))}function adminAction(t,e){"null"!=t&&($("#adminActionsIcon").addClass("fa-spin textOrange"),$.post(e,{targetModule:t},(function(t){t.ERROR?adminNotifier("error"," Error running action, check logs!"):adminNotifier("info"," Action Ran, Booya!"),$("#adminActionsIcon").removeClass("fa-spin textOrange")})))}function adminNotifier(t,e,a){switch(toastr.options={closeButton:!0,preventDuplicates:!0,progressBar:!0,showDuration:"300",timeOut:"2000",positionClass:"toast-top-center"},t){case"info":toastr.info(e);break;case"error":toastr.error(e);break;case"success":toastr.success(e);break;case"warning":toastr.warning(e);break;default:toastr.info(e)}}function activateContentSearch(){$nav_search=$("#nav-search"),$nav_search_results=$("#div-search-results"),$nav_search.css("opacity","0.8"),$nav_search.focusin((function(){$(this).animate({opacity:1},500,(function(){}))})).blur((function(){$(this).animate({opacity:.5},500,(function(){}))})),$nav_search.keyup(_.debounce((function(){var t=$(this);t.val().length>1&&$nav_search_results.load($("#nav-search-url").val(),{search:t.val()},(function(t){"none"===$nav_search_results.css("display")&&$nav_search_results.fadeIn().slideDown()}))}),300)),$("body").click((function(t){$(t.target).closest("#div-search").length||closeSearchBox()}))}function closeSearchBox(){$("#div-search-results").slideUp(),$("#nav-search").val("")}function quickLinks(t){"null"!=t&&(window.location=t)}function activateTooltips(){$("[title]").tooltip(toolTipSettings)}function hideAllTooltips(){$(".tooltip").hide()}function toggleFlickers(){$(".flickerMessages").slideToggle(),$(".flickers").fadeOut(3e3)}function closeRemoteModal(){$remoteModal.modal("hide")}function resetContainerForms(t){var e=t.find("form");e.length&&$(e[0]).clearForm()}function closeModal(t){t.modal("hide")}function openModal(t,e,a){t.modal(),$(t).on("hidden.bs.modal",(function(){resetContainerForms($(this))}))}function openRemoteModal(t,e,a,n,o){if(t){var i=$remoteModal,s=$(window).height()-200,r=.85*$(window).width();i.data("url",t),i.data("params",e),i.data("width",void 0!==a?a:r),i.data("height",void 0!==n?n:s);var l=i.data("height");l.search&&-1!==l.search("%")&&(l=l.replace("%","")/100,l=$(window).height()*l),l>s&&(l=s),i.data("height",l),o?(i.data("delay",!0),i.modal()):i.load(t,e,(function(){i.modal()}))}else console.log("URL needed")}function setPreviewSize(t,e){var a=$remoteModal.find(".modal-dialog"),n=($("#previewFrame").length&&$("#previewFrame"),{width:$remoteModal.data("width")}),o={width:e};(!e||o.width>n.width)&&(o={width:n.width}),$remoteModal.find(".header-title").toggle(o.width>600),$(t).siblings(".btn-primary").removeClass("btn-primary").addClass("btn-info"),$(t).removeClass("btn-info").addClass("btn-primary"),a.animate(o,500)}function attachModalListeners(){$remoteModal.on("show.bs.modal",(function(){var t=$remoteModal;t.find(".modal-dialog").css({width:t.data("width"),height:t.data("height")})})),$remoteModal.on("shown.bs.modal",(function(){var t=$remoteModal;t.data("delay")&&t.load(t.data("url"),t.data("params"),(function(){t.find(".modal-dialog").css({width:t.data("width"),height:t.data("height")})}))})),$remoteModal.on("hidden.bs.modal",(function(){var t=$remoteModal;t.html(''),resetContainerForms(t)}))}function activateToggleCheckboxes(){$('input[data-toggle="toggle"]').change((function(){var t=$(this).data("match");$("#"+t).val($(this).prop("checked"))}))}function closeConfirmations(){$confirmIt.modal("hide")}function activateConfirmations(){$confirmIt.find("button").click((function(t){"confirm"===$(this).attr("data-action")&&($confirmIt.find("#confirmItButtons").hide(),$confirmIt.find("#confirmItLoader").fadeIn(),window.location=$confirmIt.data("confirmSrc"))})),$(".confirmIt").click((function(t){$confirmIt.find("#confirmItButtons").fadeIn(),$confirmIt.find("#confirmItLoader").hide(),$confirmIt.data("confirmSrc",$(this).attr("href"));var e=$(this).attr("data-message")?$(this).attr("data-message"):"Are you sure you want to perform this action?",a=$(this).attr("data-title")?$(this).attr("data-title"):"Are you sure?";$confirmIt.find("#confirmItMessage").html(e),$confirmIt.find("#confirmItTitle").html(a),$confirmIt.modal(),t.preventDefault()}))}function popup(t,e,a){var n=750;e&&(minWidth=e),a&&(n=a);var o=screen.width/2-500,i=screen.height/2-n/2;window.open(t,"layoutPreview","resizable=yes,status=yes,location=no,menubar=no,toolbar=no,scrollbars=yes,width=1000,height="+n+",left="+o+",top="+i+",screenX="+o+",screenY="+i)}function to(t){return window.location=t,!1}function checkAll(t,e){$("input[name='"+e+"']").each((function(){this.checked=t}))}function checkByValue(t,e){$("input[name='"+t+"']").each((function(){this.value===e?this.checked=!0:this.checked=!1}))}function getToday(t){return(t=null==t||t)?moment().format("YYYY-MM-DD"):moment().format("DD-MM-YYYY")}function importContent(){var t=$("#importForm");openModal($importDialog,500,350),t.validate({submitHandler:function(e){t.find("#importButtonBar").slideUp(),t.find("#importBarLoader").slideDown(),e.submit()}}),t.find("#closeButton").click((function(t){return closeModal($importDialog),!1})),t.find("#importButton").click((function(e){t.submit()}))}function toggleMoreInfoPanel(t){$("#moreInfo-"+t).toggleClass("hidden"),$("#moreInfoOpenButton-"+t).toggleClass("hidden"),$("#moreInfoCloseButton-"+t).toggleClass("hidden")}function passwordMeter(t){var e=$(this).val();$("#pw_rule_count").html(e.length);var a=$("#passwordRules").data("min-length"),n={lower:REGEX_LOWER.test(e),upper:REGEX_UPPER.test(e),digit:REGEX_DIGIT.test(e),special:REGEX_SPECIAL.test(e)};for(var o in e.length>=a?$("#pw_rule_count").addClass("badge-success"):$("#pw_rule_count").removeClass("badge-success"),n)n[o]?$("#pw_rule_"+o).addClass("badge-success"):$("#pw_rule_"+o).removeClass("badge-success")}function passwordValidator(t){var e=$("#passwordRules").data("min-length"),a=REGEX_LOWER.test(t),n=REGEX_UPPER.test(t),o=REGEX_DIGIT.test(t),i=(REGEX_DIGITS.test(t),REGEX_SPECIAL.test(t));return a&&n&&o&&i&&t.length>=e}function toLocalString(t,e){return new Date(t).toLocaleString(void 0,e||getDefaultDateTimeOptions())}function toLocaleDateString(t,e){return new Date(t).toLocaleDateString(void 0,e||getDefaultDateTimeOptions())}function toLocaleTimeString(t,e){return new Date(t).toLocaleTimeString(void 0,e||getDefaultDateTimeOptions())}function getDefaultDateTimeOptions(){return{dateStyle:"medium",timeStyle:"long"}}function scrollToHash(t){location.hash="#"+t}document.addEventListener("DOMContentLoaded",(()=>{REGEX_LOWER=/[a-z]/,REGEX_UPPER=/[A-Z]/,REGEX_DIGIT=/[0-9]/,REGEX_DIGITS=/[0-9].*[0-9]/,REGEX_SPECIAL=/[^a-zA-Z0-9]/,"no"==$("body").attr("data-showsidebar")&&toggleSidebar(),void 0!==$("#main-content-sidebar").attr("id")&&$("#main-content-sidebar-trigger").fadeIn(),$confirmIt=$("#confirmIt"),$remoteModal=$("#modal"),attachModalListeners(),toolTipSettings={animation:"slide",delay:{show:100,hide:100}},activateContentSearch(),activateConfirmations(),activateTooltips(),activateNavbarState(),activateToggleCheckboxes(),$.validator.setDefaults({ignore:[],highlight:function(t){$(t).closest(".form-group").removeClass("success").addClass("error")},success:function(t){t.text("Field is valid").addClass("valid").closest(".form-group").removeClass("error").addClass("success"),t.remove()},errorPlacement:function(t,e){if($(e).is(":hidden"))return!1;t.appendTo(e.closest("div.controls"))}}),$.fn.resetValidations=function(){var t=this[0].currentForm;return $(t).find(".form-group").each((function(){$(this).removeClass("error").removeClass("success")})),$(t).find(":input").each((function(){$(this).removeClass("error").removeClass("valid")})),this},$.fn.clearForm=function(){if(void 0!==this.data("validator"))return this.data("validator").resetForm(),this.find(":input").each((function(){switch(this.type){case"password":case"hidden":case"select-multiple":case"select-one":case"text":case"textarea":$(this).val("");break;case"checkbox":case"radio":this.checked=!1}})),$(this.data("validator")).resetValidations(),this},$.fn.collect=function(){var t=this.serializeArray(),e={};return $.each(t,(function(t,a){e[a.name]=a.value})),e};setTimeout(toggleFlickers(),5e3);$((function(){var t=$('[href="'+location.hash+'"]');t&&t.tab("show")})),jwerty.key("ctrl+shift+s",(function(){return $("#nav-search").focus(),!1})),$("[data-keybinding]").each((function(){var t=$(this);jwerty.key(t.data("keybinding"),(function(){t.attr("onclick")?t.click():to(t.attr("href"))}))})),$("#main-navbar li.nav-dropdown").each((function(){$(this).find("ul.nav-sub li").length||$(this).hide()})),$(".accordion[data-stateful]").each((function(){var t,e=$(this),a=e.data("stateful");a&&null!==(t=$.cookie(a))&&(e.find(".collapse").removeClass("in"),$("#"+t).addClass("in")),e.bind("shown.bs.collapse",(function(){var t=e.find(".in").attr("id");$.cookie(a,t)}))}))}));var app=function(){var t=function(){$("#toggle-left").tooltip({delay:100})},e=function(){$(".actions > .fa-chevron-down").click((function(){$(this).parent().parent().next().slideToggle("fast"),$(this).toggleClass("fa-chevron-down fa-chevron-up")}))},a=function(){$("#toggle-left").bind("click",(function(t){$("body").removeClass("off-canvas-open");var e=$("#container");$(window).width()>767?$(e).toggleClass("sidebar-mini"):$(e).toggleClass("sidebar-opened")}))},n=function(){$("#toggle-right").click((function(){$(".off-canvas").toggleClass("off-canvas-open")}))},o=function(){Array.prototype.slice.call(document.querySelectorAll(".js-switch")).forEach((function(t){new Switchery(t,{size:"small"})}))},i=function(){$(".actions > .fa-times").click((function(){$(this).parent().parent().parent().fadeOut()}))},s=function(){var t=$(".sidebar .nav");$(t).navgoco({caretHtml:!1,accordion:!0,slide:{duration:400,easing:"swing"}})};return{init:function(){t(),a(),n(),o(),s(),e(),i()},sliders:function(){$(".slider-span").slider()},morrisPie:function(){Morris.Donut({element:"donut-example",data:[{label:"Chrome",value:73},{label:"Firefox",value:71},{label:"Safari",value:69},{label:"Internet Explorer",value:40},{label:"Opera",value:20},{label:"Android Browser",value:10}],colors:["#1abc9c","#293949","#e84c3d","#3598db","#2dcc70","#f1c40f"]})}}}();document.addEventListener("DOMContentLoaded",(()=>{app.init();var t=$("#container");$(window).width()<=768&&!$(t).hasClass("sidebar-mini")&&($("body").removeClass("off-canvas-open"),$(t).toggleClass("sidebar-mini"))}));const contentListHelper=(()=>{const t={"Content-type":"application/json;charset=UTF-8"};var e="",a="",n="",o="",i="",s="",r="",l="",c="",d=t=>{null==t&&(t={}),"search"in t||(t.search=""),"page"in t||(t.page=1),"parent"in t||(t.parent=""),"fAuthors"in t||(t.fAuthors="all"),"fCreators"in t||(t.fCreators="all"),"fCategories"in t||(t.fCategories="all"),"fStatus"in t||(t.fStatus="any"),"showAll"in t||(t.showAll=!1),a.css("opacity",.6);var e={page:t.page,parent:t.parent,fAuthors:t.fAuthors,fCategories:t.fCategories,fStatus:t.fStatus,showAll:t.showAll,fCreators:t.fCreators};e[i]=t.search,a.load(n,e,(function(){a.css("opacity",1),$(this).fadeIn("fast")}))},f=()=>{"all"!=$("#fAuthors").val()||"all"!=$("#fCreators").val()||"all"!=$("#fCategories").val()||"any"!=$("#fStatus").val()?$("#filterBox").addClass("selected"):$("#filterBox").removeClass("selected"),d({fAuthors:$("#fAuthors").val(),fCategories:$("#fCategories").val(),fStatus:$("#fStatus").val(),fCreators:$("#fCreators").val()})},u=t=>{t&&d(),$("#filterBox").removeClass("selected"),$("#fAuthors").val("all"),$("#fCategories").val("all"),$("#fStatus").val("any"),$("#fCreators").val("all")};return{init:t=>{e=t.adminEntryPoint,a=t.tableContainer,n=t.tableURL,o=t.searchField,i=t.searchName,s=t.contentForm,r=t.bulkStatusURL,l=t.cloneDialog,c=t.parentID,History.Adapter.bind(window,"statechange",(function(){d({parent:History.getState().data.parent})})),o.keyup(_.debounce((function(){d({search:$(this).val()})}),300)),c.length?d({parent:c}):d({})},contentLoad:d,contentFilter:f,resetFilter:u,contentDrilldown:t=>{u(),null==t&&(t=""),o.val(""),History.pushState({parent:t},document.title,"?parent="+t),scrollToHash("container")},contentShowAll:()=>{u(),d({showAll:!0})},contentPaginate:t=>{d({search:o.val(),page:t,parent:History.getState().data.parent||c,fAuthors:$("#fAuthors").val(),fCategories:$("#fCategories").val(),fStatus:$("#fStatus").val(),fCreators:$("#fCreators").val()})},getInfoPanelContent:t=>$("#infoPanel_"+t).html(),activateInfoPanels:()=>{$(".popovers").popover({html:!0,content:function(){return getInfoPanelContent($(this).attr("data-contentID"))},trigger:"hover",placement:"left",title:' Quick Info',delay:{show:200,hide:500}})},activateQuickLook:(t,e)=>{t.find("tr").bind("contextmenu",(function(t){3===t.which&&null!=$(this).attr("data-contentID")&&(openRemoteModal(e+$(this).attr("data-contentID")),t.preventDefault())}))},remove:(t,e)=>{checkAll(!1,e=void 0!==e?e:"contentID"),null!=t&&($("#delete_"+t).removeClass("fa fa-minus-circle").addClass("fa fa-spinner fa-spin"),checkByValue(e,t)),s.submit()},bulkRemove:()=>{s.submit()},exportSelected:t=>{var e=[];$("#contentID:checked").each((function(){e.push($(this).val())})),e.length?(checkAll(!1,"contentID"),window.open(t+"/contentID/"+e)):alert("Please select something to export!")},bulkChangeStatus:(t,e)=>{s.attr("action",r),s.find("#contentStatus").val(t),null!=e&&($("#status_"+recordID).removeClass("fa fa-minus-circle").addClass("fa fa-spinner fa-spin"),checkByValue("contentID",e)),s.submit()},openCloneDialog:(t,e)=>{var a=l.find("#cloneForm");openModal(l,500),a.validate({submitHandler:function(t){l.find("#cloneButtonBar").slideUp(),l.find("#clonerBarLoader").slideDown(),t.submit()}}),a.find("#contentID").val(t),a.find("#title").val(e).focus(),l.find("#cloneButton").click((function(t){a.submit()}))},resetHits:a=>{a.length&&fetch(e+"/content/resetHits",{method:"POST",headers:t,body:JSON.stringify({contentID:a})}).then((t=>t.json())).then((t=>{t.error?alert("Error Reseting Hits: "+t.messages.join(",")):(adminNotifier("info",t.messages.join("
    "),3e3),f())})).catch((t=>{alert("Error Reseting Hits: "+t)}))},resetBulkHits:()=>{var t=[];$("#contentID:checked").each((function(){t.push($(this).val())})),t.length&&resetHits(t.join(","))}}})();function fbCKSelect(t,e,a){if(t.length&&"dir"!==a){var n,o,i=(n=new RegExp("(?:[?&]|&)"+"CKEditorFuncNum"+"=([^&]+)","i"),(o=window.location.search.match(n))&&o.length>1?o[1]:"");window.opener.CKEDITOR.tools.callFunction(i,e),window.close()}else alert("Please select a file first.")}function fbGenericClose(){window.close()}function fbTestChoose(t,e,a){alert("Path: "+t+"\n URL: "+e+"\n Type: "+a)}function fbTestCancel(){alert("Cancel Called")}function fbUpload(){$("#uploadBar").slideToggle()}function fbVerifyActiveView(){let t="#"+$listType.val()+$listFolder.val();$(t).removeClass("btn-more").addClass("btn-default")} \ No newline at end of file diff --git a/workbench/resources/js/contentList.js b/workbench/resources/js/contentList.js index 52d99d5ffb..6f5be1e18b 100644 --- a/workbench/resources/js/contentList.js +++ b/workbench/resources/js/contentList.js @@ -111,10 +111,7 @@ const contentListHelper = ( () => { $searchField.keyup( _.debounce( function(){ - var $this = $( this ); - var clearIt = ( $this.val().length > 0 ? false : true ); - // ajax search - contentLoad( { search: $this.val() } ); + contentLoad( { search: $( this ).val() } ); }, 300 ) @@ -156,7 +153,7 @@ const contentListHelper = ( () => { contentLoad( { search : $searchField.val(), page : page, - parent : $parentID, + parent : History.getState().data.parent || $parentID, fAuthors : $( "#fAuthors" ).val(), fCategories : $( "#fCategories" ).val(), fStatus : $( "#fStatus" ).val(), @@ -304,4 +301,4 @@ const contentListHelper = ( () => { } }; -} )(); \ No newline at end of file +} )(); From a68fdedf3a4673b30f9fe81129c1bb53076c36b7 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 17 Mar 2022 18:01:47 -0500 Subject: [PATCH 100/100] finalized changelog --- changelog.md | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 0cbd505e2e..80a45834d8 100644 --- a/changelog.md +++ b/changelog.md @@ -7,4 +7,45 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ---- -## [5.1.0] => 2022-MAR +## [5.1.0] => 2022-MAR-17 + +### Fixed + +- [CONTENTBOX-1410](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1410) Widget Form missing type and class elements +- [CONTENTBOX-1409](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1409) regression: issue when resetting an user password due to change to `getFullName()` +- [CONTENTBOX-1407](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1407) Media Manager Item Contextual Menus Do Not Work +- [CONTENTBOX-1405](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1405) Cloning Fails if Title of Page/entry/contentstore that Contains an Apostrophe +- [CONTENTBOX-1398](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1398) Cloning a Page with Children Produces an Error +- [CONTENTBOX-1397](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1397) Settings should not be cached on a per host basis anymore, since a single instance manages 1 or x number of sites +- [CONTENTBOX-1396](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1396) Deleting Permissions is not working due to change of primary key from numeric to string +- [CONTENTBOX-1381](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1381) Individual ContentBox Content-Level Cache Settings are Never Checked +- [CONTENTBOX-1379](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1379) Fail Quietly on ContentBox Module Removal +- [CONTENTBOX-1367](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1367) error on relocate widget when argumetns have no length +- [CONTENTBOX-1365](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1365) Paginated results in CBAdmin for Page Children returns non-parented results for page 2 +- [CONTENTBOX-1364](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1364) Relocation Widget Always inserts URL arg even when selecting page +- [CONTENTBOX-1362](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1362) Change all date comparisons on the expirations and publishing dates to dateCompare\(\) to avoid ambiguity with types +- [CONTENTBOX-1361](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1361) Pages with null expiration date show as Expired in Page Editor +- [CONTENTBOX-1358](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1358) API throwing exception when content objects exist in multiple sites +- [CONTENTBOX-1357](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1357) If using the contentbox installer and no database tables are created yet, running the migrations fail due to tables not found +- [CONTENTBOX-1356](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1356) Invalid setting name on migration removing unique constraints +- [CONTENTBOX-1355](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1355) Category isPublic new boolean flag cannot be notnull=true as it has been a new added field +- [CONTENTBOX-1354](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1354) Rapidoc is not publishing on latest builds +- [CONTENTBOX-1353](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1353) MSSQL Issues when upgrading v4 databases due to uuid's and invalid sql syntaxes +- [CONTENTBOX-1333](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1333) If you activate a new theme in the active theme area, contentbox creates double entries for theme settings + +### Improvements + +- [CONTENTBOX-1401](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1401) Add a Warning Confirmation When a Published Page is About to Be Sent to Draft +- [CONTENTBOX-1386](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1386) cleanup of dev dependencies on site box.json +- [CONTENTBOX-1384](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1384) Remove development environment from 127 ip due to container executions +- [CONTENTBOX-1383](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1383) Remove cacheLayout column/values from SQL seeder files +- [CONTENTBOX-1380](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1380) Remove Individual Page Handling of SSL +- [CONTENTBOX-1373](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1373) Add support for x-forwarded-port to the site root url builder in order to assist with proxied web servers +- [CONTENTBOX-1363](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1363) Consolidate and encapsulate the usage of date/time methods for publish/expire date in the base content +- [CONTENTBOX-1359](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1359) Add Error handling to renderWithSearchResults +- [CONTENTBOX-1351](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1351) Resources folder that contain apidocs \+ seeders \+ migrations is not updateable + +### Tasks + +- [CONTENTBOX-1394](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1394) Create the migration to remove the page sslOnly bit +- [CONTENTBOX-1389](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1389) QA of the entire admin and API