diff --git a/.cfformat.json b/.cfformat.json
index f733831dea..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,
@@ -41,7 +42,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,
@@ -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/.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
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 212d8045fc..43e47cf42e 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -20,7 +20,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- cfengine: [ "lucee@5", "adobe@2016", "adobe@2018" ]
+ cfengine: [ "lucee@5", "adobe@2016", "adobe@2018", "adobe@2021" ]
javaVersion: [ "openjdk8", "openjdk11" ]
steps:
- name: Checkout Repository
@@ -28,7 +28,7 @@ jobs:
- name: Setup Database and Fixtures
run: |
- sudo /etc/init.d/mysql start
+ sudo systemctl start mysql.service
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
@@ -38,12 +38,13 @@ jobs:
distribution: "adopt"
java-version: "11"
- - name: Setup CommandBox
- uses: elpete/setup-commandbox@v1.0.0
+ - name: Setup CommandBox CLI
+ uses: Ortus-Solutions/setup-commandbox@v2.0.1
- name: Setup .env For Runner
run: |
touch .env
+ printf "ENVIRONMENT=development\n" >> .env
printf "DB_HOST=127.0.0.1\n" >> .env
printf "DB_DATABASE=contentbox\n" >> .env
printf "DB_DRIVER=MySQL\n" >> .env
@@ -105,7 +106,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
@@ -126,7 +127,7 @@ jobs:
if: failure()
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 tests failed :cry:, check them out here: https://github.com/Ortus-Solutions/ContentBox/actions'
@@ -143,6 +144,9 @@ jobs:
if [[ "{{ matrix.cfengine }}" == "adobe@2018" ]] ; then
cat .engines/acf2018/WEB-INF/cfusion/logs/hibernatesql.log
fi
+ if [[ "{{ matrix.cfengine }}" == "adobe@2021" ]] ; then
+ cat .engines/acf2021/WEB-INF/cfusion/logs/hibernatesql.log
+ fi
box server log serverConfigFile="server-${{ matrix.cfengine }}.json"
- name: Upload Debugging Info To Artifacts
@@ -173,17 +177,8 @@ jobs:
distribution: "adopt"
java-version: "11"
- - name: Cache CommandBox Dependencies
- uses: actions/cache@v1
- if: ${{ true }}
- with:
- path: ~/.CommandBox/artifacts
- key: ${{ runner.OS }}-commandbox-cache-${{ hashFiles( 'box.json' ) }}-${{ hashFiles( 'modules/contentbox/box.json' ) }}
- restore-keys: |
- ${{ runner.OS }}-commandbox-cache-${{ hashFiles( 'box.json' ) }}-${{ hashFiles( 'modules/contentbox/box.json' ) }}
-
- - name: Setup CommandBox
- uses: elpete/setup-commandbox@v1.0.0
+ - name: Setup CommandBox CLI
+ uses: Ortus-Solutions/setup-commandbox@v2.0.1
with:
forgeboxAPIKey: ${{ secrets.FORGEBOX_API_TOKEN }}
@@ -191,6 +186,7 @@ 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
@@ -211,7 +207,8 @@ jobs:
- name: Build Docs
run: |
# Normalize swagger doc results
- cp tests/results/contentbox-test-results-lucee@5/contentbox-swagger.json 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
@@ -266,10 +263,10 @@ 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 }}!'
SLACK_TITLE: "ContentBox Build"
SLACK_USERNAME: CI
- SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
\ No newline at end of file
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
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/.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/.github/workflows/pr.yml b/.github/workflows/pr.yml
index 1d24c49234..f90d660f7b 100644
--- a/.github/workflows/pr.yml
+++ b/.github/workflows/pr.yml
@@ -20,14 +20,15 @@ jobs:
strategy:
fail-fast: true
matrix:
- cfengine: ["lucee@5", "adobe@2016", "adobe@2018"]
+ cfengine: [ "lucee@5", "adobe@2016", "adobe@2018", "adobe@2021" ]
+ javaVersion: [ "openjdk8", "openjdk11" ]
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Setup Database and Fixtures
run: |
- sudo /etc/init.d/mysql start
+ sudo systemctl start mysql.service
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
@@ -37,12 +38,13 @@ jobs:
distribution: "adopt"
java-version: "11"
- - name: Setup CommandBox
- uses: elpete/setup-commandbox@v1.0.0
+ - name: Setup CommandBox CLI
+ uses: Ortus-Solutions/setup-commandbox@v2.0.1
- name: Setup .env For Runner
run: |
touch .env
+ printf "ENVIRONMENT=development\n" >> .env
printf "DB_HOST=127.0.0.1\n" >> .env
printf "DB_DATABASE=contentbox\n" >> .env
printf "DB_DRIVER=MySQL\n" >> .env
@@ -52,17 +54,6 @@ jobs:
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
@@ -70,9 +61,9 @@ jobs:
# ContentBox dependencies
cd modules/contentbox && box install
- - name: Start ${{ matrix.cfengine }} Server
+ - name: Start ${{ matrix.cfengine }}/${{ matrix.javaVersion }} Server
run: |
- box server start serverConfigFile="server-${{ matrix.cfengine }}.json" --debug
+ box server start serverConfigFile="server-${{ matrix.cfengine }}.json" javaVersion=${{ matrix.javaVersion }} --noSaveSettings --debug
# Install Adobe 2021 cfpm modules
if [[ "${{ matrix.cfengine }}" == "adobe@2021" ]] ; then
box run-script install:2021
@@ -96,7 +87,7 @@ jobs:
if: always()
with:
report_paths: 'tests/results/**/*.xml'
- summary: true
+ check_name: "${{ matrix.cfengine }}/${{ matrix.javaVersion }} Test Results"
- name: Failure debugging
if: ${{ failure() }}
@@ -107,6 +98,9 @@ jobs:
if [[ "{{ matrix.cfengine }}" == "adobe@2018" ]] ; then
cat .engines/acf2018/WEB-INF/cfusion/logs/hibernatesql.log
fi
+ if [[ "{{ matrix.cfengine }}" == "adobe@2021" ]] ; then
+ cat .engines/acf2021/WEB-INF/cfusion/logs/hibernatesql.log
+ fi
box server log serverConfigFile="server-${{ matrix.cfengine }}.json"
format:
@@ -116,22 +110,11 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v2
- - name: Setup Java
- uses: actions/setup-java@v2
+ - uses: Ortus-Solutions/commandbox-action@v1.0.2
with:
- distribution: "adopt"
- java-version: "11"
-
- - name: Set Up CommandBox
- uses: elpete/setup-commandbox@v1.0.0
-
- - name: Install CFFormat
- run: box install commandbox-cfformat
-
- - name: Run CFFormat
- run: box run-script format
+ cmd: run-script format
- name: Commit Format Changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
- commit_message: Apply cfformat changes
\ No newline at end of file
+ commit_message: Apply cfformat changes
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/Application.cfc b/Application.cfc
index 24eafdc874..184ced67da 100644
--- a/Application.cfc
+++ b/Application.cfc
@@ -139,9 +139,9 @@ component {
public boolean function onRequestStart( string targetPage ){
// In case bootstrap or controller are missing, perform a manual restart
if (
- !structKeyExists( application, "cbBootstrap" )
+ isNull( application.cbBootstrap )
||
- !structKeyExists( application, "cbController" )
+ isNull( application.cbController )
) {
if( this._loadDynamicEnvironment ){
loadEnv( force : true );
@@ -151,7 +151,7 @@ component {
// Development Reinit + ORM Reloads
if (
- structKeyExists( application, "cbController" )
+ !isNull( application.cbController )
&&
application.cbController.getSetting( "environment" ) == "development"
&&
@@ -173,7 +173,7 @@ component {
}
public void function onSessionStart(){
- if ( structKeyExists( application, "cbBootstrap" ) ) {
+ if( !isNull( application.cbBootstrap ) ){
application.cbBootStrap.onSessionStart();
}
}
@@ -227,4 +227,4 @@ component {
} // end lock check
}
-}
\ No newline at end of file
+}
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000000..d9b8b779bc
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,107 @@
+# ContentBox CMS Contributing Guide
+
+Hola amigo! I'm really excited that you are interested in contributing to ContentBox CMS. Before submitting your contribution, please make sure to take a moment and read through the following guidelines:
+
+- [Code Of Conduct](#code-of-conduct)
+- [Bug Reporting](#bug-reporting)
+- [Support Questions](#support-questions)
+- [Pull Request Guidelines](#pull-request-guidelines)
+- [Security Vulnerabilities](#security-vulnerabilities)
+- [Development Setup](#development-setup)
+ - [Language Compatiblity](#language-compatiblity)
+- [Coding Styles & Formatting](#coding-styles--formatting)
+- [CFC Docs With DocBox](#cfc-docs-with-docbox)
+- [Financial Contributions](#financial-contributions)
+- [Contributors](#contributors)
+
+## Code Of Conduct
+
+This project is open source, and as such, the maintainers give their free time to build and maintain the source code held within. They make the code freely available in the hope that it will be of use to other developers and/or businesses. Please be considerate towards maintainers when raising issues or presenting pull requests. **We all follow the Golden Rule: Do to others as you want them to do to you.**
+
+- As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
+- Participants will be tolerant of opposing views.
+- Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
+- Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
+- When interpreting the words and actions of others, participants should always assume good intentions. Emotions cannot be derived from textual representations.
+- Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
+
+
+## Bug Reporting
+
+Please make sure also that if you submit a pull request, that you link it to the appropriate issue.
+
+- ContentBox : https://ortussolutions.atlassian.net/browse/CONTENTBOX
+- ColdBox Core : https://ortussolutions.atlassian.net/browse/COLDBOX
+
+If you file a bug report, your issue should contain a title, a clear description of the issue, a way to replicate the issue, and any support files that we might need to replicate your issue. The goal of a bug report is to make it easy for yourself - and others - to replicate the bug and develop a fix for it. All issues that do not contain a way to replicate will not be addressed.
+
+## Support Questions
+
+If you have any questions on usage, professional support or just ideas to bounche of the maintainers, please do not create an issue. Leverage our support channels first.
+
+- Ortus Community Discourse: https://community.ortussolutions.com/c/communities/contentbox/15
+- Box Slack Team: http://boxteam.herokuapp.com/
+- Professional Support: https://www.ortussolutions.com/services/support
+
+## Pull Request Guidelines
+
+- The `master` branch is just a snapshot of the latest stable release. All development should be done in dedicated branches. Do not submit PRs against the master branch. They will be closed.
+- All pull requests should be sent against the `development` branch.
+- It's OK to have multiple small commits as you work on the PR - GitHub will automatically squash it before merging.
+- Make sure all local tests pass before submitting the merge.
+- Please make sure all your pull requests have companion tests.
+- Please link the Jira issue in your PR title when sending the final PR
+
+## Security Vulnerabilities
+
+If you discover a security vulnerability, please send an email to the development team at [security@ortussolutions.com](mailto:security@ortussolutions.com?subject=security) and make sure you report it to the `#security` channel in our Box Team Slack Channel. All security vulnerabilities will be promptly addressed.
+
+## Development Setup
+
+We have added all the necessary information for you to develop on ContentBox in our [readme collaboration area](../readme.md) and also in our [UI Developer Docs](../workbench/Developer.md) so you can setup for UI development.
+
+### Language Compatiblity
+
+Please make sure your code runs on the following CFML Engines:
+
+- Lucee 5+
+- Adobe ColdFusion 2018+
+
+## Coding Styles & Formatting
+
+We are big on coding styles and have included a `.cfformat.json` in the root of the project so that you can run the formatting tools and CommandBox scripts:
+
+```bash
+# Format everything
+box run-script format
+
+# Start a watcher, type away, save and auto-format for you
+box run-script format:watch
+```
+
+We recommend that anytime you hack on the core you start the formatter watcher (`box run-script format:watch`). This will monitor your changes and auto-format your code for you.
+
+You can also see the Ortus Coding Standards you must follow here: https://github.com/Ortus-Solutions/coding-standards.
+
+## CFC Docs With DocBox
+
+All CFCs are self-documenting and we leverage [DocBox](https://docbox.ortusbooks.com/) to document the entire software. All functions must be properly documented using the DocBox syntax: https://docbox.ortusbooks.com/getting-started/annotating-your-code
+
+
+## Financial Contributions
+
+You can support ColdBox and all of our Open Source initiatives at Ortus Solutions by becoming a patreon. You can also get lots of goodies and services depending on the level of contributions.
+
+- [Become a backer or sponsor on Patreon](https://www.patreon.com/ortussolutions)
+- [One-time donations via PayPal](https://www.paypal.com/paypalme/ortussolutions)
+
+## Contributors
+
+Thank you to all the people who have already contributed to ColdBox! We :heart: :heart: :heart: love you!
+
+
+
+
+
+
+Made with [contributors-img](https://contrib.rocks)
diff --git a/box-site.json b/box-site.json
index a04379c059..3ecec4e7df 100644
--- a/box-site.json
+++ b/box-site.json
@@ -34,9 +34,6 @@
"commandbox-migrations":"*"
},
"devDependencies":{
- "testbox":"*",
- "commandbox-cfformat":"*",
- "commandbox-docbox":"*"
},
"installPaths":{
},
@@ -53,5 +50,11 @@
"password":"${DB_PASSWORD}"
},
"defaultGrammar":"AutoDiscover@qb"
- }
-}
\ No newline at end of file
+ },
+ "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",
+ "install:2021":"!cfpm install zip,orm,mysql,postgresql,sqlserver,document,feed"
+ }
+}
diff --git a/box.json b/box.json
index 1349051073..c76dc382d6 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,16 +44,16 @@
},
"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`",
- "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,12 @@
"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: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",
+ "contentbox:migrate:down":"migrate down migrationsDirectory=modules/contentbox/migrations"
},
"cfmigrations":{
"schema":"${DB_DATABASE}",
@@ -88,4 +93,4 @@
}
]
}
-}
\ No newline at end of file
+}
diff --git a/build/BuildDocs.cfc b/build/BuildDocs.cfc
index 2f41659e99..c62fe6caf1 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"
);
}
@@ -109,13 +127,21 @@ 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"
+ );
- 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
+}
diff --git a/build/patches/1-0-4/Update.cfc b/build/patches/1-0-4/Update.cfc
index 292b8a1630..d6d36dd8ef 100755
--- a/build/patches/1-0-4/Update.cfc
+++ b/build/patches/1-0-4/Update.cfc
@@ -74,10 +74,6 @@ component implements="contentbox.model.updates.IUpdate"{
KEY `idx_moduleName` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
- // Cache layout bits
- ALTER TABLE cb_content ADD COLUMN cacheLayout BIT NULL DEFAULT b'1';
- CREATE INDEX idx_cachelayout ON cb_content(cacheLayout);
-
// Create new columns custom HTML
ALTER TABLE cb_customHTML ADD COLUMN cache BIT NULL DEFAULT b'1';
ALTER TABLE cb_customHTML ADD COLUMN cacheTimeout INT NOT NULL DEFAULT 0;
diff --git a/build/patches/5.0.0/Updater.cfc b/build/patches/5.0.0/Updater.cfc
index 12fe76d31c..62682dcfba 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. " )
@@ -67,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
diff --git a/changelog.md b/changelog.md
new file mode 100644
index 0000000000..80a45834d8
--- /dev/null
+++ b/changelog.md
@@ -0,0 +1,51 @@
+# 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-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
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..f4ee413965 100755
--- a/config/Coldbox.cfc
+++ b/config/Coldbox.cfc
@@ -76,7 +76,7 @@ component {
*
* Uncomment to use, but make sure your .env ENVIRONMENT key is also removed.
*/
- environments = { development : "localhost,^127" };
+ environments = { development : "localhost" };
/**
* --------------------------------------------------------------------------
@@ -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/ModuleConfig.cfc b/modules/contentbox/ModuleConfig.cfc
index f31509af57..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 = [
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 98%
rename from resources/apidocs/contentStore/create/example.200.json
rename to modules/contentbox/apidocs/contentStore/create/example.200.json
index 272d685943..2e8b39e47d 100644
--- a/resources/apidocs/contentStore/create/example.200.json
+++ b/modules/contentbox/apidocs/contentStore/create/example.200.json
@@ -54,7 +54,6 @@
"contentVersionID": "ff8081817bd0c176017bd0d281340003"
},
"expireDate": "",
- "cacheLayout": true,
"customFields": {},
"title": "Title",
"numberOfChildren": "0",
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 98%
rename from resources/apidocs/contentStore/index/example.200.json
rename to modules/contentbox/apidocs/contentStore/index/example.200.json
index 209e5004c3..3ce4a3c64b 100644
--- a/resources/apidocs/contentStore/index/example.200.json
+++ b/modules/contentbox/apidocs/contentStore/index/example.200.json
@@ -35,7 +35,6 @@
"categories": [],
"markup": "HTML",
"expireDate": "",
- "cacheLayout": true,
"title": "Contact Info",
"numberOfChildren": "0",
"featuredImageURL": "",
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 98%
rename from resources/apidocs/contentStore/show/example.200.json
rename to modules/contentbox/apidocs/contentStore/show/example.200.json
index 332dc8b0b9..7e3c7824ae 100644
--- a/resources/apidocs/contentStore/show/example.200.json
+++ b/modules/contentbox/apidocs/contentStore/show/example.200.json
@@ -55,7 +55,6 @@
"contentVersionID": "ff8081817bd0c176017bd0d281340003"
},
"expireDate": "",
- "cacheLayout": true,
"customFields": {},
"title": "Title",
"numberOfChildren": "0",
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 98%
rename from resources/apidocs/contentStore/update/example.200.json
rename to modules/contentbox/apidocs/contentStore/update/example.200.json
index af4a9cacf1..87c2c784fc 100644
--- a/resources/apidocs/contentStore/update/example.200.json
+++ b/modules/contentbox/apidocs/contentStore/update/example.200.json
@@ -54,7 +54,6 @@
"contentVersionID": "ff8081817bd0c176017bd0d281340003"
},
"expireDate": "",
- "cacheLayout": true,
"customFields": {},
"title": "Title",
"numberOfChildren": "0",
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 98%
rename from resources/apidocs/entries/create/example.200.json
rename to modules/contentbox/apidocs/entries/create/example.200.json
index c7e4df6c98..f658e1ee28 100644
--- a/resources/apidocs/entries/create/example.200.json
+++ b/modules/contentbox/apidocs/entries/create/example.200.json
@@ -53,7 +53,6 @@
"contentVersionID": "ff8081817bd0c176017bd0e2eb5b0005"
},
"expireDate": "",
- "cacheLayout": true,
"customFields": {},
"title": "Title",
"numberOfChildren": "0",
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 98%
rename from resources/apidocs/entries/index/example.200.json
rename to modules/contentbox/apidocs/entries/index/example.200.json
index eeca37c596..68fab8f638 100644
--- a/resources/apidocs/entries/index/example.200.json
+++ b/modules/contentbox/apidocs/entries/index/example.200.json
@@ -34,7 +34,6 @@
"categories": [],
"markup": "HTML",
"expireDate": "",
- "cacheLayout": true,
"title": "My first entry",
"numberOfChildren": "0",
"featuredImageURL": "",
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 98%
rename from resources/apidocs/entries/show/example.200.json
rename to modules/contentbox/apidocs/entries/show/example.200.json
index 072c7e50f0..978703cb53 100644
--- a/resources/apidocs/entries/show/example.200.json
+++ b/modules/contentbox/apidocs/entries/show/example.200.json
@@ -54,7 +54,6 @@
"contentVersionID": "ff8081817bd0c176017bd0e2eb5b0005"
},
"expireDate": "",
- "cacheLayout": true,
"customFields": {},
"title": "Title",
"numberOfChildren": "0",
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 98%
rename from resources/apidocs/entries/update/example.200.json
rename to modules/contentbox/apidocs/entries/update/example.200.json
index 1d85cf69f4..16c4db8450 100644
--- a/resources/apidocs/entries/update/example.200.json
+++ b/modules/contentbox/apidocs/entries/update/example.200.json
@@ -53,7 +53,6 @@
"contentVersionID": "ff8081817bd0c176017bd0e2eb5b0005"
},
"expireDate": "",
- "cacheLayout": true,
"customFields": {},
"title": "Title",
"numberOfChildren": "0",
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 97%
rename from resources/apidocs/pages/create/example.200.json
rename to modules/contentbox/apidocs/pages/create/example.200.json
index 750f319e53..6e66a65c7d 100644
--- a/resources/apidocs/pages/create/example.200.json
+++ b/modules/contentbox/apidocs/pages/create/example.200.json
@@ -23,7 +23,6 @@
},
"showInSearch": true,
"HTMLKeywords": "",
- "SSLOnly": false,
"featuredImage": "",
"numberOfComments": "0",
"isDeleted": false,
@@ -58,7 +57,6 @@
"contentVersionID": "ff8081817bd0c176017bd110c4ee0008"
},
"expireDate": "",
- "cacheLayout": true,
"customFields": {},
"title": "Title",
"numberOfChildren": "0",
@@ -76,4 +74,4 @@
"totalRecords": 0
},
"messages": []
-}
\ No newline at end of file
+}
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 96%
rename from resources/apidocs/pages/index/example.200.json
rename to modules/contentbox/apidocs/pages/index/example.200.json
index 172f5bc37b..fb87008acc 100644
--- a/resources/apidocs/pages/index/example.200.json
+++ b/modules/contentbox/apidocs/pages/index/example.200.json
@@ -20,7 +20,6 @@
"email": "lmajano@ortussolutions.com"
},
"showInSearch": true,
- "SSLOnly": true,
"featuredImage": "",
"numberOfComments": "0",
"isDeleted": false,
@@ -39,7 +38,6 @@
"categories": [],
"markup": "HTML",
"expireDate": "",
- "cacheLayout": true,
"title": "About",
"numberOfChildren": "0",
"featuredImageURL": "",
@@ -66,7 +64,6 @@
"email": "lmajano@ortussolutions.com"
},
"showInSearch": true,
- "SSLOnly": false,
"featuredImage": "",
"numberOfComments": "0",
"isDeleted": false,
@@ -85,7 +82,6 @@
"categories": [],
"markup": "HTML",
"expireDate": "",
- "cacheLayout": true,
"title": "New",
"numberOfChildren": "0",
"featuredImageURL": "",
@@ -112,7 +108,6 @@
"email": "lmajano@ortussolutions.com"
},
"showInSearch": true,
- "SSLOnly": false,
"featuredImage": "",
"numberOfComments": "0",
"isDeleted": false,
@@ -131,7 +126,6 @@
"categories": [],
"markup": "HTML",
"expireDate": "",
- "cacheLayout": true,
"title": "Something",
"numberOfChildren": "0",
"featuredImageURL": "",
@@ -148,4 +142,4 @@
"totalRecords": 3
},
"messages": []
-}
\ No newline at end of file
+}
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/update/example.200.json b/modules/contentbox/apidocs/pages/show/example.200.json
similarity index 98%
rename from resources/apidocs/pages/update/example.200.json
rename to modules/contentbox/apidocs/pages/show/example.200.json
index ddd68155b2..4fe2dce1c9 100644
--- a/resources/apidocs/pages/update/example.200.json
+++ b/modules/contentbox/apidocs/pages/show/example.200.json
@@ -24,7 +24,6 @@
},
"showInSearch": true,
"HTMLKeywords": "",
- "SSLOnly": false,
"featuredImage": "",
"numberOfComments": "0",
"isDeleted": false,
@@ -59,7 +58,6 @@
"contentVersionID": "ff8081817bd0c176017bd110c4ee0008"
},
"expireDate": "",
- "cacheLayout": true,
"customFields": {},
"title": "Title",
"numberOfChildren": "0",
@@ -77,4 +75,4 @@
"totalRecords": 0
},
"messages": []
-}
\ No newline at end of file
+}
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/show/example.200.json b/modules/contentbox/apidocs/pages/update/example.200.json
similarity index 98%
rename from resources/apidocs/pages/show/example.200.json
rename to modules/contentbox/apidocs/pages/update/example.200.json
index ddd68155b2..4fe2dce1c9 100644
--- a/resources/apidocs/pages/show/example.200.json
+++ b/modules/contentbox/apidocs/pages/update/example.200.json
@@ -24,7 +24,6 @@
},
"showInSearch": true,
"HTMLKeywords": "",
- "SSLOnly": false,
"featuredImage": "",
"numberOfComments": "0",
"isDeleted": false,
@@ -59,7 +58,6 @@
"contentVersionID": "ff8081817bd0c176017bd110c4ee0008"
},
"expireDate": "",
- "cacheLayout": true,
"customFields": {},
"title": "Title",
"numberOfChildren": "0",
@@ -77,4 +75,4 @@
"totalRecords": 0
},
"messages": []
-}
\ No newline at end of file
+}
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/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/resources/database/migrations/2020_08_24_150933_v5Upgrade.cfc b/modules/contentbox/migrations/2020_08_24_150933_v5Upgrade.cfc
similarity index 53%
rename from resources/database/migrations/2020_08_24_150933_v5Upgrade.cfc
rename to modules/contentbox/migrations/2020_08_24_150933_v5Upgrade.cfc
index 34e722c3c8..824262d19e 100755
--- a/resources/database/migrations/2020_08_24_150933_v5Upgrade.cfc
+++ b/modules/contentbox/migrations/2020_08_24_150933_v5Upgrade.cfc
@@ -26,38 +26,51 @@ 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;
}
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 ){
// 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,16 +94,23 @@ 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 ) );
- 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" );
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 );
@@ -100,7 +120,7 @@ component {
}
function down( schema, query ){
- if( !isContentBox4() ){
+ if ( !isContentBox4() ) {
return;
}
@@ -127,7 +147,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
@@ -145,11 +165,10 @@ 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.uuid( "FK_siteID" ).nullable() );
+ table.addColumn( table.string( "FK_siteID", 36 ).nullable() );
table.addConstraint(
table
.foreignKey( "FK_siteID" )
@@ -164,14 +183,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 );
+ }
} );
}
@@ -229,10 +249,7 @@ component {
.isEmpty();
if ( !isNewPermission ) {
- systemOutput(
- "√ - #thisPermission.name# permission already in database skipping",
- true
- );
+ systemOutput( "√ - #thisPermission.name# permission already in database skipping", true );
return;
}
@@ -257,7 +274,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 );
@@ -283,13 +300,15 @@ component {
} );
systemOutput( "√ - Site table created", true );
- schema.alter(
- "cb_setting",
- function( table ){
- table.addColumn( table.uuid( "FK_siteID" ).nullable() );
- table.addConstraint( table.uuid( "FK_siteID" ).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()
@@ -301,7 +320,6 @@ component {
return results;
}, {} );
-
var initialSiteIdentifier = uuidLib.randomUUID().toString();
arguments.query
.newQuery()
@@ -311,7 +329,7 @@ component {
"createdDate" : today,
"modifiedDate" : today,
"isDeleted" : 0,
- "isActive" : 1,
+ "isActive" : 1,
"name" : allSettings.cb_site_name,
"slug" : "default",
"homepage" : allSettings.cb_site_homepage,
@@ -319,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
@@ -377,23 +395,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.uuid( "id" ).unique().nullable() );
+ 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 );
@@ -401,20 +418,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.uuid( tmpColumn ).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 );
@@ -422,48 +441,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.uuid( tmpColumn ).nullable() );
- } );
- populateFKValues( tmpColumn, tableName, arguments.keyConfig );
- schema.alter( tableName, function( table ){
- table.dropColumn( keyConfig.column );
- table.renameColumn( tmpColumn, table.uuid( keyConfig.column ).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.uuid( pkColumn ).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 );
@@ -471,17 +497,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.uuid( keyConfig.column ).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 );
@@ -489,21 +522,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.uuid( tmpColumn ) );
- table.addConstraint( table.primaryKey( tmpColumn ) );
- table.dropColumn( pkColumn );
- table.renameColumn( tmpColumn, table.uuid( pkColumn ) );
- table.addConstraint( table.uuid( pkColumn ).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 );
@@ -514,262 +560,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
@@ -780,93 +852,150 @@ component {
return "ALTER TABLE #tableName# DROP CONSTRAINT #constraintName#";
}
variables.populateFKValues = function( tmpColumn, tableName, keyConfig ){
- queryExecute("
- UPDATE #arguments.tableName# as target
+ 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#
- 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#
+ 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." );
- }
}
}
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..c399ca8f55
--- /dev/null
+++ b/modules/contentbox/migrations/2022_03_07_155812_v5.1.0_page_sslonly_removals.cfc
@@ -0,0 +1,21 @@
+/**
+ * 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
+ * @author Davis Vega
+ */
+component {
+
+ function up( schema, qb ){
+ // Remove the sslonly column from the `cb_page` table
+ schema.alter( "cb_page", ( table ) => {
+ table.dropColumn( "SSLOnly" );
+ } );
+ }
+
+ function down( schema, qb ){
+ }
+
+}
diff --git a/modules/contentbox/models/BaseEntityMethods.cfc b/modules/contentbox/models/BaseEntityMethods.cfc
index cb22c1fdd2..018a47b3b6 100644
--- a/modules/contentbox/models/BaseEntityMethods.cfc
+++ b/modules/contentbox/models/BaseEntityMethods.cfc
@@ -14,17 +14,17 @@ 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
@@ -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/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/comments/CommentService.cfc b/modules/contentbox/models/comments/CommentService.cfc
index fbc96a06ae..45e885e14f 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 ){
@@ -358,6 +352,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 +363,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 +389,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 +399,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 +439,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 +483,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 +502,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 a8a55fb98b..0e0ea8c91c 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,62 +16,66 @@ component
discriminatorColumn="contentType"
{
- /* *********************************************************************
- ** DI INJECTIONS
- ********************************************************************* */
+ /**
+ * --------------------------------------------------------------------------
+ * DI
+ * --------------------------------------------------------------------------
+ * All DI is done lazyly to avoid any performance issues. Thus the provider annotation
+ */
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"
- persistent="false";
-
- property
- name ="contentboxSettings"
- inject ="coldbox:moduleSettings:contentbox"
+ inject ="provider:JSONPrettyPrint@JSONPrettyPrint"
persistent="false";
property
name ="settingService"
- inject ="id:settingService@contentbox"
+ 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"
@@ -94,9 +99,11 @@ component
notnull="true"
default="false";
- /* *********************************************************************
- ** PROPERTIES
- ********************************************************************* */
+ /**
+ * --------------------------------------------------------------------------
+ * PROPERTIES
+ * --------------------------------------------------------------------------
+ */
property
name ="contentID"
@@ -167,8 +174,7 @@ component
column ="passwordProtection"
notnull="false"
length ="100"
- default=""
- index ="idx_published";
+ default="";
property
name ="HTMLKeywords"
@@ -199,14 +205,6 @@ component
default="true"
index ="idx_cache";
- property
- name ="cacheLayout"
- column ="cacheLayout"
- notnull="true"
- ormtype="boolean"
- default="true"
- index ="idx_cachelayout";
-
property
name ="cacheTimeout"
column ="cacheTimeout"
@@ -252,9 +250,11 @@ component
default=""
length ="500";
- /* *********************************************************************
- ** RELATIONSHIPS
- ********************************************************************* */
+ /**
+ * --------------------------------------------------------------------------
+ * RELATIONSHIPS
+ * --------------------------------------------------------------------------
+ */
// M20 -> creator loaded as a proxy and fetched immediately
property
@@ -402,9 +402,11 @@ component
fetch ="join"
lazy ="true";
- /* *********************************************************************
- ** CALCULATED FIELDS
- ********************************************************************* */
+ /**
+ * --------------------------------------------------------------------------
+ * CALCULATED FIELDS
+ * --------------------------------------------------------------------------
+ */
property
name ="numberOfHits"
@@ -428,9 +430,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";
@@ -439,7 +443,6 @@ component
"allowComments",
"cache",
"cacheLastAccessTimeout",
- "cacheLayout",
"cacheTimeout",
"categoriesArray:categories",
"contentID",
@@ -515,7 +518,6 @@ component
"allowComments",
"cache",
"cacheLastAccessTimeout",
- "cacheLayout",
"cacheTimeout",
"categoriesArray:categories",
"contentID",
@@ -590,10 +592,6 @@ component
"title" : { required : true, size : "1..200" }
};
- /* *********************************************************************
- ** PUBLIC FUNCTIONS
- ********************************************************************* */
-
/**
* Base constructor
*/
@@ -603,13 +601,13 @@ component
variables.publishedDate = now();
variables.allowComments = true;
variables.cache = true;
- variables.cacheLayout = true;
variables.cacheTimeout = 0;
variables.cacheLastAccessTimeout = 0;
variables.markup = "HTML";
variables.contentType = "";
variables.showInSearch = true;
variables.renderedContent = "";
+ variables.children = [];
return this;
}
@@ -618,9 +616,12 @@ component
*/
function onDIComplete(){
// Load up content helpers
- variables.contentboxSettings.contentHelpers.each( function( thisHelper ){
- includeMixin( arguments.thisHelper );
- } );
+ variables.wirebox
+ .getInstance( dsl: "coldbox:moduleSettings:contentbox" )
+ .contentHelpers
+ .each( function( thisHelper ){
+ includeMixin( arguments.thisHelper );
+ } );
}
@@ -719,9 +720,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 );
}
/**
@@ -730,9 +729,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
@@ -744,13 +743,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,
@@ -847,6 +842,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 ){
@@ -932,7 +928,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 ){
@@ -1047,11 +1043,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() )
@@ -1203,21 +1195,33 @@ 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
+ len( variables.expireDate ) AND // In case of some odd empty string cases
+ 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;
}
/**
@@ -1228,20 +1232,20 @@ 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
* - 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(
+ BaseContent function clone(
required any author,
required any original,
required any originalService,
@@ -1249,176 +1253,182 @@ 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.cacheLayout = arguments.original.getCacheLayout();
- 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;
}
/**
- * 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
- */
- string function getDisplayPublishedDate(){
- var publishedDate = getPublishedDate();
- if ( isNull( 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
+ * @showTime Show the time or just the date
+ */
+ string function getDisplayPublishedDate(
+ dateFormat = this.DATE_FORMAT,
+ timeFormat = this.TIME_FORMAT,
+ boolean showTime = true
+ ){
+ if ( isNull( variables.publishedDate ) || !len( variables.publishedDate ) ) {
return "";
}
- return dateFormat( publishedDate, this.DATE_FORMAT ) & " " & timeFormat(
- publishedDate,
- this.TIME_FORMAT
+ if ( !arguments.showTime ) {
+ return dateFormat( variables.publishedDate, arguments.dateFormat );
+ }
+ return dateFormat( variables.publishedDate, arguments.dateFormat ) & " " & timeFormat(
+ variables.publishedDate,
+ arguments.timeFormat
);
}
/**
- * Get formatted expireDate
- */
- string function getDisplayExpireDate(){
- if ( isNull( expireDate ) ) {
- return "N/A";
+ * 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
+ * @showTime Show the time or just the date
+ */
+ string function getDisplayExpireDate(
+ dateFormat = this.DATE_FORMAT,
+ timeFormat = this.TIME_FORMAT,
+ boolean showTime = true
+ ){
+ if ( isNull( variables.expireDate ) || !len( variables.expireDate ) ) {
+ return "";
}
- return dateFormat( expireDate, this.DATE_FORMAT ) & " " & timeFormat(
- expireDate,
- this.TIME_FORMAT
+ if ( !arguments.showTime ) {
+ return dateFormat( variables.expireDate, arguments.dateFormat );
+ }
+ return dateFormat( variables.expireDate, arguments.dateFormat ) & " " & timeFormat(
+ variables.expireDate,
+ arguments.timeFormat
);
}
@@ -1443,6 +1453,7 @@ component
/**
* add published timestamp to property
+ *
* @timeString The joined time string (e.g., 12:00)
*/
any function addJoinedPublishedTime( required string timeString ){
@@ -1476,6 +1487,7 @@ component
/**
* add expired timestamp to property
+ *
* @timeString The joined time string (e.g., 12:00)
*/
any function addJoinedExpiredTime( required string timeString ){
@@ -1569,9 +1581,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() )
);
}
@@ -1588,10 +1598,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();
}
@@ -1701,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/Category.cfc b/modules/contentbox/models/content/Category.cfc
index 89f3170df2..1b2ee13b82 100755
--- a/modules/contentbox/models/content/Category.cfc
+++ b/modules/contentbox/models/content/Category.cfc
@@ -20,29 +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"
- persistent="false";
- property
- name ="contentStoreService"
- inject ="contentStoreService@contentbox"
+ inject ="provider:entryService@contentbox"
persistent="false";
property
- name ="cachebox"
- inject ="cachebox"
+ name ="contentStoreService"
+ inject ="provider:contentStoreService@contentbox"
persistent="false";
property
name ="settingService"
- inject ="settingService@contentbox"
+ inject ="provider:settingService@contentbox"
persistent="false";
/* *********************************************************************
@@ -76,7 +74,7 @@ component
name ="isPublic"
column ="isPublic"
ormtype="boolean"
- notnull="true"
+ notnull="false"
default="true"
index ="idx_isPublic";
@@ -197,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;
}
@@ -210,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..1c0c847532 100755
--- a/modules/contentbox/models/content/ContentStore.cfc
+++ b/modules/contentbox/models/content/ContentStore.cfc
@@ -78,14 +78,14 @@ 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(
+ 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/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 cb9c37a3cb..e4e1c6b8d7 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
********************************************************************* */
@@ -206,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..301a446d28 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,14 +100,14 @@ 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(
+ BaseContent function clone(
required any author,
required any original,
required any originalService,
@@ -126,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/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..c33cdb79eb 100755
--- a/modules/contentbox/models/content/Page.cfc
+++ b/modules/contentbox/models/content/Page.cfc
@@ -73,17 +73,6 @@ component
default=""
length ="8000";
- /**
- * If true, it will force the page to be viewed in SSL. ContentBox will redirect with a 301
- */
- property
- name ="SSLOnly"
- column ="SSLOnly"
- notnull="true"
- ormtype="boolean"
- default="false"
- index ="idx_ssl";
-
/* *********************************************************************
** NON PERSISTED PROPERTIES
********************************************************************* */
@@ -98,7 +87,6 @@ component
this.constraints[ "mobileLayout" ] = { required : false, size : "1..200" };
this.constraints[ "order" ] = { required : true, type : "numeric" };
this.constraints[ "showInMenu" ] = { required : false, type : "boolean" };
- this.constraints[ "SSLOnly" ] = { required : false, type : "boolean" };
/* *********************************************************************
** CONSTRUCTOR
@@ -111,8 +99,7 @@ component
"layout",
"mobileLayout",
"order",
- "showInMenu",
- "SSLOnly"
+ "showInMenu"
],
"defaultIncludes"
);
@@ -130,7 +117,6 @@ component
variables.contentType = "Page";
variables.order = 0;
variables.showInMenu = true;
- variables.SSLOnly = false;
// INHERITANCE LAYOUT STATIC
variables.LAYOUT_INHERITANCE_KEY = "-inherit-";
@@ -152,16 +138,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,14 +192,14 @@ 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(
+ BaseContent function clone(
required any author,
required any original,
required any originalService,
@@ -231,13 +211,12 @@ component
setLayout( arguments.original.getLayout() );
setMobileLayout( arguments.original.getMobileLayout() );
setShowInMenu( arguments.original.getShowInMenu() );
- setSSLOnly( arguments.original.getSSLOnly() );
// do excerpts
if ( arguments.original.hasExcerpt() ) {
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 4be0dc5ade..af6de080e5 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
@@ -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(
@@ -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..66befde4e1 100644
--- a/modules/contentbox/models/importers/ContentBoxImporter.cfc
+++ b/modules/contentbox/models/importers/ContentBoxImporter.cfc
@@ -62,9 +62,11 @@ 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;
@@ -89,13 +91,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 );
}
@@ -115,12 +114,14 @@ component accessors=true {
overwriteFiles = true
);
descriptorContents = fileRead( getTempDirectory() & "descriptor.json" );
+ descriptorContents = replaceNoCase( descriptorContents, "null,", "0,", "all" );
}
return !arguments.asObject ? descriptorContents : deserializeJSON( descriptorContents );
}
/**
* 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 +143,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 +160,7 @@ component accessors=true {
var descriptorContents = getDescriptorContents( true );
// prioritize keys
- var priorityOrder = structSort(
+ var priorityOrder = structSort(
descriptorContents.content,
"numeric",
"asc",
@@ -166,7 +168,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 +195,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 +205,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/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/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/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/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 012ffc429f..46189ba8ea 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";
/* *********************************************************************
@@ -34,24 +34,21 @@ component
type ="date"
ormtype="timestamp"
notnull="true"
- update ="false"
- index ="idx_BaseMenuItem_createDate";
+ update ="false";
property
name ="modifiedDate"
column ="modifiedDate"
type ="date"
ormtype="timestamp"
- notnull="true"
- index ="idx_BaseMenuItem_modifiedDate";
+ notnull="true";
property
name ="isDeleted"
column ="isDeleted"
ormtype="boolean"
notnull="true"
- default="false"
- index ="idx_BaseMenuItem_deleted";
+ default="false";
/* *********************************************************************
** PROPERTIES
@@ -72,8 +69,7 @@ component
notnull="true"
ormtype="string"
length ="200"
- default=""
- index ="idx_menuitemtitle";
+ default="";
property
name ="label"
@@ -258,6 +254,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 412798c472..23ff5aa37f 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
@@ -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/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..58048f52b7 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
@@ -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/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/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 b3b0580408..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;
}
@@ -100,7 +108,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 +139,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 }
@@ -187,10 +195,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 +231,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.
}
}
@@ -313,13 +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
@@ -387,12 +388,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 +464,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 +492,7 @@ component
} );
// Force Reload all widgets
- widgetService.getWidgets( reload = true );
+ variables.widgetService.getWidgets( reload = true );
return this;
}
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 d23d7f47dc..7a275f72b3 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(
- "
-
-
- #item.getTitle()#
+ // Render out the results or error if the results had errors
+ if( arguments.searchResults.getError() ){
+ writeOutput( "
+
+ ");
if ( item.hasCategories() ) {
writeOutput( "
Categories: " );
@@ -153,7 +165,8 @@ 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"
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/modules/contentbox/models/security/Author.cfc b/modules/contentbox/models/security/Author.cfc
index 5aa1ea1061..56070660cf 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";
/* *********************************************************************
@@ -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..5d6390f46a 100755
--- a/modules/contentbox/models/security/PermissionService.cfc
+++ b/modules/contentbox/models/security/PermissionService.cfc
@@ -22,39 +22,42 @@ 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,
- cfsqltype = "numeric"
+ cfsqltype = "varchar"
);
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,
+ 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 = "numeric"
+ cfsqltype = "varchar"
);
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,
- cfsqltype = "numeric"
+ cfsqltype = "varchar"
);
q.execute();
}
@@ -69,19 +72,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 +87,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 +100,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 +115,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 +151,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 c12a1076e9..2ef737dd57 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";
/* *********************************************************************
@@ -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..6ef7a14936 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,17 +242,14 @@ 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 : ""
};
// 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();
}
@@ -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/subscriptions/BaseSubscription.cfc b/modules/contentbox/models/subscriptions/BaseSubscription.cfc
index 9c5003478c..0b58cfa28e 100644
--- a/modules/contentbox/models/subscriptions/BaseSubscription.cfc
+++ b/modules/contentbox/models/subscriptions/BaseSubscription.cfc
@@ -84,7 +84,6 @@ component
fieldtype="many-to-one"
fkcolumn ="FK_subscriberID"
lazy ="true"
- index ="idx_subscriber"
inverse ="true"
orderBy ="subscriberEmail";
diff --git a/modules/contentbox/models/subscriptions/CommentSubscription.cfc b/modules/contentbox/models/subscriptions/CommentSubscription.cfc
index 119506849e..916b26beb4 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";
/* *********************************************************************
@@ -37,7 +37,6 @@ component
fkcolumn ="FK_contentID"
lazy ="true"
fetch ="join"
- index ="idx_contentCommentSubscription"
orderBy ="Title ASC";
/* *********************************************************************
diff --git a/modules/contentbox/models/system/CBHelper.cfc b/modules/contentbox/models/system/CBHelper.cfc
index eb0713cdb3..2a88a78309 100644
--- a/modules/contentbox/models/system/CBHelper.cfc
+++ b/modules/contentbox/models/system/CBHelper.cfc
@@ -95,10 +95,9 @@ 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
+ * @throw InvalidSettingException
*/
any function setting( required key, defaultValue ){
var prc = getPrivateRequestCollection();
@@ -121,7 +120,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 +182,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 +245,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 +393,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 +433,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 );
@@ -563,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 );
@@ -612,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 );
@@ -630,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 );
@@ -648,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 );
@@ -718,6 +716,7 @@ component accessors="true" singleton threadSafe {
/**
* Get the current page or entries related content array
+ *
* @return array
*/
any function getCurrentRelatedContent(){
@@ -743,7 +742,8 @@ 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 ){
@@ -775,6 +775,7 @@ component accessors="true" singleton threadSafe {
/**
* Set the Meta Title for the request
+ *
* @title - The new title
*/
function setMetaTitle( required string title ){
@@ -798,6 +799,7 @@ component accessors="true" singleton threadSafe {
/**
* Set the Meta Description for the request
+ *
* @description - The new Description
*/
function setMetaDescription( required string description ){
@@ -821,6 +823,7 @@ component accessors="true" singleton threadSafe {
/**
* Set the Meta Keywords for the request
+ *
* @keywords - The new Keywords
*/
function setMetaKeywords( required string keywords ){
@@ -944,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 ){
@@ -994,6 +998,7 @@ component accessors="true" singleton threadSafe {
/**
* Set the Meta ImageURL for the request
+ *
* @ImageURL - The new ImageURL
*/
function setMetaImageURL( required string ImageURL ){
@@ -1040,6 +1045,7 @@ component accessors="true" singleton threadSafe {
/**
* Set the Meta OGType for the request
+ *
* @OGType - The new OGType
*/
function setMetaOGType( required string OGType ){
@@ -1089,16 +1095,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(
@@ -1152,6 +1152,7 @@ component accessors="true" singleton threadSafe {
/**
* Get the curent search results object
+ *
* @return contentbox.models.search.SearchResults
*/
function getSearchResults(){
@@ -1202,10 +1203,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 +1248,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,37 +1283,28 @@ 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 );
}
/**
* 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
- );
+ return getRequestContext().buildLink( to = adminRoot() & "/security/doLogout", ssl = arguments.ssl );
}
/**
* 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
- );
+ return getRequestContext().buildLink( to = adminRoot() & "/security/login", ssl = arguments.ssl );
}
/**
@@ -1349,10 +1341,11 @@ 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 +1379,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,
@@ -1421,10 +1414,11 @@ 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 +1454,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 +1471,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,
@@ -1518,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";
@@ -1527,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";
@@ -1536,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";
@@ -1544,20 +1535,18 @@ 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 +1571,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 +1592,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 +1619,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 +1649,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 +1670,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 = "";
@@ -1697,8 +1686,9 @@ 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 +1705,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.
*/
@@ -1729,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" ){
@@ -1808,9 +1799,10 @@ 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 +1822,10 @@ 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 +1846,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 +1870,10 @@ 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 +1901,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 +1911,10 @@ 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",
@@ -1941,8 +1934,9 @@ 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 +1961,21 @@ 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 +2001,12 @@ 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(
@@ -2027,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 ){
@@ -2035,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() ){
@@ -2046,8 +2044,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 +2070,10 @@ 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 +2098,9 @@ 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 +2141,15 @@ 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 +2177,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(
@@ -2227,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
*/
@@ -2248,7 +2250,8 @@ 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 +2259,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 +2280,12 @@ 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 +2360,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 +2381,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 +2396,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 +2436,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 +2499,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(
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..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}";
@@ -266,9 +267,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,
@@ -339,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" )#";
}
/**
@@ -405,11 +404,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 +435,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 +476,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 +597,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 +674,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 +724,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 +737,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 +752,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 +801,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 +826,7 @@ component
/**
* Get the cache provider object to be used for settings
+ *
* @return coldbox.system.cache.ICacheProvider
*/
function getSettingsCacheProvider(){
@@ -885,9 +878,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..abe8c6e552 100644
--- a/modules/contentbox/models/system/Site.cfc
+++ b/modules/contentbox/models/system/Site.cfc
@@ -485,12 +485,26 @@ component
* Get the site root URL as defined per the settings
*/
String function getSiteRoot(){
+ var serverPort = getServerPort();
// Return the appropriate site Uri
return "http"
& ( this.getIsSSL() ? "s" : "" ) // SSL or not
& "://"
& this.getDomain() // Site Domain
- & ( listFind( "80,443", cgi.server_port ) ? "" : ":#cgi.server_port#" ); // The right port
+ & ( listFind( "80,443", serverPort ) ? "" : ":#serverPort#" ); // The right port
+ }
+
+ /**
+ * Get the server port according to lookup order
+ * 1. x-forwarded-port header
+ * 2. cgi.server_port
+ */
+ private function getServerPort(){
+ var headers = getHTTPRequestData( false ).headers;
+ if ( structKeyExists( headers, "x-forwarded-port" ) && len( headers[ "x-forwarded-port" ] ) ) {
+ return headers[ "x-forwarded-port" ];
+ }
+ return cgi.server_port;
}
/**
@@ -524,10 +538,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 +553,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 91f5954f06..f4ed0332e9 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
@@ -162,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.
- * @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,
@@ -239,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
*/
@@ -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;
}
@@ -407,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,
@@ -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;
}
@@ -586,6 +572,7 @@ component accessors="true" threadSafe singleton {
/**
* Get constraints for setting fields
+ *
* @themeName The name of the theme
*/
struct function getSettingsConstraints( required themeName ){
@@ -821,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 ){
@@ -893,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
*/
@@ -917,10 +905,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/models/ui/WidgetService.cfc b/modules/contentbox/models/ui/WidgetService.cfc
index 9d1e5c2c3b..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.
@@ -175,15 +176,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 );
@@ -200,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() ){
@@ -229,15 +232,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 );
@@ -254,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() ){
@@ -280,15 +285,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 +392,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 +404,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 +433,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 ) {
@@ -469,6 +480,7 @@ component accessors="true" singleton threadSafe {
/**
* Rip Extensions from file name
+ *
* @fileName The target to rip
*/
function ripExtension( required filename ){
@@ -477,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 1bd2107a88..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 ){
@@ -250,9 +254,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!" );
}
@@ -339,6 +341,7 @@ component extends="baseHandler" {
/**
* Author editor panel
+ *
* @return html
*/
function editor( event, rc, prc ){
@@ -413,6 +416,7 @@ component extends="baseHandler" {
/**
* Shortcut to author profile
+ *
* @return html
*/
function myprofile( event, rc, prc ){
@@ -479,24 +483,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 +500,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 +539,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 +560,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 +569,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 +580,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 +735,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 +757,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#";
@@ -806,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/baseContentHandler.cfc b/modules/contentbox/modules/contentbox-admin/handlers/baseContentHandler.cfc
index 33d339e0db..450b7ec2b7 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";
@@ -217,19 +216,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!" );
}
@@ -280,27 +274,20 @@ 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
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
@@ -329,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,
@@ -476,10 +463,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 +481,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;
}
@@ -513,22 +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,
@@ -537,18 +513,12 @@ component extends="baseHandler" {
newSlugRoot : clone.getSlug()
);
- // clone this sucker now!
- variables.ormService.save( clone );
-
// relocate
variables.cbMessageBox.info( "#variables.entity# Cloned!" );
// 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 +547,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 +633,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" );
}
/**
@@ -724,11 +689,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
*/
@@ -765,10 +730,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 +778,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..2581eb3d2f 100755
--- a/modules/contentbox/modules/contentbox-admin/handlers/baseHandler.cfc
+++ b/modules/contentbox/modules/contentbox-admin/handlers/baseHandler.cfc
@@ -26,16 +26,14 @@ 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 );
}
/**
* 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/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..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
@@ -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 );
@@ -134,8 +131,8 @@ component extends="baseHandler" {
* Show the comment editor
*
* @event
- * @rc
- * @prc
+ * @rc
+ * @prc
*/
function editor( event, rc, prc ){
// get new or persisted
@@ -150,8 +147,8 @@ component extends="baseHandler" {
* Show the comment moderator
*
* @event
- * @rc
- * @prc
+ * @rc
+ * @prc
*/
function moderate( event, rc, prc ){
// get new or persisted
@@ -172,8 +169,8 @@ component extends="baseHandler" {
* Comment quick look
*
* @event
- * @rc
- * @prc
+ * @rc
+ * @prc
*
* @return HTML
*/
@@ -188,15 +185,12 @@ component extends="baseHandler" {
* Save a comment
*
* @event
- * @rc
- * @prc
+ * @rc
+ * @prc
*/
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
@@ -213,8 +207,8 @@ component extends="baseHandler" {
* Remove all Moderated comments
*
* @event
- * @rc
- * @prc
+ * @rc
+ * @prc
*
* @return JSON or relocation
*/
@@ -242,8 +236,8 @@ component extends="baseHandler" {
* Remove comments from the database
*
* @event
- * @rc
- * @prc
+ * @rc
+ * @prc
*
* @return JSON or relocation
*/
@@ -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" );
@@ -298,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(
@@ -368,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";
@@ -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..aba367fd64 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,22 +237,21 @@ 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()#)" );
} );
}
/**
* 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
*/
@@ -309,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
*/
@@ -351,9 +347,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..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 ){
@@ -178,15 +181,13 @@ 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" );
}
/**
* Produce the latest system news
+ *
* @return html
*/
function latestNews( event, rc, prc ){
@@ -211,12 +212,11 @@ component extends="baseHandler" {
/**
* Produce the latest system logins
+ *
* @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" );
}
@@ -224,6 +224,7 @@ component extends="baseHandler" {
/**
* delete installer module
+ *
* @return JSON
*/
function deleteInstaller(){
@@ -297,9 +298,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..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 ){
@@ -82,10 +84,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" );
@@ -124,6 +123,7 @@ component extends="baseHandler" {
/**
* Create a menu Item
+ *
* @return text
*/
function createMenuItem( event, rc, prc ){
@@ -143,6 +143,7 @@ component extends="baseHandler" {
/**
* Build out the index table for the async loaded menus
+ *
* @return html
*/
function menuTable( event, rc, prc ){
@@ -200,6 +201,7 @@ component extends="baseHandler" {
/**
* Preview the menu built
+ *
* @return text
*/
function preview( event, rc, prc ){
@@ -219,10 +221,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" );
}
/**
@@ -268,6 +267,7 @@ component extends="baseHandler" {
/**
* Export a menu
+ *
* @return json,xml
*/
function export( event, rc, prc ){
@@ -307,9 +307,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..cba8c077ea 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 )#"
- );
+ variables.cbMessagebox.warn( "No module where found with the incoming route: #encodeForHTML( routedURL )#" );
return relocate( prc.xehModules );
}
@@ -99,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;
@@ -115,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 );
}
@@ -124,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 );
}
@@ -133,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 );
}
@@ -142,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 );
}
@@ -151,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 );
}
diff --git a/modules/contentbox/modules/contentbox-admin/handlers/permissionGroups.cfc b/modules/contentbox/modules/contentbox-admin/handlers/permissionGroups.cfc
index c5be19a9bb..7f8d3b5f0c 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
@@ -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
@@ -95,18 +92,19 @@ 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 }
- );
+ announce( "cbadmin_postPermissionGroupRemove", { permissionGroupID : rc.permissionGroupID } );
// Message
cbMessagebox.setMessage( "info", "Permission Group Removed!" );
// relocate
@@ -122,12 +120,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 +131,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 +144,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..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,26 +51,20 @@ component extends="baseHandler" {
* Save permissions
*
* @event
- * @rc
- * @prc
+ * @rc
+ * @prc
*/
function save( event, rc, prc ){
// 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
@@ -89,8 +83,8 @@ component extends="baseHandler" {
* Remove permissions
*
* @event
- * @rc
- * @prc
+ * @rc
+ * @prc
*/
function remove( event, rc, prc ){
// 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..6df27d5071 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,16 +99,23 @@ component extends="baseHandler" {
* Remove Roles
*
* @event
- * @rc
- * @prc
+ * @rc
+ * @prc
*/
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
@@ -127,12 +134,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" );
}
@@ -141,21 +145,19 @@ 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" );
+ return variables.roleService.get( event.getValue( "roleID", 0 ) ).getMemento( includes = "permissions" );
}
/**
* Export all roles
*
* @event
- * @rc
- * @prc
+ * @rc
+ * @prc
*/
function exportAll( event, rc, prc ){
param rc.roleID = "";
@@ -175,18 +177,15 @@ component extends="baseHandler" {
* Import roles
*
* @event
- * @rc
- * @prc
+ * @rc
+ * @prc
*/
function importAll( event, rc, prc ){
event.paramValue( "importFile", "" );
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..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 ){
@@ -195,9 +198,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();
@@ -233,6 +234,7 @@ component extends="baseHandler" {
/**
* WireBox mapping dump
+ *
* @return html
*/
function mappingDump( event, rc, prc ){
@@ -306,15 +308,13 @@ 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" );
}
/**
* View settings cached data
+ *
* @return html
*/
function viewCached( event, rc, prc ){
@@ -329,6 +329,7 @@ component extends="baseHandler" {
/**
* Display the auth logs manager
+ *
* @return html
*/
function authLogs( event, rc, prc ){
@@ -337,10 +338,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/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 );
}
}
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..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(
@@ -70,10 +71,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/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('
-
\ No newline at end of file
+
diff --git a/modules/contentbox/modules/contentbox-admin/views/_components/editor/sidebar/Modifiers.cfm b/modules/contentbox/modules/contentbox-admin/views/_components/editor/sidebar/Modifiers.cfm
index 9f580ae6b7..6bdb0d6c98 100644
--- a/modules/contentbox/modules/contentbox-admin/views/_components/editor/sidebar/Modifiers.cfm
+++ b/modules/contentbox/modules/contentbox-admin/views/_components/editor/sidebar/Modifiers.cfm
@@ -96,23 +96,6 @@
-
\ No newline at end of file
+
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 @@